build script work

This commit is contained in:
austin 2024-05-11 16:24:41 -04:00
parent 0cd3f0a619
commit 51d06c2bd7
3 changed files with 42 additions and 5 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
build

34
build.sh Normal file
View File

@ -0,0 +1,34 @@
SERVER_DIR=~/p/SelfSurvey-server
FE_DIR=~/p/SelfSurvey-FE
CONFIG_DIR=~/p/selfsurvey-config
SERVER_PUBLIC_ADDR=survey.austinwhoover.com
# make build folder structure
rm -rf $CONFIG_DIR/build
mkdir $CONFIG_DIR/build
# setup BE repo stuff
rm -rf $SERVER_DIR/src/main/resources/static
mkdir $SERVER_DIR/src/main/resources/static
# assemble FE
cd $FE_DIR
npx webpack --env apiurl=http://$SERVER_PUBLIC_ADDR
cd $SERVER_DIR/src/main/resources/static
rm -rf ./*
cp -r $FE_DIR/dist/* $SERVER_DIR/src/main/resources/static/
# assemble BE
cd $SERVER_DIR
mvn clean package
# assemble package
cp $SERVER_DIR/target/self-survey.war $CONFIG_DIR/build/ROOT.war
cp $CONFIG_DIR/docker-compose.yml $CONFIG_DIR/build/docker-compose.yml
echo "COMPLETED!"
echo "docker-compose.yml should be straightforward"
echo "ROOT.war goes in <docker folder>/webapps/"
echo "must touch the file <docker folder>/db/selfsurvey.db if it doesn't already exist!"
echo "config file goes in <docker folder/config/selfsurveybe.db"
echo " Format for the config file is"
echo " {"
echo " \"username\": \"<username here>\","
echo " \"password\": \"<password here>\""
echo " }"

12
test.sh
View File

@ -1,14 +1,16 @@
# assemble FE # assemble FE
cd ~/p/self-survey-fe cd ~/p/SelfSurvey-FE
npm run build npm run build
cd ~/p/SelfSurvey-server-master/src/main/resources/static cd ~/p/SelfSurvey-server/src/main/resources/static
rm -rf ./* rm -rf ./*
cp -r ~/p/self-survey-fe/dist/* ~/p/SelfSurvey-server-master/src/main/resources/static/ cp -r ~/p/SelfSurvey-FE/dist/* ~/p/SelfSurvey-server/src/main/resources/static/
# assemble BE # assemble BE
cd ~/p/SelfSurvey-server-master/ cd ~/p/SelfSurvey-server/
mvn clean package mvn clean package
cd ~/Documents/apache-tomcat-9.0.89/webapps/ cd ~/Documents/apache-tomcat-9.0.89/webapps/
rm -rf ./ROOT.war ./ROOT rm -rf ./ROOT.war ./ROOT
cp ~/p/SelfSurvey-server-master/target/self-survey.war ~/Documents/apache-tomcat-9.0.89/webapps/ROOT.war cp ~/p/SelfSurvey-server/target/self-survey.war ~/Documents/apache-tomcat-9.0.89/webapps/ROOT.war
cd ~/Documents/apache-tomcat-9.0.89/bin/ cd ~/Documents/apache-tomcat-9.0.89/bin/
./catalina.sh run ./catalina.sh run