From 478cc4f4d7db7f8afc3689af3aafb6b360a2f8c4 Mon Sep 17 00:00:00 2001 From: Cassowary Rusnov Date: Wed, 4 Jan 2023 16:07:49 -0800 Subject: [PATCH] Initial repo setup. --- .env.sample | 9 +++++++++ README.md | 2 +- abra.sh | 1 + compose.yml | 32 +++++++++++++++++++++++++------- startup.sh | 11 +++++++++++ 5 files changed, 47 insertions(+), 8 deletions(-) create mode 100644 abra.sh create mode 100755 startup.sh diff --git a/.env.sample b/.env.sample index 2c22272..0ad05a2 100644 --- a/.env.sample +++ b/.env.sample @@ -6,3 +6,12 @@ DOMAIN=voila.example.com #EXTRA_DOMAINS=', `www.voila.example.com`' LETS_ENCRYPT_ENV=production + +# The voila version to pin to (can be overriden by requirements.txt) +VOILA_VERSION=0.4.0 +# The directory to run voila from. +VOILA_DIRECTORY=/data +# Additional options to pass to voila. +VOILA_OPTIONS='' +# The requirements.txt path +REQUIREMENTS_PATH=/data/requirements.txt diff --git a/README.md b/README.md index d6ea492..ad47b4e 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ * **Category**: Apps * **Status**: 0 -* **Image**: [`voila`](https://hub.docker.com/r/voila), 4, upstream +* **Image**: [`python`](https://hub.docker.com/r/python), 4, upstream * **Healthcheck**: No * **Backups**: No * **Email**: No diff --git a/abra.sh b/abra.sh new file mode 100644 index 0000000..15dc1af --- /dev/null +++ b/abra.sh @@ -0,0 +1 @@ +export STARTUP_SH_VERSION=v1 diff --git a/compose.yml b/compose.yml index a2c3805..a367fcd 100644 --- a/compose.yml +++ b/compose.yml @@ -3,9 +3,22 @@ version: "3.8" services: app: - image: nginx:1.20.0 + image: python:3.10 + environment: + - VOILA_VERSION + - VOILA_DIRECTORY + - VOILA_OPTIONS + - REQUIREMENTS_PATH + volumes: + - data:/data + working_dir: /data + configs: + - source: startup_sh + target: /startup.sh + mode: 0755 networks: - proxy + command: /startup.sh deploy: restart_policy: condition: on-failure @@ -20,13 +33,18 @@ services: #- "traefik.http.middlewares.${STACK_NAME}-redirect.headers.SSLForceHost=true" #- "traefik.http.middlewares.${STACK_NAME}-redirect.headers.SSLHost=${DOMAIN}" - "coop-cloud.${STACK_NAME}.version=" - healthcheck: - test: ["CMD", "curl", "-f", "http://localhost"] - interval: 30s - timeout: 10s - retries: 10 - start_period: 1m + # healthcheck: + # test: ["CMD", "curl", "-f", "http://localhost"] + # interval: 30s + # timeout: 10s + # retries: 10 + # start_period: 1m networks: proxy: external: true + +configs: + startup_sh: + name: ${STACK_NAME}_startup_sh_{$STARTUP_SH_VERSION} + file: startup.sh diff --git a/startup.sh b/startup.sh new file mode 100755 index 0000000..9be75ad --- /dev/null +++ b/startup.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +cd $VOILA_DIRECTORY + +if [-e "$REQUIREMENTS_PATH" ]; then + pip install -r "$REQUIREMENTS_PATH" +else + pip install voila==$VOILA_VERSION +fi + +python -mvoila --no-browser --port=80 $VOILA_OPTIONS