Skip to content

Commit d9e095d

Browse files
committed
Deprecate docker swarm
1 parent a830ab6 commit d9e095d

File tree

160 files changed

+861
-800
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

160 files changed

+861
-800
lines changed

.github/workflows/deploy-and-e2e.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -280,8 +280,8 @@ jobs:
280280
- name: Read known hosts
281281
run: |
282282
echo "KNOWN_HOSTS<<EOF" >> $GITHUB_ENV
283-
sed -i -e '$a\' ./infrastructure/known-hosts
284-
cat ./infrastructure/known-hosts >> $GITHUB_ENV
283+
sed -i -e '$a\' ./infrastructure-swarm/known-hosts
284+
cat ./infrastructure-swarm/known-hosts >> $GITHUB_ENV
285285
echo "EOF" >> $GITHUB_ENV
286286
- name: Install SSH Key
287287
uses: shimataro/ssh-key-action@v2
@@ -294,7 +294,7 @@ jobs:
294294
echo "KNOWN_HOSTS=" >> $GITHUB_ENV
295295
- name: Cleanup e2e stack
296296
run: |
297-
bash infrastructure/deployment/cleanup-e2e-stack.sh \
297+
bash infrastructure-swarm/deployment/cleanup-e2e-stack.sh \
298298
--stack=${stack} \
299299
--ssh_host=${{ vars.SSH_HOST || secrets.SSH_HOST }} \
300300
--ssh_port=${{ vars.SSH_PORT || secrets.SSH_PORT }} \

.github/workflows/provision-k8s.yml

Lines changed: 36 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Provision Infrastructure on k8s
1+
name: Provision Infrastructure
22
run-name: "Provision ${{ inputs.environment }} (tag: ${{ inputs.tags }})"
33
on:
44
workflow_dispatch:
@@ -9,8 +9,7 @@ on:
99
default: 'e2e'
1010
type: choice
1111
options:
12-
- e2e
13-
12+
- "e2e"
1413
tags:
1514
description: 'Tags to apply to the provisioned resources'
1615
required: true
@@ -24,14 +23,34 @@ on:
2423
- application
2524
- tools
2625
- fail2ban
26+
- data-partition
2727
- decrypt-on-boot
2828
- checks
2929
- containerd-setup
30-
- kubernetes-installation
31-
- join-workers
30+
- k8s
3231
- system-preparation
3332
jobs:
33+
approve:
34+
environment: ${{ inputs.environment }}
35+
runs-on: ubuntu-24.04
36+
timeout-minutes: 60
37+
steps:
38+
- name: Waiting for manual approval
39+
if: ${{ (vars.APPROVAL_REQUIRED || 'false') == 'true' }}
40+
uses: trstringer/manual-approval@v1
41+
with:
42+
secret: ${{ github.TOKEN }}
43+
approvers: ${{ vars.GH_APPROVERS }}
44+
minimum-approvals: 1
45+
issue-title: "Provision ${{ inputs.environment }} (tag: ${{ inputs.tags }})"
46+
issue-body: >
47+
Please approve or deny ${{ inputs.environment }} environment provisioning
48+
initiated from GitHub Actions by @${{ github.actor }}.
49+
50+
exclude-workflow-initiator-as-approver: false
51+
3452
provision:
53+
needs: approve
3554
runs-on:
3655
- self-hosted
3756
- ${{ inputs.environment }}
@@ -41,11 +60,9 @@ jobs:
4160
- name: Set variables for ansible
4261
id: ansible-variables
4362
run: |
44-
JSON_WITH_NEWLINES=$(cat<<EOF
45-
${{ toJSON(env) }}
46-
EOF)
47-
JSON_WITHOUT_NEWLINES=$(echo $JSON_WITH_NEWLINES | jq -R -c .)
48-
echo "EXTRA_VARS=$JSON_WITHOUT_NEWLINES" >> $GITHUB_OUTPUT
63+
echo '${{ toJSON(env) }}' > tmp_vars.json
64+
JSON_WITHOUT_EMPTY=$(jq -c 'with_entries(select(.value | type == "string" and length > 0))' tmp_vars.json | jq -R )
65+
echo "EXTRA_VARS=$JSON_WITHOUT_EMPTY" >> $GITHUB_OUTPUT
4966
env:
5067
encrypted_disk_size: ${{ vars.DISK_SPACE }}
5168
disk_encryption_key: ${{ secrets.ENCRYPTION_KEY }}
@@ -54,6 +71,14 @@ jobs:
5471
k8s_cluster_env: ${{ inputs.environment }}
5572
docker_username: ${{ secrets.DOCKER_USERNAME }}
5673
docker_password: ${{ secrets.DOCKER_TOKEN }}
74+
smtp_host: ${{ secrets.SMTP_HOST }}
75+
smtp_port: ${{ secrets.SMTP_PORT }}
76+
smtp_user: ${{ secrets.SMTP_USERNAME }}
77+
smtp_secure: ${{ secrets.SMTP_SECURE }}
78+
# FIXME: Make this field configurable via secrets
79+
smtp_from: "[email protected]"
80+
smtp_password: ${{ secrets.SMTP_PASSWORD }}
81+
alert_email: ${{ secrets.ALERT_EMAIL }}
5782
- name: checkout repository
5883
uses: actions/checkout@v5
5984
- name: Run Ansible Playbook
@@ -65,7 +90,7 @@ jobs:
6590
with:
6691
requirements: galaxy-requirements.yml
6792
playbook: playbook.yml
68-
directory: ./infrastructure-k8s/server-setup
93+
directory: ./infrastructure/server-setup
6994
# Add --verbose to get more output
7095
options: |-
7196
--inventory inventory/${{ inputs.environment }}.yml

