Skip to content

Commit 55a41fd

Browse files
authored
Merge pull request #266 from cmu-delphi/deploy-safegraph
Merge the SafeGraph deployment branch updates to main
2 parents a7a8e6a + c6bafc0 commit 55a41fd

File tree

8 files changed

+134
-16
lines changed

8 files changed

+134
-16
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"static_file_dir": "./static",
3+
"raw_data_dir": "/common/safegraph",
4+
"export_dir": "./receiving",
5+
"cache_dir": "./cache",
6+
"n_core": "12",
7+
"aws_access_key_id": "{{ safegraph_aws_access_key_id }}",
8+
"aws_secret_access_key": "{{ safegraph_aws_secret_access_key }}",
9+
"aws_default_region": "us-east-1",
10+
"aws_endpoint": "https://s3.wasabisys.com",
11+
"wip_signal": ""
12+
}

ansible/vars.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ pyenv_python_path: "/home/{{ runtime_user }}/.pyenv/versions/{{ python_version }
1111
google_health_api_key: "{{ vault_google_health_api_key }}"
1212
delphi_aws_access_key_id: "{{ vault_delphi_aws_access_key_id }}"
1313
delphi_aws_secret_access_key: "{{ vault_delphi_aws_secret_access_key }}"
14-
14+
safegraph_aws_access_key_id: "{{ vault_safegraph_aws_access_key_id }}"
15+
safegraph_aws_secret_access_key: "{{ vault_safegraph_aws_secret_access_key }}"

ansible/vault.yaml

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
11
$ANSIBLE_VAULT;1.1;AES256
2-
66386163643862646634343162646465663762643034303563333833633661333932646164656462
3-
6166646131623132393238336263623562373065643633310a663232373237396361623462613333
4-
62373663383565623263306539636431623230633065626363666531366662363065343066363031
5-
3738616663336665340a326138333634306137363837396366303861663064326333613662656630
6-
62306331646637326637363766366237663037306665343761643263646663316535343561623137
7-
63313365653535393639626465343232396261643239303430383138633135346466323834336665
8-
33633064353034613836313265613466623961373565363835343430373138376336363966316365
9-
35663664396436313432376264316663326130306134326231303234393561643436623039613136
10-
63366638396262383762383336643930343661636461646162653734336334306239383132643435
11-
39333665643738643966356431333830646561353263353063326330643731616130396466343339
12-
39346437653063303336626663623835613938633834396430353634383366386237353862643766
13-
37393738353231666565303031393839306463373461393761653866653330646534393832303264
14-
30323038646166366465396235623731343539313633326539663966333437623733626131653437
15-
62326632656462383835656235373664366566343866383938343639613737623631616231616135
16-
633863383761366461363532353137323936
2+
39633436633363346633333638666438316131313337333132396634393538383432623239316463
3+
3435333238376331383439366161656639353039326163370a376363633535623363383233646533
4+
63363865646561323132663032383331346332373364333465643330616638623466333039623831
5+
6530663236313234360a336264656239383166663934303335386238386139386132626165386138
6+
32663164326237323534636263663263666634383339613362633939323565356437663666653436
7+
31353362316334313561333430626361616337643133346664636434313664373333653839323630
8+
65346331383135656135386263643564333063626563336365333865663333353337393866666139
9+
64613735663363323938633161666662653161633835383832656164343836383339376661396332
10+
66353131373265373931366130383632633466363036373562363232663162333966316563373535
11+
65343336363732303132366335616335333334373063313562336330336661353239646533356461
12+
62313365633336613037626261353639323937363066363062356234653631346233373965636461
13+
63326237663537363338346566326232353632663463386135393535343436373335393430393865
14+
33393631623762636230656263363462346561323064653561393666373735313836666238323238
15+
66366564666266343636663666386566336637373036633966643961346636373066356632326464
16+
63336565656666336436383938346461646431353265353133633736363761623634346262616436
17+
61653633326333356330626638386665313865343233393637623662383634346534326537623662
18+
34326633623431343835346339656335386330333664373166313766366339663736376261343965
19+
63616461666230616131326537373130313239663931313330356538356161333537666237376362
20+
64613232333834303737323438616437303666643166383439393030316533343530363863613034
21+
39653761626439356133393164363561316535633230633438316137623333376633663665393634
22+
63333161376263613766353030616336386531303565346263366239653232333764

jenkins/safegraph-jenkins-build.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env bash
2+
#
3+
# JHU: Jenkins build
4+
#
5+
6+
set -eo pipefail
7+
source ~/.bash_profile
8+
9+
#
10+
# Build
11+
#
12+
13+
local_indicator="safegraph"
14+
15+
cd "${WORKSPACE}/${local_indicator}" || exit
16+
17+
# Set up venv
18+
python -m venv env
19+
source env/bin/activate
20+
pip install ../_delphi_utils_python/.
21+
pip install .

jenkins/safegraph-jenkins-deploy.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Jenkins deploy
4+
#
5+
6+
set -eo pipefail
7+
source ~/.bash_profile
8+
9+
#
10+
# Deploy
11+
#
12+
13+
local_indicator="safegraph"
14+
15+
cd "${WORKSPACE}/ansible" || exit
16+
17+
# Ansible!
18+
ansible-playbook ansible-deploy.yaml --extra-vars "indicator=${local_indicator}" -i inventory

jenkins/safegraph-jenkins-package.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Jenkins package
4+
#
5+
6+
set -eo pipefail
7+
source ~/.bash_profile
8+
9+
#
10+
# Package
11+
#
12+
13+
local_indicator="safegraph"
14+
15+
cd "${WORKSPACE}" || exit
16+
17+
# Create .tar.gz for deployment
18+
tar -czvf "${JENKINS_HOME}/artifacts/${local_indicator}.tar.gz" "${local_indicator}"

jenkins/safegraph-jenkins-test.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env bash
2+
#
3+
# JHU: Jenkins test
4+
#
5+
6+
set -eo pipefail
7+
source ~/.bash_profile
8+
9+
#
10+
# Test
11+
#
12+
13+
local_indicator="safegraph"
14+
15+
cd "${WORKSPACE}/${local_indicator}" || exit
16+
17+
# Linter
18+
env/bin/pylint --disable=C --disable=W --disable=R delphi_"${local_indicator}"
19+
20+
# Unit tests and code coverage
21+
cd tests || exit && \
22+
../env/bin/pytest --cov=delphi_"${local_indicator}" --cov-report=term-missing

safegraph/run-safegraph.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Run the Safegraph indicator
4+
#
5+
6+
#set -eo pipefail
7+
8+
# Purge the receiving directory.
9+
echo "Purging ./receiving..."
10+
rm -f ./receiving/*
11+
12+
# Run the indicator code.
13+
echo "Running the indicator..."
14+
env/bin/python -m delphi_safegraph
15+
16+
# Copy the files to the ingestion directory.
17+
echo "Copying files to the ingestion directory..."
18+
# Hack to make cp care less about missing recent files since we don't always have them.
19+
cp $(date +"receiving/%Y%m*") /common/covidcast/receiving/safegraph 2>/dev/null
20+
cp $(date --date='-1 month' +"receiving/%Y%m*") /common/covidcast/receiving/safegraph

0 commit comments

Comments
 (0)