- fixed app dir
- fixed missing readme and version file
- keep config on update/remove
This commit is contained in:
Oscar Krause 2022-12-28 07:40:44 +01:00
parent cca24f0ad5
commit 6b3f536681
3 changed files with 10 additions and 7 deletions

View File

@ -12,9 +12,10 @@ build:debian:
- mkdir build
# copy install instructions
- cp -r DEBIAN build/
# copy app
# copy app into "/usr/share/fastapi-dls" as "/usr/share/fastapi-dls/app" & copy README.md and version.env
- mkdir -p build/usr/share/
- cp -r app build/usr/share/fastapi-dls
- cp -r app build/usr/share/fastapi-dls/
- cp README.md version.env build/usr/share/fastapi-dls
# create conf file
- mkdir -p build/etc/fastapi-dls
- touch build/etc/fastapi-dls/env

View File

@ -1,5 +1,6 @@
#!/bin/bash
WORKING_DIR=/usr/share/fastapi-dls
CONFIG_DIR=/etc/fastapi-dls
echo "> Create config directory ..."
@ -15,12 +16,12 @@ After=network.target
User=www-data
Group=www-data
AmbientCapabilities=CAP_NET_BIND_SERVICE
WorkingDirectory=/usr/share/fastapi-dls
WorkingDirectory=$WORKING_DIR
EnvironmentFile=$CONFIG_DIR/env
ExecStart=uvicorn main:app \\
--env-file /etc/fastapi-dls/env \\
--host \$DLS_URL --port \$DLS_PORT \\
--app-dir /usr/share/fastapi-dls \\
--app-dir $WORKING_DIR/app \\
--ssl-keyfile /etc/fastapi-dls/webserver.key \\
--ssl-certfile /etc/fastapi-dls/webserver.crt \\
--proxy-headers
@ -41,7 +42,7 @@ cat <<EOF >$CONFIG_DIR/env
DLS_URL=127.0.0.1
DLS_PORT=443
LEASE_EXPIRE_DAYS=90
DATABASE=sqlite:////usr/share/fastapi-dls/db.sqlite
DATABASE=sqlite:///$CONFIG_DIR/db.sqlite
INSTANCE_KEY_RSA=$CONFIG_DIR/instance.private.pem
INSTANCE_KEY_PUB=$CONFIG_DIR/instance.public.pem
@ -77,6 +78,7 @@ if [[ -f $CONFIG_DIR/webserver.key ]]; then
fi
chown -R www-data:www-data $CONFIG_DIR/*
chown -R www-data:www-data $WORKING_DIR
cat <<EOF

View File

@ -1,8 +1,8 @@
#!/bin/bash
if [[ -d /etc/fastapi-dls ]]; then
echo "> Removing config directory."
rm -r /etc/fastapi-dls
echo "> Config directory not empty, please remove manually."
# rm -r /etc/fastapi-dls
fi
if [[ -f /etc/systemd/system/fastapi-dls.service ]]; then