BTHLABS-63: Production deployment workflow

This commit is contained in:
2025-11-06 20:34:44 +00:00
parent d8bbe57b17
commit e800d0c16c
42 changed files with 786 additions and 97 deletions

View File

@@ -13,26 +13,21 @@ cat <<EOF
|_|
production
HotPocket v25.10.21 [${HOTPOCKET_BACKEND_IMAGE_ID}] (https://hotpocket.app/)
HotPocket v25.11.06.b0 [${HOTPOCKET_BACKEND_IMAGE_ID}] (https://hotpocket.app/)
Copyright 2025-present by BTHLabs. All rights reserved. (https://bthlabs.pl/)
Licensed under Apache-2.0
EOF
export PYTHONPATH="/srv/app:$PYTHONPATH"
if [ -n "${HOTPOCKET_BACKEND_RUN_MIGRATIONS}" ];then
echo; echo "--- Running migrations..."
${VIRTUAL_ENV}/bin/python /srv/app/manage.py migrate
echo; echo "--- Preparing the system..."
UPLOADS_PATH="${HOTPOCKET_BACKEND_UPLOADS_PATH:-/srv/uploads}"
if [ ! -d "${UPLOADS_PATH}" ];then
mkdir -p "${UPLOADS_PATH}"
fi
if [[ -n "${HOTPOCKET_BACKEND_INITIAL_ACCOUNT_USERNAME}" && -n "${HOTPOCKET_BACKEND_INITIAL_ACCOUNT_PASSWORD}" ]]; then
echo; echo "--- Creating initial Account..."
${VIRTUAL_ENV}/bin/python /srv/app/manage.py create_initial_account "${HOTPOCKET_BACKEND_INITIAL_ACCOUNT_USERNAME}" "${HOTPOCKET_BACKEND_INITIAL_ACCOUNT_PASSWORD}"
fi
if [ "${HOTPOCKET_BACKEND_ENV}" = "aio" ];then
mkdir -p "${HOTPOCKET_BACKEND_UPLOADS_PATH:-/srv/run/uploads}"
fi
sudo /srv/bin/fix-run-uploads-permissions.sh ${HOTPOCKET_BACKEND_APP_USER_UID} "${UPLOADS_PATH}"
echo; echo "--- Running entrypoint.d parts..."
find "/srv/etc/entrypoint.d/" -follow -type f -print | sort -V | while read -r ENTRYPOINT_PART; do
@@ -48,6 +43,16 @@ find "/srv/etc/entrypoint.d/" -follow -type f -print | sort -V | while read -r E
esac
done
if [ -n "${HOTPOCKET_BACKEND_RUN_MIGRATIONS}" ];then
echo; echo "--- Running migrations..."
${VIRTUAL_ENV}/bin/python /srv/app/manage.py migrate
fi
if [ -n "${HOTPOCKET_BACKEND_CREATE_INITIAL_ACCOUNT}" ];then
echo; echo "--- Creating initial Account..."
${VIRTUAL_ENV}/bin/python /srv/app/manage.py create_initial_account
fi
echo; echo "--- Setup done, booting the app..."; echo
exec /usr/bin/dumb-init "$@"