-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'kingfisher-process-deploy' of github.com:open-contracti…
…ng/deploy into kingfisher-process-deploy
- Loading branch information
Showing
21 changed files
with
329 additions
and
147 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
Data support tasks | ||
================== | ||
|
||
Create a data support server | ||
---------------------------- | ||
|
||
#. Adjust reserved disk space to 1% for large disks: | ||
|
||
.. code-block:: bash | ||
tune2fs -m 1 /dev/md2 | ||
#. Update the IP addresses and hostname in the ``pillar/kingfisher_replica.sls`` file | ||
#. Update the IP addresses in the ``pillar/tinyproxy.sls`` file, and deploy the ``docs`` service | ||
|
||
Docker | ||
~~~~~~ | ||
|
||
#. Check that ``docker.uid`` in the ``pillar/kingfisher_main.sls`` file matches the entry in the ``/etc/passwd`` file. | ||
|
||
Docker apps | ||
~~~~~~~~~~~ | ||
|
||
#. Run migrations for :doc:`Docker apps<docker>` as the ``deployer`` user: | ||
|
||
.. code-block:: bash | ||
su - deployer | ||
cd /data/deploy/kingfisher-process/ | ||
docker compose run --rm web python manage.py migrate | ||
cd /data/deploy/pelican-frontend/ | ||
docker compose run --rm web python manage.py migrate | ||
#. :doc:`Pull new images and start new containers for each Docker app<docker>`. | ||
|
||
Pelican backend | ||
~~~~~~~~~~~~~~~ | ||
|
||
.. warning:: | ||
|
||
A cron job updates the ``exchange_rates`` table every 12 hours. Complete this step before the next run. | ||
|
||
The initial migrations for Pelican backend are run by Salt. | ||
|
||
#. Connect to the old server, and dump the ``exchange_rates`` table: | ||
|
||
.. code-block:: bash | ||
sudo -i -u postgres psql -c '\copy exchange_rates (valid_on, rates, created, modified) to stdout' pelican_backend > exchange_rates.csv | ||
#. Copy the database dump to your local machine. For example: | ||
|
||
.. code-block:: bash | ||
rsync -avz [email protected]:~/exchange_rates.csv . | ||
#. Copy the database dump to the new server. For example: | ||
|
||
.. code-block:: bash | ||
rsync -avz exchange_rates.sql [email protected]:~/ | ||
#. Populate the ``exchange_rates`` table: | ||
|
||
.. code-block:: bash | ||
psql -U pelican_backend -h localhost -c "\copy exchange_rates (valid_on, rates, created, modified) from 'exchange_rates.csv';" pelican_backend | ||
Kingfisher Collect | ||
~~~~~~~~~~~~~~~~~~ | ||
|
||
#. Connect to the new server, switch to the ``incremental`` user, generate an SSH key pair, and get the public SSH key: | ||
|
||
.. code-block:: bash | ||
su - incremental | ||
ssh-keygen -t rsa -b 4096 -C "incremental" | ||
cat ~/.ssh/id_rsa.pub | ||
#. Add the public SSH key to the ``ssh.incremental`` list in the ``pillar/kingfisher_main.sls`` file: | ||
|
||
.. code-block:: yaml | ||
ssh: | ||
incremental: | ||
- ssh-rsa AAAB3N... | ||
#. Change ``cron.present`` to ``cron.absent`` in the ``salt/kingfisher/collect/incremental.sls`` file. | ||
#. :doc:`Deploy the old server and the new server<deploy>`. | ||
#. Connect to the old server: | ||
|
||
#. Switch to the ``incremental`` user: | ||
|
||
.. code-block:: bash | ||
su - incremental | ||
#. Stop any processes started by the cron jobs. | ||
#. Dump the ``kingfisher_collect`` database: | ||
|
||
.. code-block:: bash | ||
pg_dump -U kingfisher_collect -h localhost -f kingfisher_collect.sql kingfisher_collect | ||
#. Connect to the new server: | ||
|
||
#. Switch to the ``incremental`` user: | ||
|
||
.. code-block:: bash | ||
su - incremental | ||
#. Copy the database dump from the old server. For example: | ||
|
||
.. code-block:: bash | ||
rsync -avz [email protected]:~/kingfisher_collect.sql . | ||
#. Load the database dump: | ||
|
||
.. code-block:: bash | ||
psql -U kingfisher_collect -h localhost -f kingfisher_collect.sql kingfisher_collect | ||
#. Copy the ``data`` directory from the old server. For example: | ||
|
||
.. code-block:: bash | ||
rsync -avz [email protected]:/home/incremental/data/ /home/incremental/data/ | ||
#. Copy the ``logs`` directory from the old server. For example: | ||
|
||
.. code-block:: bash | ||
rsync -avz [email protected]:/home/incremental/logs/ /home/incremental/logs/ | ||
#. Remove the public SSH key from the ``ssh.incremental`` list in the ``pillar/kingfisher_main.sls`` file. | ||
#. Change ``cron.absent`` to ``cron.present`` in the ``salt/kingfisher/collect/incremental.sls`` file. | ||
#. :doc:`Deploy the new server<deploy>`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ Deployment Guides | |
docker.rst | ||
docs.rst | ||
prometheus.rst | ||
data-support.rst | ||
redash.rst | ||
redmine.rst | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.