Production deploy script

This commit is contained in:
2022-09-19 21:52:12 +02:00
parent 4107a759c0
commit 6729de1d73
2 changed files with 95 additions and 1 deletions
+78
View File
@@ -0,0 +1,78 @@
version: "3"
services:
mongo:
image: mongo:3
restart: "on-failure:5"
networks:
db-network:
volumes:
- ./persistence/database/mongodb:/usr/local/mongodb
logging:
driver: "json-file"
options:
max-file: "5"
max-size: "50m"
webserver:
image: §PROJECT_REPOSITORY§/§PROJECT_GROUP§/§PROJECT_BUILDNAME§:§TAG_NAME§-debug
env_file:
- environments/common/webserver.env
- environments/production/webserver.env
depends_on:
- db
- memcached
restart: "on-failure:3"
ports:
- "80:80"
networks:
db-network:
§PROJECT_BUILDNAME§-network:
links:
- mongo:database
volumes:
- ./persistence/webserver/storage:/home/§PROJECT_AUTHOR§/storage/§PROJECT_BUILDNAME§
- §PROJECT_BUILDNAME§-ws-log:/var/log/§PROJECT_AUTHOR§/
- §PROJECT_BUILDNAME§-job-comms:/jobComunication/
logging:
driver: "json-file"
options:
max-file: "5"
max-size: "150m"
# worker:
# image: 662348923997.dkr.ecr.eu-west-1.amazonaws.com/§PROJECT_GROUP§/edenlandia-worker:§TAG_NAME§
# env_file: worker.env
# restart: "no"
# networks:
# db-network:
# §PROJECT_BUILDNAME§-network:
# links:
# - mongo:database
# volumes:
# - §PROJECT_BUILDNAME§-storage:/home/asdynamics/storage/edenlandia-worker
# - edenlandia-worker-log:/var/log/asdynamics/
# - ~/workspace-azzurro/webapps/edenlandia-worker/app/private:/home/asdynamics/private/§PROJECT_BUILDNAME§:ro
# - §PROJECT_BUILDNAME§-job-comms:/jobComunication/
memcached:
image: memcached:1.6.9-alpine
restart: "on-failure:3"
networks:
§PROJECT_BUILDNAME§-network:
logging:
driver: "json-file"
options:
max-file: "5"
max-size: "10m"
networks:
nginx-network:
external:
name:
nginx-network
db-network:
§PROJECT_BUILDNAME§-network:
volumes:
§PROJECT_BUILDNAME§-ws-log:
# edenlandia-worker-log:
§PROJECT_BUILDNAME§-db-persist:
§PROJECT_BUILDNAME§-job-comms:
+17 -1
View File
@@ -22,6 +22,7 @@ usage() {
echo " -u: Unit tests locally" 1>&2;
echo " -d: Run debug vesion locally" 1>&2;
echo " -p: Publish (requires a version)" 1>&2;
echo " -x: Production Deploy (requires a version)" 1>&2;
echo " -t: Software version, this will be used for the docker tag (default: local)" 1>&2;
echo " -v: Verbose" 1>&2;
exit 1;
@@ -30,11 +31,12 @@ usage() {
UNIT_MODE=0
DEBUG_MODE=0
PUBLISH_MODE=0
DEPLOY_MODE=0
SELECTED_MODES=0
TAG="local"
while getopts "t:hvudp" o; do
while getopts "t:hvudpx" o; do
case "${o}" in
u)
UNIT_MODE=1
@@ -48,6 +50,10 @@ while getopts "t:hvudp" o; do
PUBLISH_MODE=1
SELECTED_MODES+=1
;;
x)
DEPLOY_MODE=1
SELECTED_MODES+=1
;;
t)
TAG=${OPTARG}
@@ -127,3 +133,13 @@ if [[ $DEBUG_MODE -eq 1 ]]; then
xdg-open "$DDNINJA_PUBLIC_URL"
fi
if [[ $DEPLOY_MODE -eq 1 ]]; then
OUT_FOLDER="/home/$PROJECT_AUTHOR/$PROJECT_BUILDNAME/local"
mkdir -p $OUT_FOLDER
./generateComposeFolder.sh -p -o "$OUT_FOLDER" -t $TAG
cd "$OUT_FOLDER"
docker-compose up -d
fi