Rename creds file to correct app

This commit is contained in:
Jesse Antoszyk 2024-10-22 15:15:05 -04:00
parent ccc8a7a165
commit 2557432443
2 changed files with 24 additions and 26 deletions

View File

@ -29,6 +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
function default_settings() { function default_settings() {
CT_TYPE="1" CT_TYPE="1"
PW="" PW=""
@ -50,13 +51,12 @@ function default_settings() {
VLAN="" VLAN=""
SSH="no" SSH="no"
VERB="no" VERB="no"
INSTALL_ALL="yes"
echo_default echo_default
} }
function update_script() { function update_script() {
header_info header_info
if [[ ! -d /etc/neo4j ]]; then msg_error "No ${APP} Installation Found!"; exit; fi if [[ ! -d /opt/ghostfolio ]]; then msg_error "No ${APP} Installation Found!"; exit; fi
msg_info "Updating OS" msg_info "Updating OS"
apt-get update &>/dev/null apt-get update &>/dev/null
apt-get -y upgrade &>/dev/null apt-get -y upgrade &>/dev/null

View File

@ -14,6 +14,10 @@ setting_up_container
network_check network_check
update_os update_os
## Following Ghostfolio's Dockerfile and docker-compose for versions/steps, but installing all postgres/redis on the same host
# - https://github.com/ghostfolio/ghostfolio/blob/main/Dockerfile
# - https://github.com/ghostfolio/ghostfolio/blob/main/docker/docker-compose.yml
msg_info "Installing Dependencies" msg_info "Installing Dependencies"
$STD apt-get update $STD apt-get update
$STD apt-get install -y \ $STD apt-get install -y \
@ -23,7 +27,7 @@ $STD apt-get install -y \
msg_ok "Installed Dependencies" msg_ok "Installed Dependencies"
# POSTGRES ================================= # POSTGRES =================================
msg_info "Setting up postgresql" msg_info "Setting up Postgresql"
POSTGRES_HOST=localhost POSTGRES_HOST=localhost
POSTGRES_PORT=5432 POSTGRES_PORT=5432
@ -49,17 +53,17 @@ $STD pg_isready -d "$POSTGRES_DB" -U "$POSTGRES_USER"
$STD psql -d "$DATABASE_URL" -c "select now()" $STD psql -d "$DATABASE_URL" -c "select now()"
# Store creds # Store creds
echo "" >~/ghostery.creds echo "" >~/ghostfolio.creds
echo "Ghostery Database Credentials" >>~/ghostery.creds echo "Ghostfolio Database Credentials" >>~/ghostfolio.creds
echo "" >>~/ghostery.creds echo "" >>~/ghostfolio.creds
echo -e "ghostery Database User: \e[32m$POSTGRES_USER\e[0m" >>~/ghostery.creds echo -e "Ghostfolio Database User: \e[32m$POSTGRES_USER\e[0m" >>~/ghostfolio.creds
echo -e "ghostery Database Password: \e[32m$POSTGRES_PASSWORD\e[0m" >>~/ghostery.creds echo -e "Ghostfolio Database Password: \e[32m$POSTGRES_PASSWORD\e[0m" >>~/ghostfolio.creds
echo -e "ghostery Database Name: \e[32m$POSTGRES_DB\e[0m" >>~/ghostery.creds echo -e "Ghostfolio Database Name: \e[32m$POSTGRES_DB\e[0m" >>~/ghostfolio.creds
msg_ok "Set up postgresql" msg_ok "Set up Postgresql"
#-- END POSTGRES #-- END POSTGRES
# REDIS CACHE ================================= # REDIS CACHE =================================
msg_info "Setting up redis" msg_info "Setting up Redis"
REDIS_HOST=localhost REDIS_HOST=localhost
REDIS_PORT=6379 REDIS_PORT=6379
REDIS_PASSWORD="$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 32)" REDIS_PASSWORD="$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 32)"
@ -74,19 +78,19 @@ $STD systemctl restart redis
# Test Redis with password auth # Test Redis with password auth
$STD redis-cli -a "$REDIS_PASSWORD" ping $STD redis-cli -a "$REDIS_PASSWORD" ping
echo "" >~/ghostery.creds echo "" >>~/ghostfolio.creds
echo "Ghostery Redis Credentials" >>~/ghostery.creds echo "Ghostfolio Redis Credentials" >>~/ghostfolio.creds
echo "" >>~/ghostery.creds echo "" >>~/ghostfolio.creds
echo -e "ghostery Redis Password: \e[32m$REDIS_PASSWORD\e[0m" >>~/ghostery.creds echo -e "Ghostfolio Redis Password: \e[32m$REDIS_PASSWORD\e[0m" >>~/ghostfolio.creds
msg_ok "Set up Redis"
#-- END REDIS CACHE #-- END REDIS CACHE
# GHOSTFOLIO ================================= # 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
## read this from the project in a way that doesnt break GHOSTFOLIO_VERSION='latest' # tested with 2.117.0
GHOSTFOLIO_VERSION='latest'
cd /opt/ cd /opt/
@ -108,6 +112,7 @@ $STD rm ghostfolio-$GHOSTFOLIO_VERSION.tgz
cd /opt/ghostfolio-$GHOSTFOLIO_VERSION cd /opt/ghostfolio-$GHOSTFOLIO_VERSION
# 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
$STD bash nodesource_setup.sh $STD bash nodesource_setup.sh
@ -119,19 +124,14 @@ $STD apt-get install -y --no-install-suggests nodejs
$STD npm install $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.json was generated by the build process, however the original package-lock.json needs to be used to ensure the same versions
# package-lock.json needs to be used to ensure the same versions
# curl -o package-lock.json https://raw.githubusercontent.com/ghostfolio/ghostfolio/refs/tags/$GHOSTFOLIO_VERSION/package-lock.json
mv /opt/ghostfolio-$GHOSTFOLIO_VERSION/package-lock.json /opt/ghostfolio-$GHOSTFOLIO_VERSION/dist/apps/api/ mv /opt/ghostfolio-$GHOSTFOLIO_VERSION/package-lock.json /opt/ghostfolio-$GHOSTFOLIO_VERSION/dist/apps/api/
#cp package-lock.json dist/apps/api/
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 # Overwrite the generated package.json with the original one to ensure having all the scripts
# all the scripts
# curl -o package.json https://raw.githubusercontent.com/ghostfolio/ghostfolio/refs/tags/$GHOSTFOLIO_VERSION/package.json
mv /opt/ghostfolio-$GHOSTFOLIO_VERSION/package.json /opt/ghostfolio-$GHOSTFOLIO_VERSION/dist/apps/api/ mv /opt/ghostfolio-$GHOSTFOLIO_VERSION/package.json /opt/ghostfolio-$GHOSTFOLIO_VERSION/dist/apps/api/
$STD npm run database:generate-typings $STD npm run database:generate-typings
@ -148,8 +148,6 @@ rm -rf /opt/ghostfolio-$GHOSTFOLIO_VERSION
# 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
# Node
NODE_OPTIONS=--max_old_space_size=2048
# CACHE # CACHE
REDIS_HOST=$REDIS_HOST REDIS_HOST=$REDIS_HOST
REDIS_PORT=$REDIS_PORT REDIS_PORT=$REDIS_PORT