File tree Expand file tree Collapse file tree 2 files changed +35
-1
lines changed Expand file tree Collapse file tree 2 files changed +35
-1
lines changed Original file line number Diff line number Diff line change 1717# Run official PostgreSQL Docker container with specified version.
1818#
1919- name : Run PostgreSQL container
20- docker_container :
20+ community.docker. docker_container :
2121 name : cgapp-postgres
2222 image : " postgres:{{ postgres_version }}"
2323 restart_policy : unless-stopped
2828 - " {{ postgres_port }}:{{ postgres_port }}"
2929 volumes :
3030 - " {{ server_dir }}/database/data/:/var/lib/postgresql/data"
31+
32+ #
33+ # Make DB migration.
34+ #
35+ - name : Make DB migration
36+ community.docker.docker_container :
37+ name : cgapp-db-migration
38+ image : " migrate/migrate"
39+ recreate : true
40+ networks :
41+ - name : " {{ docker_network }}"
42+ command :
43+ [
44+ " -path" ,
45+ " /migrations" ,
46+ " -database" ,
47+ " postgres://{{ postgres_user }}:{{ postgres_password }}@localhost:{{ postgres_port }}/{{ postgres_db }}?sslmode={{ postgres_ssl_mode }}" ,
48+ " up" ,
49+ " {{ migrate_number }}" ,
50+ ]
51+ volumes :
52+ - " {{ server_dir }}/backend/platform/migrations/:/migrations"
Original file line number Diff line number Diff line change @@ -70,6 +70,18 @@ postgres_password=password
7070# Set PostgreSQL DB name,
7171# MUST BE MATCH to the DB name that is listed in your `./backend/.env` file!
7272postgres_db=postgres
73+ # Set PostgreSQL SSL mode state ('enabled' or 'disabled'),
74+ # MUST BE MATCH to the SSL mode state that is listed in your `./backend/.env` file!
75+ postgres_ssl_mode=disable
76+
77+ #
78+ # Go-Migrate configuration:
79+ #
80+
81+ # Set migration number,
82+ # if you WANT to migrate all of your migrations, just leave it blank,
83+ # for only initial migration set it to '1'
84+ migrate_number=1
7385
7486#
7587# Redis configuration (backend cache):
You can’t perform that action at this time.
0 commit comments