From 95f307960450b68873540d2628cccf348fd3a348 Mon Sep 17 00:00:00 2001 From: bronze Date: Fri, 29 May 2026 01:49:39 -0400 Subject: [PATCH] setup.sh rework and fixes --- scripts/setup.sh | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/scripts/setup.sh b/scripts/setup.sh index a8abeb8..c792aa0 100644 --- a/scripts/setup.sh +++ b/scripts/setup.sh @@ -1,10 +1,27 @@ #!/bin/sh -read -p "Enter the domain your instance will run from: " PL_DOMAIN -read -p "Enter the name of your instance: " PL_INSTANCE_NAME -read -p "Enter the admin email: " PL_ADMIN_EMAIL -read -p "Enter the notify email: " PL_NOTIFY_EMAIL -PL_DB_PASS=`strings /dev/urandom | grep -o '[[:alnum:]]' | head -n 48 | tr -d '\n'; echo` +# Check if docker is installed +if ! command -v docker >/dev/null 2>&1; then + echo "Error: docker command not found. Please install docker before running this script." + exit 1 +fi + +# Check if docker daemon is running +if ! docker info >/dev/null 2>&1; then + echo "Error: docker daemon is not running. Please start docker before running this script." + exit 1 +fi + +prompt_read() { + printf "%s " "$1" + read -r "$2" +} +prompt_read "Enter the domain your instance will run from: " PL_DOMAIN +prompt_read "Enter the name of your instance: " PL_INSTANCE_NAME +prompt_read "Enter the admin email: " PL_ADMIN_EMAIL +prompt_read "Enter the notify email: " PL_NOTIFY_EMAIL + +PL_DB_PASS=$(strings /dev/urandom | grep -o '[[:alnum:]]' | head -n 48 | tr -d '\n'; echo) sed -i -e "s/CHANGETHEDATABASEPASSWORD!/${PL_DB_PASS}/g" \ -e "s/admin@example.com/${PL_ADMIN_EMAIL}/g" \ @@ -23,6 +40,6 @@ docker compose build web --no-cache docker compose up -d sleep 10 echo "The docker container for your instance should be up and ready, but there is no admin account..." -read -p "Enter the admin username: " PL_ADMIN_USERNAME +prompt_read "Enter the admin username: " PL_ADMIN_USERNAME docker exec -it pleroma_web sh ./bin/pleroma_ctl user new "${PL_ADMIN_USERNAME}" "${PL_ADMIN_EMAIL}" --admin echo "Please copy the reset link above and save it, and make sure to set up your reverse proxy so you can access your new instance!" \ No newline at end of file