Merge branch 'master' of github.com:tsileo/microblog.pub

This commit is contained in:
Thomas Sileo 2019-06-29 11:34:12 +02:00
commit 8f9a6ede7c
3 changed files with 10 additions and 7 deletions

View file

@ -2,13 +2,13 @@ PYTHON=python
SETUP_WIZARD_IMAGE=microblogpub-setup-wizard:latest SETUP_WIZARD_IMAGE=microblogpub-setup-wizard:latest
PWD=$(shell pwd) PWD=$(shell pwd)
# Build the config (will error if an existing config is found) via a Docker container # Build the config (will error if an existing config/me.yml is found) via a Docker container
.PHONY: config .PHONY: config
config: config:
# Build the container for the setup wizard on-the-fly # Build the container for the setup wizard on-the-fly
cd setup_wizard && docker build . -t $(SETUP_WIZARD_IMAGE) cd setup_wizard && docker build . -t $(SETUP_WIZARD_IMAGE)
# Run and remove instantly # Run and remove instantly
-docker run --rm -it --volume $(PWD):/app/out $(SETUP_WIZARD_IMAGE) -docker run -e MICROBLOGPUB_WIZARD_PROJECT_NAME --rm -it --volume $(PWD):/app/out $(SETUP_WIZARD_IMAGE)
# Finally, remove the tagged image # Finally, remove the tagged image
docker rmi $(SETUP_WIZARD_IMAGE) docker rmi $(SETUP_WIZARD_IMAGE)

View file

@ -1,5 +1,7 @@
FROM python:3 FROM python:3.7
WORKDIR /app WORKDIR /app
ADD . /app ADD . /app
RUN pip install -r requirements.txt RUN pip install -r requirements.txt
LABEL maintainer="t@a4.io"
LABEL pub.microblog.oneshot=true
CMD ["python", "wizard.py"] CMD ["python", "wizard.py"]

View file

@ -15,12 +15,11 @@ def main() -> None:
config_file = Path("/app/out/config/me.yml") config_file = Path("/app/out/config/me.yml")
env_file = Path("/app/out/.env") env_file = Path("/app/out/.env")
if config_file.exists() or env_file.exists(): if config_file.exists():
# Spit out the relative path for the "config artifacts" # Spit out the relative path for the "config artifacts"
rconfig_file = "config/me.yml" rconfig_file = "config/me.yml"
renv_file = ".env"
print( print(
f"Existing setup detected, please delete {rconfig_file} and/or {renv_file} before restarting the wizard" f"Existing setup detected, please delete {rconfig_file} before restarting the wizard"
) )
sys.exit(2) sys.exit(2)
@ -58,12 +57,14 @@ def main() -> None:
with config_file.open("w") as f: with config_file.open("w") as f:
f.write(out) f.write(out)
proj_name = os.getenv("MICROBLOGPUB_WIZARD_PROJECT_NAME", "microblogpub")
env = { env = {
"WEB_PORT": 5005, "WEB_PORT": 5005,
"CONFIG_DIR": "./config", "CONFIG_DIR": "./config",
"DATA_DIR": "./data", "DATA_DIR": "./data",
"POUSSETACHES_AUTH_KEY": binascii.hexlify(os.urandom(32)).decode(), "POUSSETACHES_AUTH_KEY": binascii.hexlify(os.urandom(32)).decode(),
"COMPOSE_PROJECT_NAME": Path.cwd().name.replace(".", ""), "COMPOSE_PROJECT_NAME": proj_name,
} }
out2 = "" out2 = ""