@ -87,6 +87,7 @@ msg_ok "Set up Redis"
#-- END REDIS CACHE
# GHOSTFOLIO =================================
msg_info "Set up Ghostfolio"
## Setup Vars
## default node to 20 (current required version, but determine from nvmrc later)
NODE_VERSION = 20
@ -112,6 +113,10 @@ $STD rm ghostfolio-$GHOSTFOLIO_VERSION.tgz
cd /opt/ghostfolio-$GHOSTFOLIO_VERSION
# Stash these so we have clean versions later
cp /opt/ghostfolio-$GHOSTFOLIO_VERSION /package.json /opt/ghostfolio-$GHOSTFOLIO_VERSION /package.json.bak
cp /opt/ghostfolio-$GHOSTFOLIO_VERSION /package-lock.json /opt/ghostfolio-$GHOSTFOLIO_VERSION /package-lock.json.bak
# Get node version and install node
test -f .nvmrc && NODE_VERSION = $( sed 's/^v\([0-9]*\)[.]*.*/\1/g' .nvmrc) # get first digits after an v, excluding potential .minor.patch versions
$STD curl -fsSL https://deb.nodesource.com/setup_$NODE_VERSION .x -o nodesource_setup.sh
@ -125,14 +130,15 @@ $STD npm install
$STD npm run build:production
# package.json was generated by the build process, however the original package-lock.json needs to be used to ensure the same versions
mv /opt/ghostfolio-$GHOSTFOLIO_VERSION /package-lock.json /opt/ghostfolio-$GHOSTFOLIO_VERSION /dist/apps/api/
mv /opt/ghostfolio-$GHOSTFOLIO_VERSION /package-lock.json.bak /opt/ghostfolio-$GHOSTFOLIO_VERSION /dist/apps/api/package-lock.json
cd /opt/ghostfolio-$GHOSTFOLIO_VERSION /dist/apps/api/
$STD npm install
mv /opt/ghostfolio-$GHOSTFOLIO_VERSION /prisma .
# Overwrite the generated package.json with the original one to ensure having all the scripts
mv /opt/ghostfolio-$GHOSTFOLIO_VERSION /package.json /opt/ghostfolio-$GHOSTFOLIO_VERSION /dist/apps/api/
mv /opt/ghostfolio-$GHOSTFOLIO_VERSION /package.json.bak /opt/ghostfolio-$GHOSTFOLIO_VERSION /dist/apps/api/package.json
$STD npm run database:generate-typings
# Move the built project to /opt/ghostfolio
@ -141,10 +147,11 @@ mv /opt/ghostfolio-$GHOSTFOLIO_VERSION/dist/apps /opt/ghostfolio
mv /opt/ghostfolio-$GHOSTFOLIO_VERSION /docker/entrypoint.sh /opt/ghostfolio/
rm -rf /opt/ghostfolio-$GHOSTFOLIO_VERSION
msg_ok "Set up Ghostfolio"
# --- END GHOSTFOLIO
# SERVICE =================================
msg_info "Creating Startup Scripts"
# Create env file
msg_info "Creating Environment File"
cat <<EOF >/opt/ghostfolio/api/.env
@ -162,7 +169,6 @@ DATABASE_URL="$DATABASE_URL"
JWT_SECRET_KEY = $JWT_SECRET_KEY
EOF
msg_info "Creating Startup Script"
# Create startup script
cat <<EOF >/opt/ghostfolio/start.sh
#!/bin/bash
@ -201,7 +207,7 @@ EOF
# Make the service run on container startup
systemctl enable ghostfolio
systemctl start ghostfolio
msg_ok "Created S ervice "
msg_ok "Created S tartup Scripts "
# -- END SERVICE
motd_ssh