-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Set GORM log output to file in RELEASE mode.
- Loading branch information
Showing
5 changed files
with
229 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
version: '3' | ||
services: | ||
# nginx: | ||
# image: nginx | ||
# volumes: | ||
# - ../../conf/nginx/nginx.prod.conf:/etc/nginx/nginx.conf | ||
# - ../../conf/nginx/api.safeu.a2os.club:/etc/nginx/sites-enabled/api.safeu.a2os.club | ||
# - /etc/letsencrypt/live/api.safeu.a2os.club:/opt/nginx/api.safeu.a2os.club/ | ||
# environment: | ||
# - TZ=Asia/Shanghai | ||
# ports: | ||
# - "80:80" | ||
# networks: | ||
# - lbnet | ||
# depends_on: | ||
# - web1 | ||
# - web2 | ||
# restart: on-failure | ||
|
||
safeu1: | ||
build: | ||
context: ../.. | ||
dockerfile: ././build/package/safeu-backend/Dockerfile-compose | ||
volumes: | ||
- ../../log/safeu1:/go/src/a2os/safeu-backend/log | ||
# - ../..:/go/src/a2os/safeu-backend/ | ||
environment: | ||
- TZ=Asia/Shanghai | ||
ports: | ||
- "8090:8080" | ||
networks: | ||
- safeu-app-net | ||
depends_on: | ||
- safeu-redis | ||
restart: on-failure | ||
|
||
safeu2: | ||
build: | ||
context: ../.. | ||
dockerfile: ././build/package/safeu-backend/Dockerfile-compose | ||
volumes: | ||
- ../../log/safeu2:/go/src/a2os/safeu-backend/log | ||
# - ../..:/go/src/a2os/safeu-backend/ | ||
environment: | ||
- TZ=Asia/Shanghai | ||
ports: | ||
- "8091:8080" | ||
networks: | ||
- safeu-app-net | ||
depends_on: | ||
- safeu-redis | ||
restart: on-failure | ||
|
||
safeu3: | ||
build: | ||
context: ../.. | ||
dockerfile: ././build/package/safeu-backend/Dockerfile-compose | ||
volumes: | ||
- ../../log/safeu3:/go/src/a2os/safeu-backend/log | ||
# - ../..:/go/src/a2os/safeu-backend/ | ||
environment: | ||
- TZ=Asia/Shanghai | ||
ports: | ||
- "8092:8080" | ||
networks: | ||
- safeu-app-net | ||
depends_on: | ||
- safeu-redis | ||
restart: on-failure | ||
|
||
# db: | ||
# environment: | ||
# - TZ=Asia/Shanghai | ||
# - MYSQL_ROOT_PASSWORD=safeu | ||
# - MYSQL_DATABASE=safeu | ||
# image: mariadb:10.3 | ||
# volumes: | ||
# - ../../data/mariadb:/var/lib/mysql | ||
# - ../../conf/mariadb:/etc/mysql/conf.d | ||
# ports: | ||
# - "3306:3306" | ||
# networks: | ||
# - dbnet | ||
# restart: on-failure | ||
safeu-redis: | ||
image: redis:5.0.3-alpine | ||
environment: | ||
- TZ=Asia/Shanghai | ||
volumes: | ||
- ../../conf/redis/redis.conf:/usr/local/etc/redis/redis.conf | ||
- ../../data/redis:/data # for redis persistent storage | ||
entrypoint: redis-server /usr/local/etc/redis/redis.conf | ||
# no reveal for ports, waiting for the database instance | ||
# ports: | ||
# - "6379:6379" | ||
networks: | ||
- safeu-app-net | ||
restart: on-failure | ||
|
||
networks: | ||
safeu-app-net: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#!/bin/bash | ||
# Author: TripleZ<[email protected]> | ||
# Date: 2019-04-30 | ||
|
||
echo -e "\n Build, up, down, restart, pull, check logs for SafeU staging docker clusters.\n" | ||
|
||
if [ "$1" == "up" ] | ||
then | ||
mkdir -p ../data | ||
sudo docker-compose -f ../deployments/staging-safeu/docker-compose.yml up -d | ||
|
||
elif [ "$1" == "down" ] | ||
then | ||
sudo docker-compose -f ../deployments/staging-safeu/docker-compose.yml down | ||
|
||
elif [ "$1" == "build" ] | ||
then | ||
sudo docker-compose -f ../deployments/staging-safeu/docker-compose.yml build --force-rm | ||
|
||
elif [ "$1" == "restart" ] | ||
then | ||
sudo docker-compose -f ../deployments/staging-safeu/docker-compose.yml restart -t 10 | ||
|
||
elif [ "$1" == "pull" ] | ||
then | ||
sudo docker-compose -f ../deployments/staging-safeu/docker-compose.yml pull | ||
|
||
elif [ "$1" == "logs" ] | ||
then | ||
echo -e " Follow log output? (y/n, default: n): \c" | ||
read isF | ||
echo "" | ||
if [ "$isF" == "y" ] || [ "$isF" == "Y" ] | ||
then | ||
sudo docker-compose -f ../deployments/staging-safeu/docker-compose.yml logs -f | ||
else | ||
sudo docker-compose -f ../deployments/staging-safeu/docker-compose.yml logs | ||
fi | ||
|
||
elif [ "$1" == "help" ] || [ "$1" == "-h" ] || [ "$1" == "--help" ] | ||
then | ||
echo -e " Usage: | ||
./staging-docker-compose.sh [COMMAND] | ||
./staging-docker-compose.sh -h|--help | ||
Commands: | ||
build Build SafeU staging container images | ||
down Down SafeU staging containers | ||
help Show this help message | ||
logs View output from staging containers | ||
pull Pull SafeU staging container images | ||
restart Restart SafeU staging containers | ||
up Up SafeU staging containers | ||
" | ||
|
||
else | ||
echo -e " Cannot match the command \"$1\", please type \"help\" command for help." | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#!/bin/bash | ||
# Author: TripleZ<[email protected]> | ||
# Date: 2019-04-30 | ||
|
||
helpMsg() { | ||
echo -e " Usage: | ||
./upgrade-safeu-containers.sh [ENV] [BRANCH NAME] | ||
./upgrade-safeu-containers.sh -h|--help | ||
Environments: | ||
dev Development environment | ||
staging Staging deployment environment | ||
prod Production deployment environment | ||
Branchs: | ||
master Stable version | ||
dev Development version | ||
[custom] Custom Git branch | ||
" | ||
} | ||
|
||
if [ "$2" != "" ] | ||
then | ||
# update code | ||
git checkout $2 | ||
git pull origin $2 | ||
else | ||
echo -e "\n [ERROR] Unrecognized branch name!\n" | ||
helpMsg | ||
exit 1 | ||
fi | ||
|
||
if [ "$1" == "prod" ] | ||
then | ||
sudo ./prod-docker-compose.sh build | ||
sudo ./prod-docker-compose.sh down | ||
sudo ./prod-docker-compose.sh up | ||
|
||
elif [ "$1" == "staging" ] | ||
then | ||
sudo ./staging-docker-compose.sh build | ||
sudo ./staging-docker-compose.sh down | ||
sudo ./staging-docker-compose.sh up | ||
|
||
elif [ "$1" == "dev" ] | ||
then | ||
sudo ./dev-docker-compose.sh build | ||
sudo ./dev-docker-compose.sh down | ||
sudo ./dev-docker-compose.sh up | ||
|
||
elif [ "$1" == "-h" ] || [ "$1" == "--help" ] | ||
then | ||
helpMsg | ||
else | ||
echo -e " [ERROR] Unrecognized environment name!\n" | ||
helpMsg | ||
exit 1 | ||
fi |