From e1c8be0f92fc12ce79c2af3c89868b420029fae8 Mon Sep 17 00:00:00 2001 From: Jesse Antoszyk <22500761+jcantosz@users.noreply.github.com> Date: Tue, 22 Oct 2024 15:19:59 -0400 Subject: [PATCH] Insatllation messages + store clean local files package.json + package-lock.json stored before build --- ct/ghostfolio.sh | 2 +- install/ghostfolio-install.sh | 16 +++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/ct/ghostfolio.sh b/ct/ghostfolio.sh index 314d2401..0b934d9e 100644 --- a/ct/ghostfolio.sh +++ b/ct/ghostfolio.sh @@ -29,7 +29,7 @@ variables color catch_errors -# Install prequires at least 2GiB of RAM and 6GiB of disk space, both are lower to actually run the app +# Install requires at least 2GiB of RAM and 6GiB of disk space, both requirements are lower to actually run the app function default_settings() { CT_TYPE="1" PW="" diff --git a/install/ghostfolio-install.sh b/install/ghostfolio-install.sh index 1425588b..020a813f 100644 --- a/install/ghostfolio-install.sh +++ b/install/ghostfolio-install.sh @@ -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 </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 </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 Service" +msg_ok "Created Startup Scripts" # -- END SERVICE motd_ssh