From b114aa40122fb91f1fbba948c075c5242a89eca9 Mon Sep 17 00:00:00 2001 From: Jesse Antoszyk <22500761+jcantosz@users.noreply.github.com> Date: Tue, 22 Oct 2024 20:27:07 -0400 Subject: [PATCH] Make this work more like my original script --- install/ghostfolio-install.sh | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/install/ghostfolio-install.sh b/install/ghostfolio-install.sh index 020a813f..6d0f7ff3 100644 --- a/install/ghostfolio-install.sh +++ b/install/ghostfolio-install.sh @@ -114,8 +114,8 @@ $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 +#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 @@ -130,15 +130,16 @@ $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.bak /opt/ghostfolio-$GHOSTFOLIO_VERSION/dist/apps/api/package-lock.json +# mv /opt/ghostfolio-$GHOSTFOLIO_VERSION/package-lock.json.bak /opt/ghostfolio-$GHOSTFOLIO_VERSION/dist/apps/api/package-lock.json +$STD curl -o package-lock.json https://raw.githubusercontent.com/ghostfolio/ghostfolio/refs/tags/$GHOSTFOLIO_VERSION/package-lock.json cd /opt/ghostfolio-$GHOSTFOLIO_VERSION/dist/apps/api/ $STD npm install -mv /opt/ghostfolio-$GHOSTFOLIO_VERSION/prisma . +cp -r /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.bak /opt/ghostfolio-$GHOSTFOLIO_VERSION/dist/apps/api/package.json - +# mv /opt/ghostfolio-$GHOSTFOLIO_VERSION/package.json.bak /opt/ghostfolio-$GHOSTFOLIO_VERSION/dist/apps/api/package.json +$STD curl -o package.json https://raw.githubusercontent.com/ghostfolio/ghostfolio/refs/tags/$GHOSTFOLIO_VERSION/package.json $STD npm run database:generate-typings # Move the built project to /opt/ghostfolio @@ -159,10 +160,12 @@ cat </opt/ghostfolio/api/.env REDIS_HOST=$REDIS_HOST REDIS_PORT=$REDIS_PORT REDIS_PASSWORD=$REDIS_PASSWORD + # POSTGRES POSTGRES_DB=$POSTGRES_DB POSTGRES_USER=$POSTGRES_USER POSTGRES_PASSWORD=$POSTGRES_PASSWORD + # VARIOUS ACCESS_TOKEN_SALT=$ACCESS_TOKEN_SALT DATABASE_URL="$DATABASE_URL" @@ -176,6 +179,7 @@ cat </opt/ghostfolio/start.sh set -a . /opt/ghostfolio/api/.env set +a + # Run the docker entrypoint /opt/ghostfolio/entrypoint.sh EOF @@ -187,19 +191,24 @@ msg_info "Creating Systemd Service Definition" cat </etc/systemd/system/ghostfolio.service [Unit] Description=ghostfolio + [Service] After=postgresql.service redis.service Require=postgresql.service redis.service + # Start Service ExecStart=/opt/ghostfolio/start.sh WorkingDirectory=/opt/ghostfolio/api/ + # Restart service after 10 seconds if node service crashes RestartSec=10 Restart=always + # Output to syslog StandardOutput=syslog StandardError=syslog SyslogIdentifier=ghostfolio + [Install] WantedBy=multi-user.target EOF @@ -213,8 +222,8 @@ msg_ok "Created Startup Scripts" motd_ssh customize -msg_info "Cleaning up" -apt remove -y make git g++ -$STD apt-get -y autoremove -$STD apt-get -y autoclean -msg_ok "Cleaned" +# msg_info "Cleaning up" +# apt remove -y make git g++ +# $STD apt-get -y autoremove +# $STD apt-get -y autoclean +# msg_ok "Cleaned"