From b5b8162cfa76bfdb93dc7ac3deb3383d02a2844c Mon Sep 17 00:00:00 2001 From: Thomas Sileo Date: Thu, 28 Jul 2022 20:28:13 +0200 Subject: [PATCH] Fix Docker setup --- Makefile | 5 +++++ misc/docker-supervisord.conf | 12 ++++++------ scripts/config_wizard.py | 13 ++++++++++++- tasks.py | 2 +- 4 files changed, 24 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index e284116..27df1d4 100644 --- a/Makefile +++ b/Makefile @@ -5,3 +5,8 @@ PWD=$(shell pwd) config: # Run and remove instantly -docker run --rm -it --volume `pwd`/data:/app/data microblogpub/microblogpub inv configuration-wizard + -docker run --env MICROBLOGPUB_CONFIG_FILE=tests.toml --rm -it --volume `pwd`/data:/app/data --volume `pwd`/app/static:/app/app/static microblogpub/microblogpub inv configuration-wizard + +.PHONY: update +update: + -docker run --volume `pwd`/data:/app/data --volume `pwd`/app/static:/app/app/static microblogpub/microblogpub inv update diff --git a/misc/docker-supervisord.conf b/misc/docker-supervisord.conf index d57eeac..c39833e 100644 --- a/misc/docker-supervisord.conf +++ b/misc/docker-supervisord.conf @@ -10,19 +10,19 @@ command=uvicorn app.main:app --no-server-header --fd 0 numprocs=2 process_name=uvicorn-%(process_num)d redirect_stderr=true -stdout_logfile=/dev/fd/1 -stdout_logfile_maxbytes=0 +stdout_logfile=data/uvicorn.log +stdout_logfile_maxbytes=50MB [program:incoming_worker] command=inv process-incoming-activities numproc=1 redirect_stderr=true -stdout_logfile=/dev/fd/1 -stdout_logfile_maxbytes=0 +stdout_logfile=data/incoming.log +stdout_logfile_maxbytes=50MB [program:outgoing_worker] command=inv process-outgoing-activities numproc=1 redirect_stderr=true -stdout_logfile=/dev/fd/1 -stdout_logfile_maxbytes=0 +stdout_logfile=data/outgoing.log +stdout_logfile_maxbytes=50MB diff --git a/scripts/config_wizard.py b/scripts/config_wizard.py index 192b0a2..eadcb9e 100644 --- a/scripts/config_wizard.py +++ b/scripts/config_wizard.py @@ -8,6 +8,7 @@ import bcrypt import tomli_w from markdown import markdown # type: ignore from prompt_toolkit import prompt +from prompt_toolkit.key_binding import KeyBindings from app.key import generate_key @@ -15,6 +16,15 @@ _ROOT_DIR = Path().parent.resolve() _KEY_PATH = _ROOT_DIR / "data" / "key.pem" +_kb = KeyBindings() + + +@_kb.add("c-@") +def _(event): + """Save multi-line buffer on CTRL + space""" + event.current_buffer.validate_and_handle() + + def main() -> None: print("Welcome to microblog.pub setup wizard\n") print("Generating key...") @@ -52,8 +62,9 @@ def main() -> None: prompt( ( "summary (short description, in markdown, " - "press [ESC] then [ENTER] to submit):\n" + "press [CTRL] + [SPACE] to submit):\n" ), + key_bindings=_kb, multiline=True, ) ) diff --git a/tasks.py b/tasks.py index 1a6006b..2eb3327 100644 --- a/tasks.py +++ b/tasks.py @@ -141,7 +141,7 @@ def install_deps(ctx): run("poetry install", pty=True, echo=True) -@task(install_deps, compile_scss, migrate_db) +@task(compile_scss, migrate_db) def update(ctx): # type: (Context) -> None print("Done")