Changeset View
Changeset View
Standalone View
Standalone View
docker/README.rst
Show First 20 Lines • Show All 197 Lines • ▼ Show 20 Lines | |||||
- deposit app: 5006 | - deposit app: 5006 | ||||
Beware that these ports are not the same as the ports used from within | Beware that these ports are not the same as the ports used from within | ||||
the docker network. This means that the same command executed from the | the docker network. This means that the same command executed from the | ||||
host or from a docker container will not use the same urls to access | host or from a docker container will not use the same urls to access | ||||
services. For example, to use the ``celery`` utility from the host, you | services. For example, to use the ``celery`` utility from the host, you | ||||
may type:: | may type:: | ||||
~/swh-environment/docker$ CELERY_BROKER_URL=amqp://:5072// celery status | ~/swh-environment/docker$ celery --broker amqp://:5072// \ | ||||
--app swh.scheduler.celery_backend.config.app status | |||||
loader@61704103668c: OK | loader@61704103668c: OK | ||||
[...] | [...] | ||||
To run the same command from within a container:: | To run the same command from within a container:: | ||||
~/swh-environment/docker$ docker-compose exec swh-scheduler celery status | ~/swh-environment/docker$ docker-compose exec swh-scheduler celery status | ||||
loader@61704103668c: OK | loader@61704103668c: OK | ||||
[...] | [...] | ||||
▲ Show 20 Lines • Show All 234 Lines • ▼ Show 20 Lines | |||||
running in docker containers. | running in docker containers. | ||||
For this, we just need to configure a few environment variables. First, | For this, we just need to configure a few environment variables. First, | ||||
ensure your Software Heritage virtualenv is activated (here, using | ensure your Software Heritage virtualenv is activated (here, using | ||||
virtualenvwrapper):: | virtualenvwrapper):: | ||||
~$ workon swh | ~$ workon swh | ||||
(swh) ~/swh-environment$ export SWH_SCHEDULER_URL=http://127.0.0.1:5008/ | (swh) ~/swh-environment$ export SWH_SCHEDULER_URL=http://127.0.0.1:5008/ | ||||
(swh) ~/swh-environment$ export CELERY_BROKER_URL=amqp://127.0.0.1:5072/ | (swh) ~/swh-environment$ export BROKER_URL=amqp://127.0.0.1:5072/ | ||||
(swh) ~/swh-environment$ export APP=swh.scheduler.celery_backend.config.app | |||||
Now we can use the ``celery`` command directly to control the celery | Now we can use the ``celery`` command directly to control the celery | ||||
system running in the docker environment:: | system running in the docker environment:: | ||||
(swh) ~/swh-environment$ celery status | (swh) ~/swh-environment$ celery status | ||||
vault@c9fef1bbfdc1: OK | vault@c9fef1bbfdc1: OK | ||||
listers@ba66f18e7d02: OK | listers@ba66f18e7d02: OK | ||||
indexer@cb14c33cbbfb: OK | indexer@cb14c33cbbfb: OK | ||||
Show All 29 Lines | case "$shell" in | ||||
;; | ;; | ||||
*) | *) | ||||
autocomplete_cmd=source | autocomplete_cmd=source | ||||
;; | ;; | ||||
esac | esac | ||||
eval "$(_SWH_COMPLETE=$autocomplete_cmd swh)" | eval "$(_SWH_COMPLETE=$autocomplete_cmd swh)" | ||||
export SWH_SCHEDULER_URL=http://127.0.0.1:5008/ | export SWH_SCHEDULER_URL=http://127.0.0.1:5008/ | ||||
export CELERY_BROKER_URL=amqp://127.0.0.1:5072/ | export BROKER_URL=amqp://127.0.0.1:5072/ | ||||
export APP=swh.scheduler.celery_backend.config.app | |||||
export COMPOSE_FILE=~/swh-environment/docker/docker-compose.yml:~/swh-environment/docker/docker-compose.override.yml | export COMPOSE_FILE=~/swh-environment/docker/docker-compose.yml:~/swh-environment/docker/docker-compose.override.yml | ||||
alias doco=docker-compose | alias doco=docker-compose | ||||
EOF | EOF | ||||
This postactivate script does: | This postactivate script does: | ||||
- install a shell completion handler for the swh-scheduler command, | - install a shell completion handler for the swh-scheduler command, | ||||
- preset a bunch of environment variables | - preset a bunch of environment variables | ||||
- ``SWH_SCHEDULER_URL`` so that you can just run ``swh scheduler`` | - ``SWH_SCHEDULER_URL`` so that you can just run ``swh scheduler`` against | ||||
against the scheduler API instance running in docker, without | the scheduler API instance running in docker, without having to specify | ||||
having to specify the endpoint URL, | the endpoint URL, | ||||
- ``CELERY_BROKER`` so you can execute the ``celery`` tool (without | - ``BROKER_URL`` and ``APP`` so you can execute the ``celery`` tool (without | ||||
cli options) against the rabbitmq server running in the docker | cli options) against the rabbitmq server running in the docker environment | ||||
environment, | (see the `documentation of the celery command | ||||
<https://docs.celeryproject.org/en/latest/reference/cli.html>`_), | |||||
- ``COMPOSE_FILE`` so you can run ``docker-compose`` from | - ``COMPOSE_FILE`` so you can run ``docker-compose`` from everywhere, | ||||
everywhere, | |||||
- create an alias ``doco`` for ``docker-compose`` because this is way | - create an alias ``doco`` for ``docker-compose`` because this is way | ||||
too long to type, | too long to type, | ||||
So now you can easily: | So now you can easily: | ||||
- Start the SWH platform:: | - Start the SWH platform:: | ||||
▲ Show 20 Lines • Show All 337 Lines • Show Last 20 Lines |