This commit is contained in:
Slaviša Arežina 2025-12-10 18:38:56 +01:00 committed by GitHub
parent da7cafd82c
commit 4134136918
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 5 additions and 28 deletions

View File

@ -28,7 +28,6 @@ function update_script() {
fi fi
setup_uv setup_uv
if check_for_gh_release "tianji" "msgbyte/tianji"; then if check_for_gh_release "tianji" "msgbyte/tianji"; then
NODE_VERSION="22" NODE_MODULE="pnpm@$(curl -s https://raw.githubusercontent.com/msgbyte/tianji/master/package.json | jq -r '.packageManager | split("@")[1]')" setup_nodejs NODE_VERSION="22" NODE_MODULE="pnpm@$(curl -s https://raw.githubusercontent.com/msgbyte/tianji/master/package.json | jq -r '.packageManager | split("@")[1]')" setup_nodejs

View File

@ -11,7 +11,7 @@
"interface_port": 12345, "interface_port": 12345,
"documentation": "https://tianji.dev/docs/intro", "documentation": "https://tianji.dev/docs/intro",
"website": "https://tianji.msgbyte.com/", "website": "https://tianji.msgbyte.com/",
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons@master/webp/tianji.webp", "logo": "https://cdn.jsdelivr.net/gh/selfhst/icons@main/webp/tianji.webp",
"config_path": "/opt/tianji/src/server/.env", "config_path": "/opt/tianji/src/server/.env",
"description": "Tianji is an open-source tool for website analytics, uptime monitoring, and server status tracking, all in one. It\u2019s lightweight, privacy-focused, and helps teams monitor web traffic, server health, and gather user interaction data", "description": "Tianji is an open-source tool for website analytics, uptime monitoring, and server status tracking, all in one. It\u2019s lightweight, privacy-focused, and helps teams monitor web traffic, server health, and gather user interaction data",
"install_methods": [ "install_methods": [

View File

@ -18,38 +18,17 @@ msg_info "Installing Dependencies"
$STD apt install -y \ $STD apt install -y \
python3 \ python3 \
cmake \ cmake \
g++ \
build-essential \ build-essential \
git \ git
ca-certificates
msg_ok "Installed Dependencies" msg_ok "Installed Dependencies"
NODE_VERSION="22" NODE_MODULE="pnpm@$(curl -s https://raw.githubusercontent.com/msgbyte/tianji/master/package.json | jq -r '.packageManager | split("@")[1]')" setup_nodejs NODE_VERSION="22" NODE_MODULE="pnpm@$(curl -s https://raw.githubusercontent.com/msgbyte/tianji/master/package.json | jq -r '.packageManager | split("@")[1]')" setup_nodejs
PG_VERSION="17" setup_postgresql PG_VERSION="17" setup_postgresql
PG_DB_NAME="tianji_db" PG_DB_USER="tianji" setup_postgresql_db
PYTHON_VERSION="3.13" setup_uv PYTHON_VERSION="3.13" setup_uv
msg_info "Setting up PostgreSQL"
DB_NAME=tianji_db
DB_USER=tianji
DB_PASS="$(openssl rand -base64 18 | cut -c1-13)"
TIANJI_SECRET="$(openssl rand -base64 32 | cut -c1-24)"
$STD sudo -u postgres psql -c "CREATE DATABASE $DB_NAME;"
$STD sudo -u postgres psql -c "CREATE USER $DB_USER WITH PASSWORD '$DB_PASS';"
$STD sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE $DB_NAME TO $DB_USER;"
$STD sudo -u postgres psql -c "ALTER DATABASE $DB_NAME OWNER TO $DB_USER;"
$STD sudo -u postgres psql -c "ALTER USER $DB_USER WITH SUPERUSER;"
{
echo ""
echo "Database User: $DB_USER"
echo "Database Password: $DB_PASS"
echo "Database Name: $DB_NAME"
echo "Tianji Secret: $TIANJI_SECRET"
} >>~/tianji.creds
msg_ok "Set up PostgreSQL"
fetch_and_deploy_gh_release "tianji" "msgbyte/tianji" fetch_and_deploy_gh_release "tianji" "msgbyte/tianji"
msg_info "Setup Tianji" msg_info "Setting up Tianji"
cd /opt/tianji cd /opt/tianji
$STD pnpm install --filter @tianji/client... --config.dedupe-peer-dependents=false --frozen-lockfile $STD pnpm install --filter @tianji/client... --config.dedupe-peer-dependents=false --frozen-lockfile
$STD pnpm build:static $STD pnpm build:static
@ -69,7 +48,7 @@ rm -rf /opt/tianji/website
rm -rf /opt/tianji/reporter rm -rf /opt/tianji/reporter
msg_ok "Setup Tianji" msg_ok "Setup Tianji"
msg_info "Setup AppRise" msg_info "Setting up AppRise"
$STD uv pip install apprise cryptography --system $STD uv pip install apprise cryptography --system
msg_ok "Setup AppRise" msg_ok "Setup AppRise"
@ -84,7 +63,6 @@ ExecStart=/usr/bin/node /opt/tianji/src/server/dist/src/server/main.js
WorkingDirectory=/opt/tianji/src/server WorkingDirectory=/opt/tianji/src/server
Restart=always Restart=always
RestartSec=10 RestartSec=10
Environment=NODE_ENV=production Environment=NODE_ENV=production
[Install] [Install]