.github/workflows/provision.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,8 @@ jobs:
126126
run: |
127127
cd ${{ github.event.repository.name }}
128128
echo "KNOWN_HOSTS<<EOF" >> $GITHUB_ENV
129-
sed -i -e '$a\' ./infrastructure/known-hosts
130-
cat ./infrastructure/known-hosts >> $GITHUB_ENV
129+
sed -i -e '$a\' ./infrastructure-swarm/known-hosts
130+
cat ./infrastructure-swarm/known-hosts >> $GITHUB_ENV
131131
echo "EOF" >> $GITHUB_ENV
132132
133133
- name: Install SSH Key
@@ -153,7 +153,7 @@ jobs:
153153
- name: Check if backup environment if configured in inventory file
154154
if: needs.get-backup-ssh-key.outputs.environment_exists != 'true'
155155
run: |
156-
FILE=./${{ github.event.repository.name }}/infrastructure/server-setup/inventory/${{ github.event.inputs.environment }}.yml
156+
FILE=./${{ github.event.repository.name }}/infrastructure-swarm/server-setup/inventory/${{ github.event.inputs.environment }}.yml
157157
if grep -q '^[[:blank:]]*backups:[[:blank:]]*$' "$FILE"; then
158158
echo "Your inventory contains configuration for either a backup target or backup source."
159159
echo "If you are upgrading OpenCRVS, please start by running environment creator script for the backup server"
@@ -173,7 +173,7 @@ jobs:
173173
ANSIBLE_SSH_RETRIES: 5
174174
with:
175175
playbook: playbook.yml
176-
directory: ${{ github.event.repository.name }}/infrastructure/server-setup
176+
directory: ${{ github.event.repository.name }}/infrastructure-swarm/server-setup
177177
options: |
178178
--verbose
179179
--inventory inventory/${{ github.event.inputs.environment }}.yml

