-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-compose.yaml
More file actions
222 lines (212 loc) · 11.1 KB
/
Copy pathdocker-compose.yaml
File metadata and controls
222 lines (212 loc) · 11.1 KB
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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
name: check_performance_data
services:
web:
profiles: [web, all, e2e]
container_name: cypd_web
restart: unless-stopped
build:
context: ./src
dockerfile: DfE.CheckPerformanceData.Web/Dockerfile
target: runtime
image: cypd_web:latest
ports:
- "8080:8080"
environment:
- ASPNETCORE_ENVIRONMENT=${ASPNETCORE_ENVIRONMENT:-Development}
# Local-only dev tooling surface (impersonation + /dev/* seed endpoints). The
# E2E suite drives /dev/impersonate/* against this container, so it must be on
# here. Deployed DEV/QA/Preproduction never set this; Production is hard-guarded.
- Dev__ToolsEnabled=${DEV_TOOLS_ENABLED:-true}
- ASPNETCORE_URLS=http://+:8080
# Local dev has no GOV.UK Notify secret, so use the console fake (logs emails
# instead of sending). Set NOTIFY_USEFAKE=false + supply Notify__ApiKey to send real emails.
- Notify__UseFake=${NOTIFY_USEFAKE:-true}
- ConnectionStrings__Postgres=${POSTGRES_CONNECTION_STRING:-Host=db;Database=cypd;Username=postgres;Password=postgres}
- ConnectionStrings__AzureStorage=${AZURE_STORAGE_CONNECTION_STRING:-DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://azurite:10000/devstoreaccount1;QueueEndpoint=http://azurite:10001/devstoreaccount1;}
- DfeSignIn__BaseUrl=${DFESIGNIN_BASEURL:-https://test-api.signin.education.gov.uk/}
- DfeSignIn__ClientId=${DFESIGNIN_CLIENTID}
- DfeSignIn__ApiClientSecret=${DFESIGNIN_APICLIENTSECRET}
- DfeSignIn__Audience=${DFESIGNIN_AUDIENCE:-signin.education.gov.uk}
- DfeSignIn__MetadataAddress=${DFESIGNIN_METADATAADDRESS:-https://test-oidc.signin.education.gov.uk/.well-known/openid-configuration}
- DfeSignIn__ClientSecret=${DFESIGNIN_CLIENTSECRET}
- DfeSignIn__ServiceId=${DFESIGNIN_SERVICEID}
- DfEAnalytics__DatasetId=${DfEAnalytics_DatasetId}
- DfEAnalytics__ProjectId=${DfEAnalytics_ProjectId}
- DfEAnalytics__Environment=${DfEAnalytics_Environment}
- DfEAnalytics__Namespace=${DfEAnalytics_Namespace}
- DfEAnalytics__CredentialsJson=${DfEAnalytics_CredentialsJson}
depends_on:
- db
- azurite
networks:
- cypd
rules_engine:
profiles: [rules_engine, all]
container_name: cypd_rules_engine
restart: unless-stopped
build:
context: ./src
dockerfile: DfE.CheckPerformanceData.RulesEngineWorker/Dockerfile
image: cypd_rules_engine:latest
environment:
- ASPNETCORE_ENVIRONMENT=${ASPNETCORE_ENVIRONMENT:-Development}
- ConnectionStrings__Postgres=${POSTGRES_CONNECTION_STRING:-Host=db;Database=cypd;Username=postgres;Password=postgres}
- ConnectionStrings__AzureStorage=${AZURE_STORAGE_CONNECTION_STRING:-DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://azurite:10000/devstoreaccount1;QueueEndpoint=http://azurite:10001/devstoreaccount1;}
- DfeSignIn__BaseUrl=${DFESIGNIN_BASEURL:-https://test-api.signin.education.gov.uk/}
- DfeSignIn__ClientId=${DFESIGNIN_CLIENTID}
- DfeSignIn__ApiClientSecret=${DFESIGNIN_APICLIENTSECRET}
- DfeSignIn__Audience=${DFESIGNIN_AUDIENCE:-signin.education.gov.uk}
- DfeSignIn__MetadataAddress=${DFESIGNIN_METADATAADDRESS:-https://test-oidc.signin.education.gov.uk/.well-known/openid-configuration}
- DfeSignIn__ClientSecret=${DFESIGNIN_CLIENTSECRET}
- DfeSignIn__ServiceId=${DFESIGNIN_SERVICEID}
- RulesEngineOptions__QueueName=${RULESENGINEOPTIONS_QUEUENAME:-requests}
- RulesEngineOptions__RetryDelayMs=${RULESENGINEOPTIONS_RETRYDELAYMS:-1000}
- RulesEngineOptions__MaxMessagesPerPoll=${RULESENGINEOPTIONS_MAXMESSAGESPERPOLL:-10}
- RulesEngineOptions__EmptyQueueDelayMs=${RULESENGINEOPTIONS_EMPTYQUEUEDELAYMS:-1000}
- RulesEngineOptions__MaxDequeueCount=${RULESENGINEOPTIONS_MAXDEQUEUECOUNT:-3}
- RulesEngineOptions__RulesBlobContainer=${RULESENGINEOPTIONS_RULESBLOBCONTAINER:-rules-config}
- RulesEngineOptions__RulesBlobName=${RULESENGINEOPTIONS_RULESBLOBNAME:-rules.json}
- RulesEngineOptions__LookupsBlobName=${RULESENGINEOPTIONS_LOOKUPSBLOBNAME:-country-languages.json}
- RulesEngineOptions__RefreshIntervalSeconds=${RULESENGINEOPTIONS_REFRESHINTERVALSECONDS:-300}
- RulesEngineOptions__StalenessWarningSeconds=${RULESENGINEOPTIONS_STALENESSWARNINGSECONDS:-1800}
- ZendeskSettings__Subdomain=${ZendeskSettings_Subdomain}
- ZendeskSettings__Domain=${ZendeskSettings_Domain}
- ZendeskSettings__Email=${ZendeskSettings_Email}
- ZendeskSettings__ApiToken=${ZendeskSettings_ApiToken}
- ZendeskSettings__ClientId=${ZendeskSettings_ClientId}
- ZendeskSettings__ClientSecret=${ZendeskSettings_ClientSecret}
- SchoolCheckingExercise__TargetViewTitle=${SchoolCheckingExercise_TargetViewTitle}
- SchoolCheckingExercise__GroupId=${SchoolCheckingExercise_GroupId}
- SchoolCheckingExercise__BrandId=${SchoolCheckingExercise_BrandId}
- ZendeskTicketFields__UpnId=${ZendeskTicketFields_UpnId}
- ZendeskTicketFields__TypeOfOrganisationId=${ZendeskTicketFields_TypeOfOrganisationId}
- ZendeskTicketFields__SurnameCypmdId=${ZendeskTicketFields_SurnameCypmdId}
- ZendeskTicketFields__SexId=${ZendeskTicketFields_SexId}
- ZendeskTicketFields__SchoolUrnId=${ZendeskTicketFields_SchoolUrnId}
- ZendeskTicketFields__ReasonForRemovalId=${ZendeskTicketFields_ReasonForRemovalId}
- ZendeskTicketFields__LdsMatchedPupilIdId=${ZendeskTicketFields_LdsMatchedPupilIdId}
- ZendeskTicketFields__KeyStageId=${ZendeskTicketFields_KeyStageId}
- ZendeskTicketFields__ForenameCypmdId=${ZendeskTicketFields_ForenameCypmdId}
- ZendeskTicketFields__DfeEstablishmentNumberId=${ZendeskTicketFields_DfeEstablishmentNumberId}
- ZendeskTicketFields__DecisionStatusId=${ZendeskTicketFields_DecisionStatusId}
- ZendeskTicketFields__DateOfBirthCypmdId=${ZendeskTicketFields_DateOfBirthCypmdId}
- ZendeskTicketFields__CypmdId=${ZendeskTicketFields_CypmdId}
- ZendeskTicketFields__CycleYearId=${ZendeskTicketFields_CycleYearId}
- ZendeskTicketFields__CycleMonthId=${ZendeskTicketFields_CycleMonthId}
- ZendeskTicketFields__CorrectionTypeId=${ZendeskTicketFields_CorrectionTypeId}
- ZendeskTicketFields__CorrectionReason31Id=${ZendeskTicketFields_CorrectionReason31Id}
- ZendeskTicketFields__AdmissionDateId=${ZendeskTicketFields_AdmissionDateId}
depends_on:
db:
condition: service_started
azurite:
condition: service_started
# Wait for the seed upload so the worker's first refresh reads real rules
# rather than starting on the cold-fallback path. The init container exits 0
# after a successful upload (or after the blobs already exist).
azurite_init:
condition: service_completed_successfully
networks:
- cypd
# One-shot init: waits for Azurite to be reachable, creates the rules-config
# container if missing, and uploads seed/rules.json + seed/country-languages.json.
# Idempotent: re-runs are a no-op if the blobs already exist.
azurite_init:
profiles: [rules_engine, all]
container_name: cypd_azurite_init
image: mcr.microsoft.com/azure-cli:latest
depends_on:
- azurite
volumes:
- ./src/DfE.CheckPerformanceData.RulesEngineWorker/seed:/seed:ro
environment:
- AZURE_STORAGE_CONNECTION_STRING=DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://azurite:10000/devstoreaccount1;
entrypoint: ["/bin/sh", "-c"]
# command MUST be a single-element list, not a `|` block scalar (a YAML string).
# With an exec-form entrypoint, Compose word-splits a string command into separate
# argv entries, so `sh -c` would receive only the first token ("set") as its script
# and the rest as positional parameters — the whole seed script silently became a
# no-op env dump. A one-element list passes the entire script as a single argument.
command:
- |
set -eu
echo "Waiting for Azurite to respond..."
for i in $$(seq 1 60); do
if az storage container exists --name rules-config --only-show-errors >/dev/null 2>&1; then
break
fi
sleep 1
done
echo "Ensuring rules-config container..."
az storage container create --name rules-config --only-show-errors >/dev/null
echo "Uploading seed JSON..."
az storage blob upload-batch \
--destination rules-config \
--source /seed \
--pattern '*.json' \
--overwrite \
--only-show-errors
echo "Seed upload complete."
networks:
- cypd
db:
profiles: [database, all, e2e]
container_name: cypd_db
restart: unless-stopped
image: postgres:18.1-alpine
environment:
- POSTGRES_DB=${POSTGRES_DB:-cypd}
- POSTGRES_USER=${POSTGRES_USER:-postgres}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-postgres}
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
networks:
- cypd
pgadmin:
profiles: [database, all]
image: dpage/pgadmin4:${PGADMIN_IMAGE_TAG:-latest}
container_name: cypd_pgadmin
restart: unless-stopped
environment:
PGADMIN_DEFAULT_EMAIL: ${PGADMIN_DEFAULT_EMAIL:-admin@admin.com}
PGADMIN_DEFAULT_PASSWORD: ${PGADMIN_DEFAULT_PASSWORD:-admin}
volumes:
- pgadmin_data:/var/lib/pgadmin/data
ports:
- "5050:80"
depends_on:
- db
networks:
- cypd
azurite:
profiles: [storage, all, e2e]
container_name: cypd_azurite
restart: unless-stopped
image: mcr.microsoft.com/azure-storage/azurite:latest
ports:
- "10000:10000" # Blob
- "10001:10001" # Queue
environment:
- AZURITE_ACCOUNTS=devstoreaccount1:Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;ingressaccount:Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==
volumes:
- azurite_data:/data
command: azurite --blobHost 0.0.0.0 --queueHost 0.0.0.0 --location /data --debug /data/debug.log --skipApiVersionCheck
networks:
- cypd
# NOTE: the e2e-tests service is intentionally NOT defined here. Visual Studio's
# docker-compose orchestration loads ONLY this file (via the .dcproj, with an
# explicit `-f docker-compose.yaml` that ignores COMPOSE_FILE) and would try to
# manage the one-shot Playwright runner — failing with "Can not find the container
# for the service 'e2e-tests'" because it is gated to the 'e2e' profile and never
# starts under VS. The service lives in docker-compose.e2e.yml instead; the CLI
# merges it back in via COMPOSE_FILE in .env, so `make test-e2e` works unchanged.
volumes:
postgres_data:
azurite_data:
pgadmin_data:
cpd-nuget-cache:
networks:
cypd:
driver: bridge