From 5496146053a070f8971414b90e0799bfa80a4384 Mon Sep 17 00:00:00 2001 From: arne Date: Tue, 22 Aug 2023 19:16:13 +0200 Subject: [PATCH] fixed service --- app.sh | 8 -------- entrypoint.sh | 13 +++++++++++++ webapp.initrc | 11 ++++++----- 3 files changed, 19 insertions(+), 13 deletions(-) delete mode 100755 app.sh create mode 100644 entrypoint.sh diff --git a/app.sh b/app.sh deleted file mode 100755 index 4265391..0000000 --- a/app.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -BASE=$(dirname $0) -cd $BASE -git pull -source env/bin/activate -pip3 install -r requirements.txt -gunicorn -D --bind 0.0.0.0:80 --pid /var/run/webapp.pid wsgi:app diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..ff3d024 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +BASE=$(dirname $0) +cd $BASE +git pull +if [ -d env ]; +then + python3 -m venv env +fi + +source env/bin/activate +pip3 install -U -r requirements.txt +gunicorn -D --bind 0.0.0.0:8080 --pid /run/webapp.pid wsgi:app diff --git a/webapp.initrc b/webapp.initrc index e43f249..71766de 100755 --- a/webapp.initrc +++ b/webapp.initrc @@ -1,12 +1,13 @@ #!/sbin/openrc-run -name="busybox $SVCNAME" -command="/opt/webapp/app.sh" -command_args="" +name="scratch-cloudvars-server" +command="/data/entrypoint.sh" pidfile="/var/run/$SVCNAME.pid" +command_background="yes" +output_logger="/usr/bin/logger" +error_logger="/usr/bin/logger" depend() { need net - use dns + use logger } -