Skip to content

Commit

Permalink
Merge pull request #92 from Triple-Z/redis-persistence
Browse files Browse the repository at this point in the history
Add redis snapshot for persistence storage
  • Loading branch information
arcosx authored Apr 16, 2019
2 parents 2051e5c + 66310b1 commit 206c7cc
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 7 deletions.
14 changes: 14 additions & 0 deletions conf/redis/redis.conf
Original file line number Diff line number Diff line change
@@ -1,2 +1,16 @@
notify-keyspace-events "Ex"
# requirepass "safeu"
save 60 100
save 900 1
save 300 10
stop-writes-on-bgsave-error no
rdbcompression yes
dbfilename dump.rdb

appendonly no
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb

dir /data
22 changes: 17 additions & 5 deletions deployments/prod-safeu/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,10 @@ services:
environment:
- TZ=Asia/Shanghai
ports:
# TODO: This port should not be exposed, remove it after finishing the production test.
- "8080:8080"
networks:
- safeu-app-net
depends_on:
# - db
- safeu-redis
restart: on-failure

Expand All @@ -46,19 +44,33 @@ services:
environment:
- TZ=Asia/Shanghai
ports:
# TODO: This port should not be exposed, remove it after finishing the production test.
- "8081:8080"
networks:
- safeu-app-net
depends_on:
# - db
- safeu-redis
restart: on-failure

safeu3:
build:
context: ../..
dockerfile: ././build/package/safeu-backend/Dockerfile-compose
volumes:
- ../../log/web2:/go/src/a2os/safeu-backend/log/
# - ../..:/go/src/a2os/safeu-backend/
environment:
- TZ=Asia/Shanghai
ports:
- "8082:8080"
networks:
- safeu-app-net
depends_on:
- safeu-redis
restart: on-failure

# db:
# environment:
# - TZ=Asia/Shanghai
# # TODO: Change a stronger password.
# - MYSQL_ROOT_PASSWORD=safeu
# - MYSQL_DATABASE=safeu
# image: mariadb:10.3
Expand Down
4 changes: 2 additions & 2 deletions scripts/prod-docker-compose.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ echo -e "\n Build, up, down, restart, pull, check logs for SafeU production dock

if [ "$1" == "up" ]
then
mkdir -p ../data/mariadb
mkdir -p ../data
sudo docker-compose -f ../deployments/prod-safeu/docker-compose.yml up -d

elif [ "$1" == "down" ]
Expand Down Expand Up @@ -50,7 +50,7 @@ then
logs View output from prod containers
pull Pull SafeU prod container images
restart Restart SafeU prod containers
up Up SafeU prod containers with force recreate and build
up Up SafeU prod containers
"

else
Expand Down

0 comments on commit 206c7cc

Please sign in to comment.