.github/workflows/reindex.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ jobs:
4545
run: |
4646
cd ${{ github.event.repository.name }}
4747
echo "KNOWN_HOSTS<<EOF" >> $GITHUB_ENV
48-
sed -i -e '$a\' ./infrastructure/known-hosts
49-
cat ./infrastructure/known-hosts >> $GITHUB_ENV
48+
sed -i -e '$a\' ./infrastructure-swarm/known-hosts
49+
cat ./infrastructure-swarm/known-hosts >> $GITHUB_ENV
5050
echo "EOF" >> $GITHUB_ENV
5151
5252
- name: Install SSH Key
@@ -59,7 +59,7 @@ jobs:
5959
run: |
6060
ssh -p ${{ vars.SSH_PORT }} ${{ secrets.SSH_USER }}@${{ vars.SSH_HOST }} ${{ vars.SSH_ARGS }} "
6161
docker run --rm \
62-
-v /opt/opencrvs/infrastructure/deployment:/workspace \
62+
-v /opt/opencrvs/infrastructure-swarm/deployment:/workspace \
6363
-w /workspace \
6464
-e 'AUTH_URL=http://auth.${{ inputs.stack }}_app_net:4040/' \
6565
-e 'EVENTS_URL=http://events.${{ inputs.stack }}_app_net:5555/' \

.github/workflows/reset-2fa.yml

Lines changed: 42 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,62 @@
11
name: Reset 2FA
2-
run-name: Reset 2FA from user ${{ github.event.inputs.user }} in ${{ github.event.inputs.environment }}
2+
run-name: Reset 2FA from user ${{ inputs.user }} in ${{ inputs.environment }}
33
on:
44
workflow_dispatch:
55
inputs:
66
user:
77
description: User to remove 2FA from
8+
type: string
89
required: true
910
environment:
1011
type: choice
11-
description: Machine to provision
12-
default: qa
12+
description: Infrastructure to provision
13+
default: "e2e"
1314
required: true
1415
options:
15-
- development
16-
- staging
17-
- qa
18-
- production
19-
- backup
16+
- "e2e"
2017

2118
jobs:
22-
reset:
23-
environment: ${{ github.event.inputs.environment }}
19+
approve:
20+
environment: ${{ inputs.environment }}
2421
runs-on: ubuntu-24.04
25-
outputs:
26-
outcome: ${{ steps.deploy.outcome }}
2722
timeout-minutes: 60
2823
steps:
29-
- name: Clone country config resource package
30-
uses: actions/checkout@v3
24+
- name: Waiting for manual approval
25+
if: ${{ (vars.APPROVAL_REQUIRED || 'false') == 'true' }}
26+
uses: trstringer/manual-approval@v1
3127
with:
32-
fetch-depth: 1
33-
path: './${{ github.event.repository.name }}'
28+
secret: ${{ github.TOKEN }}
29+
approvers: ${{ vars.GH_APPROVERS }}
30+
minimum-approvals: 1
31+
issue-title: "Reset 2FA from user ${{ inputs.user }} in ${{ inputs.environment }}"
32+
issue-body: >
33+
Please approve or deny Reset 2FA from user ${{ inputs.user }} in
34+
${{ inputs.environment }} initiated from GitHub Actions by @${{ github.actor }}.
3435
35-
- name: Read known hosts
36-
run: |
37-
cd ${{ github.event.repository.name }}
38-
echo "KNOWN_HOSTS<<EOF" >> $GITHUB_ENV
39-
sed -i -e '$a\' ./infrastructure/known-hosts
40-
cat ./infrastructure/known-hosts >> $GITHUB_ENV
41-
echo "EOF" >> $GITHUB_ENV
36+
exclude-workflow-initiator-as-approver: false
4237

43-
- name: Install SSH Key
44-
uses: shimataro/ssh-key-action@v2
38+
reset:
39+
needs: approve
40+
environment: ${{ inputs.environment }}
41+
runs-on:
42+
- self-hosted
43+
- ${{ inputs.environment }}
44+
- node
45+
timeout-minutes: 60
46+
steps:
47+
- name: checkout repository
48+
uses: actions/checkout@v5
49+
- name: Run Ansible Playbook
50+
uses: dawidd6/action-ansible-playbook@v4
51+
env:
52+
ANSIBLE_PERSISTENT_COMMAND_TIMEOUT: 10
53+
ANSIBLE_SSH_TIMEOUT: 10
54+
ANSIBLE_SSH_RETRIES: 5
4555
with:
46-
key: ${{ secrets.SSH_KEY }}
47-
known_hosts: ${{ env.KNOWN_HOSTS }}
48-
49-
- name: Remove 2FA
50-
run: |
51-
ssh ${{ secrets.SSH_USER }}@${{ vars.SSH_HOST || secrets.SSH_HOST }} -p ${{ vars.SSH_PORT || secrets.SSH_PORT }} ${{ vars.SSH_ARGS }} "sudo rm /home/${{ github.event.inputs.user }}/.google_authenticator"
56+
requirements: galaxy-requirements.yml
57+
playbook: reset-2fa.yml
58+
directory: ./infrastructure/server-setup
59+
# Add --verbose to get more output
60+
options: |-
61+
--inventory inventory/${{ inputs.environment }}.yml
62+
--extra-vars user=${{ inputs.user }}

