System administrators ===================== Setup ----- - `Create a .netrc file `__ with a ``collect`` login and ``collect.data.open-contracting.org`` machine. - `Create a ~/.config/scrapy.cfg file `__ with: .. code-block:: ini [deploy:registry] url = https://collect.data.open-contracting.org/ project = kingfisher Deploy ------ If the Salt configuration has changed, `deploy the service `__. Kingfisher Collect ~~~~~~~~~~~~~~~~~~ #. If the ``requirements.txt`` file has changed, `deploy the service `__. #. `Deploy the latest version to Scrapyd `__. If your local repository is up-to-date: .. code-block:: bash scrapyd-deploy registry .. attention:: When the Scrapyd service restarts (for example, when the server restarts), the running Scrapyd jobs are lost, and therefore the Collect :class:`~data_registry.process_manager.util.TaskManager` won't be able to check the task's status. :ref:`Cancel the job` and reschedule it (`#350 `__). Kingfisher Process, Data Registry ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #. Wait for the Docker image to build in GitHub Actions. - `Kingfisher Process `__ - `Data Registry `__ #. Connect to the server as the ``deployer`` user: .. code-block:: bash ssh -p 2223 deployer@ocp13.open-contracting.org #. `Update the application `__. Troubleshoot ------------ Read log files ~~~~~~~~~~~~~~ All containers log to standard output, which can be `read as usual using Docker `__. .. seealso:: :ref:`Troubleshooting for site administrators` Debug another application ~~~~~~~~~~~~~~~~~~~~~~~~~ Kingfisher Collect `Use Kingfisher Collect locally `__. Kingfisher Process - Download the data from crawl directory in the ``KINGFISHER_COLLECT_FILES_STORE`` directory. - Run Kingfisher Process' ``load`` `command `__. Coverage - Download the ``full.jsonl.gz`` file from the job's directory in the ``EXPORTER_DIR`` directory. - Run the `ocdscardinal coverage `__ command locally. Flattener - Download the ``*.jsonl.gz`` files from the job's directory in the ``EXPORTER_DIR`` directory. - Run the `flatterer `__ command locally. Reset other applications ~~~~~~~~~~~~~~~~~~~~~~~~ The Kingfisher Process, Exporter and Flattener tasks use RabbitMQ. In an extreme scenario, the relevant queues can be purged in the `RabbitMQ management interface `__. .. warning:: Purging queues affects all running jobs! It is not possible to purge only one job's messages from a queue. In an extreme scenario, the other applications can be reset: #. Cancel all Scrapyd jobs #. Stop their Docker containers #. Purge all RabbitMQ queues #. Drop the PostgreSQL databases for Kingfisher Process #. `Deploy the service `__ to recreate the databases #. Run the `Django migrations `__ .. note:: This will cause database ``id`` values in old job contexts to collide with those in new job contexts. This is okay, because we don't touch old Kingfisher Process tasks.