mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-04-18 16:32:17 +00:00
Refactor: Joplin Server (#10769)
This commit is contained in:
@@ -35,10 +35,12 @@ function update_script() {
|
|||||||
systemctl stop joplin-server
|
systemctl stop joplin-server
|
||||||
msg_ok "Stopped Services"
|
msg_ok "Stopped Services"
|
||||||
|
|
||||||
fetch_and_deploy_gh_release "joplin-server" "laurent22/joplin" "tarball" "latest"
|
cp /opt/joplin-server/.env /opt
|
||||||
|
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "joplin-server" "laurent22/joplin" "tarball"
|
||||||
|
mv /opt/.env /opt/joplin-server
|
||||||
|
|
||||||
msg_info "Updating Joplin-Server"
|
msg_info "Updating Joplin-Server"
|
||||||
cd /opt/joplin-server
|
cd /opt/joplin-server
|
||||||
sed -i "/onenote-converter/d" packages/lib/package.json
|
sed -i "/onenote-converter/d" packages/lib/package.json
|
||||||
$STD yarn config set --home enableTelemetry 0
|
$STD yarn config set --home enableTelemetry 0
|
||||||
export BUILD_SEQUENCIAL=1
|
export BUILD_SEQUENCIAL=1
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ $STD apt install -y \
|
|||||||
msg_ok "Installed Dependencies"
|
msg_ok "Installed Dependencies"
|
||||||
|
|
||||||
PG_VERSION="17" setup_postgresql
|
PG_VERSION="17" setup_postgresql
|
||||||
|
PG_DB_NAME="joplin" PG_DB_USER="joplin" setup_postgresql_db
|
||||||
NODE_VERSION=24 NODE_MODULE="yarn,npm,pm2" setup_nodejs
|
NODE_VERSION=24 NODE_MODULE="yarn,npm,pm2" setup_nodejs
|
||||||
mkdir -p /opt/pm2
|
mkdir -p /opt/pm2
|
||||||
export PM2_HOME=/opt/pm2
|
export PM2_HOME=/opt/pm2
|
||||||
@@ -27,28 +28,10 @@ $STD pm2 install pm2-logrotate
|
|||||||
$STD pm2 set pm2-logrotate:max_size 100MB
|
$STD pm2 set pm2-logrotate:max_size 100MB
|
||||||
$STD pm2 set pm2-logrotate:retain 5
|
$STD pm2 set pm2-logrotate:retain 5
|
||||||
$STD pm2 set pm2-logrotate:compress tr
|
$STD pm2 set pm2-logrotate:compress tr
|
||||||
|
fetch_and_deploy_gh_release "joplin-server" "laurent22/joplin" "tarball"
|
||||||
msg_info "Setting up PostgreSQL Database"
|
import_local_ip
|
||||||
DB_NAME=joplin
|
|
||||||
DB_USER=joplin
|
|
||||||
DB_PASS="$(openssl rand -base64 18 | 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 -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 "Joplin-Credentials"
|
|
||||||
echo "Joplin Database User: $DB_USER"
|
|
||||||
echo "Joplin Database Password: $DB_PASS"
|
|
||||||
echo "Joplin Database Name: $DB_NAME"
|
|
||||||
} >>~/joplin.creds
|
|
||||||
msg_ok "Set up PostgreSQL Database"
|
|
||||||
|
|
||||||
fetch_and_deploy_gh_release "joplin-server" "laurent22/joplin" "tarball" "latest"
|
|
||||||
|
|
||||||
msg_info "Setting up Joplin Server (Patience)"
|
msg_info "Setting up Joplin Server (Patience)"
|
||||||
LOCAL_IP=$(hostname -I | awk '{print $1}')
|
|
||||||
cd /opt/joplin-server
|
cd /opt/joplin-server
|
||||||
sed -i "/onenote-converter/d" packages/lib/package.json
|
sed -i "/onenote-converter/d" packages/lib/package.json
|
||||||
$STD yarn config set --home enableTelemetry 0
|
$STD yarn config set --home enableTelemetry 0
|
||||||
@@ -61,9 +44,9 @@ NODE_ENV=production
|
|||||||
APP_BASE_URL=http://$LOCAL_IP:22300
|
APP_BASE_URL=http://$LOCAL_IP:22300
|
||||||
APP_PORT=22300
|
APP_PORT=22300
|
||||||
DB_CLIENT=pg
|
DB_CLIENT=pg
|
||||||
POSTGRES_PASSWORD=$DB_PASS
|
POSTGRES_PASSWORD=$PG_DB_PASS
|
||||||
POSTGRES_DATABASE=$DB_NAME
|
POSTGRES_DATABASE=$PG_DB_NAME
|
||||||
POSTGRES_USER=$DB_USER
|
POSTGRES_USER=$PG_DB_USER
|
||||||
POSTGRES_PORT=5432
|
POSTGRES_PORT=5432
|
||||||
POSTGRES_HOST=localhost
|
POSTGRES_HOST=localhost
|
||||||
EOF
|
EOF
|
||||||
|
|||||||
Reference in New Issue
Block a user