ytsm/Docker_README.md
Brandon baaf9577da Environment Variables and Docker standalone support (#21)
* Ignore .dist folder used by visual studio code

* Add example env file

* Added environment variables

* Ignore env file

* Added default name to be ytmanager instead

* Default to postgres

* Update example env for postgres instead of sqlite

* Added default as postgres as well in settings

* Add volume for sqlite3 database storage (incase desired)

* Added example env file for sqlite3 configuration

* whitespace for sanity of my own

* Add database_url as an optional env variable

* hopefully working towards chibicitiberiu/ytsm#6

* Added default command

* Expose 8000

* Added environment variable prefixes

* added environment variable to parse for dj_database_url

* Take out command in docker-compose since it's already in the Dockerfile as a cmd

* SQLite as default

* Create Docker README with information about how to run with Docker

* Took out postgres. If people desire it, they can add it themselves.

* Took out db depenednecy for docker-compose

* Change cmd

* Fixed up commands to run better in readme

* Added underscore to Docker_README

* Change default .db file location
2018-10-31 17:57:32 +02:00

40 lines
1.4 KiB
Markdown

Running with Docker
===
Sample Run command
-----
```bash
docker run -d --name ytsm -p 80:8000 --env-file sqlite3.env.env --volume ./downloads:/usr/src/app/data/downloads chibicitiberiu/ytsm:latest
```
### Quick Rundown:
- `--expose 80:8000` maps the Host OS port 80 to the container port 80
- `--env-file sqlite3.env.env` points to the env file with the desired variable settings (saves from typing them in the command line)
- `--volume ./downloads:/usr/src/app/data/downloads` maps the downloads folder of the current directory to the container folder `downloads` (where you could set the program to download to)
- `chibicitiberiu/ytsm:latest` tells Docker which image to run the container with (in this case, the latest version)
**Note:** Replace `./downloads` in the command to where you want the downloads folder to be mapped to on the Host OS. Ex: `/path/to/host/download/folder:/path/to/container/download/folder`
Environment variables
-----
- YTSM_DATABASE_ENGINE
- YTSM_DATABASE_NAME
- YTSM_YOUTUBE_API_KEY
Volumes
-----
- /usr/src/app/data/media
- /usr/src/app/data/db
Notes
----
If you experience any issues with the app running, make sure to run the following command to apply Django migrations to the database
### When using just the Dockerfile/Image
- `docker exec ytsm python manage.py migrate`
### When using the docker-compose file
- `docker exec ytsm_web_1 python manage.py migrate`