From 2ff2fe6fb045fdb744beb93b3e90baced0f2add6 Mon Sep 17 00:00:00 2001 From: Brandon Date: Sat, 3 Nov 2018 12:17:27 -0700 Subject: [PATCH 1/4] Added ignore for Docker and copy config dir (aka defaults) to the volume on build --- .dockerignore | 1 + Dockerfile | 1 + 2 files changed, 2 insertions(+) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..b02c44d --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +config/config.ini \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index e4630bd..d929469 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,6 +17,7 @@ VOLUME /usr/src/ytsm/data COPY ./app/ ./ COPY ./docker/init.sh ./ +COPY ./config/ /usr/src/ytsm/config/ EXPOSE 8000 From 70a8cfeec48670cbf05c6d9f1546476d22e8620d Mon Sep 17 00:00:00 2001 From: Brandon Date: Sat, 3 Nov 2018 13:46:01 -0700 Subject: [PATCH 2/4] Fixed volumes list --- Docker_README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Docker_README.md b/Docker_README.md index ce98824..0bb5beb 100644 --- a/Docker_README.md +++ b/Docker_README.md @@ -23,8 +23,8 @@ Environment variables Volumes ----- -- /usr/src/app/data/media -- /usr/src/app/data/db +- /usr/src/app/data +- /usr/src/app/config Notes From a5de3bf6cb4f95057a1387591f40bb2e497fd718 Mon Sep 17 00:00:00 2001 From: Brandon Date: Thu, 8 Nov 2018 17:25:00 -0800 Subject: [PATCH 3/4] Changed based on feedback in chibicitiberiu/ytsm#27 --- Docker_README.md | 2 +- Dockerfile | 1 - app/YtManager/settings.py | 4 +++- {config => app/default}/defaults.ini | 0 4 files changed, 4 insertions(+), 3 deletions(-) rename {config => app/default}/defaults.ini (100%) diff --git a/Docker_README.md b/Docker_README.md index 0bb5beb..d382919 100644 --- a/Docker_README.md +++ b/Docker_README.md @@ -4,7 +4,7 @@ Running with Docker Sample Run command ----- ```bash -docker run -d --name ytsm -p 80:8000 --volume ./downloads:/usr/src/app/data/downloads chibicitiberiu/ytsm:latest +docker run -d --name ytsm -p 80:8000 --volume /media/ytsm/data:/usr/src/ytsm/data --volume /media/ytsm/config:/usr/src/ytsm/config chibicitiberiu/ytsm:latest ``` ### Quick Rundown: - `--expose 80:8000` maps the Host OS port 80 to the container port 80 diff --git a/Dockerfile b/Dockerfile index d929469..e4630bd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,7 +17,6 @@ VOLUME /usr/src/ytsm/data COPY ./app/ ./ COPY ./docker/init.sh ./ -COPY ./config/ /usr/src/ytsm/config/ EXPOSE 8000 diff --git a/app/YtManager/settings.py b/app/YtManager/settings.py index 637a233..b1a78fb 100644 --- a/app/YtManager/settings.py +++ b/app/YtManager/settings.py @@ -126,11 +126,13 @@ CONFIG_DIR = os.path.join(PROJECT_ROOT, "config") DATA_DIR = os.path.join(PROJECT_ROOT, "data") STATIC_ROOT = os.path.join(PROJECT_ROOT, "static") + +_DEFAULT_CONFIG_DIR = os.path.join(BASE_DIR, "default") _DEFAULT_CONFIG_FILE = os.path.join(CONFIG_DIR, 'config.ini') _DEFAULT_LOG_FILE = os.path.join(DATA_DIR, 'log.log') _DEFAULT_MEDIA_ROOT = os.path.join(DATA_DIR, 'media') -DEFAULTS_FILE = os.path.join(CONFIG_DIR, 'defaults.ini') +DEFAULTS_FILE = os.path.join(_DEFAULT_CONFIG_DIR, 'defaults.ini') CONFIG_FILE = os.getenv('YTSM_CONFIG_FILE', _DEFAULT_CONFIG_FILE) # diff --git a/config/defaults.ini b/app/default/defaults.ini similarity index 100% rename from config/defaults.ini rename to app/default/defaults.ini From 22ed6a6813c6c7f7106889c27289385d82f68ef5 Mon Sep 17 00:00:00 2001 From: Brandon Date: Thu, 8 Nov 2018 17:27:44 -0800 Subject: [PATCH 4/4] Fix up Docker_README --- Docker_README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Docker_README.md b/Docker_README.md index d382919..41837c7 100644 --- a/Docker_README.md +++ b/Docker_README.md @@ -8,11 +8,10 @@ docker run -d --name ytsm -p 80:8000 --volume /media/ytsm/data:/usr/src/ytsm/dat ``` ### Quick Rundown: - `--expose 80:8000` maps the Host OS port 80 to the container port 80 -- `--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) +- `--volume /media/ytsm/data:/usr/src/app/data` maps the data folder on the host to the container folder `data` +- `--volume /media/ytsm/coinfig:/usr/src/app/config` maps the config folder on the host to the container folder `config` - `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 -----