-
Notifications
You must be signed in to change notification settings - Fork 13
FAQs
If you want to run a script to interact with the app you will have to run it inside the container. There are two options to do this. When running scripts, you always want to run them against the web container. The name of the container should always be pawprints_web_1
, but if it has changed you can always see the name by running docker ps
to show all running containers.
- Run the single command in the container
This option is best if you're just doing a one off command. All you have to do is call the command against the container. When running a script, the command will look like the following:
docker exec -it pawprints_web_1 <YOUR COMMAND>
So if you wanted to call the mockdata command, it would look like:
docker exec -it pawprints_web_1 python manage.py mockdata
- Work in the container
If you're going to be doing a lot of work in the container you can simply enter the container. To do that, run the following command:
docker exec -it pawprints_web_1 sh
This will drop you into a shell in the container.
If for some reason you need to get into the database, the best option is to use the Django command dbshell
. Assuming your .env
file is set correctly, all you need to do to access the database is the following command.
docker exec -it pawprints_web_1 python manage.py dbshell
This will drop you right into a psql
shell. In order for this to work, the database container must be running.
When deploying, you may need to scale the workers. Generally you should have a worker per core on the machine. Docker makes scaling easy. If you have not started any of the services yet. Simple run the following:
docker-compose up -d --scale worker=<num workers>
If the containers are already running, simple run:
docker-compose up -d --scale worker=<num workers> worker