Insatllation messages + store clean local files

package.json + package-lock.json stored before build
This commit is contained in:
Jesse Antoszyk 2024-10-22 15:19:59 -04:00
parent 2557432443
commit e1c8be0f92
2 changed files with 12 additions and 6 deletions

View File

@ -29,7 +29,7 @@ variables
color color
catch_errors 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() { function default_settings() {
CT_TYPE="1" CT_TYPE="1"
PW="" PW=""

View File

@ -87,6 +87,7 @@ msg_ok "Set up Redis"
#-- END REDIS CACHE #-- END REDIS CACHE
# GHOSTFOLIO ================================= # GHOSTFOLIO =================================
msg_info "Set up Ghostfolio"
## Setup Vars ## Setup Vars
## default node to 20 (current required version, but determine from nvmrc later) ## default node to 20 (current required version, but determine from nvmrc later)
NODE_VERSION=20 NODE_VERSION=20
@ -112,6 +113,10 @@ $STD rm ghostfolio-$GHOSTFOLIO_VERSION.tgz
cd /opt/ghostfolio-$GHOSTFOLIO_VERSION 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 # 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 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 $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 $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 # 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/ cd /opt/ghostfolio-$GHOSTFOLIO_VERSION/dist/apps/api/
$STD npm install $STD npm install
mv /opt/ghostfolio-$GHOSTFOLIO_VERSION/prisma . mv /opt/ghostfolio-$GHOSTFOLIO_VERSION/prisma .
# Overwrite the generated package.json with the original one to ensure having all the scripts # 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 $STD npm run database:generate-typings
# Move the built project to /opt/ghostfolio # 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/ mv /opt/ghostfolio-$GHOSTFOLIO_VERSION/docker/entrypoint.sh /opt/ghostfolio/
rm -rf /opt/ghostfolio-$GHOSTFOLIO_VERSION rm -rf /opt/ghostfolio-$GHOSTFOLIO_VERSION
msg_ok "Set up Ghostfolio"
# --- END GHOSTFOLIO # --- END GHOSTFOLIO
# SERVICE ================================= # SERVICE =================================
msg_info "Creating Startup Scripts"
# Create env file # Create env file
msg_info "Creating Environment File" msg_info "Creating Environment File"
cat <<EOF >/opt/ghostfolio/api/.env cat <<EOF >/opt/ghostfolio/api/.env
@ -162,7 +169,6 @@ DATABASE_URL="$DATABASE_URL"
JWT_SECRET_KEY=$JWT_SECRET_KEY JWT_SECRET_KEY=$JWT_SECRET_KEY
EOF EOF
msg_info "Creating Startup Script"
# Create startup script # Create startup script
cat <<EOF >/opt/ghostfolio/start.sh cat <<EOF >/opt/ghostfolio/start.sh
#!/bin/bash #!/bin/bash
@ -201,7 +207,7 @@ EOF
# Make the service run on container startup # Make the service run on container startup
systemctl enable ghostfolio systemctl enable ghostfolio
systemctl start ghostfolio systemctl start ghostfolio
msg_ok "Created Service" msg_ok "Created Startup Scripts"
# -- END SERVICE # -- END SERVICE
motd_ssh motd_ssh