ProjectLighthouse/scripts-and-tools/docker-entrypoint.sh
Josh 017dcd6888
Make PhotoSubjects use a one to many relationship (#687)
* Attempt to remodel PhotoSubject and Photo relationship

* Fix migration name

* Use exactName for migration lock

* Revert "Use exactName for migration lock"

This reverts commit 76cee6a3ff.

* Set command timeout to 5 minutes for database migrations

* Delete unused PhotoSubjects in migration

* Clean up website queries and finalize subject refactor

* Add migration to remove PhotoSubjectCollection

* Add grace period for container startup and optimize startup

* Make config backup copy original file

* Allow docker entrypoint to fix data permissions
2023-02-24 04:20:55 +00:00

33 lines
No EOL
898 B
Bash

#!/bin/sh
log() {
local type="$1"; shift
printf '%s [%s] [Entrypoint]: %s\n' "$(date -Iseconds)" "$type" "$*"
}
log Note "Entrypoint script for Lighthouse $SERVER started".
if [ ! -d "/lighthouse/data" ]; then
log Note "Creating data directory"
mkdir -p "/lighthouse/data"
fi
owner=$(stat -c "%U %G" /lighthouse/data)
if [ owner != "lighthouse lighthouse" ]; then
log Note "Changing ownership of data directory"
chown -R lighthouse:lighthouse /lighthouse/data
fi
if [ -d "/lighthouse/temp" ]; then
log Note "Copying temp directory to data"
cp -rn /lighthouse/temp/* /lighthouse/data
rm -rf /lighthouse/temp
fi
# Start server
log Note "Startup tasks finished, starting $SERVER..."
cd /lighthouse/data
exec su-exec lighthouse:lighthouse dotnet /lighthouse/app/LBPUnion.ProjectLighthouse.Servers."$SERVER".dll
exit $? # Expose error code from dotnet command