-
Notifications
You must be signed in to change notification settings - Fork 4
232 lines (206 loc) · 11 KB
/
ci-pollution-v2.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
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
223
224
225
226
227
228
229
230
231
232
name: CI/CD pollution-v2
on:
push:
paths:
- "pollution_v2/**"
- ".github/workflows/ci-pollution-v2.yml"
- "!*.md"
env:
WORKING_DIRECTORY: pollution_v2
jobs:
# Deploy Test
deploy-test-pollution-v2:
runs-on: ubuntu-24.04
if: github.ref == 'refs/heads/main'
concurrency: deploy-test-pollution-v2
env:
KEYCLOAK_URL: https://auth.opendatahub.testingmachine.eu
DOCKER_TAG: ${{ github.sha }}-test
PROJECT_NAME: odh-mobility-el-pollution-v2-test
steps:
- name: Checkout source code
uses: noi-techpark/github-actions/checkout@v2
- name: Create .env file
uses: noi-techpark/github-actions/env-file@v2
with:
working-directory: ${{ env.WORKING_DIRECTORY }}
env:
# General deployment options
X_COMPOSE_PROJECT_NAME: ${{ env.PROJECT_NAME }}
X_DOCKER_IMAGE: ${{ env.DOCKER_IMAGE }}
X_DOCKER_TAG: ${{ env.DOCKER_TAG }}
X_LOG_LEVEL: INFO
X_LOG_LEVEL_LIBS: INFO
X_SERVER_PORT: 1097
X_pollution-v2_TASK_SCHEDULING_MINUTE: "*/10"
X_pollution-v2_TASK_SCHEDULING_HOUR: "*"
X_ODH_BASE_READER_URL: https://mobility.api.opendatahub.testingmachine.eu
X_ODH_BASE_WRITER_URL: https://share.opendatahub.testingmachine.eu
X_ODH_AUTHENTICATION_URL: ${{ env.KEYCLOAK_URL }}/auth/
X_ODH_CLIENT_ID: odh-a22-dataprocessor
X_ODH_CLIENT_SECRET: ${{ secrets.COMBINED_CLIENT_SECRET_TEST }}
X_ODH_GRANT_TYPE: client_credentials
X_ODH_PAGINATION_SIZE: 10000
X_ODH_MAX_POST_BATCH_SIZE: 10000
X_PROVENANCE_NAME: ${{ env.PROJECT_NAME }}
X_PROVENANCE_VERSION: ${{ github.sha }}
X_AIRFLOW_PROJ_DIR: /opt/pollution-v2
X_AIRFLOW_UID: 5000
X_AIRFLOW__CORE__EXECUTOR: CeleryExecutor
X_AIRFLOW__DATABASE__SQL_ALCHEMY_CONN: postgresql+psycopg2://airflow:airflow@postgres/airflow
X_AIRFLOW__CELERY__RESULT_BACKEND: db+postgresql://airflow:airflow@postgres/airflow
X_AIRFLOW__CELERY__BROKER_URL: redis://:@redis:6379/0
X_AIRFLOW__CORE__FERNET_KEY: ''
X_AIRFLOW__CORE__DAGS_ARE_PAUSED_AT_CREATION: 'true'
X_AIRFLOW__CORE__LOAD_EXAMPLES: 'false'
X_AIRFLOW__API__AUTH_BACKENDS: 'airflow.api.auth.backend.basic_auth,airflow.api.auth.backend.session'
# yamllint disable rule:line-length
# Use simple http server on scheduler for health checks
# See https://airflow.apache.org/docs/apache-airflow/stable/administration-and-deployment/logging-monitoring/check-health.html#scheduler-health-check-server
# yamllint enable rule:line-length
X_AIRFLOW__SCHEDULER__ENABLE_HEALTH_CHECK: 'true'
# WARNING: Use _PIP_ADDITIONAL_REQUIREMENTS option ONLY for a quick checks
# for other purpose (development, test and especially production usage) build/extend Airflow image.
X__PIP_ADDITIONAL_REQUIREMENTS: ${_PIP_ADDITIONAL_REQUIREMENTS:-}
X_AIRFLOW_VAR_ODH_AUTHENTICATION_URL: ${{ env.KEYCLOAK_URL }}/auth/
X_AIRFLOW_VAR_ODH_BASE_READER_URL: 'https://mobility.api.opendatahub.testingmachine.eu'
X_AIRFLOW_VAR_ODH_BASE_WRITER_URL: 'https://share.opendatahub.testingmachine.eu'
X_AIRFLOW_VAR_ODH_CLIENT_ID: 'odh-a22-dataprocessor'
X_AIRFLOW_VAR_ODH_CLIENT_SECRET: ${{ secrets.COMBINED_CLIENT_SECRET_TEST }}
X_AIRFLOW_VAR_ODH_GRANT_TYPE: client_credentials
X_AIRFLOW_VAR_ODH_MAX_POST_BATCH_SIZE: '10000'
X_AIRFLOW_VAR_ODH_PAGINATION_SIZE: '10000'
X_AIRFLOW_WWW_USER_USERNAME: ${{ secrets.AIRFLOW_WWW_USER_USERNAME }}
X_AIRFLOW_WWW_USER_PASSWORD: ${{ secrets.AIRFLOW_WWW_USER_PASSWORD }}
X_AIRFLOW_VAR_DATATYPE_PREFIX: ''
X_AIRFLOW_VAR_DAG_POLLUTION_EXECUTION_CRONTAB: 0 4 * * *
X_AIRFLOW_VAR_DAG_VALIDATION_EXECUTION_CRONTAB: 0 2 * * *
# username/pass not needed with client_credentials
X_AIRFLOW_VAR_ODH_PASSWORD: 'ODH_PASSWORD'
X_AIRFLOW_VAR_ODH_USERNAME: 'ODH_USERNAME'
X_AIRFLOW_VAR_ODH_MINIMUM_STARTING_DATE: "2017-01-01"
X_AIRFLOW_VAR_COMPUTATION_CHECKPOINT_REDIS_HOST: 'redis'
X_AIRFLOW_VAR_COMPUTATION_CHECKPOINT_REDIS_PORT: 6379
X_AIRFLOW_VAR_COMPUTATION_CHECKPOINT_REDIS_DB: 3
# X_AIRFLOW__CORE__MAX_ACTIVE_TASKS_PER_DAG: 4
X_AIRFLOW__CORE__MAX_ACTIVE_TASKS_PER_DAG: 16
# Currently no logging enabled
# X_AIRFLOW__CORE__REMOTE_LOGGING: '<your_choice_on_remote_logging>'
# X_AIRFLOW__CORE__REMOTE_BASE_LOG_FOLDER: '<your_bucket_for_remote_logging>'
# X_AIRFLOW__CORE__REMOTE_LOG_CONN_ID: '<your_connection_id_for_remote_logging>'
# X_AIRFLOW__CORE__ENCRYPT_S3_LOGS: '<your_choice_on_encrypt_logs>'
# X_AIRFLOW_CONN_MINIO_S3_CONN: '<your_connection_details_for_remote_logging>'
X_NO_PROXY: '*'
- name: Build and push images
uses: noi-techpark/github-actions/docker-build-and-push@v2
with:
working-directory: ${{ env.WORKING_DIRECTORY }}/infrastructure
docker-username: ${{ github.actor }}
docker-password: ${{ secrets.GITHUB_TOKEN }}
- name: Deploy application
uses: noi-techpark/github-actions/docker-deploy@v2
with:
working-directory: ${{ env.WORKING_DIRECTORY }}/infrastructure/ansible
hosts: 'test'
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
docker-username: 'noi-techpark-bot'
docker-password: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
project-name: ${{ env.PROJECT_NAME }}
# Deploy Prod
deploy-prod-pollution-v2:
runs-on: ubuntu-24.04
if: github.ref == 'refs/heads/prod'
concurrency: deploy-prod-pollution-v2
env:
KEYCLOAK_URL: https://auth.opendatahub.com
DOCKER_TAG: ${{ github.sha }}-prod
PROJECT_NAME: odh-mobility-el-pollution-v2-prod
steps:
- name: Checkout source code
uses: noi-techpark/github-actions/checkout@v2
- name: Create .env file
uses: noi-techpark/github-actions/env-file@v2
with:
working-directory: ${{ env.WORKING_DIRECTORY }}
env:
# General deployment options
X_COMPOSE_PROJECT_NAME: ${{ env.PROJECT_NAME }}
X_DOCKER_IMAGE: ${{ env.DOCKER_IMAGE }}
X_DOCKER_TAG: ${{ env.DOCKER_TAG }}
X_LOG_LEVEL: INFO
X_LOG_LEVEL_LIBS: INFO
X_SERVER_PORT: 1098
X_pollution-v2_TASK_SCHEDULING_MINUTE: "*/10"
X_pollution-v2_TASK_SCHEDULING_HOUR: "*"
X_ODH_BASE_READER_URL: https://mobility.api.opendatahub.com
X_ODH_BASE_WRITER_URL: 'https://mobility.share.opendatahub.com'
X_ODH_AUTHENTICATION_URL: ${{ env.KEYCLOAK_URL }}/auth/
X_ODH_CLIENT_ID: odh-a22-dataprocessor
X_ODH_CLIENT_SECRET: ${{ secrets.COMBINED_CLIENT_SECRET_PROD }}
X_ODH_GRANT_TYPE: client_credentials
X_ODH_PAGINATION_SIZE: 10000
X_ODH_MAX_POST_BATCH_SIZE: 10000
X_PROVENANCE_NAME: ${{ env.PROJECT_NAME }}
X_PROVENANCE_VERSION: ${{ github.sha }}
X_AIRFLOW_PROJ_DIR: /opt/pollution-v2
X_AIRFLOW_UID: 5000
X_AIRFLOW__CORE__EXECUTOR: CeleryExecutor
X_AIRFLOW__DATABASE__SQL_ALCHEMY_CONN: postgresql+psycopg2://airflow:airflow@postgres/airflow
X_AIRFLOW__CELERY__RESULT_BACKEND: db+postgresql://airflow:airflow@postgres/airflow
X_AIRFLOW__CELERY__BROKER_URL: redis://:@redis:6379/0
X_AIRFLOW__CORE__FERNET_KEY: ''
X_AIRFLOW__CORE__DAGS_ARE_PAUSED_AT_CREATION: 'true'
X_AIRFLOW__CORE__LOAD_EXAMPLES: 'false'
X_AIRFLOW__API__AUTH_BACKENDS: 'airflow.api.auth.backend.basic_auth,airflow.api.auth.backend.session'
# yamllint disable rule:line-length
# Use simple http server on scheduler for health checks
# See https://airflow.apache.org/docs/apache-airflow/stable/administration-and-deployment/logging-monitoring/check-health.html#scheduler-health-check-server
# yamllint enable rule:line-length
X_AIRFLOW__SCHEDULER__ENABLE_HEALTH_CHECK: 'true'
# WARNING: Use _PIP_ADDITIONAL_REQUIREMENTS option ONLY for a quick checks
# for other purpose (development, test and especially production usage) build/extend Airflow image.
X__PIP_ADDITIONAL_REQUIREMENTS: ${_PIP_ADDITIONAL_REQUIREMENTS:-}
X_AIRFLOW_VAR_ODH_AUTHENTICATION_URL: ${{ env.KEYCLOAK_URL }}/auth/
X_AIRFLOW_VAR_ODH_BASE_READER_URL: 'https://mobility.api.opendatahub.com'
X_AIRFLOW_VAR_ODH_BASE_WRITER_URL: 'https://mobility.share.opendatahub.com'
X_AIRFLOW_VAR_ODH_CLIENT_ID: 'odh-a22-dataprocessor'
X_AIRFLOW_VAR_ODH_CLIENT_SECRET: ${{ secrets.COMBINED_CLIENT_SECRET_PROD }}
X_AIRFLOW_VAR_ODH_GRANT_TYPE: client_credentials
X_AIRFLOW_VAR_ODH_MAX_POST_BATCH_SIZE: '10000'
X_AIRFLOW_VAR_ODH_PAGINATION_SIZE: '10000'
X_AIRFLOW_WWW_USER_USERNAME: ${{ secrets.AIRFLOW_WWW_USER_USERNAME }}
X_AIRFLOW_WWW_USER_PASSWORD: ${{ secrets.AIRFLOW_WWW_USER_PASSWORD }}
X_AIRFLOW_VAR_DATATYPE_PREFIX: ''
X_AIRFLOW_VAR_DAG_POLLUTION_EXECUTION_CRONTAB: 0 4 * * *
X_AIRFLOW_VAR_DAG_VALIDATION_EXECUTION_CRONTAB: 0 2 * * *
# username/pass not needed with client_credentials
X_AIRFLOW_VAR_ODH_PASSWORD: 'ODH_PASSWORD'
X_AIRFLOW_VAR_ODH_USERNAME: 'ODH_USERNAME'
X_AIRFLOW_VAR_ODH_MINIMUM_STARTING_DATE: "2017-01-01"
X_AIRFLOW_VAR_COMPUTATION_CHECKPOINT_REDIS_HOST: 'redis'
X_AIRFLOW_VAR_COMPUTATION_CHECKPOINT_REDIS_PORT: 6379
X_AIRFLOW_VAR_COMPUTATION_CHECKPOINT_REDIS_DB: 3
# X_AIRFLOW__CORE__MAX_ACTIVE_TASKS_PER_DAG: 4
X_AIRFLOW__CORE__MAX_ACTIVE_TASKS_PER_DAG: 16
# Currently no logging enabled
# X_AIRFLOW__CORE__REMOTE_LOGGING: '<your_choice_on_remote_logging>'
# X_AIRFLOW__CORE__REMOTE_BASE_LOG_FOLDER: '<your_bucket_for_remote_logging>'
# X_AIRFLOW__CORE__REMOTE_LOG_CONN_ID: '<your_connection_id_for_remote_logging>'
# X_AIRFLOW__CORE__ENCRYPT_S3_LOGS: '<your_choice_on_encrypt_logs>'
# X_AIRFLOW_CONN_MINIO_S3_CONN: '<your_connection_details_for_remote_logging>'
X_NO_PROXY: '*'
- name: Build and push images
uses: noi-techpark/github-actions/docker-build-and-push@v2
with:
working-directory: ${{ env.WORKING_DIRECTORY }}/infrastructure
docker-username: ${{ github.actor }}
docker-password: ${{ secrets.GITHUB_TOKEN }}
- name: Deploy application
uses: noi-techpark/github-actions/docker-deploy@v2
with:
working-directory: ${{ env.WORKING_DIRECTORY }}/infrastructure/ansible
hosts: 'prod'
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
docker-username: 'noi-techpark-bot'
docker-password: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
project-name: ${{ env.PROJECT_NAME }}