From 23071d36f287b84271f072e58ac6e6d26cb3e6c5 Mon Sep 17 00:00:00 2001 From: Kumi Date: Mon, 22 Jan 2024 09:18:32 +0100 Subject: [PATCH] Added Docker setup for pyfiche services Introduced a Dockerfile to containerize pyfiche alongside its dependencies. The setup includes the latest Python, installs pyfiche from a Git repository, and utilizes Supervisord for process management. Supervisord is configured to manage three pyfiche services: server, recup, and lines, ensuring they start on boot and restart on failure. Exposed ports allow external access, and a persistent data volume ensures data continuity. This encapsulates the pyfiche environment, providing a robust and consistent deployment method. --- Dockerfile | 25 +++++++++++++++++++++++++ supervisord.conf | 17 +++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 Dockerfile create mode 100644 supervisord.conf diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..28c8999 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,25 @@ +FROM python:3.11 +WORKDIR /usr/src/app + +# Install pyfiche from the git repository +RUN pip install -U git+https://kumig.it/PrivateCoffee/pyfiche.git + +# Install supervisord +RUN pip install supervisor + +# Create a directory where pyfiche will store its data +RUN mkdir data + +# Copy the supervisord configuration file into the container +COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf + +# Expose the ports that pyfiche, recup, and lines will run on +EXPOSE 9999 +EXPOSE 9998 +EXPOSE 9997 + +# Use VOLUME to allow data persistence +VOLUME ["/usr/src/app/data"] + +# Run supervisord to manage the services +CMD ["/usr/local/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"] diff --git a/supervisord.conf b/supervisord.conf new file mode 100644 index 0000000..2a87735 --- /dev/null +++ b/supervisord.conf @@ -0,0 +1,17 @@ +[supervisord] +nodaemon=true + +[program:pyfiche-server] +command=pyfiche-server -o /usr/src/app/data +autostart=true +autorestart=true + +[program:pyfiche-recup] +command=pyfiche-recup -o /usr/src/app/data +autostart=true +autorestart=true + +[program:pyfiche-lines] +command=pyfiche-lines -o /usr/src/app/data +autostart=true +autorestart=true