Skip to content

Commit bc28c33

Browse files
committed
apply suggestions
1 parent 54a69a9 commit bc28c33

File tree

3 files changed

+26
-67
lines changed

3 files changed

+26
-67
lines changed

ct/ghostfolio.sh

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env bash
2-
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
2+
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func)
33
# Copyright (c) 2021-2025 community-scripts ORG
44
# Author: lucasfell
55
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
@@ -38,18 +38,25 @@ function update_script() {
3838
msg_ok "Backup Created"
3939

4040
msg_info "Updating $APP"
41-
cd /opt/ghostfolio
42-
git fetch --all
43-
RELEASE=$(git describe --tags --abbrev=0 origin/main)
44-
if [[ "${RELEASE}" != "$(cat /opt/ghostfolio_version.txt)" ]] || [[ ! -f /opt/ghostfolio_version.txt ]]; then
45-
git checkout ${RELEASE}
41+
systemctl stop ghostfolio
42+
43+
if [[ -d /opt/ghostfolio ]]; then
44+
rm -rf /opt/ghostfolio_backup
45+
mv /opt/ghostfolio /opt/ghostfolio_backup
46+
fi
47+
48+
if fetch_and_deploy_gh_release "ghostfolio" "ghostfolio/ghostfolio" "tarball" "latest" "/opt/ghostfolio"; then
49+
cd /opt/ghostfolio
4650
npm ci
4751
npm run build:production
48-
npm run database:migrate
49-
echo "${RELEASE}" >/opt/ghostfolio_version.txt
50-
msg_ok "Updated $APP to ${RELEASE}"
52+
npx prisma migrate deploy
53+
msg_ok "Updated $APP"
5154
else
52-
msg_ok "No update required. ${APP} is already at ${RELEASE}"
55+
if [[ -d /opt/ghostfolio_backup ]]; then
56+
rm -rf /opt/ghostfolio
57+
mv /opt/ghostfolio_backup /opt/ghostfolio
58+
fi
59+
msg_ok "No update required or update failed. ${APP} is up to date"
5360
fi
5461

5562
msg_info "Starting $APP"

frontend/public/json/ghostfolio.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
{
22
"name": "Ghostfolio",
33
"slug": "ghostfolio",
4-
"categories": [23],
4+
"categories": [
5+
23
6+
],
57
"date_created": "2025-08-14",
68
"type": "ct",
79
"updateable": true,

install/ghostfolio-install.sh

Lines changed: 6 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ update_os
1515

1616
msg_info "Installing Dependencies"
1717
$STD apt-get install -y \
18-
git \
1918
build-essential \
2019
python3 \
2120
openssl \
@@ -24,14 +23,12 @@ $STD apt-get install -y \
2423
msg_ok "Installed Dependencies"
2524

2625
PG_VERSION="15" setup_postgresql
26+
NODE_VERSION="22" setup_nodejs
2727

2828
msg_info "Installing Redis"
2929
$STD apt-get install -y redis-server
30-
systemctl enable -q --now redis-server
3130
msg_ok "Installed Redis"
3231

33-
NODE_VERSION="22" setup_nodejs
34-
3532
msg_info "Setting up Database"
3633
DB_NAME=ghostfolio
3734
DB_USER=ghostfolio
@@ -47,7 +44,6 @@ $STD sudo -u postgres psql -d $DB_NAME -c "GRANT ALL ON SCHEMA public TO $DB_USE
4744
$STD sudo -u postgres psql -d $DB_NAME -c "GRANT CREATE ON SCHEMA public TO $DB_USER;"
4845
$STD sudo -u postgres psql -d $DB_NAME -c "ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL ON TABLES TO $DB_USER;"
4946
$STD sudo -u postgres psql -d $DB_NAME -c "ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL ON SEQUENCES TO $DB_USER;"
50-
5147
{
5248
echo "Ghostfolio Credentials"
5349
echo "Database User: $DB_USER"
@@ -72,55 +68,16 @@ sed -i "s/# requirepass foobared/requirepass $REDIS_PASS/" /etc/redis/redis.conf
7268
systemctl restart redis-server
7369
msg_ok "Configured Redis"
7470

75-
msg_info "Cloning Ghostfolio"
76-
cd /opt
77-
$STD git clone https://github.com/ghostfolio/ghostfolio.git
78-
cd ghostfolio
79-
RELEASE=$(git describe --tags --abbrev=0)
80-
git checkout $RELEASE
81-
msg_ok "Cloned Ghostfolio $RELEASE"
82-
83-
msg_info "Checking Build Resources"
84-
current_ram=$(free -m | awk 'NR==2{print $2}')
85-
if [[ "$current_ram" -lt 3584 ]]; then
86-
msg_warn "Current RAM: ${current_ram}MB. Ghostfolio build requires ~4GB RAM for optimal performance."
87-
msg_info "Creating temporary swap file for build process"
88-
89-
# Check if swap already exists
90-
if ! swapon --noheadings --show | grep -q 'swap'; then
91-
TEMP_SWAP_FILE="/tmp/ghostfolio_build_swap"
92-
$STD dd if=/dev/zero of="$TEMP_SWAP_FILE" bs=1M count=1024
93-
$STD chmod 600 "$TEMP_SWAP_FILE"
94-
$STD mkswap "$TEMP_SWAP_FILE"
95-
$STD swapon "$TEMP_SWAP_FILE"
96-
SWAP_CREATED=true
97-
msg_ok "Created 1GB temporary swap file"
98-
else
99-
msg_ok "Existing swap detected"
100-
SWAP_CREATED=false
101-
fi
102-
else
103-
msg_ok "Sufficient RAM available for build"
104-
SWAP_CREATED=false
105-
fi
71+
fetch_and_deploy_gh_release "ghostfolio" "ghostfolio/ghostfolio" "tarball" "latest" "/opt/ghostfolio"
10672

10773
msg_info "Installing Ghostfolio Dependencies"
108-
export NODE_OPTIONS="--max-old-space-size=3584"
109-
$STD npm ci
74+
npm ci
11075
msg_ok "Installed Dependencies"
11176

11277
msg_info "Building Ghostfolio (This may take several minutes)"
113-
$STD npm run build:production
78+
npm run build:production
11479
msg_ok "Built Ghostfolio"
11580

116-
# Clean up temporary swap if we created it
117-
if [[ "$SWAP_CREATED" == "true" ]]; then
118-
msg_info "Cleaning up temporary swap file"
119-
$STD swapoff "$TEMP_SWAP_FILE"
120-
$STD rm -f "$TEMP_SWAP_FILE"
121-
msg_ok "Removed temporary swap file"
122-
fi
123-
12481
msg_info "Optional CoinGecko API Configuration"
12582
echo
12683
echo -e "${YW}CoinGecko API keys are optional but provide better cryptocurrency data.${CL}"
@@ -153,8 +110,8 @@ msg_ok "Set up Environment"
153110

154111
msg_info "Running Database Migrations"
155112
cd /opt/ghostfolio
156-
$STD npx prisma migrate deploy
157-
$STD npx prisma db seed
113+
npx prisma migrate deploy
114+
npx prisma db seed
158115
msg_ok "Database Migrations Complete"
159116

160117
msg_info "Creating Service"
@@ -179,7 +136,6 @@ WantedBy=multi-user.target
179136
EOF
180137

181138
systemctl enable -q --now ghostfolio
182-
echo "$RELEASE" >/opt/ghostfolio_version.txt
183139
msg_ok "Created Service"
184140

185141
motd_ssh
@@ -190,9 +146,3 @@ npm cache clean --force
190146
$STD apt-get -y autoremove
191147
$STD apt-get -y autoclean
192148
msg_ok "Cleaned"
193-
194-
msg_info "Installation Complete"
195-
echo -e "${INFO}${YW}Ghostfolio is now running and accessible at http://$(hostname -I | awk '{print $1}'):3333${CL}"
196-
echo -e "${INFO}${YW}Runtime memory usage: ~2GB (you can reduce container memory to 2GB if desired)${CL}"
197-
echo -e "${INFO}${YW}First user to register will automatically get admin privileges${CL}"
198-
msg_ok "Setup Complete"

0 commit comments

Comments
 (0)