Skip to content

Commit 448e0cc

Browse files
authored
Merge pull request #130 from Sage-Bionetworks/staging
AG-1517: Deploy mv71 to production for 3.5.0 release
2 parents de4be6b + 716fc54 commit 448e0cc

File tree

4 files changed

+68
-19
lines changed

4 files changed

+68
-19
lines changed

.github/workflows/main.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,9 @@ jobs:
2626
# use older checkout version due to https://github.com/dawidd6/action-download-artifact/issues/261
2727
- uses: actions/checkout@v2
2828
- name: Import Synapse Data
29-
run: ./import-data.sh $BRANCH $SYNAPSE_USERNAME $SYNAPSE_PASSWORD $DB_HOST $DB_USER $DB_PASS
29+
run: ./import-data.sh $BRANCH $SYNAPSE_PASSWORD $DB_HOST $DB_USER $DB_PASS
3030
env:
3131
BRANCH: ${{ github.ref_name }}
32-
SYNAPSE_USERNAME: ${{ secrets.SYNAPSE_USERNAME }}
3332
SYNAPSE_PASSWORD: ${{ secrets.SYNAPSE_PASSWORD }}
3433
DB_HOST: ${{ secrets.DB_HOST }}
3534
DB_USER: ${{ secrets.DB_USER }}

README.md

Lines changed: 58 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,9 @@ The following secrets need to be setup in Github for the scripts to deploy datab
3636

3737
Global secrets:
3838

39-
| Variable | Description | Example |
40-
|----------------------|-----------------------------------|-----------------------------|
41-
| SYNAPSE_USERNAME | The Synapse service user | syn-service-user |
42-
| SYNAPSE_PASSWORD | The Synapse service user password | supersecret |
43-
39+
| Variable | Description | Example |
40+
|----------------------|----------------------------------|----------------------------------|
41+
| SYNAPSE_PASSWORD | Synapse service user token (PAT) | glY4283tLQHZ...0eXAiOi...JKV1QiL |
4442

4543
Context specific secrets for each environment that corresponds to a git branch (develop/staging/prod):
4644

