Administration
These commands will assist you in administrating your Docker environment.
Basic Docker Usage
docker-compose ls
Lists your containers.docker-compose up
Starts up your containers from adocker-compose.yml
. Run with-d
to detach from terminal.docker-compose down
Stops your containers from adocker-compose.yml
docker-compose build
If you're using ourDockerfile
, this will rebuild the image.docker-compose pull
If you're using our image, this will update your images to the latest.
Using Versions
To ensure that your application will work as you'd expect, we recommend always specifying versions for:
- Containers (e.g instead of
kryptedgaming/krypted:latest
usekryptedgaming/krypted:X.Y.Z
) - Extensions (e.g instead of
django-eveonline-connector
usedjango-eveonline-connector==X.Y.Z
)
This will save you a ton of grief later!
Creating Superuser Accounts
Superuser accounts have all Django permissions, and are optimal for your admin accounts.
- Run the command in the
app
container
docker-compose exec app python3 /opt/krypted/app/manage.py createsuperuser
- Fill out the information as required
Database Backups
Backups are important, you should do them frequently and every time before you updgrade.
Creating Backups
sudo docker-compose exec db sh -c 'exec mysqldump "$MYSQL_DATABASE" -u"$MYSQL_USER" -p"$MYSQL_PASSWORD" 2>/dev/null' | gzip > "`date +"%Y_%m_%d"`_krypted.sql.gz"
Restoring Backups
zcat *krypted.sql.gz | docker-compose exec -T db sh -c 'exec mysql "$MYSQL_DATABASE" -u"$MYSQL_USER" -p"$MYSQL_PASSWORD"'
Accessing Application
There will be times where you want a specific bit of information that we might not provide, or the ability to run your own Python code with your Krypted Platform database. The best way to do this is through the Django Shell.
sudo docker-compose exec app python3 /opt/krypted/app/manage.py shell_plus
Accessing Database
Sometimes, you'll want to access the database directly.
sudo docker-compose exec db sh -c 'mysql -u"$MYSQL_USER" -p"$MYSQL_PASSWORD"'