generated from poettl/go-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
143 lines (127 loc) · 5.05 KB
/
docker-compose.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
version: "3.4"
services:
service:
build:
context: .
target: development
ports:
- "8080:8080"
working_dir: &PROJECT_ROOT_DIR /app
# linux permissions / vscode support: we must explicitly run as the development user
user: development
volumes:
# mount working directory
# https://code.visualstudio.com/docs/remote/containers-advanced#_update-the-mount-consistency-to-delegated-for-macos
# https://docs.docker.com/docker-for-mac/osxfs-caching/#delegated
# the container’s view is authoritative (permit delays before updates on the container appear in the host)
- .:/app:delegated
# mount cached go pkg downloads
- go-pkg:/go/pkg
# mount cached vscode container extensions
# https://code.visualstudio.com/docs/remote/containers-advanced#_avoiding-extension-reinstalls-on-container-rebuild
- vscode-extensions:/home/development/.vscode-server/extensions
- vscode-extensions-insiders:/home/development/.vscode-server-insiders/extensions
depends_on:
- postgres
- integresql
- redis
environment:
# required: env for main working database, service
# default for sql-migrate (target development) and psql cli tool
PGDATABASE: &PGDATABASE "development"
PGUSER: &PGUSER "dbuser"
PGPASSWORD: &PGPASSWORD "dbpass"
PGHOST: &PGHOST "postgres"
PGPORT: &PGPORT "5432"
PGSSLMODE: &PGSSLMODE "disable"
# optional: env for sql-boiler (ability to generate models out of a "spec" database)
# sql-boiler should operate on a "spec" database only
PSQL_DBNAME: "spec"
PSQL_USER: *PGUSER
PSQL_PASS: *PGPASSWORD
PSQL_HOST: *PGHOST
PSQL_PORT: *PGPORT
PSQL_SSLMODE: *PGSSLMODE
# optional: project root directory, used for relative path resolution (e.g. fixtures)
PROJECT_ROOT_DIR: *PROJECT_ROOT_DIR
# optional: env for integresql client testing
# INTEGRESQL_CLIENT_BASE_URL: "http://integresql:5000/api"
# optional: enable pretty print of log output
# intended use is for development and debugging purposes only
# not recommended to enable on production systems due to performance penalty and loss of parsing ability
SERVER_LOGGER_PRETTY_PRINT_CONSOLE: "true"
# optional: static management secret to easily call http://localhost:8080/-/healthy?mgmt-secret=mgmtpass
SERVER_MANAGEMENT_SECRET: "mgmtpass"
# Uncomment the next four lines if you will use a ptrace-based debugger like C++, Go, and Rust.
cap_add:
- SYS_PTRACE
security_opt:
- seccomp:unconfined
# Overrides default command so things don't shut down after the process ends.
command: /bin/sh -c "while sleep 1000; do :; done"
postgres:
image: postgres:12.4-alpine # should be the same version as used in .drone.yml, .github/workflows, Dockerfile and live
# ATTENTION
# fsync=off, synchronous_commit=off and full_page_writes=off
# gives us a major speed up during local development and testing (~30%),
# however you should NEVER use these settings in PRODUCTION unless
# you want to have CORRUPTED data.
# DO NOT COPY/PASTE THIS BLINDLY.
# YOU HAVE BEEN WARNED.
# Apply some performance improvements to pg as these guarantees are not needed while running locally
command: "postgres -c 'shared_buffers=128MB' -c 'fsync=off' -c 'synchronous_commit=off' -c 'full_page_writes=off' -c 'max_connections=100' -c 'client_min_messages=warning'"
expose:
- "5432"
ports:
- "5432:5432"
environment:
POSTGRES_DB: *PGDATABASE
POSTGRES_USER: *PGUSER
POSTGRES_PASSWORD: *PGPASSWORD
volumes:
- pgvolume:/var/lib/postgresql/data
redis:
image: redis:6.0.9-alpine
expose:
- "6379"
integresql:
image: allaboutapps/integresql:1.0.0
expose:
- "5000"
depends_on:
- postgres
environment:
PGHOST: *PGHOST
PGUSER: *PGUSER
PGPASSWORD: *PGPASSWORD
mailhog:
image: mailhog/mailhog
expose:
- "1025"
ports:
- "8025:8025"
swaggerui:
image: swaggerapi/swagger-ui:v3.46.0
environment:
SWAGGER_JSON: "/api/swagger.yml"
volumes:
# mount our local main swagger.yml file (refresh your browser to see changes)
- ./api:/api:ro,consistent
# mount overwritten translator.js (intercept requests port 8081 to our local service on port 8080)
- ./api/config/swagger-ui-local-translator.js:/usr/share/nginx/configurator/translator.js:ro,delegated
swaggerui-browser-sync:
image: allaboutapps/browser-sync:v2.26.14
command: start --proxy 'swaggerui:8080' --port 8081 --files "/api/*.yml"
volumes:
- ./api:/api:ro,consistent
ports:
- "8081:8081"
volumes:
# postgresql: declare a named volume to persist DB data
pgvolume:
# go: go mod cached downloads
go-pkg:
# vscode: Avoiding extension reinstalls on container rebuild
# https://code.visualstudio.com/docs/remote/containers-advanced#_avoiding-extension-reinstalls-on-container-rebuild
vscode-extensions:
vscode-extensions-insiders: