[38;5;244m┌─[0m [38;5;40mroot@joaocosta:~#[0m [38;5;245mcat posts/14.md[0m [38;5;244m───────────────────────────────────────────[0m

[38;5;40m#[0m [1mUsing Joplin to publish a wiki[0m
[38;5;245mpublished 2024-12-05 · 3 min read · https://joaocosta.dev/blog/14[0m

Recently I've been on an adventure to find a note-taking app that allows me to
publish my notes as a personal wiki. I've ended up choosing Joplin.

You can access the wiki [38;5;40mhere[0m [38;5;244m(https://wiki.joaocosta.dev/)[0m.

[38;5;38m##[0m [1mWhy Joplin as a wiki software[0m

For a few years now, I've published a personal wiki. This basically means
sharing a part of my personal notes that I decided to make public. I used to use
dedicated wiki software. Started with [38;5;40mDokuWiki[0m
[38;5;244m(https://www.dokuwiki.org/dokuwiki)[0m, then moved to [38;5;40mWiki.js[0m [38;5;244m(https://js.wiki/)[0m.
The problem was that reaching out to the wiki to take notes broke my workflow,
so I didn't write much. At the same time, I was trying to settle on a single
note taking software. This is where [38;5;40mJoplin[0m [38;5;244m(https://joplinapp.org/)[0m comes in.

Joplin fits my use cases nicely:

[38;5;40m→[0m It's open source.
[38;5;40m→[0m Allows me to take notes in Markdown format.
[38;5;40m→[0m Has self-hosted sync options (bonus by being builtin).
[38;5;40m→[0m Allows me to have a shared notebook with my partner.
[38;5;40m→[0m Allows me to publish notes aka my personal wiki (using [38;5;40mJoplin Server[0m
  [38;5;244m(https://github.com/laurent22/joplin/blob/dev/packages/server/README.md)[0m).

[38;5;38m##[0m [1mHow I did it[0m

Joplin allows me to publish individual notes (make them publicly viewable), but
I wanted to publish an entire directory/notebook (my wiki). For this reason I
went with a slightly different approach. I'm using a Github action to fetch my
Wiki notebook through the [38;5;40mjoplin cli[0m [38;5;244m(https://joplinapp.org/help/apps/terminal/)[0m
and export the contents as markdown files. There is another action that takes
these markdown files and builds the Wiki using [38;5;40mmdBook[0m
[38;5;244m(https://rust-lang.github.io/mdBook/)[0m.

In other words:

[38;5;40m→[0m I write in my notetaking app (Joplin) inside a Wiki notebook (directory).
[38;5;40m→[0m Github fetches these notes and exports them as markdown files.
[38;5;40m→[0m An intermediate step builds the Wiki summary (a sitemap needed by mdBook).
[38;5;40m→[0m Lastly, Github builds and publishes the Wiki with Github pages.

This happens once a day at midnight (UTC). The contents of the [38;5;40mrepo[0m
[38;5;244m(https://github.com/joaocostaifg/wiki)[0m are something like a daily snapshot of
the Wiki notebook.

[38;5;38m##[0m [1mHosting Joplin server[0m

I host Joplin server using Docker compose:

[38;5;244m┄───────────────────────────────────────────────────────────────────────── yml [0m
[38;5;245m│[0m services:
[38;5;245m│[0m   joplin:
[38;5;245m│[0m     image: joplin/server:latest
[38;5;245m│[0m     container_name: joplin
[38;5;245m│[0m     ports:
[38;5;245m│[0m       - "22300:22300"
[38;5;245m│[0m     environment:
[38;5;245m│[0m       - APP_BASE_URL=https://joplin.myserver.com
[38;5;245m│[0m       - APP_PORT=22300
[38;5;245m│[0m       - SQLITE_DATABASE=/data/db.sqlite
[38;5;245m│[0m     volumes:
[38;5;245m│[0m       - joplin_data:/data
[38;5;245m│[0m     restart: unless-stopped
[38;5;245m│[0m 
[38;5;245m│[0m volumes:
[38;5;245m│[0m   joplin_data:
[38;5;244m┄──────────────────────────────────────────────────────────────────────────────[0m

This runs the server on port 22300 using an SQLite database. Unless you have
lots of users, I see no reason to use the PostgreSQL database option.

[38;5;38m##[0m [1mWant to the same as well?[0m

[38;5;40m→[0m Fork the [38;5;40mrepo[0m [38;5;244m(https://github.com/joaocostaifg/wiki)[0m.
[38;5;40m→[0m Set the following Github secrets (for the action):
- [38;5;38mJOPLIN_PATH[0m - your Joplin server instance URL. Something like
[38;5;38mhttps://joplin.myserver.com[0m - [38;5;38mJOPLIN_USER[0m - the Joplin user that is gonna be
used to fetch the contents. I created a user for this with whom I share the Wiki
notebook. - [38;5;38mJOPLIN_PASSWORD[0m - the password for the Joplin user.

The step that builds the mdBook is on a [38;5;40mseparate action[0m
[38;5;244m(https://joaocosta.dev/blog/.github/workflows/mdbook.yml)[0m. If you want to build
another kind of site, for example a personal blog, you can change this action to
build something else. There's a bunch of Github actions already setup for that.

[38;5;38m##[0m [1mConclusion[0m

[38;5;40mJoplin[0m [38;5;244m(https://joplinapp.org/)[0m and [38;5;40mmdBook[0m
[38;5;244m(https://github.com/joaocostaifg/wiki)[0m are pretty cool. Finally, I can write my
notes in a single place and easily keep them synced between my devices. I highly
recommend giving [38;5;40mJoplin[0m [38;5;244m(https://joplinapp.org/)[0m a try.

Stay safe :P

[38;5;244m└─[0m [38;5;40m→[0m view online: [38;5;40mhttps://joaocosta.dev/blog/14[0m
