Skip to content

Moving API to new server play book

Leo Lapworth edited this page Nov 18, 2016 · 6 revisions

Play book for moving v1 API into production

Backup live custom data

ssh bm-mc-01.metacpan.org
sudo su - metacpan
cd /home/metacpan/metacpan-api
~/bin/metacpan-api-carton-exec  ./bin/metacpan backup --index cpan --type favorite
~/bin/metacpan-api-carton-exec  ./bin/metacpan backup --index cpan --type author
~/bin/metacpan-api-carton-exec  ./bin/metacpan backup --index user

Copy to lw-mc-03

cd /home/metacpan/metacpan-api/var/backup
scp 2016-11-18-* [email protected]:/tmp/

Convert to correct index name

ssh [email protected]
cd /tmp
gunzip 2016-11-18-cpan-author.json.gz
gunzip 2016-11-18-cpan-favorite.json.gz
perl -pi -e 's/"_index":"cpan_v1"/"_index":"cpan"/g' 2016-11-18-cpan-author.json
perl -pi -e 's/"_index":"cpan_v1"/"_index":"cpan"/g' 2016-11-18-cpan-favorite.json
gzip 2016-11-18-cpan-author.json
gzip 2016-11-18-cpan-favorite.json

Import to lw-mc-03

sudo su - metacpan
cd ~/metacpan-api
~/bin/metacpan-api-carton-exec ./bin/metacpan backup --index cpan --type author --restore /tmp/2016-11-18-cpan-author.json.gz
~/bin/metacpan-api-carton-exec ./bin/metacpan backup --index cpan --type favorite --restore /tmp/2016-11-18-cpan-favorite.json.gz
~/bin/metacpan-api-carton-exec ./bin/metacpan backup --index user --restore /tmp/2016-11-18-user.json.gz

Update Github OAuth token

Switch over the backends

Update Fastly backends through

Change backend for metacpan.org ( https://manage.fastly.com/ and deploy )

Update clientinfo.metacpan.org

Update JSON version info response ( https://manage.fastly.com/ and deploy )