Taking And Syncing Notes With Joplin

In this guide, I will show you how to set up Joplin server. Joplin is a note taking tool with support for markdown. The server component is used to sync the notes between devices.

Taking And Syncing Notes With Joplin
Photo by David Travis / Unsplash

One of the reasons I chose Ghost to host this website, is Markdown. Markdown is a simple syntax to write. If you ever saw a repository on (or another git host). You probably noticed the README.md file. Those are written in Markdown. As the syntax is easy, the learning curve is short.

I'll give you an example:

# header 1

## header 2

this is some text

- this is a list item
- this too!

1. Numbers
2. More Numbers

| table    | col2     |
|----------|----------|
| yes      | markdown |
| supports | tables   |

This text will then render as:

header 1

header 2

this is some text

  • this is a list item
  • this too!
  1. Numbers
  2. More Numbers
table col2
yes markdown
supports tables

I use markdown a lot. It makes me confident that what I write will always look decent when rendered. Unlike some other text editors, where the whole layout changes when you move an image. That's why I also use it for my notes. And as I use my notes to write parts of these posts, it makes it easy to copy-paste.

I do want my notes synced between devices though. That's why I chose Joplin to manage them. They also have a server component. You could also sync using Nextcloud or other services, but I wanted this data to be completely mine.

Joplin Server

Luckily for us, the creator of Joplin creates a docker image. We can use this image in our docker-compose file. As always I will create a new folder with two files inside: docker-compose.yml and .env.

The first part of the compose file will be the same as always. We define the syntax version, and set the default network to the same as our NPM service:

version: '3'

networks:
  default:
    external:
      name: npm_network

Next we will add two services. A Postgres database to store all the data, and the Joplin server.

services:
  joplin_db:
    image: postgres:13.1
    volumes:
      - ${DATADIR}/postgres/data:/var/lib/postgresql/data
    restart: unless-stopped
    environment:
      - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
      - POSTGRES_USER=${POSTGRES_USER}
      - POSTGRES_DB=${POSTGRES_DATABASE}

  joplin_app:
    image: joplin/server:2.2.8-beta
    depends_on:
      - joplin_db
    restart: unless-stopped
    environment:
      - APP_PORT=22300
      - APP_BASE_URL=${JOPLIN_URL}
      - DB_CLIENT=pg
      - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
      - POSTGRES_DATABASE=${POSTGRES_DATABASE}
      - POSTGRES_USER=${POSTGRES_USER}
      - POSTGRES_PORT=5432
      - POSTGRES_HOST=joplin_db

The environment variables will be filled in with the values from our .env file:

DATADIR=/media/docker/joplin
POSTGRES_USER=*****
POSTGRES_PASSWORD=*****
POSTGRES_DATABASE=*****
JOPLIN_URL=https://***

Fill in those variables with your values. Then you can launch the services using docker-compose up -d.

Client

If you didn't have the client installed already, you can do so now. In the preferences you can set up sync with your newly created Joplin server. You can find this under the Synchronisation tab in the settings of Joplin.

Settings-Synchronisation

You can also set up encryption for your notes (which everyone should do), under the Encryption tab. This will make sure your notes are only readable by u, and not by people with access to the server or database.