-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathdocker-compose-cicd.yaml
179 lines (173 loc) · 7.77 KB
/
docker-compose-cicd.yaml
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# This file is used to run operations on CI/CD pipeline against your remotely
# running application. These operations include:
#
# - End-to-end tests for the UI
# - Integration tests for the API
# - Database migrations for the database
#
# This file contains two types of containers:
#
# a) Containers that provide the implementations (tests, migrations, etc).
# Typically the build stage of the Dockerfile.build includes these.
# b) Containers that act as a proxy to provide access to database or
# internal services. Typically Taito CLI image is used as a proxy.
version: '3.8'
services:
# TODO: update also playwright setup located in the playwright folder
full-stack-template-playwright-cicd:
image: full-stack-template-playwright-builder:${IMAGE_TAG}
restart: "no"
volumes:
- "${DOCKER_HOST_PATH}/playwright:/playwright:delegated"
- "/playwright/node_modules"
secrets:
- TEST_USER_PASSWORD
environment:
CI: "true"
TEST_ENV: ${taito_target_env}
TEST_BASE_URL: https://${taito_domain}
TEST_USER_EMAIL: username@mydomain.com
full-stack-template-server-cicd:
image: full-stack-template-server-builder:${IMAGE_TAG}
restart: 'no'
networks:
- cicd
depends_on:
full-stack-template-database-proxy:
condition: service_healthy
# full-stack-template-services-proxy
# condition: service_healthy
volumes:
- "${DOCKER_HOST_PATH:-.}/server:/develop:delegated"
- "${DOCKER_HOST_PATH:-.}/shared:/develop/shared:delegated"
- "/develop/node_modules"
- "${DOCKER_HOST_PATH:-.}/tmp/secrets/${taito_env}/${db_database_mgr_secret}:/run/secrets/DATABASE_PASSWORD" # For GitHub Actions
- "${DOCKER_HOST_PATH:-.}/tmp/secrets/${taito_env}/${db_database_ssl_ca_secret}:/run/secrets/DATABASE_SSL_CA" # For GitHub Actions
- "${DOCKER_HOST_PATH:-.}/tmp/secrets/${taito_env}/${db_database_ssl_cert_secret}:/run/secrets/DATABASE_SSL_CERT" # For GitHub Actions
- "${DOCKER_HOST_PATH:-.}/tmp/secrets/${taito_env}/${db_database_ssl_key_secret}:/run/secrets/DATABASE_SSL_KEY" # For GitHub Actions
secrets:
- DATABASE_PASSWORD
- DATABASE_SSL_CA
- DATABASE_SSL_CERT
- DATABASE_SSL_KEY
- TEST_USER_PASSWORD
environment:
TEST_ENV: ${taito_target_env}
TEST_BASE_URL: https://${taito_domain}
TEST_USER_EMAIL: username@mydomain.com
DATABASE_HOST: full-stack-template-database-proxy
DATABASE_PORT: ${db_database_real_port}
DATABASE_NAME: ${db_database_name}
DATABASE_USER: ${db_database_mgr_username}
DATABASE_SSL_ENABLED: ${db_database_ssl_enabled}
DATABASE_SSL_CLIENT_CERT_ENABLED: ${db_database_ssl_client_cert_enabled}
DATABASE_SSL_SERVER_CERT_ENABLED: ${db_database_ssl_server_cert_enabled}
# Taito CLI container serves as a database proxy
full-stack-template-database-proxy:
image: ${taito_image}
restart: 'no'
user: taito
networks:
- cicd
entrypoint:
- /bin/sh
- -c
- |
cd /project
taito db proxy:${taito_env} 5432
healthcheck:
test: (echo > /dev/tcp/localhost/5432) &> /dev/null || exit 1
start_period: 10s
ports:
- "5432"
volumes:
- "${DOCKER_HOST_PATH:-.}/:/project:delegated"
- "${DOCKER_HOST_PATH:-.}/tmp/secrets/${taito_env}/cicd-proxy-serviceaccount.key:/run/secrets/CICD_PROXY_SERVICEACCOUNT_KEY" # For GitHub Actions # For GCP
secrets: # For GCP
- CICD_PROXY_SERVICEACCOUNT_KEY # For GCP
environment:
taito_docker: 'true'
taito_mode: 'ci'
AZURE_CLIENT_ID: ${AZURE_CLIENT_ID}
AZURE_CLIENT_SECRET: ${AZURE_CLIENT_SECRET}
AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}
AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}
DO_API_KEY: ${DO_API_KEY}
# TIP: If connection halts, try to set GOOGLE_SQL_PROXY_CREDENTIALS instead # For GCP
GOOGLE_APPLICATION_CREDENTIALS: /run/secrets/CICD_PROXY_SERVICEACCOUNT_KEY # For GCP
template_default_taito_image: ${template_default_taito_image}
template_default_environments: ${template_default_environments}
template_default_organization: ${template_default_organization}
template_default_organization_abbr: ${template_default_organization_abbr}
template_default_vc_organization: ${template_default_vc_organization}
template_default_vc_url: ${template_default_vc_url}
template_default_sentry_organization: ${template_default_sentry_organization}
template_default_domain: ${template_default_domain}
template_default_domain_prod: ${template_default_domain_prod}
template_default_zone: ${template_default_zone}
template_default_zone_prod: ${template_default_zone_prod}
template_default_provider: ${template_default_provider}
template_default_provider_org_id: ${template_default_provider_org_id}
template_default_provider_region: ${template_default_provider_region}
template_default_provider_zone: ${template_default_provider_zone}
template_default_provider_org_id_prod: ${template_default_provider_org_id_prod}
template_default_provider_region_prod: ${template_default_provider_region_prod}
template_default_provider_zone_prod: ${template_default_provider_zone_prod}
template_default_uptime_channels_prod: ${template_default_uptime_channels_prod}
template_default_container_registry: ${template_default_container_registry}
template_default_source_git: ${template_default_source_git}
template_default_dest_git: ${template_default_dest_git}
template_default_kubernetes: ${template_default_kubernetes}
template_default_postgres: ${template_default_postgres}
template_default_mysql: ${template_default_mysql}
# Taito CLI container serves as a tcp proxy for redis, etc.
# full-stack-template-services-proxy:
# image: ${taito_image}
# restart: 'no'
# user: taito
# networks:
# - cicd
# entrypoint:
# - /bin/sh
# - -c
# - |
# cd /project
# taito forward:redis:${taito_env} 6379
# # TIP: you can define multiple forwards like this:
# # taito forward:redis:${taito_env} 6379 &
# # tail -f /dev/null
# healthcheck:
# test: (echo > /dev/tcp/localhost/6379) &> /dev/null || exit 1
# start_period: 10s
# ports:
# - "6379"
# volumes:
# - "${DOCKER_HOST_PATH:-.}/:/project:delegated"
# - "${DOCKER_HOST_PATH:-.}/tmp/secrets/${taito_env}/cicd-proxy-serviceaccount.key:/run/secrets/CICD_PROXY_SERVICEACCOUNT_KEY" # For GitHub Actions # For GCP
# secrets: # For GCP
# - CICD_PROXY_SERVICEACCOUNT_KEY # For GCP
# environment:
# taito_docker: 'true'
# taito_mode: 'ci'
# AZURE_CLIENT_ID: ${AZURE_CLIENT_ID}
# AZURE_CLIENT_SECRET: ${AZURE_CLIENT_SECRET}
# AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}
# AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}
# DO_API_KEY: ${DO_API_KEY}
# # TIP: If connection halts, try to set GOOGLE_SQL_PROXY_CREDENTIALS instead # For GCP
# GOOGLE_APPLICATION_CREDENTIALS: /run/secrets/CICD_PROXY_SERVICEACCOUNT_KEY # For GCP
secrets:
CICD_PROXY_SERVICEACCOUNT_KEY: # For GCP
file: ${DOCKER_HOST_PATH:-.}/tmp/secrets/${taito_env}/cicd-proxy-serviceaccount.key # For GCP
DATABASE_PASSWORD:
file: ${DOCKER_HOST_PATH:-.}/tmp/secrets/${taito_env}/${db_database_mgr_secret}
DATABASE_SSL_CA:
file: ${DOCKER_HOST_PATH:-.}/tmp/secrets/${taito_env}/${db_database_ssl_ca_secret}
DATABASE_SSL_CERT:
file: ${DOCKER_HOST_PATH:-.}/tmp/secrets/${taito_env}/${db_database_ssl_cert_secret}
DATABASE_SSL_KEY:
file: ${DOCKER_HOST_PATH:-.}/tmp/secrets/${taito_env}/${db_database_ssl_key_secret}
TEST_USER_PASSWORD:
file: ${DOCKER_HOST_PATH:-.}/tmp/secrets/${taito_env}/${taito_project}-${taito_env}-test-user-password.secret
networks:
cicd: