45 lines
1.6 KiB
Bash
45 lines
1.6 KiB
Bash
#!/bin/sh
|
|
|
|
# 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" \
|
|
-e "s/notify@example.com/${PL_NOTIFY_EMAIL}/g" \
|
|
-e "s/Pleroma/${PL_INSTANCE_NAME}/g" \
|
|
-e "s/example.com/${PL_DOMAIN}/g" \
|
|
docker-compose.yml
|
|
|
|
chmod o= config.exs
|
|
|
|
docker compose up -d db
|
|
sleep 10
|
|
docker exec -i pleroma_db psql -U pleroma -c "CREATE EXTENSION IF NOT EXISTS citext;"
|
|
docker compose down
|
|
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..."
|
|
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!" |