@@ -57,8 +55,9 @@ Context specific secrets for each environment that corresponds to a git branch (
5755
## Self hosted runners
5856

5957
[agora2-infra] repository deploys a bastian host in AWS for each environment which have access to
60-
the databases. We manually configure a [Github self-hosted runner] for each bastian host,
61-
a label is applied to each runner to match the corresponding deployment branch name (develop/staging/prod).
58+
the databases. We manually configure a [Github self-hosted runner](https://docs.github.com/en/actions/hosting-your-own-runners)
59+
for each bastian host, a label is applied to each runner to match the corresponding git branch name (develop/staging/prod).
60+
6261
Each runner corresponds to an environment which corresponds to a git branch. The update is
6362
executed from these runners. When a push happens on a branch (i.e. develop), the update
6463
is executed on the `agora-bastian-develop` runner which in turn updates the development database.
@@ -67,6 +66,58 @@ is executed on the `agora-bastian-develop` runner which in turn updates the deve
6766
![alt text][self_hosted_runners]
6867

6968

69+
### Setup self hosted runners
70+
71+
Github self hosted runners are deployed with a [Sceptre template config file])(https://github.com/Sage-Bionetworks/agora2-infra/blob/main/config/agoradev/develop/agora-bastian.yaml).
72+
73+
Self Hosted Runner setup:
74+
* Deploy the template to the Agora AWS account.
75+
* Login to AWS console and goto `EC2 -> select the deployed instance -> Connect -> Session Manager -> Connect` to gain ssh access to the instance.
76+
* Follow the instructions to install the [Github self hosted runner](https://docs.github.com/en/actions/hosting-your-own-runners/managing-self-hosted-runners/adding-self-hosted-runners#adding-a-self-hosted-runner-to-a-repository). We installed it to the `/home/ssm-user/actions-runner` folder.
77+
* Run the `config.sh` script to configure the runner. !! Important !! Make sure to set the runner `name` and `label` corresponding to the desired deployment environment (develop/staging/prod)..
78+
```text
79+
sh-4.2$ pwd
80+
/home/ssm-user/actions-runner
81+
82+
sh-4.2$ ./config.sh --url https://github.com/Sage-Bionetworks/agora-data-manager --token XXXXXXXXXXXXXXXXX6VLI
83+
84+
--------------------------------------------------------------------------------
85+
| ____ _ _ _ _ _ _ _ _ |
86+
| / ___(_) |_| | | |_ _| |__ / \ ___| |_(_) ___ _ __ ___ |
87+
| | | _| | __| |_| | | | | '_ \ / _ \ / __| __| |/ _ \| '_ \/ __| |
88+
| | |_| | | |_| _ | |_| | |_) | / ___ \ (__| |_| | (_) | | | \__ \ |
89+
| \____|_|\__|_| |_|\__,_|_.__/ /_/ \_\___|\__|_|\___/|_| |_|___/ |
90+
| |
91+
| Self-hosted runner registration |
92+
| |
93+
--------------------------------------------------------------------------------
94+
95+
# Authentication
96+
97+
98+
√ Connected to GitHub
99+
100+
# Runner Registration
101+
102+
Enter the name of the runner group to add this runner to: [press Enter for Default]
103+
104+
Enter the name of runner: [press Enter for ip-10-XXX-XXX-XXX] agora-bastian-prod
105+
106+
This runner will have the following labels: 'self-hosted', 'Linux', 'X64'
107+
Enter any additional labels (ex. label-1,label-2): [press Enter to skip] prod
108+
109+
√ Runner successfully added
110+
√ Runner connection is good
111+
112+
# Runner settings
113+
114+
Enter name of work folder: [press Enter for _work]
115+
116+
√ Settings Saved.
117+
```
118+
* Setup the [GH runner agent to run as a service](https://docs.github.com/en/actions/hosting-your-own-runners/managing-self-hosted-runners/configuring-the-self-hosted-runner-application-as-a-service)
119+
* Run the agent and then check the [GH Runners page](https://github.com/Sage-Bionetworks/agora-data-manager/settings/actions/runners) to make sure that the runner is in `Idle` status.
120+
70121
[db_update]: agora-db-update.drawio.png "update diagram"
71122
[github_secrets]: github_secrets.png "github secrets screen"
72123
[self_hosted_runners]: self-hosted-runners.png "self hosted runners"

data-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"data-version": "68",
2+
"data-version": "71",
33
"data-manifest-id": "syn13363290",
44
"team-images-id": "syn12861877"
55
}

import-data.sh

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@
66
set -e
77

88
BRANCH=$1
9-
SYNAPSE_USERNAME=$2
10-
SYNAPSE_PASSWORD=$3
11-
DB_HOST=$4
12-
DB_USER=$5
13-
DB_PASS=$6
9+
SYNAPSE_PASSWORD=$2
10+
DB_HOST=$3
11+
DB_USER=$4
12+
DB_PASS=$5
1413

1514
CURRENT_DIR=$(pwd)
1615
WORKING_DIR=$CURRENT_DIR
@@ -26,19 +25,19 @@ TEAM_IMAGES_ID=$(cat $WORKING_DIR/data-manifest.json | grep team-images-id | hea
2625
echo "$BRANCH branch, DATA_VERSION = $DATA_VERSION, manifest id = $DATA_MANIFEST_ID"
2726

2827
# Download the manifest file from synapse
29-
synapse -u $SYNAPSE_USERNAME -p $SYNAPSE_PASSWORD get --downloadLocation $DATA_DIR -v $DATA_VERSION $DATA_MANIFEST_ID
28+
synapse -p $SYNAPSE_PASSWORD get --downloadLocation $DATA_DIR -v $DATA_VERSION $DATA_MANIFEST_ID
3029

3130
# Ensure there's a newline at the end of the manifest file; otherwise the last listed file will not be downloaded
3231
# echo >> $DATA_DIR/data_manifest.csv
3332

3433
# Download all files referenced in the manifest from synapse
3534
cat $DATA_DIR/data_manifest.csv | tail -n +2 | while IFS=, read -r id version; do
3635
echo Downloading $id,$version
37-
synapse -u $SYNAPSE_USERNAME -p $SYNAPSE_PASSWORD get --downloadLocation $DATA_DIR -v $version $id ;
36+
synapse -p $SYNAPSE_PASSWORD get --downloadLocation $DATA_DIR -v $version $id ;
3837
done
3938

4039
# Download team images
41-
synapse -u $SYNAPSE_USERNAME -p $SYNAPSE_PASSWORD get -r --downloadLocation $TEAM_IMAGES_DIR/ $TEAM_IMAGES_ID
40+
synapse -p $SYNAPSE_PASSWORD get -r --downloadLocation $TEAM_IMAGES_DIR/ $TEAM_IMAGES_ID
4241

4342
echo "Data Files: "
4443
ls -al $WORKING_DIR
@@ -65,7 +64,7 @@ mongoimport -h $DB_HOST -d agora -u $DB_USER -p $DB_PASS --authenticationDatabas
6564
mongoimport -h $DB_HOST -d agora -u $DB_USER -p $DB_PASS --authenticationDatabase admin --collection genesbiodomains --jsonArray --drop --file $DATA_DIR/genes_biodomains.json
6665
mongoimport -h $DB_HOST -d agora -u $DB_USER -p $DB_PASS --authenticationDatabase admin --collection biodomaininfo --jsonArray --drop --file $DATA_DIR/biodomain_info.json
6766

68-
mongo --host $DB_HOST -u $DB_USER -p $DB_PASS --authenticationDatabase admin $WORKING_DIR/create-indexes.js
67+
mongosh --host $DB_HOST -u $DB_USER -p $DB_PASS --authenticationDatabase admin $WORKING_DIR/create-indexes.js
6968

7069
pushd $TEAM_IMAGES_DIR
7170
ls -1r *.{jpg,jpeg,png} | while read x; do mongofiles -h $DB_HOST -d agora -u $DB_USER -p $DB_PASS --authenticationDatabase $DB_USER -v put $x; echo $x; done

0 commit comments

Comments
 (0)