-
Notifications
You must be signed in to change notification settings - Fork 75
57 lines (56 loc) · 2.33 KB
/
create-backup-data-action.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
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
#
# OpenCRVS is also distributed under the terms of the Civil Registration
# & Healthcare Disclaimer located at http://opencrvs.org/license.
#
# Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS.
name: Create backup data
on:
workflow_dispatch:
inputs:
environment:
type: choice
description: Environment to create backup from
required: true
default: production
options:
- production
backup_environment:
type: choice
description: Environment to create backups to
required: true
default: migrate
options:
- migrate
replicas:
description: No of replicas deployed in the environment
default: '3'
required: true
version_label:
description: The version label for the backups
required: true
jobs:
backup:
environment: production
runs-on: ubuntu-24.04
env:
BACKUP_HOST: farajaland-${{ github.event.inputs.backup_environment }}.opencrvs.org
SRC_HOST: farajaland.opencrvs.org
REPLICAS: ${{ github.event.inputs.replicas }}
VERSION_LABEL: ${{ github.event.inputs.version_label }}
steps:
- name: Install SSH Key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_KEY }}
known_hosts: ${{ secrets.KNOWN_HOSTS }}
- name: Create backup data in given environment and copy it over to the backup environment
run: ssh root@$SRC_HOST "MONGODB_ADMIN_USER=$MONGODB_ADMIN_USER MONGODB_ADMIN_PASSWORD=$MONGODB_ADMIN_PASSWORD ELASTICSEARCH_ADMIN_USER=$ELASTICSEARCH_ADMIN_USER ELASTICSEARCH_ADMIN_PASSWORD=$ELASTICSEARCH_ADMIN_PASSWORD /opt/opencrvs/infrastructure/emergency-backup-metadata.sh root $BACKUP_HOST 22 $SRC_HOST $REMOTE_DIR $REPLICAS $VERSION_LABEL"
env:
MONGODB_ADMIN_USER: ${{ secrets.MONGODB_ADMIN_USER }}
MONGODB_ADMIN_PASSWORD: ${{ secrets.MONGODB_ADMIN_PASSWORD }}
ELASTICSEARCH_ADMIN_USER: elastic
ELASTICSEARCH_ADMIN_PASSWORD: ${{ secrets.ELASTICSEARCH_SUPERUSER_PASSWORD }}
REMOTE_DIR: /data/backups/