@@ -15,7 +15,6 @@ update_os
15
15
16
16
msg_info " Installing Dependencies"
17
17
$STD apt-get install -y \
18
- git \
19
18
build-essential \
20
19
python3 \
21
20
openssl \
@@ -24,14 +23,12 @@ $STD apt-get install -y \
24
23
msg_ok " Installed Dependencies"
25
24
26
25
PG_VERSION=" 15" setup_postgresql
26
+ NODE_VERSION=" 22" setup_nodejs
27
27
28
28
msg_info " Installing Redis"
29
29
$STD apt-get install -y redis-server
30
- systemctl enable -q --now redis-server
31
30
msg_ok " Installed Redis"
32
31
33
- NODE_VERSION=" 22" setup_nodejs
34
-
35
32
msg_info " Setting up Database"
36
33
DB_NAME=ghostfolio
37
34
DB_USER=ghostfolio
@@ -47,7 +44,6 @@ $STD sudo -u postgres psql -d $DB_NAME -c "GRANT ALL ON SCHEMA public TO $DB_USE
47
44
$STD sudo -u postgres psql -d $DB_NAME -c " GRANT CREATE ON SCHEMA public TO $DB_USER ;"
48
45
$STD sudo -u postgres psql -d $DB_NAME -c " ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL ON TABLES TO $DB_USER ;"
49
46
$STD sudo -u postgres psql -d $DB_NAME -c " ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL ON SEQUENCES TO $DB_USER ;"
50
-
51
47
{
52
48
echo " Ghostfolio Credentials"
53
49
echo " Database User: $DB_USER "
@@ -72,55 +68,16 @@ sed -i "s/# requirepass foobared/requirepass $REDIS_PASS/" /etc/redis/redis.conf
72
68
systemctl restart redis-server
73
69
msg_ok " Configured Redis"
74
70
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"
106
72
107
73
msg_info " Installing Ghostfolio Dependencies"
108
- export NODE_OPTIONS=" --max-old-space-size=3584"
109
- $STD npm ci
74
+ npm ci
110
75
msg_ok " Installed Dependencies"
111
76
112
77
msg_info " Building Ghostfolio (This may take several minutes)"
113
- $STD npm run build:production
78
+ npm run build:production
114
79
msg_ok " Built Ghostfolio"
115
80
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
-
124
81
msg_info " Optional CoinGecko API Configuration"
125
82
echo
126
83
echo -e " ${YW} CoinGecko API keys are optional but provide better cryptocurrency data.${CL} "
@@ -153,8 +110,8 @@ msg_ok "Set up Environment"
153
110
154
111
msg_info " Running Database Migrations"
155
112
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
158
115
msg_ok " Database Migrations Complete"
159
116
160
117
msg_info " Creating Service"
@@ -179,7 +136,6 @@ WantedBy=multi-user.target
179
136
EOF
180
137
181
138
systemctl enable -q --now ghostfolio
182
- echo " $RELEASE " > /opt/ghostfolio_version.txt
183
139
msg_ok " Created Service"
184
140
185
141
motd_ssh
@@ -190,9 +146,3 @@ npm cache clean --force
190
146
$STD apt-get -y autoremove
191
147
$STD apt-get -y autoclean
192
148
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