selfsurvey-config/build.sh
2024-05-11 16:49:21 -04:00

40 lines
1.4 KiB
Bash

#local dev folder location of the server source files
SERVER_DIR=~/p/SelfSurvey-server
#local dev folder loation of the front end source files
FE_DIR=~/p/SelfSurvey-FE
#local folder location of this repo
CONFIG_DIR=~/p/selfsurvey-config
#the public http address of the build
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
#instructions
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 " \"domain\": \"<public domain here>\"",
echo " }"