From 54c79225ce3d79adfe81992154dfd32b52b6770f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sascha=20I=C3=9Fbr=C3=BCcker?= Date: Sun, 27 Aug 2023 15:30:51 +0200 Subject: [PATCH] Add script for running dev server with postgres --- scripts/run-postgres.sh | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100755 scripts/run-postgres.sh diff --git a/scripts/run-postgres.sh b/scripts/run-postgres.sh new file mode 100755 index 0000000..5f4b0c4 --- /dev/null +++ b/scripts/run-postgres.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +# Remove previous container if exists +docker rm -f linkding-postgres-test || true + +# Run postgres container +docker run -d \ + -e POSTGRES_DB=linkding \ + -e POSTGRES_USER=linkding \ + -e POSTGRES_PASSWORD=linkding \ + -p 5432:5432 \ + --name linkding-postgres-test \ + postgres + +# Wait until postgres has started +echo >&2 "$(date +%Y%m%dt%H%M%S) Waiting for postgres container" +sleep 15 + +# Start linkding dev server +export LD_DB_ENGINE=postgres +export LD_DB_USER=linkding +export LD_DB_PASSWORD=linkding + +export LD_SUPERUSER_NAME=admin +export LD_SUPERUSER_PASSWORD=admin + +python manage.py migrate +python manage.py create_initial_superuser +python manage.py runserver