This list may not be comprehensive, but we hope it's a good start for those new to docker and Open ONI.
- Rebuild Dev Containers
- Manage Data
- Run Commands from Containers
- Django Reference
- Manage Containers, Volumes, and Images
Builds or rebuilds the development setup. Useful if you changed something
copied into the container, such as the various helper scripts in the docker
directory:
docker-compose down
docker-compose upOr if you don't want to be "trapped" in the log output: docker-compose up -d
Remember, you can always get at logs via docker-compose logs, and drill down
just to the logs you want, which is usually the web service: docker-compose logs web.
If you do not already have a batch ready to load, you can learn about how to obtain a batch in the Load and Purge Batches documentation.
Then run our custom batch-loader wrapper:
# You have to have the services running in order to ingest
docker-compose up -d
docker-compose exec web /load_batch.sh <batch_name>/load_batch.sh <batch_name> is a shortcut for:
manage load_batch /opt/openoni/data/batches/<batch_name>And manage is a custom wrapper for the Django manage.py script, but it
fixes permissions so that any operations which alter the filesystem cache will
still be readable when the Apache user tries to read them.
docker-compose exec web manage purge_batch batch_uuml_thys_ver01Open ONI app shell:
docker-compose exec web bashDatabase shell:
docker-compose exec rdbms mysql -uroot -p123456 -DopenoniDjango shell:
docker-compose exec web manage shellThen work with the Django ORM like this:
from core import models
models.Titles.objects.all()docker-compose -f test-compose.yml -p onitest up testThe test container definition runs a shortcut for unit tests with a special settings file for forcing in reproducible URLs and ensuring a very "clean", consistent environment.
Remove all test containers, volumes, and images with the following command:
docker-compose -f test-compose.yml -p onitest down -v --rmi localThese include CSS, JS, and images. You will need to run this command when developing themes:
docker-compose exec web manage collectstatic --noinputdjango-admin is available within the container:
docker-compose exec web django-admin helpNote that django-admin doesn't know about specific projects without passing the
--settings flag. Instead, use manage, which is an alias to the manage.py
script within the Open ONI project:
docker-compose exec web manage help batchesIf requirements.txt is changed or you want to update dependencies in
requirements.lock, you'll need to run pip-update.sh. The pip-install.sh
and pip-reinstall.sh scripts install from requirements.lock.
docker-compose exec web /pip-update.shRoll back the database
docker-compose exec web manage showmigrations
docker-compose exec web manage migrate <app (core)> <migration name>Remove the containers (persistent data remains)
docker-compose downRemove persistent data containers and data volumes
NOTE: Only do this if you want to restart with no data!
docker-compose down
docker volume rm open-oni_data-mariadb
docker volume rm open-oni_data-solrdocker ps -a # all containers, including stopped
docker ps # all running containers
docker rm container_id # remove container (if stopped)
docker rm container_name # remove container (if stopped)
docker volume ls # list all data volumes
docker volume ls -f dangling=true # list data volumes not associated with a container
docker volume rm volume_name # delete data volume
docker images # list images
docker rmi image_name # delete an image (need to remove containers, first)
docker-compose down