-
Notifications
You must be signed in to change notification settings - Fork 1
Building and Running
Docker and Docker-compose are required to run study.plus.or.kr
Recommended:
- Docker: >= 18.03.1-ce
- Docker-compose: >= 1.17.1
Downloading other dependencies and building is taken care by docker and docker-compose
There is two given sample configuration for use.
You can copy docker-compose.override.dev.yml
to docker-compose.override.yml
to configure the running environment under debug mode. You have to fill the DJANGO_SECRET_KEY
field in the file to make system work properly.
In development mode, your source code base is mounted on the container which makes your code changes immediately applied to the running environment.
You can use docker-compose.override.production.yml
to docker-compose.override.yml
to configure the running environment under release mode. Also, you have to fill the DJANGO_SECRET_KEY
and DJANGO_ALLOWED_HOSTS
field in the file to make system work properly.
In production mode, any failures occurred will be silenced in webpage but only be recorded in log file. For static serving and uploaded files, it will mount a corresponding folders on the container to prevent loss of data between image rebuilds. However, your source code is hard copied to the container, so any code changes outside the container will not affect the running service.
When the override configuration is properly set, images can be built using following command
docker-compose build
docker-compose and docker will take care of python related dependencies and database server.
Service will run when using the command:
docker-compose up # (will attach stdout to container)
docker-compose up -d # (will run background)
Also, you can update the code inside the running container by:
docker-compose up -d --no-deps --build web
Django management console will be accessible using:
docker-compose exec web python manage.py …
So, the following commands are possible to use:
docker-compose exec web python manage.py createsuperuser # (Create user with privileges)
docker-compose exec web python manage.py makemigrations # (Create migration file from model changes)
docker-compose exec web python manage.py migrate # (Execute migration to sync db with models)
docker-compose exec web python manage.py shell