.github/workflows/restart-droplet.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ jobs:
4141
run: |
4242
cd ${{ github.event.repository.name }}
4343
echo "KNOWN_HOSTS<<EOF" >> $GITHUB_ENV
44-
sed -i -e '$a\' ./infrastructure/known-hosts
45-
cat ./infrastructure/known-hosts >> $GITHUB_ENV
44+
sed -i -e '$a\' ./infrastructure-swarm/known-hosts
45+
cat ./infrastructure-swarm/known-hosts >> $GITHUB_ENV
4646
echo "EOF" >> $GITHUB_ENV
4747
4848
- name: Install SSH Key
@@ -71,7 +71,7 @@ jobs:
7171
ENCRYPTION_KEY: ${{ secrets.ENCRYPTION_KEY }}
7272
run: |
7373
ssh $SSH_USER@$SSH_HOST $ "
74-
sudo /opt/opencrvs/dependencies/infrastructure/cryptfs/mount.sh -p $ENCRYPTION_KEY"
74+
sudo /opt/opencrvs/dependencies/infrastructure-swarm/cryptfs/mount.sh -p $ENCRYPTION_KEY"
7575
7676
ssh $SSH_USER@$SSH_HOST $SSH_ARGS "
7777
sudo service docker restart"

.github/workflows/seed-data.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ jobs:
4545
run: |
4646
cd ${{ github.event.repository.name }}
4747
echo "KNOWN_HOSTS<<EOF" >> $GITHUB_ENV
48-
sed -i -e '$a\' ./infrastructure/known-hosts
49-
cat ./infrastructure/known-hosts >> $GITHUB_ENV
48+
sed -i -e '$a\' ./infrastructure-swarm/known-hosts
49+
cat ./infrastructure-swarm/known-hosts >> $GITHUB_ENV
5050
echo "EOF" >> $GITHUB_ENV
5151
5252
- name: Install SSH Key
@@ -86,12 +86,12 @@ jobs:
8686
MINIO_ROOT_PASSWORD=$MINIO_ROOT_PASSWORD \
8787
POSTGRES_USER=$POSTGRES_USER \
8888
POSTGRES_PASSWORD=$POSTGRES_PASSWORD \
89-
/opt/opencrvs/${{ inputs.stack }}/infrastructure/clear-all-data.sh $REPLICAS ${{ inputs.stack }}"
89+
/opt/opencrvs/${{ inputs.stack }}/infrastructure-swarm/clear-all-data.sh $REPLICAS ${{ inputs.stack }}"
9090
9191
echo "Running migrations..."
9292
echo
9393
ssh -p $SSH_PORT $SSH_USER@$SSH_HOST $SSH_ARGS "
94-
/opt/opencrvs/${{ inputs.stack }}/infrastructure/run-migrations.sh ${{ inputs.stack }}"
94+
/opt/opencrvs/${{ inputs.stack }}/infrastructure-swarm/run-migrations.sh ${{ inputs.stack }}"
9595
9696
- name: Pull the seed-data image
9797
run: docker pull ghcr.io/opencrvs/ocrvs-data-seeder:${{ inputs.core-image-tag }}

infrastructure-k8s/server-setup/playbook.yml

Lines changed: 0 additions & 66 deletions
This file was deleted.

0 commit comments

Comments
 (0)