AWS Portal Migrations 2017 09 27 - earthcubeprojects-chords/chords GitHub Wiki
We used this opportunity to install chords_control on the AWS instances. In the future, the CloudFormation template will be modified to use chords_control right off the bat.
-
Preparations:
- On AWS, create an ec2 snapshot of the instance volume.
- ssh into the portal, exec into chords_influxdb, and dump the influxdb database to a file. Use the command copied from bin/influxdb/export_influxdb_tsdata_file.sh. Exit chords_influxdb. Use
docker cp ...
to copy the dump file to ~ec2-user/. Then copy this file off of the AWS instance. (This process can be done from the portal configure interface, if the database is small enough). - From the portal website configure page, export the portal configuration.
-
ssh into the portal, and become root. We will be working in /chords.
sudo -i
- Save and display the existing environment.
cp .env .env.save
cat .env
- Fetch chords_control.
curl -O -k https://raw.githubusercontent.com/NCAR/chords/master/chords_control
- Create a new configuration, inserting values from .env where appropriate. (Use
openssl rand -hex 32
to generate a SECRET_KEY_BASE if necessary). Be sure to set the database retention to something reasonable. Choose a numbered version, rather than latest.
python chords_control --config
- Update the portal.
python chords_control --update
- Stop the portal.
service docker-compose-chords stop
- Restart the docker engine (for good measure).
service docker restart
- Start chords. Might get a complaint like
Service "grafana" is using volume "/var/log/grafana" from the previous container.
. In that case, just stop and start the chords service again.
service docker-compose-chords start
- Make sure that all 5 containers are running. Browse to the portal and check all functions.
docker ps
- Check disk space, then remove unneeded images. Prune docker containers and volumes. Check disk space. In normal circumstances, the system should be using about 4.8G.
df -h
docker images
docker rmi <id1> ... <idn>
docker system prune
docker volume prune
df -h