Developing with Docker

Prerequisites:

Steps

  1. Clone the repository locally.
  2. Enter the ourchive app directory: cd ourchive_app.
  3. Copy the development docker files to the ourchive app directory: cp ../docker/development/docker-compose.dev.yml docker-compose.yml && cp ../docker/development/Dockerfile Dockerfile
  4. Run docker compose up -d to bring up containers.
  5. Load the fixtures: docker compose run --rm web ./load-fixtures.sh
  6. Create a superuser: a. Run docker compose exec -it web /bin/bash b. Run python manage.py createsuperuser
  7. Visit http://localhost:8000. Verify that it works!

You should now be able to make modifications to your local files, and the development server should reflect those changes (though it may take a few seconds for the server to reload).

Debugging

View Logs

Run docker compose logs for both DB and webserver logs.

Run docker compose logs web for web logs.

Get a Docker Shell

Run docker compose exec -it web /bin/bash to get a shell onto the docker container.

Once there, you can run manage.py commands and other debugging tools.

Clear the Database

You can delete the database by running sudo rm -rf data from the ourchive_app directory. Be sure you know what you’re doing.