Rebuilding staging (Obsolete)

Here is how to destroy and rebuild the schihist_digicoll staging servers.

0. Destroy the staging servers

Go to the AWS console.

Select all 4 staging servers: scihist_digicoll_*_staging, then:

Actions > Instance State > Terminate

Delete the EBS volumes that are listed as "available". They were recently orphaned by the staging servers.

1. Build the DB server

  • ansible-playbook create_kithe.yml --vault-password-file password_file.txt --private-key=~/.ssh/test.pem --extra-vars "role=database tier=staging"

  • Then take the private IP of the resulting database server from the EC2 console, and add it to group_vars/kithe_staging:

redis_ip: new_private_ip_of_scihist_digicoll-database1-staging
postgres_ip: new_private_ip_of_scihist_digicoll-database1-staging

2. Build the jobs server

ansible-playbook create_kithe.yml --vault-password-file password_file.txt --private-key=~/.ssh/test.pem --extra-vars "role=jobs tier=staging"

3. Build the web server

ansible-playbook create_kithe.yml --vault-password-file password_file.txt --private-key=~/.ssh/test.pem --extra-vars "role=web tier=staging" --extra-vars "@group_vars/kithe_web_staging_override"

4. Associate the elastic IP with the new web server

  • https://console.aws.amazon.com/ec2/v2/home?region=us-east-1

  • Select "Elastic IPs"

  • Select "digicoll-staging"

  • Actions -> Associate address

  • Under the "Resource type", Choose "Instance".

  • Fill in the appropriate instance (the staging web server)

  • Check "Allow this Elastic IP address to be reassociated if already attached"

  • Click "Associate".

  • You should then see an instance IP under "Associated instance ID" in row digicoll-staging

5. Deploy to staging

cd /path/to/scihist_digicoll/
bundle exec cap staging deploy --trace

At this stage you should see an empty but functioning site at https://staging-digital.sciencehistory.org/, but with no data in it.

6. Sync data from production to staging

See https://chemheritage.atlassian.net/wiki/pages/createpage.action?spaceKey=HDC&title=Delete%20this%20page&linkCreation=true&fromPageId=1072463877 for details.

7. Commit changes to the staging branch of Ansible

See https://chemheritage.atlassian.net/wiki/spaces/HDC/pages/976945261 for details.

8. Log in to the management server and run the stage_update.shscript

See https://chemheritage.atlassian.net/wiki/pages/createpage.action?spaceKey=HDC&title=Management%20Server%20%28Obsolete%29&linkCreation=true&fromPageId=1072463877 for details.