-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OCRVS-6000: Infrastructure deployment, monitoring and maintenance updates #789
Changes from all commits
50e996f
c1de407
0560ad0
db578b0
e1825d9
9b19e19
a2618d1
254a20a
6efc958
a65b672
2a637d3
91446f7
2a56a0d
3cbc67a
bf6900d
e638bc7
f0f633d
286e955
2d5b806
11d602f
d94b847
955c8f5
5fbae00
595c943
6c71498
8454054
df17c28
0c60360
9307beb
29fe10e
eb4b447
1796794
cb93915
0aaf347
b205399
2ccecb3
75413cf
2daab78
c44100c
22160b2
64a1522
b004ff0
c038766
13cae90
7a46278
573edb1
ab2e6d3
ebd69ff
0401b83
b562faf
1b563dc
2e78eb7
142c03f
b5c3492
5a63ba6
2ed836e
da3cb96
dbfab44
ab12b7e
a9afe40
837b61f
3eb9bbd
625e842
8bebba6
f4f94fe
f4410e1
9107eae
19a67ac
4e26a70
008d092
5d4b622
298db77
d584daf
c7aa311
84b4049
39deb98
db4dca9
07a18b2
0eff586
69d1d7f
6d01727
48f9278
89b4d4d
abffde1
882c432
a5dc5e7
30a1bf7
27b70ec
fabc512
1115e30
2ac8e6c
a290a1e
a09f322
f74ae7e
636dbe7
3e52c42
98c876e
4ee1c1d
90e3e98
e64a31a
043b1fb
3b1d801
e149707
9b3f3a7
6118754
c735bbd
b55bf9c
3ea4a4f
1c51bbb
2d6f26e
2a6dc3c
4ab046a
7a3e48a
dc53b53
e94956a
ee421e3
c9b4085
8423a30
2dc45b9
8a305c4
73c807c
ca8ba16
2ff4c2a
6fa9a68
9d82a8e
5de4684
60d9fdc
9b7f7e7
e56aefb
43a70a8
8cc1ce7
2c9be00
77d37d1
bc07dd5
03e0d6a
0cd4095
0f84db9
97e42f7
dc3ae4d
68f173e
6aa4a35
282faee
3dfcf5e
e1d6211
6ec1842
fb8bb83
94f8392
ddbeac5
080e8bc
445d52c
9523d5d
214e4f9
36283a4
8d3fd92
f2bbb66
f5d1f67
bf6aeee
505bd64
2fefebe
c71aaf5
489c8e2
b072e49
1139e06
032318e
843c839
1f95ee7
bd60b39
ab36738
d6cdd4c
a956c8c
8e3e481
5c78aa2
748222f
7fe32bb
de4f252
841a779
2846314
c3a9b09
08aec94
7860b77
98cb151
7602d1b
954cfec
7a03473
e819962
460ad7a
210e7e6
eb40db6
ce29cb2
8608fb5
f68ecd6
e33ef87
67ef318
2181e92
928a2d0
4bc7e14
70e2eae
a9cb29f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
name: Reset environment | ||
run-name: Reset data on ${{ github.event.inputs.environment }} | ||
on: | ||
workflow_call: | ||
inputs: | ||
environment: | ||
required: true | ||
type: string | ||
workflow_dispatch: | ||
inputs: | ||
environment: | ||
type: choice | ||
description: Environment to reset | ||
required: true | ||
default: 'development' | ||
options: | ||
- staging | ||
- qa | ||
- development | ||
jobs: | ||
reset-data: | ||
name: 'Reset data' | ||
environment: ${{ github.event.inputs.environment }} | ||
runs-on: ubuntu-20.04 | ||
timeout-minutes: 60 | ||
steps: | ||
- name: Clone country config resource package | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
path: './${{ github.event.repository.name }}' | ||
|
||
- name: Read known hosts | ||
run: | | ||
cd ${{ github.event.repository.name }} | ||
echo "KNOWN_HOSTS<<EOF" >> $GITHUB_ENV | ||
sed -i -e '$a\' ./infrastructure/.known-hosts | ||
cat ./infrastructure/.known-hosts >> $GITHUB_ENV | ||
echo "EOF" >> $GITHUB_ENV | ||
|
||
- name: Install SSH Key | ||
uses: shimataro/ssh-key-action@v2 | ||
with: | ||
key: ${{ secrets.SSH_KEY }} | ||
known_hosts: ${{ env.KNOWN_HOSTS }} | ||
|
||
- name: Reset data | ||
env: | ||
HOST: ${{ vars.DOMAIN }} | ||
ENV: ${{ vars.ENVIRONMENT_TYPE }} | ||
SSH_USER: ${{ secrets.SSH_USER }} | ||
SSH_HOST: ${{ secrets.SSH_HOST }} | ||
REPLICAS: ${{ vars.REPLICAS }} | ||
MONGODB_ADMIN_USER: ${{ secrets.MONGODB_ADMIN_USER }} | ||
MONGODB_ADMIN_PASSWORD: ${{ secrets.MONGODB_ADMIN_PASSWORD }} | ||
ELASTICSEARCH_SUPERUSER_PASSWORD: ${{ secrets.ELASTICSEARCH_SUPERUSER_PASSWORD }} | ||
MINIO_ROOT_USER: ${{ secrets.MINIO_ROOT_USER }} | ||
MINIO_ROOT_PASSWORD: ${{ secrets.MINIO_ROOT_PASSWORD }} | ||
SSH_ARGS: ${{ vars.SSH_ARGS }} | ||
run: | | ||
ssh $SSH_USER@$SSH_HOST $SSH_ARGS " | ||
ELASTICSEARCH_ADMIN_USER=elastic \ | ||
ELASTICSEARCH_ADMIN_PASSWORD=$ELASTICSEARCH_SUPERUSER_PASSWORD \ | ||
MONGODB_ADMIN_USER=$MONGODB_ADMIN_USER \ | ||
MONGODB_ADMIN_PASSWORD=$MONGODB_ADMIN_PASSWORD \ | ||
MINIO_ROOT_USER=$MINIO_ROOT_USER \ | ||
MINIO_ROOT_PASSWORD=$MINIO_ROOT_PASSWORD \ | ||
/opt/opencrvs/infrastructure/clear-all-data.sh $REPLICAS" | ||
|
||
echo "Running migrations..." | ||
echo | ||
ssh $SSH_USER@$SSH_HOST $SSH_ARGS " | ||
ELASTICSEARCH_ADMIN_USER=elastic \ | ||
ELASTICSEARCH_ADMIN_PASSWORD=$ELASTICSEARCH_SUPERUSER_PASSWORD \ | ||
/opt/opencrvs/infrastructure/run-migrations.sh" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: Deploy(production) | ||
name: Deploy (production) | ||
run-name: Deploy to ${{ github.event.inputs.environment }} core=${{ github.event.inputs.core-image-tag }} country config=${{ github.event.inputs.countryconfig-image-tag }} | ||
on: | ||
workflow_dispatch: | ||
|
@@ -7,33 +7,32 @@ on: | |
type: choice | ||
description: Environment to deploy to | ||
required: true | ||
default: 'production' | ||
default: 'staging' | ||
options: | ||
- production | ||
- staging | ||
core-image-tag: | ||
description: Core DockerHub image tag | ||
required: true | ||
default: 'v1.4.0' | ||
countryconfig-image-tag: | ||
description: Your Country Config DockerHub image tag | ||
required: true | ||
deploy-script-environment: | ||
type: choice | ||
description: Deploy script environment | ||
required: true | ||
default: 'production' | ||
options: | ||
- production | ||
- demo | ||
|
||
jobs: | ||
deploy: | ||
environment: ${{ github.event.inputs.environment }} | ||
runs-on: ubuntu-20.04 | ||
timeout-minutes: 60 | ||
strategy: | ||
matrix: | ||
node-version: [16.20.0] | ||
steps: | ||
- uses: trstringer/manual-approval@v1 | ||
with: | ||
secret: ${{ github.TOKEN }} | ||
approvers: euanmillar,rikukissa | ||
minimum-approvals: 1 | ||
issue-title: 'Deploy (Prod): core: ${{ github.event.inputs.core-image-tag }} country config: ${{ github.event.inputs.countryconfig-image-tag }}' | ||
issue-body: 'Please approve or deny the deployment of core: ${{ github.event.inputs.core-image-tag }} country config: ${{ github.event.inputs.countryconfig-image-tag }} to production' | ||
exclude-workflow-initiator-as-approver: false | ||
- name: Clone core | ||
uses: actions/checkout@v3 | ||
with: | ||
|
@@ -57,17 +56,29 @@ jobs: | |
cd opencrvs-core | ||
git checkout ${{ github.event.inputs.core-image-tag }} | ||
|
||
- name: Read known hosts | ||
run: | | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Breaking change:
|
||
cd ${{ github.event.repository.name }} | ||
echo "KNOWN_HOSTS<<EOF" >> $GITHUB_ENV | ||
sed -i -e '$a\' ./infrastructure/.known-hosts | ||
cat ./infrastructure/.known-hosts >> $GITHUB_ENV | ||
echo "EOF" >> $GITHUB_ENV | ||
|
||
- name: Install SSH Key | ||
uses: shimataro/ssh-key-action@v2 | ||
with: | ||
key: ${{ secrets.SSH_KEY }} | ||
known_hosts: ${{ secrets.KNOWN_HOSTS }} | ||
known_hosts: ${{ env.KNOWN_HOSTS }} | ||
|
||
- name: Unset KNOWN_HOSTS variable | ||
run: | | ||
echo "KNOWN_HOSTS=" >> $GITHUB_ENV | ||
|
||
- name: Login to DockerHub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
password: ${{ secrets.DOCKER_TOKEN }} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Breaking change:
|
||
- name: Wait for images to be available | ||
run: | | ||
|
@@ -88,28 +99,40 @@ jobs: | |
env: | ||
DOMAIN: ${{ vars.DOMAIN }} | ||
REPLICAS: ${{ vars.REPLICAS }} | ||
NOTIFICATION_TRANSPORT: ${{ vars.NOTIFICATION_TRANSPORT }} | ||
SMTP_PORT: ${{ secrets.SMTP_PORT }} | ||
SMTP_HOST: ${{ secrets.SMTP_HOST }} | ||
SMTP_USERNAME: ${{ secrets.SMTP_USERNAME }} | ||
SMTP_PASSWORD: ${{ secrets.SMTP_PASSWORD }} | ||
SMTP_SECURE: ${{ secrets.SMTP_SECURE }} | ||
ALERT_EMAIL: ${{ secrets.ALERT_EMAIL }} | ||
DOCKERHUB_ACCOUNT: ${{ secrets.DOCKERHUB_ACCOUNT }} | ||
DOCKERHUB_REPO: ${{ secrets.DOCKERHUB_REPO }} | ||
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | ||
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }} | ||
KIBANA_USERNAME: ${{ secrets.KIBANA_USERNAME }} | ||
KIBANA_PASSWORD: ${{ secrets.KIBANA_PASSWORD }} | ||
MONGODB_ADMIN_USER: ${{ secrets.MONGODB_ADMIN_USER }} | ||
MONGODB_ADMIN_PASSWORD: ${{ secrets.MONGODB_ADMIN_PASSWORD }} | ||
ELASTICSEARCH_SUPERUSER_PASSWORD: ${{ secrets.ELASTICSEARCH_SUPERUSER_PASSWORD }} | ||
MINIO_ROOT_USER: ${{ secrets.MINIO_ROOT_USER }} | ||
MINIO_ROOT_PASSWORD: ${{ secrets.MINIO_ROOT_PASSWORD }} | ||
EMAIL_API_KEY: ${{ secrets.EMAIL_API_KEY }} | ||
INFOBIP_SENDER_ID: ${{ secrets.INFOBIP_SENDER_ID }} | ||
SENTRY_DSN: ${{ secrets.SENTRY_DSN }} | ||
INFOBIP_GATEWAY_ENDPOINT: ${{ secrets.INFOBIP_GATEWAY_ENDPOINT }} | ||
INFOBIP_API_KEY: ${{ secrets.INFOBIP_API_KEY }} | ||
SENDER_EMAIL_ADDRESS: ${{ secrets.SENDER_EMAIL_ADDRESS }} | ||
SUPER_USER_PASSWORD: ${{ secrets.SUPER_USER_PASSWORD }} | ||
CONTENT_SECURITY_POLICY_WILDCARD: ${{ vars.CONTENT_SECURITY_POLICY_WILDCARD }} | ||
SSH_ARGS: ${{ vars.SSH_ARGS }} | ||
run: | | ||
cd ./${{ github.event.repository.name }} | ||
yarn deploy --clear_data=no --environment=${{ github.event.inputs.deploy-script-environment }} --host=${{ env.DOMAIN }} --version=${{ github.event.inputs.core-image-tag }} --country_config_version=${{ github.event.inputs.countryconfig-image-tag }} --country_config_path=../${{ github.event.repository.name }} --replicas=${{ env.REPLICAS }} | ||
yarn deploy \ | ||
--clear_data=no \ | ||
--environment=${{ github.event.inputs.environment }} \ | ||
--host=${{ env.DOMAIN }} \ | ||
--ssh_host=${{ secrets.SSH_HOST }} \ | ||
--ssh_user=${{ secrets.SSH_USER }} \ | ||
--version=${{ github.event.inputs.core-image-tag }} \ | ||
--country_config_version=${{ github.event.inputs.countryconfig-image-tag }} \ | ||
--replicas=${{ env.REPLICAS }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Breaking change: