apply suggestions
This commit is contained in:
parent
54a69a9922
commit
bc28c336e4
@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
|
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func)
|
||||||
# Copyright (c) 2021-2025 community-scripts ORG
|
# Copyright (c) 2021-2025 community-scripts ORG
|
||||||
# Author: lucasfell
|
# Author: lucasfell
|
||||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||||
@ -38,18 +38,25 @@ function update_script() {
|
|||||||
msg_ok "Backup Created"
|
msg_ok "Backup Created"
|
||||||
|
|
||||||
msg_info "Updating $APP"
|
msg_info "Updating $APP"
|
||||||
cd /opt/ghostfolio
|
systemctl stop ghostfolio
|
||||||
git fetch --all
|
|
||||||
RELEASE=$(git describe --tags --abbrev=0 origin/main)
|
if [[ -d /opt/ghostfolio ]]; then
|
||||||
if [[ "${RELEASE}" != "$(cat /opt/ghostfolio_version.txt)" ]] || [[ ! -f /opt/ghostfolio_version.txt ]]; then
|
rm -rf /opt/ghostfolio_backup
|
||||||
git checkout ${RELEASE}
|
mv /opt/ghostfolio /opt/ghostfolio_backup
|
||||||
|
fi
|
||||||
|
|
||||||
|
if fetch_and_deploy_gh_release "ghostfolio" "ghostfolio/ghostfolio" "tarball" "latest" "/opt/ghostfolio"; then
|
||||||
|
cd /opt/ghostfolio
|
||||||
npm ci
|
npm ci
|
||||||
npm run build:production
|
npm run build:production
|
||||||
npm run database:migrate
|
npx prisma migrate deploy
|
||||||
echo "${RELEASE}" >/opt/ghostfolio_version.txt
|
msg_ok "Updated $APP"
|
||||||
msg_ok "Updated $APP to ${RELEASE}"
|
|
||||||
else
|
else
|
||||||
msg_ok "No update required. ${APP} is already at ${RELEASE}"
|
if [[ -d /opt/ghostfolio_backup ]]; then
|
||||||
|
rm -rf /opt/ghostfolio
|
||||||
|
mv /opt/ghostfolio_backup /opt/ghostfolio
|
||||||
|
fi
|
||||||
|
msg_ok "No update required or update failed. ${APP} is up to date"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
msg_info "Starting $APP"
|
msg_info "Starting $APP"
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
{
|
{
|
||||||
"name": "Ghostfolio",
|
"name": "Ghostfolio",
|
||||||
"slug": "ghostfolio",
|
"slug": "ghostfolio",
|
||||||
"categories": [23],
|
"categories": [
|
||||||
|
23
|
||||||
|
],
|
||||||
"date_created": "2025-08-14",
|
"date_created": "2025-08-14",
|
||||||
"type": "ct",
|
"type": "ct",
|
||||||
"updateable": true,
|
"updateable": true,
|
||||||
|
@ -15,7 +15,6 @@ update_os
|
|||||||
|
|
||||||
msg_info "Installing Dependencies"
|
msg_info "Installing Dependencies"
|
||||||
$STD apt-get install -y \
|
$STD apt-get install -y \
|
||||||
git \
|
|
||||||
build-essential \
|
build-essential \
|
||||||
python3 \
|
python3 \
|
||||||
openssl \
|
openssl \
|
||||||
@ -24,14 +23,12 @@ $STD apt-get install -y \
|
|||||||
msg_ok "Installed Dependencies"
|
msg_ok "Installed Dependencies"
|
||||||
|
|
||||||
PG_VERSION="15" setup_postgresql
|
PG_VERSION="15" setup_postgresql
|
||||||
|
NODE_VERSION="22" setup_nodejs
|
||||||
|
|
||||||
msg_info "Installing Redis"
|
msg_info "Installing Redis"
|
||||||
$STD apt-get install -y redis-server
|
$STD apt-get install -y redis-server
|
||||||
systemctl enable -q --now redis-server
|
|
||||||
msg_ok "Installed Redis"
|
msg_ok "Installed Redis"
|
||||||
|
|
||||||
NODE_VERSION="22" setup_nodejs
|
|
||||||
|
|
||||||
msg_info "Setting up Database"
|
msg_info "Setting up Database"
|
||||||
DB_NAME=ghostfolio
|
DB_NAME=ghostfolio
|
||||||
DB_USER=ghostfolio
|
DB_USER=ghostfolio
|
||||||
@ -47,7 +44,6 @@ $STD sudo -u postgres psql -d $DB_NAME -c "GRANT ALL ON SCHEMA public TO $DB_USE
|
|||||||
$STD sudo -u postgres psql -d $DB_NAME -c "GRANT CREATE ON SCHEMA public TO $DB_USER;"
|
$STD sudo -u postgres psql -d $DB_NAME -c "GRANT CREATE ON SCHEMA public TO $DB_USER;"
|
||||||
$STD sudo -u postgres psql -d $DB_NAME -c "ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL ON TABLES TO $DB_USER;"
|
$STD sudo -u postgres psql -d $DB_NAME -c "ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL ON TABLES TO $DB_USER;"
|
||||||
$STD sudo -u postgres psql -d $DB_NAME -c "ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL ON SEQUENCES TO $DB_USER;"
|
$STD sudo -u postgres psql -d $DB_NAME -c "ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL ON SEQUENCES TO $DB_USER;"
|
||||||
|
|
||||||
{
|
{
|
||||||
echo "Ghostfolio Credentials"
|
echo "Ghostfolio Credentials"
|
||||||
echo "Database User: $DB_USER"
|
echo "Database User: $DB_USER"
|
||||||
@ -72,55 +68,16 @@ sed -i "s/# requirepass foobared/requirepass $REDIS_PASS/" /etc/redis/redis.conf
|
|||||||
systemctl restart redis-server
|
systemctl restart redis-server
|
||||||
msg_ok "Configured Redis"
|
msg_ok "Configured Redis"
|
||||||
|
|
||||||
msg_info "Cloning Ghostfolio"
|
fetch_and_deploy_gh_release "ghostfolio" "ghostfolio/ghostfolio" "tarball" "latest" "/opt/ghostfolio"
|
||||||
cd /opt
|
|
||||||
$STD git clone https://github.com/ghostfolio/ghostfolio.git
|
|
||||||
cd ghostfolio
|
|
||||||
RELEASE=$(git describe --tags --abbrev=0)
|
|
||||||
git checkout $RELEASE
|
|
||||||
msg_ok "Cloned Ghostfolio $RELEASE"
|
|
||||||
|
|
||||||
msg_info "Checking Build Resources"
|
|
||||||
current_ram=$(free -m | awk 'NR==2{print $2}')
|
|
||||||
if [[ "$current_ram" -lt 3584 ]]; then
|
|
||||||
msg_warn "Current RAM: ${current_ram}MB. Ghostfolio build requires ~4GB RAM for optimal performance."
|
|
||||||
msg_info "Creating temporary swap file for build process"
|
|
||||||
|
|
||||||
# Check if swap already exists
|
|
||||||
if ! swapon --noheadings --show | grep -q 'swap'; then
|
|
||||||
TEMP_SWAP_FILE="/tmp/ghostfolio_build_swap"
|
|
||||||
$STD dd if=/dev/zero of="$TEMP_SWAP_FILE" bs=1M count=1024
|
|
||||||
$STD chmod 600 "$TEMP_SWAP_FILE"
|
|
||||||
$STD mkswap "$TEMP_SWAP_FILE"
|
|
||||||
$STD swapon "$TEMP_SWAP_FILE"
|
|
||||||
SWAP_CREATED=true
|
|
||||||
msg_ok "Created 1GB temporary swap file"
|
|
||||||
else
|
|
||||||
msg_ok "Existing swap detected"
|
|
||||||
SWAP_CREATED=false
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
msg_ok "Sufficient RAM available for build"
|
|
||||||
SWAP_CREATED=false
|
|
||||||
fi
|
|
||||||
|
|
||||||
msg_info "Installing Ghostfolio Dependencies"
|
msg_info "Installing Ghostfolio Dependencies"
|
||||||
export NODE_OPTIONS="--max-old-space-size=3584"
|
npm ci
|
||||||
$STD npm ci
|
|
||||||
msg_ok "Installed Dependencies"
|
msg_ok "Installed Dependencies"
|
||||||
|
|
||||||
msg_info "Building Ghostfolio (This may take several minutes)"
|
msg_info "Building Ghostfolio (This may take several minutes)"
|
||||||
$STD npm run build:production
|
npm run build:production
|
||||||
msg_ok "Built Ghostfolio"
|
msg_ok "Built Ghostfolio"
|
||||||
|
|
||||||
# Clean up temporary swap if we created it
|
|
||||||
if [[ "$SWAP_CREATED" == "true" ]]; then
|
|
||||||
msg_info "Cleaning up temporary swap file"
|
|
||||||
$STD swapoff "$TEMP_SWAP_FILE"
|
|
||||||
$STD rm -f "$TEMP_SWAP_FILE"
|
|
||||||
msg_ok "Removed temporary swap file"
|
|
||||||
fi
|
|
||||||
|
|
||||||
msg_info "Optional CoinGecko API Configuration"
|
msg_info "Optional CoinGecko API Configuration"
|
||||||
echo
|
echo
|
||||||
echo -e "${YW}CoinGecko API keys are optional but provide better cryptocurrency data.${CL}"
|
echo -e "${YW}CoinGecko API keys are optional but provide better cryptocurrency data.${CL}"
|
||||||
@ -153,8 +110,8 @@ msg_ok "Set up Environment"
|
|||||||
|
|
||||||
msg_info "Running Database Migrations"
|
msg_info "Running Database Migrations"
|
||||||
cd /opt/ghostfolio
|
cd /opt/ghostfolio
|
||||||
$STD npx prisma migrate deploy
|
npx prisma migrate deploy
|
||||||
$STD npx prisma db seed
|
npx prisma db seed
|
||||||
msg_ok "Database Migrations Complete"
|
msg_ok "Database Migrations Complete"
|
||||||
|
|
||||||
msg_info "Creating Service"
|
msg_info "Creating Service"
|
||||||
@ -179,7 +136,6 @@ WantedBy=multi-user.target
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
systemctl enable -q --now ghostfolio
|
systemctl enable -q --now ghostfolio
|
||||||
echo "$RELEASE" >/opt/ghostfolio_version.txt
|
|
||||||
msg_ok "Created Service"
|
msg_ok "Created Service"
|
||||||
|
|
||||||
motd_ssh
|
motd_ssh
|
||||||
@ -190,9 +146,3 @@ npm cache clean --force
|
|||||||
$STD apt-get -y autoremove
|
$STD apt-get -y autoremove
|
||||||
$STD apt-get -y autoclean
|
$STD apt-get -y autoclean
|
||||||
msg_ok "Cleaned"
|
msg_ok "Cleaned"
|
||||||
|
|
||||||
msg_info "Installation Complete"
|
|
||||||
echo -e "${INFO}${YW}Ghostfolio is now running and accessible at http://$(hostname -I | awk '{print $1}'):3333${CL}"
|
|
||||||
echo -e "${INFO}${YW}Runtime memory usage: ~2GB (you can reduce container memory to 2GB if desired)${CL}"
|
|
||||||
echo -e "${INFO}${YW}First user to register will automatically get admin privileges${CL}"
|
|
||||||
msg_ok "Setup Complete"
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user