exec archivebox from docker entrypoint script to avoid nesting pid under bash
This commit is contained in:
parent
10d687c55c
commit
19f7c907e0
2 changed files with 5 additions and 2 deletions
|
@ -1086,5 +1086,6 @@ def setup_django(out_dir: Path=None, check_db=False, config: ConfigDict=CONFIG,
|
||||||
sql_index_path = Path(output_dir) / SQL_INDEX_FILENAME
|
sql_index_path = Path(output_dir) / SQL_INDEX_FILENAME
|
||||||
assert sql_index_path.exists(), (
|
assert sql_index_path.exists(), (
|
||||||
f'No database file {SQL_INDEX_FILENAME} found in: {config["OUTPUT_DIR"]} (Are you in an ArchiveBox collection directory?)')
|
f'No database file {SQL_INDEX_FILENAME} found in: {config["OUTPUT_DIR"]} (Are you in an ArchiveBox collection directory?)')
|
||||||
|
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
raise SystemExit(2)
|
raise SystemExit(2)
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
DATA_DIR="${DATA_DIR:-/data}"
|
DATA_DIR="${DATA_DIR:-/data}"
|
||||||
ARCHIVEBOX_USER="${ARCHIVEBOX_USER:-archivebox}"
|
ARCHIVEBOX_USER="${ARCHIVEBOX_USER:-archivebox}"
|
||||||
|
|
||||||
|
|
||||||
# Set the archivebox user UID & GID
|
# Set the archivebox user UID & GID
|
||||||
if [[ -n "$PUID" && "$PUID" != 0 ]]; then
|
if [[ -n "$PUID" && "$PUID" != 0 ]]; then
|
||||||
usermod -u "$PUID" "$ARCHIVEBOX_USER" > /dev/null 2>&1
|
usermod -u "$PUID" "$ARCHIVEBOX_USER" > /dev/null 2>&1
|
||||||
|
@ -11,6 +12,7 @@ if [[ -n "$PGID" && "$PGID" != 0 ]]; then
|
||||||
groupmod -g "$PGID" "$ARCHIVEBOX_USER" > /dev/null 2>&1
|
groupmod -g "$PGID" "$ARCHIVEBOX_USER" > /dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Set the permissions of the data dir to match the archivebox user
|
# Set the permissions of the data dir to match the archivebox user
|
||||||
if [[ -d "$DATA_DIR/archive" ]]; then
|
if [[ -d "$DATA_DIR/archive" ]]; then
|
||||||
# check data directory permissions
|
# check data directory permissions
|
||||||
|
@ -33,11 +35,11 @@ if [[ "$1" == /* || "$1" == "echo" || "$1" == "archivebox" ]]; then
|
||||||
# e.g. "archivebox init"
|
# e.g. "archivebox init"
|
||||||
# "/bin/bash"
|
# "/bin/bash"
|
||||||
# "echo"
|
# "echo"
|
||||||
gosu "$ARCHIVEBOX_USER" bash -c "$*"
|
exec gosu "$ARCHIVEBOX_USER" bash -c "$*"
|
||||||
else
|
else
|
||||||
# no command given, assume args were meant to be passed to archivebox cmd
|
# no command given, assume args were meant to be passed to archivebox cmd
|
||||||
# e.g. "add https://example.com"
|
# e.g. "add https://example.com"
|
||||||
# "manage createsupseruser"
|
# "manage createsupseruser"
|
||||||
# "server 0.0.0.0:8000"
|
# "server 0.0.0.0:8000"
|
||||||
gosu "$ARCHIVEBOX_USER" bash -c "archivebox $*"
|
exec gosu "$ARCHIVEBOX_USER" bash -c "archivebox $*"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue