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
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() {
CT_TYPE="1"
PW=""
@ -50,13 +51,12 @@ function default_settings() {
VLAN=""
SSH="no"
VERB="no"
INSTALL_ALL="yes"
echo_default
}
function update_script() {
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"
apt-get update &>/dev/null
apt-get -y upgrade &>/dev/null

View File

@ -14,6 +14,10 @@ setting_up_container
network_check
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"
$STD apt-get update
$STD apt-get install -y \
@ -23,7 +27,7 @@ $STD apt-get install -y \
msg_ok "Installed Dependencies"
# POSTGRES =================================
msg_info "Setting up postgresql"
msg_info "Setting up Postgresql"
POSTGRES_HOST=localhost
POSTGRES_PORT=5432
@ -49,17 +53,17 @@ $STD pg_isready -d "$POSTGRES_DB" -U "$POSTGRES_USER"
$STD psql -d "$DATABASE_URL" -c "select now()"
# Store creds
echo "" >~/ghostery.creds
echo "Ghostery Database Credentials" >>~/ghostery.creds
echo "" >>~/ghostery.creds
echo -e "ghostery Database User: \e[32m$POSTGRES_USER\e[0m" >>~/ghostery.creds
echo -e "ghostery Database Password: \e[32m$POSTGRES_PASSWORD\e[0m" >>~/ghostery.creds
echo -e "ghostery Database Name: \e[32m$POSTGRES_DB\e[0m" >>~/ghostery.creds
msg_ok "Set up postgresql"
echo "" >~/ghostfolio.creds
echo "Ghostfolio Database Credentials" >>~/ghostfolio.creds
echo "" >>~/ghostfolio.creds
echo -e "Ghostfolio Database User: \e[32m$POSTGRES_USER\e[0m" >>~/ghostfolio.creds
echo -e "Ghostfolio Database Password: \e[32m$POSTGRES_PASSWORD\e[0m" >>~/ghostfolio.creds
echo -e "Ghostfolio Database Name: \e[32m$POSTGRES_DB\e[0m" >>~/ghostfolio.creds
msg_ok "Set up Postgresql"
#-- END POSTGRES
# REDIS CACHE =================================
msg_info "Setting up redis"
msg_info "Setting up Redis"
REDIS_HOST=localhost
REDIS_PORT=6379
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
$STD redis-cli -a "$REDIS_PASSWORD" ping
echo "" >~/ghostery.creds
echo "Ghostery Redis Credentials" >>~/ghostery.creds
echo "" >>~/ghostery.creds
echo -e "ghostery Redis Password: \e[32m$REDIS_PASSWORD\e[0m" >>~/ghostery.creds
echo "" >>~/ghostfolio.creds
echo "Ghostfolio Redis Credentials" >>~/ghostfolio.creds
echo "" >>~/ghostfolio.creds
echo -e "Ghostfolio Redis Password: \e[32m$REDIS_PASSWORD\e[0m" >>~/ghostfolio.creds
msg_ok "Set up Redis"
#-- END REDIS CACHE
# GHOSTFOLIO =================================
## Setup Vars
## default node to 20 (current required version, but determine from nvmrc later)
NODE_VERSION=20
## read this from the project in a way that doesnt break
GHOSTFOLIO_VERSION='latest'
GHOSTFOLIO_VERSION='latest' # tested with 2.117.0
cd /opt/
@ -108,6 +112,7 @@ $STD rm ghostfolio-$GHOSTFOLIO_VERSION.tgz
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
$STD curl -fsSL https://deb.nodesource.com/setup_$NODE_VERSION.x -o 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 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
# curl -o package-lock.json https://raw.githubusercontent.com/ghostfolio/ghostfolio/refs/tags/$GHOSTFOLIO_VERSION/package-lock.json
# 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/
#cp package-lock.json dist/apps/api/
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
# curl -o package.json https://raw.githubusercontent.com/ghostfolio/ghostfolio/refs/tags/$GHOSTFOLIO_VERSION/package.json
# 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/
$STD npm run database:generate-typings
@ -148,8 +148,6 @@ rm -rf /opt/ghostfolio-$GHOSTFOLIO_VERSION
# Create env file
msg_info "Creating Environment File"
cat <<EOF >/opt/ghostfolio/api/.env
# Node
NODE_OPTIONS=--max_old_space_size=2048
# CACHE
REDIS_HOST=$REDIS_HOST
REDIS_PORT=$REDIS_PORT