Skip to content

Commit 780e5c1

Browse files
push-app-to-main[bot]MickLesktremor021
authored
Ghostfolio (#7982)
* 'Add new script' * Update frontend/public/json/ghostfolio.json Co-authored-by: Slaviša Arežina <[email protected]> * Apply suggestion from @tremor021 --------- Co-authored-by: push-app-to-main[bot] <203845782+push-app-to-main[bot]@users.noreply.github.com> Co-authored-by: CanbiZ <[email protected]> Co-authored-by: Slaviša Arežina <[email protected]>
1 parent ba10ec7 commit 780e5c1

File tree

4 files changed

+264
-0
lines changed

4 files changed

+264
-0
lines changed

ct/ghostfolio.sh

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
#!/usr/bin/env bash
2+
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
3+
# Copyright (c) 2021-2025 community-scripts ORG
4+
# Author: lucasfell
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://ghostfol.io/
7+
8+
APP="Ghostfolio"
9+
var_tags="${var_tags:-finance;investment}"
10+
var_cpu="${var_cpu:-2}"
11+
var_ram="${var_ram:-4096}"
12+
var_disk="${var_disk:-8}"
13+
var_os="${var_os:-debian}"
14+
var_version="${var_version:-13}"
15+
var_unprivileged="${var_unprivileged:-1}"
16+
17+
header_info "$APP"
18+
variables
19+
color
20+
catch_errors
21+
22+
function update_script() {
23+
header_info
24+
check_container_storage
25+
check_container_resources
26+
27+
if [[ ! -f /opt/ghostfolio/dist/apps/api/main.js ]]; then
28+
msg_error "No ${APP} Installation Found!"
29+
exit
30+
fi
31+
32+
if check_for_gh_release "ghostfolio" "ghostfolio/ghostfolio"; then
33+
msg_info "Stopping Service"
34+
systemctl stop ghostfolio
35+
msg_ok "Stopped Service"
36+
37+
msg_info "Creating Backup"
38+
tar -czf "/opt/ghostfolio_backup_$(date +%F).tar.gz" \
39+
-C /opt \
40+
--exclude="ghostfolio/node_modules" \
41+
--exclude="ghostfolio/dist" \
42+
ghostfolio
43+
mv /opt/ghostfolio/.env /opt/env.backup
44+
msg_ok "Backup Created"
45+
46+
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "ghostfolio" "ghostfolio/ghostfolio" "tarball" "latest" "/opt/ghostfolio"
47+
48+
msg_info "Updating Ghostfolio"
49+
mv /opt/env.backup /opt/ghostfolio/.env
50+
cd /opt/ghostfolio
51+
$STD npm ci
52+
$STD npm run build:production
53+
$STD npx prisma migrate deploy
54+
msg_ok "Updated Ghostfolio"
55+
56+
msg_info "Starting Service"
57+
systemctl start ghostfolio
58+
msg_ok "Started Service"
59+
60+
msg_info "Cleaning Up"
61+
$STD npm cache clean --force
62+
msg_ok "Cleanup Completed"
63+
msg_ok "Updated Successfully"
64+
fi
65+
exit
66+
}
67+
68+
start
69+
build_container
70+
description
71+
72+
msg_ok "Completed Successfully!\n"
73+
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
74+
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
75+
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:3333${CL}"

ct/headers/ghostfolio

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
________ __ ____ ___
2+
/ ____/ /_ ____ _____/ /_/ __/___ / (_)___
3+
/ / __/ __ \/ __ \/ ___/ __/ /_/ __ \/ / / __ \
4+
/ /_/ / / / / /_/ (__ ) /_/ __/ /_/ / / / /_/ /
5+
\____/_/ /_/\____/____/\__/_/ \____/_/_/\____/
6+
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
{
2+
"name": "Ghostfolio",
3+
"slug": "ghostfolio",
4+
"categories": [
5+
23
6+
],
7+
"date_created": "2025-08-14",
8+
"type": "ct",
9+
"updateable": true,
10+
"privileged": false,
11+
"interface_port": 3333,
12+
"documentation": "https://github.com/ghostfolio/ghostfolio?tab=readme-ov-file#self-hosting",
13+
"website": "https://ghostfol.io/",
14+
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/ghostfolio.webp",
15+
"config_path": "/opt/ghostfolio/.env",
16+
"description": "Ghostfolio is an open source wealth management software built with web technology. The application empowers busy people to keep track of stocks, ETFs or cryptocurrencies and make solid, data-driven investment decisions.",
17+
"install_methods": [
18+
{
19+
"type": "default",
20+
"script": "ct/ghostfolio.sh",
21+
"resources": {
22+
"cpu": 2,
23+
"ram": 4096,
24+
"hdd": 8,
25+
"os": "debian",
26+
"version": "13"
27+
}
28+
}
29+
],
30+
"default_credentials": {
31+
"username": null,
32+
"password": null
33+
},
34+
"notes": [
35+
{
36+
"text": "Create your first user account by visiting the web interface and clicking 'Get Started'. The first user will automatically get admin privileges.",
37+
"type": "info"
38+
},
39+
{
40+
"text": "Database and Redis credentials: `cat ~/ghostfolio.creds`",
41+
"type": "info"
42+
},
43+
{
44+
"text": "Optional: CoinGecko API keys can be added during installation or later in the .env file for enhanced cryptocurrency data.",
45+
"type": "info"
46+
},
47+
{
48+
"text": "Build process requires 4GB RAM (runtime: ~2GB). A temporary swap file will be created automatically if insufficient memory is detected.",
49+
"type": "warning"
50+
}
51+
]
52+
}

install/ghostfolio-install.sh

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright (c) 2021-2025 community-scripts ORG
4+
# Author: lucasfell
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://ghostfol.io/
7+
8+
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
9+
color
10+
verb_ip6
11+
catch_errors
12+
setting_up_container
13+
network_check
14+
update_os
15+
16+
msg_info "Installing Dependencies"
17+
$STD apt install -y \
18+
build-essential \
19+
openssl \
20+
ca-certificates \
21+
redis-server
22+
msg_ok "Installed Dependencies"
23+
24+
PG_VERSION="17" setup_postgresql
25+
NODE_VERSION="24" setup_nodejs
26+
27+
msg_info "Setting up Database"
28+
DB_NAME=ghostfolio
29+
DB_USER=ghostfolio
30+
DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13)
31+
REDIS_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13)
32+
ACCESS_TOKEN_SALT=$(openssl rand -base64 32)
33+
JWT_SECRET_KEY=$(openssl rand -base64 32)
34+
$STD sudo -u postgres psql -c "CREATE DATABASE $DB_NAME;"
35+
$STD sudo -u postgres psql -c "CREATE USER $DB_USER WITH ENCRYPTED PASSWORD '$DB_PASS';"
36+
$STD sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE $DB_NAME TO $DB_USER;"
37+
$STD sudo -u postgres psql -c "ALTER USER $DB_USER CREATEDB;"
38+
$STD sudo -u postgres psql -d $DB_NAME -c "GRANT ALL ON SCHEMA public TO $DB_USER;"
39+
$STD sudo -u postgres psql -d $DB_NAME -c "GRANT CREATE ON SCHEMA public TO $DB_USER;"
40+
$STD sudo -u postgres psql -d $DB_NAME -c "ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL ON TABLES TO $DB_USER;"
41+
$STD sudo -u postgres psql -d $DB_NAME -c "ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL ON SEQUENCES TO $DB_USER;"
42+
{
43+
echo "Ghostfolio Credentials"
44+
echo "Database User: $DB_USER"
45+
echo "Database Password: $DB_PASS"
46+
echo "Database Name: $DB_NAME"
47+
echo "Redis Password: $REDIS_PASS"
48+
echo "Access Token Salt: $ACCESS_TOKEN_SALT"
49+
echo "JWT Secret Key: $JWT_SECRET_KEY"
50+
} >>~/ghostfolio.creds
51+
msg_ok "Set up Database"
52+
53+
fetch_and_deploy_gh_release "ghostfolio" "ghostfolio/ghostfolio" "tarball" "latest" "/opt/ghostfolio"
54+
55+
msg_info "Setup Ghostfolio"
56+
sed -i "s/# requirepass foobared/requirepass $REDIS_PASS/" /etc/redis/redis.conf
57+
systemctl restart redis-server
58+
cd /opt/ghostfolio
59+
$STD npm ci
60+
$STD npm run build:production
61+
msg_ok "Built Ghostfolio"
62+
63+
msg_ok "Optional CoinGecko API Configuration"
64+
echo
65+
echo -e "${YW}CoinGecko API keys are optional but provide better cryptocurrency data.${CL}"
66+
echo -e "${YW}You can skip this and add them later by editing /opt/ghostfolio/.env${CL}"
67+
echo
68+
read -rp "${TAB3}CoinGecko Demo API key (press Enter to skip): " COINGECKO_DEMO_KEY
69+
read -rp "${TAB3}CoinGecko Pro API key (press Enter to skip): " COINGECKO_PRO_KEY
70+
71+
msg_info "Setting up Environment"
72+
cat <<EOF >/opt/ghostfolio/.env
73+
DATABASE_URL=postgresql://$DB_USER:$DB_PASS@localhost:5432/$DB_NAME?connect_timeout=300&sslmode=prefer
74+
REDIS_HOST=localhost
75+
REDIS_PORT=6379
76+
REDIS_PASSWORD=$REDIS_PASS
77+
ACCESS_TOKEN_SALT=$ACCESS_TOKEN_SALT
78+
JWT_SECRET_KEY=$JWT_SECRET_KEY
79+
NODE_ENV=production
80+
PORT=3333
81+
HOST=0.0.0.0
82+
EOF
83+
84+
if [[ -n "${COINGECKO_DEMO_KEY:-}" ]]; then
85+
echo "API_KEY_COINGECKO_DEMO=$COINGECKO_DEMO_KEY" >>/opt/ghostfolio/.env
86+
fi
87+
88+
if [[ -n "${COINGECKO_PRO_KEY:-}" ]]; then
89+
echo "API_KEY_COINGECKO_PRO=$COINGECKO_PRO_KEY" >>/opt/ghostfolio/.env
90+
fi
91+
msg_ok "Set up Environment"
92+
93+
msg_info "Running Database Migrations"
94+
cd /opt/ghostfolio
95+
$STD npx prisma migrate deploy
96+
$STD npx prisma db seed
97+
msg_ok "Database Migrations Complete"
98+
99+
msg_info "Creating Service"
100+
cat <<EOF >/etc/systemd/system/ghostfolio.service
101+
[Unit]
102+
Description=Ghostfolio Investment Tracker
103+
After=network.target postgresql.service redis-server.service
104+
Wants=postgresql.service redis-server.service
105+
106+
[Service]
107+
Type=simple
108+
User=root
109+
WorkingDirectory=/opt/ghostfolio/dist/apps/api
110+
Environment=NODE_ENV=production
111+
EnvironmentFile=/opt/ghostfolio/.env
112+
ExecStart=/usr/bin/node main.js
113+
Restart=always
114+
RestartSec=10
115+
116+
[Install]
117+
WantedBy=multi-user.target
118+
EOF
119+
120+
systemctl enable -q --now ghostfolio
121+
msg_ok "Created Service"
122+
123+
motd_ssh
124+
customize
125+
126+
msg_info "Cleaning up"
127+
$STD npm cache clean --force
128+
$STD apt -y autoremove
129+
$STD apt -y autoclean
130+
$STD apt -y clean
131+
msg_ok "Cleaned"

0 commit comments

Comments
 (0)