Skip to content

Commit 4134136

Browse files
authored
Refactor (#9842)
1 parent da7cafd commit 4134136

File tree

3 files changed

+5
-28
lines changed

3 files changed

+5
-28
lines changed

ct/tianji.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ function update_script() {
2828
fi
2929

3030
setup_uv
31-
3231
if check_for_gh_release "tianji" "msgbyte/tianji"; then
3332
NODE_VERSION="22" NODE_MODULE="pnpm@$(curl -s https://raw.githubusercontent.com/msgbyte/tianji/master/package.json | jq -r '.packageManager | split("@")[1]')" setup_nodejs
3433

frontend/public/json/tianji.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"interface_port": 12345,
1212
"documentation": "https://tianji.dev/docs/intro",
1313
"website": "https://tianji.msgbyte.com/",
14-
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons@master/webp/tianji.webp",
14+
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons@main/webp/tianji.webp",
1515
"config_path": "/opt/tianji/src/server/.env",
1616
"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",
1717
"install_methods": [

install/tianji-install.sh

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -18,38 +18,17 @@ msg_info "Installing Dependencies"
1818
$STD apt install -y \
1919
python3 \
2020
cmake \
21-
g++ \
2221
build-essential \
23-
git \
24-
ca-certificates
22+
git
2523
msg_ok "Installed Dependencies"
2624

2725
NODE_VERSION="22" NODE_MODULE="pnpm@$(curl -s https://raw.githubusercontent.com/msgbyte/tianji/master/package.json | jq -r '.packageManager | split("@")[1]')" setup_nodejs
2826
PG_VERSION="17" setup_postgresql
27+
PG_DB_NAME="tianji_db" PG_DB_USER="tianji" setup_postgresql_db
2928
PYTHON_VERSION="3.13" setup_uv
30-
31-
msg_info "Setting up PostgreSQL"
32-
DB_NAME=tianji_db
33-
DB_USER=tianji
34-
DB_PASS="$(openssl rand -base64 18 | cut -c1-13)"
35-
TIANJI_SECRET="$(openssl rand -base64 32 | cut -c1-24)"
36-
$STD sudo -u postgres psql -c "CREATE DATABASE $DB_NAME;"
37-
$STD sudo -u postgres psql -c "CREATE USER $DB_USER WITH PASSWORD '$DB_PASS';"
38-
$STD sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE $DB_NAME TO $DB_USER;"
39-
$STD sudo -u postgres psql -c "ALTER DATABASE $DB_NAME OWNER TO $DB_USER;"
40-
$STD sudo -u postgres psql -c "ALTER USER $DB_USER WITH SUPERUSER;"
41-
{
42-
echo ""
43-
echo "Database User: $DB_USER"
44-
echo "Database Password: $DB_PASS"
45-
echo "Database Name: $DB_NAME"
46-
echo "Tianji Secret: $TIANJI_SECRET"
47-
} >>~/tianji.creds
48-
msg_ok "Set up PostgreSQL"
49-
5029
fetch_and_deploy_gh_release "tianji" "msgbyte/tianji"
5130

52-
msg_info "Setup Tianji"
31+
msg_info "Setting up Tianji"
5332
cd /opt/tianji
5433
$STD pnpm install --filter @tianji/client... --config.dedupe-peer-dependents=false --frozen-lockfile
5534
$STD pnpm build:static
@@ -69,7 +48,7 @@ rm -rf /opt/tianji/website
6948
rm -rf /opt/tianji/reporter
7049
msg_ok "Setup Tianji"
7150

72-
msg_info "Setup AppRise"
51+
msg_info "Setting up AppRise"
7352
$STD uv pip install apprise cryptography --system
7453
msg_ok "Setup AppRise"
7554

@@ -84,7 +63,6 @@ ExecStart=/usr/bin/node /opt/tianji/src/server/dist/src/server/main.js
8463
WorkingDirectory=/opt/tianji/src/server
8564
Restart=always
8665
RestartSec=10
87-
8866
Environment=NODE_ENV=production
8967
9068
[Install]

0 commit comments

Comments
 (0)