refactor: use os keyring for secrets, remap volumes (#11)

refactor: abstract storage root

feat: system keyring
This commit is contained in:
Marc 2022-12-03 13:22:37 -05:00 committed by GitHub
parent 3c279aee70
commit 41cafc59b3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 7 deletions

10
plex/.env Normal file
View file

@ -0,0 +1,10 @@
# Media data
DATA_DIR=${DATA_STORAGE_ROOT:-.}/media
# Application data
DATABASE_DIR=${APP_STORAGE_ROOT:-.}/plex/database
TRANSCODE_DIR=${APP_STORAGE_ROOT:-.}/plex/transcode
# Configuration
ADVERTISE_IP="http://192.168.1.69:32400"
PLEX_CLAIM=$PLEX_CLAIM

1
plex/.gitignore vendored
View file

@ -1,4 +1,3 @@
*.env
media/**/*
transcode/**/*
database/**/*

View file

@ -15,11 +15,11 @@ services:
- "32412:32412/udp"
- "32413:32413/udp"
- "32414:32414/udp"
env_file:
- plex.env
environment:
- TZ=America/Toronto
- ADVERTISE_IP=${ADVERTISE_IP}
- PLEX_CLAIM=${PLEX_CLAIM}
volumes:
- ./database:/config
- ./transcode:/transcode
- ./media:/data
- ${DATABASE_DIR}:/config
- ${TRANSCODE_DIR}:/transcode
- ${DATA_DIR}:/data

View file

@ -2,6 +2,8 @@ import invoke
import pathlib
import typing
import json
import os
PATH = pathlib.Path(__file__).parent
@ -53,7 +55,13 @@ def load_configuration() -> Configuration:
@invoke.task()
def start(ctx):
with ctx.cd(PATH):
ctx.run("docker-compose up -d")
data_root = os.getenv("DATA_STORAGE_ROOT", PATH)
app_data_root = os.getenv("APP_STORAGE_ROOT", PATH)
ctx.run(
f"PLEX_CLAIM=$(pass show plex-claim) docker-compose up -d",
env={"APP_STORAGE_ROOT": app_data_root, "DATA_STORAGE_ROOT": data_root},
)
@invoke.task()