Skip to content

Commit d0a1f30

Browse files
push-app-to-main[bot]tremor021CrazyWolf13
authored
Add Script: Joplin Server (#7879)
Co-authored-by: push-app-to-main[bot] <203845782+push-app-to-main[bot]@users.noreply.github.com> Co-authored-by: Slaviša Arežina <[email protected]> Co-authored-by: Tobias <[email protected]>
1 parent 6948e1f commit d0a1f30

File tree

4 files changed

+206
-0
lines changed

4 files changed

+206
-0
lines changed

ct/headers/joplin-server

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
_ ___
2+
(_)___ ____ / (_)___ ________ ______ _____ _____
3+
/ / __ \/ __ \/ / / __ \______/ ___/ _ \/ ___/ | / / _ \/ ___/
4+
/ / /_/ / /_/ / / / / / /_____(__ ) __/ / | |/ / __/ /
5+
__/ /\____/ .___/_/_/_/ /_/ /____/\___/_/ |___/\___/_/
6+
/___/ /_/

ct/joplin-server.sh

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
#!/usr/bin/env bash
2+
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
3+
# Copyright (c) 2021-2025 community-scripts ORG
4+
# Author: Slaviša Arežina (tremor021)
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://joplinapp.org/
7+
8+
APP="Joplin-Server"
9+
var_tags="${var_tags:-notes}"
10+
var_cpu="${var_cpu:-2}"
11+
var_ram="${var_ram:-4096}"
12+
var_disk="${var_disk:-20}"
13+
var_os="${var_os:-debian}"
14+
var_version="${var_version:-12}"
15+
var_unprivileged="${var_unprivileged:-1}"
16+
17+
header_info "$APP"
18+
variables
19+
color
20+
catch_errors
21+
22+
function update_script() {
23+
header_info
24+
check_container_storage
25+
check_container_resources
26+
if [[ ! -d /opt/joplin-server ]]; then
27+
msg_error "No ${APP} Installation Found!"
28+
exit
29+
fi
30+
31+
if check_for_gh_release "joplin-server" "laurent22/joplin"; then
32+
msg_info "Stopping Services"
33+
systemctl stop joplin-server
34+
msg_ok "Stopped Services"
35+
36+
fetch_and_deploy_gh_release "joplin-server" "laurent22/joplin" "tarball" "latest"
37+
38+
msg_info "Updating ${APP}"
39+
cd /opt/joplin-server
40+
sed -i "/onenote-converter/d" packages/lib/package.json
41+
$STD yarn config set --home enableTelemetry 0
42+
export BUILD_SEQUENCIAL=1
43+
$STD yarn install --inline-builds
44+
msg_ok "Updated ${APP}"
45+
46+
msg_info "Starting Services"
47+
systemctl start joplin-server
48+
msg_ok "Started Services"
49+
50+
msg_ok "Updated Successfully"
51+
fi
52+
exit
53+
}
54+
55+
start
56+
build_container
57+
description
58+
59+
msg_ok "Completed Successfully!\n"
60+
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
61+
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
62+
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:22300${CL}"
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"name": "Joplin Server",
3+
"slug": "joplin-server",
4+
"categories": [
5+
12
6+
],
7+
"date_created": "2025-09-12",
8+
"type": "ct",
9+
"updateable": true,
10+
"privileged": false,
11+
"interface_port": 22300,
12+
"documentation": "https://joplinapp.org/help/",
13+
"config_path": "/opt/joplin-server/.env",
14+
"website": "https://joplinapp.org/",
15+
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/joplin.webp",
16+
"description": "Joplin - the privacy-focused note taking app with sync capabilities for Windows, macOS, Linux, Android and iOS.",
17+
"install_methods": [
18+
{
19+
"type": "default",
20+
"script": "ct/joplin-server.sh",
21+
"resources": {
22+
"cpu": 2,
23+
"ram": 4096,
24+
"hdd": 20,
25+
"os": "Debian",
26+
"version": "12"
27+
}
28+
}
29+
],
30+
"default_credentials": {
31+
"username": "admin@localhost",
32+
"password": "admin"
33+
},
34+
"notes": [
35+
{
36+
"text": "Application can take some time to build, depending on your host speed. Please be patient.",
37+
"type": "info"
38+
}
39+
]
40+
}

