Joplin Server on Rootless Podman

I would like to share my use case so that you guys to be aware of perhaps a niche use-case for the Joplin Server. Instead of using rootful docker, I am using rootless podman. I initially tried to use rootless docker, but was unsuccessful at getting that to work due to the docker daemon's rootful-first nature - at least as far as I could tell. Would it be possible if I could help contribute to some of the documentation as well? I struggled to understand the Joplin Server documentation, and I had to rely heavily on outside resources. Anyway, some key features of my configuration are running the container in rootless mode (as previously discussed), using a postgres database on my host machine rather than in a container, and using a filesystem storage driver. Which after rereading some of the documentation, it seems that that is mutually exclusive from the database. At first, I was under the impression that it uses both if you set the storage driver to the filesystem (i.e. database for metadata and filesystem for large files). At any rate, here is the command I used to get everything working:

--label io.containers.autoupdate=registry \
--env-file $HOME/joplin.env \
-p 10.0.0.2:22300:22300 \
--userns keep-id:uid=1001,gid=1001 \
-v /var/run/postgresql:/var/run/postgresql:ro \
-v $HOME/notes:/home/joplin/notes:Z \
--name joplin \
docker.io/joplin/server:latest

The --label parameter uses Podman's auto update feature, which Docker doesn't have to my knowledge. Although it's not a super important detail to the point I am trying to make, the publish port specifies the ip address of my homelab's Wireguard tunnel. Wireguard is how the remote Nginx reverse proxy communicates with that machine. I won't include the remote machine's NGINX configuration on this initial post because it is pretty long, and this post is already very long. Anyway, since my host's uid and gid do not match that of the container, I use the --userns keep-id parameter to allow the host's uid and gid to be used within the container without specifying any mapping that would change the uid and gid of the joplin user within the container. This is important if using a filesystem driver for the storage medium as I have. Also, here I am using a postgres socket, but at one point I did connect to the same database on the host over IP using the --net=host parameter passed into the podman run. For more useful information, the environment variables I pass into the container are:

# Base Configuration
APP_PORT=22300
APP_BASE_URL=https://notes.example.com

# Database Configuration
DB_CLIENT=pg
POSTGRES_PASSWORD=secret
POSTGRES_DATABASE=joplin
POSTGRES_USER=joplin
POSTGRES_PORT=5432
POSTGRES_HOST=/var/run/postgresql

# Storage Driver Configuration
STORAGE_DRIVER=Type=Filesystem; Path=/home/joplin/notes

# SMTP Email Settings
MAILER_ENABLED=1
MAILER_HOST=mail.example.com
MAILER_PORT=465
MAILER_SECURE=1
MAILER_AUTH_USER=username@example.com
MAILER_AUTH_PASSWORD=secret
MAILER_NOREPLY_NAME=JoplinServer
MAILER_NOREPLY_EMAIL=joplin@example.com

To be honest though, I am not sure that my mailer config works. I know that it would be a configuration issue there, as I have successfully implemented a mailer elsewhere.

TLDR; I hope this is useful to users who may want to configure their server in rootless mode or with a non-containerized PostgreSQL database. Running in rootless mode presents unique challenges, particularly with Joplin server. I also hope this post provides useful information to the devs by providing ways users may use the server software.

From Joplin Server 2.7 MAILER_SECURE= was replaced by MAILER_SECURITY= and its values are tls, starttls or none.

source