From a4f249ed336539cc1dc77fb1a842b2742069ed25 Mon Sep 17 00:00:00 2001 From: tremor021 Date: Tue, 17 Jun 2025 09:31:04 +0200 Subject: [PATCH] Update planka --- install/planka-install.sh | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/install/planka-install.sh b/install/planka-install.sh index aa93ef8d..85e2b666 100644 --- a/install/planka-install.sh +++ b/install/planka-install.sh @@ -21,9 +21,36 @@ msg_ok "Installed dependencies" NODE_VERSION="22" setup_nodejs PG_VERSION="16" setup_postgresql + +msg_info "Setting up PostgreSQL Database" +DB_NAME=planka +DB_USER=planka +DB_PASS="$(openssl rand -base64 18 | cut -c1-13)" +$STD sudo -u postgres psql -c "CREATE ROLE $DB_USER WITH LOGIN PASSWORD '$DB_PASS';" +$STD sudo -u postgres psql -c "CREATE DATABASE $DB_NAME WITH OWNER $DB_USER ENCODING 'UTF8' TEMPLATE template0;" +$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET client_encoding TO 'utf8';" +$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET default_transaction_isolation TO 'read committed';" +$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET timezone TO 'UTC'" +{ + echo "PLANKA-Credentials" + echo "PLANKA Database User: $DB_USER" + echo "PLANKA Database Password: $DB_PASS" + echo "PLANKA Database Name: $DB_NAME" +} >>~/planka.creds +msg_ok "Set up PostgreSQL Database" + fetch_and_deploy_gh_release "planka" "plankanban/planka" "prebuild" "latest" "/opt/planka" "planka-prebuild.zip" msg_info "Setup planka" +LOCAL_IP=$(hostname -I | awk '{print $1}') +cd /opt/planka/planka +$STD npm install +cp .env.sample .env +SECRET_KEY=$(openssl rand -hex 64) +sed -i "s#http://localhost:1337#http://${LOCAL_IP}:8080#g" /opt/planka/planka/.env +sed -i "s#postgres@localhost#planka:$DB_PASS@localhost#g" /opt/planka/planka/.env +sed -i "s#notsecretkey#${SECRET_KEY}#g" /opt/planka/planka/.env +$STD npm run db:init msg_ok "Installed planka" msg_info "Creating Service"