File tree Expand file tree Collapse file tree 6 files changed +124
-0
lines changed Expand file tree Collapse file tree 6 files changed +124
-0
lines changed Original file line number Diff line number Diff line change
1
+ # deployment YAML
Original file line number Diff line number Diff line change
1
+ .env *
2
+ notes.txt
3
+ configs /*
4
+
5
+ secrets /*
6
+ ! secrets /.gitkeep
7
+ test-Dockerfile
Original file line number Diff line number Diff line change
1
+ # Example bash to backing up data
2
+ DATE=$( date +' %Y%m%d%H%M%S' )
3
+ S3_BUCKET=${BUCKET_URL}
4
+ DB_HOST=${DB_HOST}
5
+ DB_PORT=${DB_PORT}
6
+ DB_USER=${DB_USER}
7
+ DB_PASSWORD=${DB_PASSWORD}
8
+ DB_NAME=${DB_NAME}
9
+ BACKUP_FILE=" /backup/${DB_NAME} _${DATE} .sql"
10
+
11
+
12
+ echo " Backing up ${DB_NAME} ..."
13
+ PGPASSWORD=$DB_PASSWORD pg_dump -h $DB_HOST -p $DB_PORT -U $DB_USER -d $DB_NAME > $BACKUP_FILE
14
+
15
+ # Upload to bucket S3 in this case
16
+ echo " upload started..."
17
+ aws s3 cp $BACKUP_FILE $S3_BUCKET$BACKUP_FILE
18
+ echo " done <3"
Original file line number Diff line number Diff line change
1
+ 0 3 * * * /backup/backup.sh
Original file line number Diff line number Diff line change
1
+ version : " 3.8"
2
+
3
+ services :
4
+ postgres :
5
+ image : postgres:16
6
+ environment :
7
+ POSTGRES_PASSWORD_FILE : /run/secrets/postgres_password
8
+ secrets :
9
+ - postgres_password
10
+ volumes :
11
+ - postgres_main:/var/lib/postgresql/data
12
+ - ./configs/postgres/pg_hba.conf:/etc/postgresql-custom/pg_hba.conf
13
+ - ./configs/postgres/postgresql.conf:/etc/postgresql-custom/postgresql.conf
14
+ command : >
15
+ postgres -c config_file=/etc/postgresql-custom/postgresql.conf
16
+ ports :
17
+ - " 5433:5432"
18
+ networks :
19
+ - app_network
20
+
21
+ mysql :
22
+ image : mysql:8.0
23
+ environment :
24
+ MYSQL_ROOT_PASSWORD_FILE : /run/secrets/mysql_root_password
25
+ MYSQL_PASSWORD_FILE : /run/secrets/mysql_password
26
+ secrets :
27
+ - mysql_root_password
28
+ - mysql_password
29
+ ports :
30
+ - " 3307:3306"
31
+ volumes :
32
+ - mysql_main:/var/lib/mysql
33
+ - ./configs/mysql/my.cnf:/etc/mysql/conf.d/my.cnf
34
+ networks :
35
+ - app_network
36
+
37
+ redis :
38
+ image : redis:alpine
39
+ ports :
40
+ - " 6379:6379"
41
+ volumes :
42
+ - ./configs/redis.conf:/usr/local/etc/redis/redis.conf
43
+ command : ["redis-server", "/usr/local/etc/redis/redis.conf"]
44
+ networks :
45
+ - app_network
46
+
47
+ # dbmate_postgres:
48
+ # image: amacneil/dbmate:latest
49
+ # depends_on:
50
+ # - postgres
51
+ # environment:
52
+ # DATABASE_URL: ${DATABASE_URL}
53
+ # volumes:
54
+ # - ./migrations/${DB_NAME}:/db/migrations
55
+ # command: ["up"]
56
+ # networks:
57
+ # - app_network
58
+
59
+ # backup_service:
60
+ # image: amazon/aws-cli:latest
61
+ # container_name: postgres_backup
62
+ # secrets:
63
+ # - aws_access_key_id
64
+ # - aws_secret_access_key
65
+ # environment:
66
+ # AWS_DEFAULT_REGION: ${AWS_REGION}
67
+ # AWS_ACCESS_KEY_ID_FILE: /run/secrets/aws_access_key_id
68
+ # AWS_SECRET_ACCESS_KEY_FILE: /run/secrets/aws_secret_access_key
69
+ # volumes:
70
+ # - ./backup:/backup
71
+ # entrypoint: ["sh", "-c", "/backup/backup.sh"]
72
+ # depends_on:
73
+ # - ${PG_CONTAINER_NAME}
74
+ # networks:
75
+ # - app_network
76
+
77
+ networks :
78
+ app_network :
79
+
80
+ volumes :
81
+ postgres_main :
82
+ mysql_main :
83
+
84
+ secrets :
85
+ postgres_password :
86
+ external : true
87
+ mysql_root_password :
88
+ external : true
89
+ mysql_password :
90
+ external : true
91
+ aws_access_key_id :
92
+ external : true
93
+ aws_secret_access_key :
94
+ external : true
Original file line number Diff line number Diff line change
1
+ # .gitignore
2
+ *
3
+ ! .gitignore
You can’t perform that action at this time.
0 commit comments