-
Notifications
You must be signed in to change notification settings - Fork 129
Instance Hosts Commands and Debugging
These are several useful commands you may find helpful for debugging.
To view all currently running containers with docker run docker ps
.
This will return you a list of containers and info about them.
To view a specific container's logs, use docker logs -f <container-name>
where <container-name>
is the name of
the container you wish to view. IE: docker logs -f django
to view django logs. The -f
flag is for follow
.
To view all logs outputs from the project currently ( Good for debugging several containers ) use
docker-compose logs -f
. This will stream all logs from all active containers.
List of containers, description, and log use.
Container | Description | Use |
---|---|---|
django |
Web Service | Main container. View many debug prints from various processes. |
postgres |
Database | Useful to debug database issues |
worker_compute |
Compute Worker | Useful to debug object creation, etc. |
worker_site |
Site worker | Task manager logs |
nginx |
Nginx service | HTTP Service logs |
flower |
Flower Service | View flower logs |
rabbit |
Rabbit Service | View rabbit logs |
To stop streaming logs, press control+c
.
Other docker commands that you may find useful:
Use docker-compose <command>
. You may also use docker-compose <command> <container> <args/flags>
Command | Description | Suggested Usage |
---|---|---|
up |
Brings everything into an 'up' state. -d is for detatched. |
docker-compose up -d |
start |
Starts all containers not running | docker-compose start |
stop |
Stops all active containers | docker-compose stop |
docker exec -it <container-name> <program-name>
: Run an interactive terminal inside the container,
with the specified program. IE: docker exec -it django bash
for a bash terminal inside the django
container.
To perform automatic py tests locally, go inside of the django
docker container with docker exec -it django bash
.
This will put you in an interactive ( -it )
bash shell within the container.
Next run py.test
to perform all tests, or if you know the name of the test you'd like to run,
py.test -k <test-name>
.
The testing printout should revert back to the django
container bash prompt. From here type exit
to exit the container.
These commands are all run through the django container by having bash execute python
. To get into the django container
with a bash prompt use docker exec -it django bash
.
To execute the command use python manage.py <command>
with any appropriate flags or arguments.
Command | Description |
<parms> & --flags
|
Usage |
---|---|---|---|
createsuperuser |
Creates a new super user | N/A: Interactive Prompt | createsuperuser |
migrate |
Performs a migration |
<app> , <migration_number>
|
migrate web 0059 |
schemamigration |
Creates a migration |
<app> , <object> , --auto
|
schemamigration web object |
create_competition_zip |
Creates a comp bundle |
-p or --numphases num phases, -l or --phaselength phase length in mins, -d or --delete don't delete temp files, -a or --automigrate auto migrate |
create_competition_zip -p 2 -l 5 -d -a |
create_competition |
Creates a competition |
--title title, --description description, --logo logo file for comp, --force_user_create create user if non-existant, --creator creator email, --numphases number of phases, --phasedates Comma-seprated list of the startdates (YYYY-MM-DD, YYYY-MM-DD)
|
create_competition .. |
create_solution |
Creates a submission |
d don't delete temp files, -w Wrong. Makes a submission that fails. |
create_solution -d -w |
create_codalab_user |
Creates a user | password |
create_codalab_user "bongo" |
Sometimes it is necessary to destroy, and re-create the database. In those cases use the following commands from
a bash terminal inside the database docker container. IE: docker exec -it postgres bash
dropdb <db_name>
Removes the database with <db_name>
createdb <db_name>
Creates a database with <db_name>
--
In the scripts
directory there are many outdated scripts, however these are useful:
Takes a file and participant email, turns it into a new submission through the normal process as if the user submitted it via the form. Optionally a competition ID can be specified, but it defaults to 1
assuming it's a single competition server.
usage: make_submission.py [-h] [-c COMPETITION]
submission_zip participant_email
positional arguments:
submission_zip Submission zip file to use for stressing
participant_email Participant, identified by email address
optional arguments:
-h, --help show this help message and exit
-c COMPETITION, --competition COMPETITION
Competition ID, defaults to 1