PR review feedback
This commit is contained in:
parent
5c296111c1
commit
8dc0e3b962
@ -28,15 +28,13 @@ function update_script() {
|
||||
exit
|
||||
fi
|
||||
|
||||
NODE_VERSION="22" NODE_MODULE="pnpm@10.24.0" setup_nodejs
|
||||
|
||||
if check_for_gh_release "tracearr" "connorgallopo/Tracearr"; then
|
||||
msg_info "Stopping Services"
|
||||
systemctl stop tracearr
|
||||
systemctl stop postgresql
|
||||
systemctl stop redis
|
||||
systemctl stop tracearr postgresql redis
|
||||
msg_ok "Stopped Services"
|
||||
|
||||
NODE_VERSION="22" NODE_MODULE="pnpm@10.24.0" setup_nodejs
|
||||
|
||||
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "tracearr" "connorgallopo/Tracearr" "tarball" "latest" "/opt/tracearr.build"
|
||||
|
||||
msg_info "Building Tracearr"
|
||||
@ -82,8 +80,28 @@ function update_script() {
|
||||
echo "$COOKIE_SECRET" > /data/tracearr/.cookie_secret
|
||||
chmod 600 /data/tracearr/.cookie_secret
|
||||
fi
|
||||
if [ ! -f /root/tracearr.creds ]; then
|
||||
if [ -f /data/tracearr/.env ]; then
|
||||
PG_DB_NAME=$(grep 'DATABASE_URL=' /data/tracearr/.env | cut -d'/' -f4)
|
||||
PG_DB_USER=$(grep 'DATABASE_URL=' /data/tracearr/.env | cut -d'/' -f3 | cut -d':' -f1)
|
||||
PG_DB_PASS=$(grep 'DATABASE_URL=' /data/tracearr/.env | cut -d':' -f3 | cut -d'@' -f1)
|
||||
{ echo "PostgreSQL Credentials"
|
||||
echo "Database: $PG_DB_NAME"
|
||||
echo "User: $PG_DB_USER"
|
||||
echo "Password: $PG_DB_PASS"
|
||||
} >/root/tracearr.creds
|
||||
msg_ok "Recreated tracearr.creds file from existing .env"
|
||||
else
|
||||
msg_error "No existing tracearr.creds or .env file found. Cannot configure database connection!"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
PG_DB_NAME=$(grep 'Database:' /root/tracearr.creds | awk '{print $2}')
|
||||
PG_DB_USER=$(grep 'User:' /root/tracearr.creds | awk '{print $2}')
|
||||
PG_DB_PASS=$(grep 'Password:' /root/tracearr.creds | awk '{print $2}')
|
||||
fi
|
||||
cat <<EOF >/data/tracearr/.env
|
||||
DATABASE_URL=postgresql://${DB_USER}:${DB_PASS}@127.0.0.1:5432/${DB_NAME}
|
||||
DATABASE_URL=postgresql://${PG_DB_USER}:${PG_DB_PASS}@127.0.0.1:5432/${PG_DB_NAME}
|
||||
REDIS_URL=redis://127.0.0.1:6379
|
||||
PORT=3000
|
||||
HOST=0.0.0.0
|
||||
@ -101,9 +119,7 @@ EOF
|
||||
msg_ok "Configured Tracearr"
|
||||
|
||||
msg_info "Starting Services"
|
||||
systemctl start postgresql
|
||||
systemctl start redis
|
||||
systemctl start tracearr
|
||||
systemctl start postgresql redis tracearr
|
||||
msg_ok "Started Services"
|
||||
msg_ok "Updated successfully!"
|
||||
fi
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
"documentation": "https://github.com/connorgallopo/Tracearr#readme",
|
||||
"config_path": "",
|
||||
"website": "https://github.com/connorgallopo/Tracearr",
|
||||
"logo": "https://raw.githubusercontent.com/connorgallopo/Tracearr/refs/heads/main/apps/web/public/logo-transparent.png",
|
||||
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons@main/webp/tracearr.webp",
|
||||
"description": "Tracearr is a streaming access manager for Plex, Jellyfin and Emby servers. It answers the question every server owner eventually asks: \"Who's actually using my server, and are they sharing their login?\"",
|
||||
"install_methods": [
|
||||
{
|
||||
|
||||
@ -41,25 +41,7 @@ $STD systemctl restart postgresql
|
||||
msg_ok "Installed TimescaleDB"
|
||||
|
||||
msg_info "Creating PostgreSQL Database"
|
||||
DB_NAME=tracearr
|
||||
DB_USER=tracearr
|
||||
DB_PASS="$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | cut -c1-13)"
|
||||
$STD sudo -u postgres psql -c "CREATE ROLE $DB_USER WITH LOGIN PASSWORD '$DB_PASS';"
|
||||
$STD sudo -u postgres psql -c "CREATE DATABASE $DB_NAME WITH OWNER $DB_USER ENCODING 'UTF8' TEMPLATE template0;"
|
||||
$STD sudo -u postgres psql -d $DB_NAME -c "CREATE EXTENSION IF NOT EXISTS timescaledb;"
|
||||
$STD sudo -u postgres psql -d $DB_NAME -c "CREATE EXTENSION IF NOT EXISTS timescaledb_toolkit;"
|
||||
$STD sudo -u postgres psql -d $DB_NAME -c "GRANT ALL PRIVILEGES ON DATABASE $DB_NAME TO $DB_USER;"
|
||||
$STD sudo -u postgres psql -d $DB_NAME -c "GRANT ALL ON SCHEMA public TO $DB_USER;"
|
||||
$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET client_encoding TO 'utf8';"
|
||||
$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET default_transaction_isolation TO 'read committed';"
|
||||
$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET timezone TO 'UTC';"
|
||||
{
|
||||
echo "Dispatcharr Credentials"
|
||||
echo "Database Name: $DB_NAME"
|
||||
echo "Database User: $DB_USER"
|
||||
echo "Database Password: $DB_PASS"
|
||||
echo ""
|
||||
} >>~/tracearr.creds
|
||||
PG_DB_NAME="tracearr" PG_DB_USER="tracearr" PG_DB_EXTENSIONS="timescaledb,timescaledb_toolkit" setup_postgresql_db
|
||||
msg_ok "Created PostgreSQL Database"
|
||||
|
||||
fetch_and_deploy_gh_release "tracearr" "connorgallopo/Tracearr" "tarball" "latest" "/opt/tracearr.build"
|
||||
@ -106,7 +88,7 @@ else
|
||||
chmod 600 /data/tracearr/.cookie_secret
|
||||
fi
|
||||
cat <<EOF >/data/tracearr/.env
|
||||
DATABASE_URL=postgresql://${DB_USER}:${DB_PASS}@127.0.0.1:5432/${DB_NAME}
|
||||
DATABASE_URL=postgresql://${PG_DB_USER}:${PG_DB_PASS}@127.0.0.1:5432/${PG_DB_NAME}
|
||||
REDIS_URL=redis://127.0.0.1:6379
|
||||
PORT=3000
|
||||
HOST=0.0.0.0
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user