close
close

Host a Joplin Sync server yourself in Proxmox

Intro

In a previous post I had written a guide to setting up Obsidian and CouchDB for sync, since then I’ve been struggling to get into the right rhythm and keep everything running. This post is the first in a two-part series on setting up Joplin and hosting your own sync server. The sync path is a little simpler than the Obsidian method. Since that was the case, and I wasn’t really using Obsidian in a way that worked for me, I switched. Let’s start with setting up the server and in the next post I’ll go into more detail about why I switched and how to set up the sync server in the Joplin clients themselves.

Creating a base LXC for Joplin

We want to run a few commands to get a basic LXC for our server. Since my home lab is a hyper-converged Promxox Cluster and this project uses Docker, I decided to use a stripped down LXC, the script for which can be found on the tteck site.

Run the Proxmox script to set up LXC

Run the following in the shell on your Proxmox node/server. As you go through the prompts, use the progress and change the disk size to 5GB to start, say yes to docker compose, and leave the rest as default (maybe change the name), then you’re ready to go.

bash -c "$(wget -qO - https://github.com/tteck/Proxmox/raw/main/ct/alpine-docker.sh)"
Go to full screen mode

Exit full screen mode

Joplin Sync Server

While researching this, I found an article on Vultr by Humphrey Mpairwe that served as a starting point.

Important note about reverse proxies

If you are using NPM (Nginx Proxy Manger) or Traefik, you will want to do that to set up a reverse proxy. In my case, I added a subdomain and forwarder using Cloudflare Tunnels.

Starting the synchronization server itself

Run the following commands to get started with the prep work.

mkdir /opt/joplin
cd /opt/joplin
nano docker-compose.yml
Go to full screen mode

Exit full screen mode

Now we want to paste the following into the docker-compose.yml file.

version: '3'

services:
  db:
    image: postgres:13
    volumes:
      - ./data/postgres:/var/lib/postgresql/data
    ports:
      - "5432:5432"
    restart: always
    environment:
      - POSTGRES_PASSWORD=strong-password
      - POSTGRES_USER=joplin-user
      - POSTGRES_DB=joplindb
  app:
    image: joplin/server:latest
    container_name: joplin-server
    depends_on:
      - db
    ports:
      - "8080:8080"
    restart: always
    environment:
      - APP_PORT=8080
      - APP_BASE_URL=https://joplin.example.com
      - DB_CLIENT=pg
      - POSTGRES_PASSWORD=strong-password
      - POSTGRES_DATABASE=joplindb
      - POSTGRES_USER=joplin-user
      - POSTGRES_PORT=5432
      - POSTGRES_HOST=db
Go to full screen mode

Exit full screen mode

Once that’s done and you’ve changed the app base URL and passwords, press ctrl+x and then y to save the file. Now we only have one command to get things going.

docker compose up -d
Go to full screen mode

Exit full screen mode

After a minute you should be able to go to the URL we set earlier. The default username is [email protected] and the password is admin, which you want to change.

Wrapping up

If you found this helpful, please consider following, or clapping if you read this on Medium, please consider buying me a coffee.

Until next time fair winds and following seas.