-
Notifications
You must be signed in to change notification settings - Fork 3
224 lines (180 loc) · 8.12 KB
/
data-service.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
name: CI/CD data-service (api)
on:
push:
paths:
- 'backend/data-service/**'
- 'backend/common/**'
- '.github/workflows/data-service.yml'
pull_request:
paths:
- 'backend/data-service/**'
- 'backend/common/**'
- '.github/workflows/data-service.yml'
env:
PROJECT_NAME: odh-webcompstore-api
JAVA_VERSION: '8'
jobs:
test:
runs-on: ubuntu-20.04
steps:
- uses: noi-techpark/github-actions/checkout@v2
- name: REUSE Compliance Check
uses: fsfe/reuse-action@v1
- name: Test backend
uses: noi-techpark/github-actions/maven-test@v2
with:
java-version: ${{ env.JAVA_VERSION }}
test-command: 'mvn -B -U clean test'
working-directory: backend
deploy-test-data-service:
runs-on: ubuntu-20.04
if: github.ref == 'refs/heads/main'
needs: test
concurrency: deploy-test-data-service
env:
DOCKER_IMAGE: ghcr.io/${{ github.repository }}/${{ github.event.repository.name }}-api-test
DOCKER_TAG: ${{ github.sha }}
steps:
- name: Checkout source code
uses: noi-techpark/github-actions/checkout@v2
- name: Create .env file
uses: noi-techpark/github-actions/env-file@v2
env:
X_COMPOSE_PROJECT_NAME: ${{ env.PROJECT_NAME }}
X_DOCKER_IMAGE: ${{ env.DOCKER_IMAGE }}
X_DOCKER_TAG: ${{ env.DOCKER_TAG }}
X_API_SERVER_PORT: 1200
X_LIGHTHOUSE_API_KEY: ${{ secrets.LIGHTHOUSE_API_KEY_TEST }}
X_DEBUG_LEVEL: "INFO"
X_WORKSPACE_PATH: "/workspace"
X_DB_URL: "jdbc:postgresql://test-pg-bdp.co90ybcr8iim.eu-west-1.rds.amazonaws.com:5432/webcompstore"
X_DB_USR: ${{ secrets.DB_USR_TEST }}
X_DB_PWD: ${{ secrets.DB_PWD_TEST }}
X_DB_SCHEMA: "public"
# Endpoint from where we create a standalone preview inside a simple HTML skeleton
X_API_PREVIEW_URL: "https://api.webcomponents.opendatahub.testingmachine.eu/preview"
# Base URL from where we will distribute build artifacts (javascript bundles and assets)
X_CDN_DIST_URL: "https://cdn.webcomponents.opendatahub.testingmachine.eu/dist"
X_API_SWAGGER_BASE_URL: "https://api.webcomponents.opendatahub.testingmachine.eu"
# Security for CRUD operations
X_KEYCLOAK_URL: "https://auth.opendatahub.testingmachine.eu/auth/"
X_KEYCLOAK_SSL_REQUIRED: "none"
X_KEYCLOAK_REALM: "noi"
X_KEYCLOAK_CLIENT_ID: "it.bz.opendatahub.webcomponents.api"
X_KEYCLOAK_CLIENT_SECRET: ${{ secrets.KEYCLOAK_CLIENT_SECRET_TEST }}
# SMTP configuration
X_SMTP_PWD: ${{ secrets.SMTP_PWD_TEST }}
X_SMTP_USR: "[email protected]"
X_SMTP_TO: "[email protected]"
X_SMTP_FROM: "[email protected]"
X_SMTP_SUBJECT: "Web Component Store: Contact form (TEST PLEASE IGNORE)"
X_SMTP_HOST: "smtp.eu.mailgun.org"
X_SMTP_PORT: 587
X_SMTP_DEBUG: "true"
X_DOCKER_CLIENT_TIMEOUT: 360
X_COMPOSE_HTTP_TIMEOUT: 360
X_JAVA_OPTIONS: "-Xms128m -Xmx1024m"
X_HCAPTCHA_SECRET_KEY: ${{ secrets.HCAPTCHA_SECRET_KEY }}
X_THUMBNAIL_WIDTH: 800
X_THUMBNAIL_HEIGHT: 600
- name: Prepare application.properties
run: cp application-deployment.properties application.properties
working-directory: ./backend/data-service/src/main/resources/
- name: Build project
uses: noi-techpark/github-actions/maven-build@v2
with:
java-version: ${{ env.JAVA_VERSION }}
build-command: 'mvn -B -DskipTests -DfinalName=ROOT --projects data-service --also-make package'
working-directory: backend
- name: Build and push
uses: noi-techpark/github-actions/docker-build-and-push@v2
with:
docker-username: ${{ github.actor }}
docker-password: ${{ secrets.GITHUB_TOKEN }}
working-directory: ./backend/data-service/infrastructure/docker/
- name: Deploy application
uses: noi-techpark/github-actions/docker-deploy@v2
with:
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 }}
working-directory: ./backend/data-service/infrastructure/ansible
deploy-prod-data-service:
runs-on: ubuntu-20.04
if: github.ref == 'refs/heads/prod'
needs: test
concurrency: deploy-prod-data-service
env:
DOCKER_IMAGE: ghcr.io/${{ github.repository }}/${{ github.event.repository.name }}-api-prod
DOCKER_TAG: ${{ github.sha }}
steps:
- name: Checkout source code
uses: noi-techpark/github-actions/checkout@v2
- name: Create .env file
uses: noi-techpark/github-actions/env-file@v2
env:
X_COMPOSE_PROJECT_NAME: ${{ env.PROJECT_NAME }}
X_DOCKER_IMAGE: ${{ env.DOCKER_IMAGE }}
X_DOCKER_TAG: ${{ env.DOCKER_TAG }}
#X_API_SERVER_PORT: 1088 # docker01
X_API_SERVER_PORT: 1090 # docker03
# change with prod
X_LIGHTHOUSE_API_KEY: ${{ secrets.LIGHTHOUSE_API_KEY_TEST }}
X_DEBUG_LEVEL: "INFO"
X_WORKSPACE_PATH: "/workspace"
X_DB_URL: "jdbc:postgresql://postgres-prod.co90ybcr8iim.eu-west-1.rds.amazonaws.com:5432/webcompstore"
X_DB_USR: ${{ secrets.DB_USR_PROD }}
X_DB_PWD: ${{ secrets.DB_PWD_PROD }}
X_DB_SCHEMA: "public"
# Endpoint from where we create a standalone preview inside a simple HTML skeleton
X_API_PREVIEW_URL: "https://api.webcomponents.opendatahub.com/preview"
# Base URL from where we will distribute build artifacts (javascript bundles and assets)
X_CDN_DIST_URL: "https://cdn.webcomponents.opendatahub.com/dist"
X_API_SWAGGER_BASE_URL: "https://api.webcomponents.opendatahub.com"
# Security for CRUD operations
X_KEYCLOAK_URL: "https://auth.opendatahub.com/auth/"
X_KEYCLOAK_SSL_REQUIRED: "none"
X_KEYCLOAK_REALM: "noi"
X_KEYCLOAK_CLIENT_ID: "it.bz.opendatahub.webcomponents.api"
X_KEYCLOAK_CLIENT_SECRET: ${{ secrets.KEYCLOAK_CLIENT_SECRET_PROD }}
# SMTP configuration
X_SMTP_PWD: ${{ secrets.SMTP_PWD_PROD }}
X_SMTP_USR: "[email protected]"
X_SMTP_TO: "[email protected]"
X_SMTP_FROM: "[email protected]"
X_SMTP_SUBJECT: "Web Component Store: Contact form"
X_SMTP_HOST: "smtp.eu.mailgun.org"
X_SMTP_PORT: 587
X_SMTP_DEBUG: "true"
X_DOCKER_CLIENT_TIMEOUT: 360
X_COMPOSE_HTTP_TIMEOUT: 360
X_JAVA_OPTIONS: "-Xms128m -Xmx1024m"
X_HCAPTCHA_SECRET_KEY: ${{ secrets.HCAPTCHA_SECRET_KEY }}
X_THUMBNAIL_WIDTH: 800
X_THUMBNAIL_HEIGHT: 600
- name: Prepare application.properties
run: cp application-deployment.properties application.properties
working-directory: ./backend/data-service/src/main/resources/
- name: Build project
uses: noi-techpark/github-actions/maven-build@v2
with:
java-version: ${{ env.JAVA_VERSION }}
build-command: 'mvn -B -DskipTests -DfinalName=ROOT --projects data-service --also-make package'
working-directory: backend
- name: Build and push
uses: noi-techpark/github-actions/docker-build-and-push@v2
with:
docker-username: ${{ github.actor }}
docker-password: ${{ secrets.GITHUB_TOKEN }}
working-directory: ./backend/data-service/infrastructure/docker/
- name: Deploy application
uses: noi-techpark/github-actions/docker-deploy@v2
with:
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 }}
working-directory: ./backend/data-service/infrastructure/ansible