install/joplin-server-install.sh

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright (c) 2021-2025 community-scripts ORG
4+
# Author: Slaviša Arežina (tremor021)
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://joplinapp.org/
7+
8+
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
9+
color
10+
verb_ip6
11+
catch_errors
12+
setting_up_container
13+
network_check
14+
update_os
15+
16+
msg_info "Installing Dependencies"
17+
$STD apt-get install -y \
18+
git \
19+
rsync
20+
msg_ok "Installed Dependencies"
21+
22+
PG_VERSION="17" setup_postgresql
23+
NODE_VERSION=22 NODE_MODULE="yarn@latest,npm@latest,pm2@latest" setup_nodejs
24+
mkdir -p /opt/pm2
25+
export PM2_HOME=/opt/pm2
26+
$STD pm2 install pm2-logrotate
27+
$STD pm2 set pm2-logrotate:max_size 100MB
28+
$STD pm2 set pm2-logrotate:retain 5
29+
$STD pm2 set pm2-logrotate:compress tr
30+
31+
msg_info "Setting up PostgreSQL Database"
32+
DB_NAME=joplin
33+
DB_USER=joplin
34+
DB_PASS="$(openssl rand -base64 18 | cut -c1-13)"
35+
$STD sudo -u postgres psql -c "CREATE ROLE $DB_USER WITH LOGIN PASSWORD '$DB_PASS';"
36+
$STD sudo -u postgres psql -c "CREATE DATABASE $DB_NAME WITH OWNER $DB_USER ENCODING 'UTF8' TEMPLATE template0;"
37+
$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET client_encoding TO 'utf8';"
38+
$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET default_transaction_isolation TO 'read committed';"
39+
$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET timezone TO 'UTC'"
40+
{
41+
echo "Joplin-Credentials"
42+
echo "Joplin Database User: $DB_USER"
43+
echo "Joplin Database Password: $DB_PASS"
44+
echo "Joplin Database Name: $DB_NAME"
45+
} >>~/joplin.creds
46+
msg_ok "Set up PostgreSQL Database"
47+
48+
fetch_and_deploy_gh_release "joplin-server" "laurent22/joplin" "tarball" "latest"
49+
50+
msg_info "Setting up Joplin Server (Patience)"
51+
LOCAL_IP=$(hostname -I | awk '{print $1}')
52+
cd /opt/joplin-server
53+
sed -i "/onenote-converter/d" packages/lib/package.json
54+
$STD yarn config set --home enableTelemetry 0
55+
export BUILD_SEQUENCIAL=1
56+
$STD yarn install --inline-builds
57+
58+
cat <<EOF >/opt/joplin-server/.env
59+
PM2_HOME=/opt/pm2
60+
NODE_ENV=production
61+
APP_BASE_URL=http://$LOCAL_IP:22300
62+
APP_PORT=22300
63+
DB_CLIENT=pg
64+
POSTGRES_PASSWORD=$DB_PASS
65+
POSTGRES_DATABASE=$DB_NAME
66+
POSTGRES_USER=$DB_USER
67+
POSTGRES_PORT=5432
68+
POSTGRES_HOST=localhost
69+
EOF
70+
msg_ok "Setup Joplin Server"
71+
72+
msg_info "Setting up Service"
73+
cat <<EOF >/etc/systemd/system/joplin-server.service
74+
[Unit]
75+
Description=Joplin Server Service
76+
After=network.target
77+
78+
[Service]
79+
Type=simple
80+
WorkingDirectory=/opt/joplin-server/packages/server
81+
EnvironmentFile=/opt/joplin-server/.env
82+
ExecStart=/usr/bin/yarn start-prod
83+
Restart=on-failure
84+
RestartSec=5
85+
86+
[Install]
87+
WantedBy=multi-user.target
88+
EOF
89+
systemctl enable -q --now joplin-server
90+
msg_ok "Service Setup"
91+
92+
motd_ssh
93+
customize
94+
95+
msg_info "Cleaning up"
96+
$STD apt-get -y autoremove
97+
$STD apt-get -y autoclean
98+
msg_ok "Cleaned"

0 commit comments

Comments
 (0)