Joplin Server is the self-hosted synchronization backend for the popular open-source note-taking app, Joplin. It allows users to sync their notes, notebooks, attachments, and tasks across devices while maintaining full control of their data. By hosting Joplin Server yourself, you gain customization options, enhanced security, and independence from third-party services. This guide provides step-by-step instructions to install, configure, manage, and leverage Joplin Server to its fullest potential.
Installing Joplin Server
π¦ Docker/Docker Compose Setup
Docker Compose is the easiest and most efficient way to deploy Joplin Server. Below is a complete docker-compose.yml
tailored for Joplin Server. It includes a PostgreSQL database and volume configurations for persistent storage.
- Create a directory for Joplin Server:
mkdir -p ~/joplin-server && cd ~/joplin-server
- Create a
docker-compose.yml
file:
version: "3.8"
services:
db:
image: postgres:15
volumes:
- ./data/postgres:/var/lib/postgresql/data
environment:
POSTGRES_USER: joplin
POSTGRES_PASSWORD: joplinpassword
POSTGRES_DB: joplin
restart: always
app:
image: joplin/server:latest
ports:
- "22300:22300"
environment:
APP_BASE_URL: "http://yourdomain.com" # Update with your domain
DB_CLIENT: "pg"
POSTGRES_PASSWORD: "joplinpassword"
POSTGRES_DATABASE: "joplin"
POSTGRES_USER: "joplin"
POSTGRES_PORT: 5432
POSTGRES_HOST: "db"
NODE_ENV: "production"
depends_on:
- db
restart: always
- Deploy the stack using Docker Compose:
docker-compose up -d
- Verify the deployment:
docker ps
curl http://localhost:22300/api/ping
π Manual Installation
For users who prefer manual installation, below are the steps to set up Joplin Server directly on a Linux server.
- Install Node.js and PostgreSQL:
sudo apt update
sudo apt install -y nodejs npm postgresql
- Clone the Joplin Server repository:
git clone https://github.com/laurent22/joplin.git
cd joplin/packages/server
- Install dependencies:
npm install
- Configure the database in PostgreSQL:
sudo -u postgres psql
CREATE DATABASE joplin;
CREATE USER joplin WITH PASSWORD 'joplinpassword';
GRANT ALL PRIVILEGES ON DATABASE joplin TO joplin;
\q
- Run the server:
APP_BASE_URL=http://yourdomain.com DB_CLIENT=pg \
POSTGRES_DATABASE=joplin POSTGRES_USER=joplin POSTGRES_PASSWORD=joplinpassword \
POSTGRES_HOST=localhost POSTGRES_PORT=5432 \
npm start
Configuring Nginx as a Reverse Proxy
π Nginx Configuration
To route traffic through Nginx and serve Joplin Server at your domain, create the following Nginx server block:
- Create an Nginx configuration file:
sudo nano /etc/nginx/sites-available/joplin
- Add the server block:
server {
server_name yourdomain.com;
location / {
proxy_pass http://localhost:22300;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
listen 80;
}
- Enable the configuration:
sudo ln -s /etc/nginx/sites-available/joplin /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx
π SSL/TLS Setup
Secure your domain with Let's Encrypt using Certbot:
- Install Certbot:
sudo apt install -y certbot python3-certbot-nginx
- Obtain and apply an SSL certificate:
sudo certbot --nginx -d yourdomain.com
- Automate certificate renewals:
sudo systemctl enable certbot.timer
π οΈ Testing and Reloading Nginx
Test the Nginx configuration for issues and reload:
sudo nginx -t
sudo systemctl reload nginx
Logging and Debugging Joplin Server
ποΈ Enabling Debug Logs
Enable debug logging for Joplin Server by setting LOG_LEVEL
to debug
in your environment variables:
LOG_LEVEL=debug
For Docker Compose, add this to the app
service in docker-compose.yml
:
environment:
LOG_LEVEL: debug
Restart the container:
docker-compose restart
π Viewing Logs
Access logs to monitor the server:
- Docker:
docker logs -f joplin-server_app_1
- Manual installation:
tail -f logs/app.log
π οΈ Troubleshooting Common Issues
Common errors are often database-related. Check connectivity:
psql -U joplin -h localhost -d joplin -c "\dt"
Ensure environmental variables in docker-compose.yml
or .env
are accurate.
π€ Exporting Logs
To forward logs to an ELK stack:
-
Install
Filebeat
on your server. -
Configure it to watch log files:
filebeat.inputs:
- type: log
paths:
- /path/to/app.log
- Restart Filebeat:
systemctl restart filebeat
Backup and Restore
ποΈ File-Based Backups
Back up your server configurations:
tar -czvf joplin-config-backup.tar.gz ~/joplin-server
π Database Backups
Export the database:
pg_dump -U joplin -h localhost joplin > joplin-backup.sql
Restore the database:
psql -U joplin -h localhost -d joplin -f joplin-backup.sql
π Automated Backup Scripts
Automate backups with a cron job:
crontab -e
0 2 * * * pg_dump -U joplin -h localhost joplin > ~/backups/joplin-$(date +\%F).sql
Updating and Upgrading Joplin Server
β¬οΈ Updating Docker Images
To update Joplin Server when using Docker:
docker-compose pull
docker-compose up -d
π οΈ Manual Updates
If installed manually, pull the latest code and rebuild:
cd ~/joplin/packages/server
git pull
npm install
npm start
π Checking for Updates
Monitor the Joplin Server GitHub repository for release notes and updates.
Leveraging Joplin Serverβs Unique Features
π§ Enabling APIs
Joplin Server includes a robust API. To enable it, ensure APP_BASE_URL
is set, then test an endpoint:
curl http://yourdomain.com/api/ping
π Advanced Configurations
Integrate third-party tools like Prometheus for monitoring or configure rate-limiting using Nginx:
limit_req_zone $binary_remote_addr zone=mylimit:10m rate=5r/s;
Wrapping Up
By deploying and managing Joplin Server, you gain full control over your data synchronization and note management. This guide covers every essential step, from installation and configuration to backups and updates, empowering you to customize and secure your self-hosted environment. Start exploring the provided code examples to unlock the full potential of Joplin Server for your workflow!