From f4be7b6f24d8e7c8d3a45dff79c0168654bc61de Mon Sep 17 00:00:00 2001 From: Lucas Fell Date: Thu, 14 Aug 2025 23:03:32 -0300 Subject: [PATCH 1/7] wip: add ghostfolio --- ct/ghostfolio.sh | 72 +++++++++++++++ frontend/public/json/ghostfolio.json | 46 ++++++++++ install/ghostfolio-install.sh | 132 +++++++++++++++++++++++++++ 3 files changed, 250 insertions(+) create mode 100644 ct/ghostfolio.sh create mode 100644 frontend/public/json/ghostfolio.json create mode 100644 install/ghostfolio-install.sh diff --git a/ct/ghostfolio.sh b/ct/ghostfolio.sh new file mode 100644 index 00000000..19316226 --- /dev/null +++ b/ct/ghostfolio.sh @@ -0,0 +1,72 @@ +#!/usr/bin/env bash +source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) +# Copyright (c) 2021-2025 community-scripts ORG +# Author: lucasfell +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://ghostfol.io/ + +APP="Ghostfolio" +var_tags="${var_tags:-finance;investment}" +var_cpu="${var_cpu:-2}" +var_ram="${var_ram:-2048}" +var_disk="${var_disk:-8}" +var_os="${var_os:-debian}" +var_version="${var_version:-12}" +var_unprivileged="${var_unprivileged:-1}" + +header_info "$APP" +variables +color +catch_errors + +function update_script() { + header_info + check_container_storage + check_container_resources + + if [[ ! -f /opt/ghostfolio/dist/apps/api/main.js ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + + msg_info "Stopping $APP" + systemctl stop ghostfolio + msg_ok "Stopped $APP" + + msg_info "Creating Backup" + tar -czf "/opt/ghostfolio_backup_$(date +%F).tar.gz" /opt/ghostfolio + msg_ok "Backup Created" + + msg_info "Updating $APP" + cd /opt/ghostfolio + git fetch --all + RELEASE=$(git describe --tags --abbrev=0 origin/main) + if [[ "${RELEASE}" != "$(cat /opt/ghostfolio_version.txt)" ]] || [[ ! -f /opt/ghostfolio_version.txt ]]; then + git checkout ${RELEASE} + npm ci + npm run build:production + npm run database:migrate + echo "${RELEASE}" >/opt/ghostfolio_version.txt + msg_ok "Updated $APP to ${RELEASE}" + else + msg_ok "No update required. ${APP} is already at ${RELEASE}" + fi + + msg_info "Starting $APP" + systemctl start ghostfolio + msg_ok "Started $APP" + + msg_info "Cleaning Up" + npm cache clean --force + msg_ok "Cleanup Completed" + exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}" +echo -e "${INFO}${YW} Access it using the following URL:${CL}" +echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:3333${CL}" diff --git a/frontend/public/json/ghostfolio.json b/frontend/public/json/ghostfolio.json new file mode 100644 index 00000000..48230624 --- /dev/null +++ b/frontend/public/json/ghostfolio.json @@ -0,0 +1,46 @@ +{ + "name": "Ghostfolio", + "slug": "ghostfolio", + "categories": [23], + "date_created": "2025-08-14", + "type": "ct", + "updateable": true, + "privileged": false, + "interface_port": 3333, + "documentation": "https://github.com/ghostfolio/ghostfolio?tab=readme-ov-file#self-hosting", + "website": "https://ghostfol.io/", + "logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/ghostfolio.webp", + "config_path": "/opt/ghostfolio/.env", + "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.", + "install_methods": [ + { + "type": "default", + "script": "ct/ghostfolio.sh", + "resources": { + "cpu": 2, + "ram": 2048, + "hdd": 8, + "os": "debian", + "version": "12" + } + } + ], + "default_credentials": { + "username": null, + "password": null + }, + "notes": [ + { + "text": "Create your first user account by visiting the web interface and clicking 'Get Started'. The first user will automatically get admin privileges.", + "type": "info" + }, + { + "text": "Database and Redis credentials: `cat ~/ghostfolio.creds`", + "type": "info" + }, + { + "text": "Configuration file: `/opt/ghostfolio/.env`", + "type": "info" + } + ] +} diff --git a/install/ghostfolio-install.sh b/install/ghostfolio-install.sh new file mode 100644 index 00000000..58809daa --- /dev/null +++ b/install/ghostfolio-install.sh @@ -0,0 +1,132 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2025 community-scripts ORG +# Author: lucasfell +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://ghostfol.io/ + +source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +msg_info "Installing Dependencies" +$STD apt-get install -y \ + git \ + build-essential \ + python3 \ + openssl \ + curl \ + ca-certificates +msg_ok "Installed Dependencies" + +PG_VERSION="15" setup_postgresql + +msg_info "Installing Redis" +$STD apt-get install -y redis-server +systemctl enable -q --now redis-server +msg_ok "Installed Redis" + +NODE_VERSION="22" setup_nodejs + +msg_info "Setting up Database" +DB_NAME=ghostfolio +DB_USER=ghostfolio +DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13) +REDIS_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13) +ACCESS_TOKEN_SALT=$(openssl rand -base64 32) +JWT_SECRET_KEY=$(openssl rand -base64 32) + +$STD sudo -u postgres psql -c "CREATE DATABASE $DB_NAME;" +$STD sudo -u postgres psql -c "CREATE USER $DB_USER WITH ENCRYPTED PASSWORD '$DB_PASS';" +$STD sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE $DB_NAME TO $DB_USER;" +$STD sudo -u postgres psql -c "ALTER USER $DB_USER CREATEDB;" + +{ + echo "Ghostfolio Credentials" + echo "Database User: $DB_USER" + echo "Database Password: $DB_PASS" + echo "Database Name: $DB_NAME" + echo "Redis Password: $REDIS_PASS" + echo "Access Token Salt: $ACCESS_TOKEN_SALT" + echo "JWT Secret Key: $JWT_SECRET_KEY" +} >>~/ghostfolio.creds +msg_ok "Set up Database" + +msg_info "Configuring Redis" +sed -i "s/# requirepass foobared/requirepass $REDIS_PASS/" /etc/redis/redis.conf +systemctl restart redis-server +msg_ok "Configured Redis" + +msg_info "Cloning 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 "Installing Ghostfolio Dependencies" +$STD npm ci +msg_ok "Installed Dependencies" + +msg_info "Building Ghostfolio" +$STD npm run build:production +msg_ok "Built Ghostfolio" + +msg_info "Setting up Environment" +cat </opt/ghostfolio/.env +DATABASE_URL=postgresql://$DB_USER:$DB_PASS@localhost:5432/$DB_NAME?connect_timeout=300&sslmode=prefer +REDIS_HOST=localhost +REDIS_PORT=6379 +REDIS_PASSWORD=$REDIS_PASS +ACCESS_TOKEN_SALT=$ACCESS_TOKEN_SALT +JWT_SECRET_KEY=$JWT_SECRET_KEY +NODE_ENV=production +PORT=3333 +HOST=0.0.0.0 +EOF +msg_ok "Set up Environment" + +msg_info "Running Database Migrations" +cd /opt/ghostfolio/dist/apps/api +$STD npx prisma migrate deploy +$STD npx prisma db seed +msg_ok "Database Migrations Complete" + +msg_info "Creating Service" +cat </etc/systemd/system/ghostfolio.service +[Unit] +Description=Ghostfolio Investment Tracker +After=network.target postgresql.service redis-server.service +Wants=postgresql.service redis-server.service + +[Service] +Type=simple +User=root +WorkingDirectory=/opt/ghostfolio/dist/apps/api +Environment=NODE_ENV=production +EnvironmentFile=/opt/ghostfolio/.env +ExecStart=/usr/bin/node main.js +Restart=always +RestartSec=10 + +[Install] +WantedBy=multi-user.target +EOF + +systemctl enable -q --now ghostfolio +echo "$RELEASE" >/opt/ghostfolio_version.txt +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +npm cache clean --force +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" From ff6b151929fdde0843ae120d2b1562a344a7396d Mon Sep 17 00:00:00 2001 From: Lucas Fell Date: Thu, 14 Aug 2025 23:31:06 -0300 Subject: [PATCH 2/7] increase ram to 4gb during build add optional coingecko env keys --- ct/ghostfolio.sh | 2 +- frontend/public/json/ghostfolio.json | 10 ++++- install/ghostfolio-install.sh | 66 +++++++++++++++++++++++++++- 3 files changed, 75 insertions(+), 3 deletions(-) diff --git a/ct/ghostfolio.sh b/ct/ghostfolio.sh index 19316226..1ad15294 100644 --- a/ct/ghostfolio.sh +++ b/ct/ghostfolio.sh @@ -8,7 +8,7 @@ source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxV APP="Ghostfolio" var_tags="${var_tags:-finance;investment}" var_cpu="${var_cpu:-2}" -var_ram="${var_ram:-2048}" +var_ram="${var_ram:-4096}" var_disk="${var_disk:-8}" var_os="${var_os:-debian}" var_version="${var_version:-12}" diff --git a/frontend/public/json/ghostfolio.json b/frontend/public/json/ghostfolio.json index 48230624..224bd7bb 100644 --- a/frontend/public/json/ghostfolio.json +++ b/frontend/public/json/ghostfolio.json @@ -18,7 +18,7 @@ "script": "ct/ghostfolio.sh", "resources": { "cpu": 2, - "ram": 2048, + "ram": 4096, "hdd": 8, "os": "debian", "version": "12" @@ -41,6 +41,14 @@ { "text": "Configuration file: `/opt/ghostfolio/.env`", "type": "info" + }, + { + "text": "Optional: CoinGecko API keys can be added during installation or later in the .env file for enhanced cryptocurrency data.", + "type": "info" + }, + { + "text": "Build process requires 4GB RAM (runtime: ~2GB). A temporary swap file will be created automatically if insufficient memory is detected.", + "type": "warning" } ] } diff --git a/install/ghostfolio-install.sh b/install/ghostfolio-install.sh index 58809daa..8ead0611 100644 --- a/install/ghostfolio-install.sh +++ b/install/ghostfolio-install.sh @@ -53,6 +53,14 @@ $STD sudo -u postgres psql -c "ALTER USER $DB_USER CREATEDB;" echo "Redis Password: $REDIS_PASS" echo "Access Token Salt: $ACCESS_TOKEN_SALT" echo "JWT Secret Key: $JWT_SECRET_KEY" + if [[ -n "$COINGECKO_DEMO_KEY" ]]; then + echo "CoinGecko Demo API Key: $COINGECKO_DEMO_KEY" + fi + if [[ -n "$COINGECKO_PRO_KEY" ]]; then + echo "CoinGecko Pro API Key: $COINGECKO_PRO_KEY" + fi + echo "" + echo "To add CoinGecko API keys later, edit: /opt/ghostfolio/.env" } >>~/ghostfolio.creds msg_ok "Set up Database" @@ -69,14 +77,55 @@ 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" +export NODE_OPTIONS="--max-old-space-size=3584" $STD npm ci msg_ok "Installed Dependencies" -msg_info "Building Ghostfolio" +msg_info "Building Ghostfolio (This may take several minutes)" $STD npm run build:production 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" +echo +echo -e "${YW}CoinGecko API keys are optional but provide better cryptocurrency data.${CL}" +echo -e "${YW}You can skip this and add them later by editing /opt/ghostfolio/.env${CL}" +echo +read -rp "${TAB3}Enter CoinGecko Demo API key (optional, press Enter to skip): " COINGECKO_DEMO_KEY +read -rp "${TAB3}Enter CoinGecko Pro API key (optional, press Enter to skip): " COINGECKO_PRO_KEY + msg_info "Setting up Environment" cat </opt/ghostfolio/.env DATABASE_URL=postgresql://$DB_USER:$DB_PASS@localhost:5432/$DB_NAME?connect_timeout=300&sslmode=prefer @@ -89,6 +138,15 @@ NODE_ENV=production PORT=3333 HOST=0.0.0.0 EOF + +if [[ -n "$COINGECKO_DEMO_KEY" ]]; then + echo "API_KEY_COINGECKO_DEMO=$COINGECKO_DEMO_KEY" >>/opt/ghostfolio/.env +fi + +if [[ -n "$COINGECKO_PRO_KEY" ]]; then + echo "API_KEY_COINGECKO_PRO=$COINGECKO_PRO_KEY" >>/opt/ghostfolio/.env +fi + msg_ok "Set up Environment" msg_info "Running Database Migrations" @@ -130,3 +188,9 @@ npm cache clean --force $STD apt-get -y autoremove $STD apt-get -y autoclean 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" From 6242c3894f17556221b3a7ab7392c71d48e16a3a Mon Sep 17 00:00:00 2001 From: Lucas Fell Date: Fri, 15 Aug 2025 00:26:02 -0300 Subject: [PATCH 3/7] fix env and migrations --- install/ghostfolio-install.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/install/ghostfolio-install.sh b/install/ghostfolio-install.sh index 8ead0611..d03da549 100644 --- a/install/ghostfolio-install.sh +++ b/install/ghostfolio-install.sh @@ -44,6 +44,10 @@ $STD sudo -u postgres psql -c "CREATE DATABASE $DB_NAME;" $STD sudo -u postgres psql -c "CREATE USER $DB_USER WITH ENCRYPTED PASSWORD '$DB_PASS';" $STD sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE $DB_NAME TO $DB_USER;" $STD sudo -u postgres psql -c "ALTER USER $DB_USER CREATEDB;" +$STD sudo -u postgres psql -d $DB_NAME -c "GRANT ALL 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 SEQUENCES TO $DB_USER;" { echo "Ghostfolio Credentials" @@ -53,10 +57,10 @@ $STD sudo -u postgres psql -c "ALTER USER $DB_USER CREATEDB;" echo "Redis Password: $REDIS_PASS" echo "Access Token Salt: $ACCESS_TOKEN_SALT" echo "JWT Secret Key: $JWT_SECRET_KEY" - if [[ -n "$COINGECKO_DEMO_KEY" ]]; then + if [[ -n "${COINGECKO_DEMO_KEY:-}" ]]; then echo "CoinGecko Demo API Key: $COINGECKO_DEMO_KEY" fi - if [[ -n "$COINGECKO_PRO_KEY" ]]; then + if [[ -n "${COINGECKO_PRO_KEY:-}" ]]; then echo "CoinGecko Pro API Key: $COINGECKO_PRO_KEY" fi echo "" @@ -139,18 +143,18 @@ PORT=3333 HOST=0.0.0.0 EOF -if [[ -n "$COINGECKO_DEMO_KEY" ]]; then +if [[ -n "${COINGECKO_DEMO_KEY:-}" ]]; then echo "API_KEY_COINGECKO_DEMO=$COINGECKO_DEMO_KEY" >>/opt/ghostfolio/.env fi -if [[ -n "$COINGECKO_PRO_KEY" ]]; then +if [[ -n "${COINGECKO_PRO_KEY:-}" ]]; then echo "API_KEY_COINGECKO_PRO=$COINGECKO_PRO_KEY" >>/opt/ghostfolio/.env fi msg_ok "Set up Environment" msg_info "Running Database Migrations" -cd /opt/ghostfolio/dist/apps/api +cd /opt/ghostfolio $STD npx prisma migrate deploy $STD npx prisma db seed msg_ok "Database Migrations Complete" From fd2fbd36db662723751353fa0a5bbac73919638d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Slavi=C5=A1a=20Are=C5=BEina?= <58952836+tremor021@users.noreply.github.com> Date: Fri, 15 Aug 2025 14:45:50 +0200 Subject: [PATCH 4/7] Update install/ghostfolio-install.sh --- install/ghostfolio-install.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/install/ghostfolio-install.sh b/install/ghostfolio-install.sh index d03da549..b3b0efbd 100644 --- a/install/ghostfolio-install.sh +++ b/install/ghostfolio-install.sh @@ -150,7 +150,6 @@ fi if [[ -n "${COINGECKO_PRO_KEY:-}" ]]; then echo "API_KEY_COINGECKO_PRO=$COINGECKO_PRO_KEY" >>/opt/ghostfolio/.env fi - msg_ok "Set up Environment" msg_info "Running Database Migrations" From 54a69a9922eddd475a1113a09c1ce4788fe3ca12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Slavi=C5=A1a=20Are=C5=BEina?= <58952836+tremor021@users.noreply.github.com> Date: Fri, 15 Aug 2025 14:46:14 +0200 Subject: [PATCH 5/7] Update install/ghostfolio-install.sh --- install/ghostfolio-install.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/install/ghostfolio-install.sh b/install/ghostfolio-install.sh index b3b0efbd..6e5cf232 100644 --- a/install/ghostfolio-install.sh +++ b/install/ghostfolio-install.sh @@ -39,7 +39,6 @@ DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13) REDIS_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13) ACCESS_TOKEN_SALT=$(openssl rand -base64 32) JWT_SECRET_KEY=$(openssl rand -base64 32) - $STD sudo -u postgres psql -c "CREATE DATABASE $DB_NAME;" $STD sudo -u postgres psql -c "CREATE USER $DB_USER WITH ENCRYPTED PASSWORD '$DB_PASS';" $STD sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE $DB_NAME TO $DB_USER;" From bc28c336e4033acf7d17dfb3184c18acddeeea65 Mon Sep 17 00:00:00 2001 From: Lucas Fell Date: Fri, 15 Aug 2025 09:54:29 -0300 Subject: [PATCH 6/7] apply suggestions --- ct/ghostfolio.sh | 27 +++++++----- frontend/public/json/ghostfolio.json | 4 +- install/ghostfolio-install.sh | 62 +++------------------------- 3 files changed, 26 insertions(+), 67 deletions(-) diff --git a/ct/ghostfolio.sh b/ct/ghostfolio.sh index 1ad15294..6595d5f7 100644 --- a/ct/ghostfolio.sh +++ b/ct/ghostfolio.sh @@ -1,5 +1,5 @@ #!/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 # Author: lucasfell # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE @@ -38,18 +38,25 @@ function update_script() { msg_ok "Backup Created" msg_info "Updating $APP" - cd /opt/ghostfolio - git fetch --all - RELEASE=$(git describe --tags --abbrev=0 origin/main) - if [[ "${RELEASE}" != "$(cat /opt/ghostfolio_version.txt)" ]] || [[ ! -f /opt/ghostfolio_version.txt ]]; then - git checkout ${RELEASE} + systemctl stop ghostfolio + + if [[ -d /opt/ghostfolio ]]; then + rm -rf /opt/ghostfolio_backup + 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 run build:production - npm run database:migrate - echo "${RELEASE}" >/opt/ghostfolio_version.txt - msg_ok "Updated $APP to ${RELEASE}" + npx prisma migrate deploy + msg_ok "Updated $APP" 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 msg_info "Starting $APP" diff --git a/frontend/public/json/ghostfolio.json b/frontend/public/json/ghostfolio.json index 224bd7bb..84a2868e 100644 --- a/frontend/public/json/ghostfolio.json +++ b/frontend/public/json/ghostfolio.json @@ -1,7 +1,9 @@ { "name": "Ghostfolio", "slug": "ghostfolio", - "categories": [23], + "categories": [ + 23 + ], "date_created": "2025-08-14", "type": "ct", "updateable": true, diff --git a/install/ghostfolio-install.sh b/install/ghostfolio-install.sh index 6e5cf232..3ecd6707 100644 --- a/install/ghostfolio-install.sh +++ b/install/ghostfolio-install.sh @@ -15,7 +15,6 @@ update_os msg_info "Installing Dependencies" $STD apt-get install -y \ - git \ build-essential \ python3 \ openssl \ @@ -24,14 +23,12 @@ $STD apt-get install -y \ msg_ok "Installed Dependencies" PG_VERSION="15" setup_postgresql +NODE_VERSION="22" setup_nodejs msg_info "Installing Redis" $STD apt-get install -y redis-server -systemctl enable -q --now redis-server msg_ok "Installed Redis" -NODE_VERSION="22" setup_nodejs - msg_info "Setting up Database" DB_NAME=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 "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;" - { echo "Ghostfolio Credentials" 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 msg_ok "Configured Redis" -msg_info "Cloning 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 +fetch_and_deploy_gh_release "ghostfolio" "ghostfolio/ghostfolio" "tarball" "latest" "/opt/ghostfolio" msg_info "Installing Ghostfolio Dependencies" -export NODE_OPTIONS="--max-old-space-size=3584" -$STD npm ci +npm ci msg_ok "Installed Dependencies" msg_info "Building Ghostfolio (This may take several minutes)" -$STD npm run build:production +npm run build:production 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" echo 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" cd /opt/ghostfolio -$STD npx prisma migrate deploy -$STD npx prisma db seed +npx prisma migrate deploy +npx prisma db seed msg_ok "Database Migrations Complete" msg_info "Creating Service" @@ -179,7 +136,6 @@ WantedBy=multi-user.target EOF systemctl enable -q --now ghostfolio -echo "$RELEASE" >/opt/ghostfolio_version.txt msg_ok "Created Service" motd_ssh @@ -190,9 +146,3 @@ npm cache clean --force $STD apt-get -y autoremove $STD apt-get -y autoclean 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" From eadc3b6969d27b164ae134792fea2e91e0459bdf Mon Sep 17 00:00:00 2001 From: Lucas Fell Date: Fri, 15 Aug 2025 10:53:33 -0300 Subject: [PATCH 7/7] fix install --- install/ghostfolio-install.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/install/ghostfolio-install.sh b/install/ghostfolio-install.sh index 3ecd6707..9495cfef 100644 --- a/install/ghostfolio-install.sh +++ b/install/ghostfolio-install.sh @@ -71,6 +71,7 @@ msg_ok "Configured Redis" fetch_and_deploy_gh_release "ghostfolio" "ghostfolio/ghostfolio" "tarball" "latest" "/opt/ghostfolio" msg_info "Installing Ghostfolio Dependencies" +cd /opt/ghostfolio npm ci msg_ok "Installed Dependencies" @@ -78,13 +79,13 @@ msg_info "Building Ghostfolio (This may take several minutes)" npm run build:production msg_ok "Built Ghostfolio" -msg_info "Optional CoinGecko API Configuration" +msg_ok "Optional CoinGecko API Configuration" echo echo -e "${YW}CoinGecko API keys are optional but provide better cryptocurrency data.${CL}" echo -e "${YW}You can skip this and add them later by editing /opt/ghostfolio/.env${CL}" echo -read -rp "${TAB3}Enter CoinGecko Demo API key (optional, press Enter to skip): " COINGECKO_DEMO_KEY -read -rp "${TAB3}Enter CoinGecko Pro API key (optional, press Enter to skip): " COINGECKO_PRO_KEY +read -rp "${TAB3}CoinGecko Demo API key (press Enter to skip): " COINGECKO_DEMO_KEY +read -rp "${TAB3}CoinGecko Pro API key (press Enter to skip): " COINGECKO_PRO_KEY msg_info "Setting up Environment" cat </opt/ghostfolio/.env