mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-09-10 16:06:27 +00:00
portabase: resolve tusd arch, use nginx and backup helpers, random admin password
This commit is contained in:
@@ -37,16 +37,13 @@ function update_script() {
|
||||
systemctl stop portabase portabase-tusd
|
||||
msg_ok "Stopped Services"
|
||||
|
||||
msg_info "Backing up Configuration"
|
||||
cp /opt/portabase/.env /opt/portabase.env.bak
|
||||
msg_ok "Backed up Configuration"
|
||||
create_backup /opt/portabase/.env
|
||||
|
||||
NODE_VERSION="22" NODE_MODULE="pnpm@11.8.0" setup_nodejs
|
||||
|
||||
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "portabase" "Portabase/portabase" "tarball"
|
||||
|
||||
msg_info "Restoring Configuration"
|
||||
cp /opt/portabase.env.bak /opt/portabase/.env
|
||||
rm -f /opt/portabase.env.bak
|
||||
msg_ok "Restored Configuration"
|
||||
restore_backup
|
||||
|
||||
msg_info "Building Portabase"
|
||||
cd /opt/portabase
|
||||
|
||||
@@ -25,14 +25,15 @@ PG_VERSION="17" setup_postgresql
|
||||
PG_DB_NAME="portabase" PG_DB_USER="portabase" setup_postgresql_db
|
||||
|
||||
fetch_and_deploy_gh_release "portabase" "Portabase/portabase" "tarball"
|
||||
fetch_and_deploy_gh_release "tusd" "tus/tusd" "prebuild" "latest" "/opt/tusd" "tusd_linux_amd64.tar.gz"
|
||||
fetch_and_deploy_gh_release "tusd" "tus/tusd" "prebuild" "latest" "/opt/tusd" "tusd_linux_$(arch_resolve).tar.gz"
|
||||
|
||||
msg_info "Configuring Portabase"
|
||||
mkdir -p /opt/portabase-data/uploads/tmp
|
||||
mv -f /opt/tusd/tusd_linux_amd64/tusd /opt/tusd/tusd
|
||||
rm -rf /opt/tusd/tusd_linux_amd64
|
||||
mv -f "/opt/tusd/tusd_linux_$(arch_resolve)/tusd" /opt/tusd/tusd
|
||||
rm -rf "/opt/tusd/tusd_linux_$(arch_resolve)"
|
||||
chmod +x /opt/tusd/tusd
|
||||
PROJECT_SECRET=$(openssl rand -hex 32)
|
||||
ADMIN_PASSWORD=$(openssl rand -base64 18 | tr -dc 'A-Za-z0-9' | head -c 16)
|
||||
cat <<EOF >/opt/portabase/.env
|
||||
LOG_LEVEL=info
|
||||
DATABASE_URL=postgresql://${PG_DB_USER}:${PG_DB_PASS}@127.0.0.1:5432/${PG_DB_NAME}
|
||||
@@ -43,13 +44,18 @@ TRUSTED_DOMAINS=http://${LOCAL_IP}:3000
|
||||
PRIVATE_PATH=/opt/portabase-data
|
||||
AUTH_DEFAULT_USER_NAME=Portabase Admin
|
||||
AUTH_DEFAULT_USER=admin@example.com
|
||||
AUTH_DEFAULT_PASSWORD=Portabase123!
|
||||
AUTH_DEFAULT_PASSWORD=${ADMIN_PASSWORD}
|
||||
AUTH_EMAIL_PASSWORD_ENABLED=true
|
||||
AUTH_SIGNUP_ENABLED=true
|
||||
RETENTION_CRON=0 7 * * *
|
||||
TUSD_BEHIND_PROXY=true
|
||||
TELEMETRY=false
|
||||
EOF
|
||||
cat <<EOF >~/portabase.creds
|
||||
Portabase Admin
|
||||
Username: admin@example.com
|
||||
Password: ${ADMIN_PASSWORD}
|
||||
EOF
|
||||
msg_ok "Configured Portabase"
|
||||
|
||||
msg_info "Building Portabase"
|
||||
@@ -105,7 +111,7 @@ systemctl enable -q --now portabase-tusd portabase
|
||||
msg_ok "Created Services"
|
||||
|
||||
msg_info "Configuring Nginx"
|
||||
cat <<'EOF' >/etc/nginx/conf.d/portabase.conf
|
||||
cat <<'EOF' >/etc/nginx/sites-available/portabase
|
||||
map $http_x_forwarded_proto $forwarded_proto {
|
||||
default $scheme;
|
||||
"~*^\s*(https?)\s*(?:,|$)" $1;
|
||||
@@ -149,8 +155,7 @@ server {
|
||||
}
|
||||
}
|
||||
EOF
|
||||
rm -f /etc/nginx/sites-enabled/default
|
||||
systemctl restart nginx
|
||||
nginx_enable_site portabase
|
||||
msg_ok "Configured Nginx"
|
||||
|
||||
motd_ssh
|
||||
|
||||
Reference in New Issue
Block a user