'502 Bad Gateway' error while setting up joplin server on RPi4

Hey guys,

I'm trying to setup joplin server on my RPi4 running a 64 bit kernel for the first time and am experiencing some difficulties in connecting to the server.

I have setup the server using the following docker-compose.yml

version: '3'
            - APP_BASE_URL=https://notes.xxxxx.com
            - APP_PORT=22300
            - POSTGRES_PASSWORD=pg_pass
            - POSTGRES_DATABASE=joplin
            - POSTGRES_USER=joplin_user
            - POSTGRES_PORT=5432
            - POSTGRES_HOST=db
            - DB_CLIENT=pg
        restart: unless-stopped
        image: florider89/joplin-server:master
        #image: florider89/joplin-server:latest
        platform: linux/arm64
            - "22300:22300"
        restart: unless-stopped
        image: postgres:13.1
            - "5432:5432"
            - /foo/bar/joplin-data:/var/lib/postgresql/data
            - POSTGRES_PASSWORD=joplin_pass
            - POSTGRES_USER=joplin_user
            - POSTGRES_DB=joplin

Docker is pulling the latest image for pi which I believe is 2.2.7-beta.

NGINX Proxy Manager is used to expose the server to the system and I've mapped that to '${pi_local_ip}:22300'

When I try to go to https://notes.xxxxx.com, I'm greeted with a 502 Bad Gateway error.
How would I go about troubleshooting this?

Thanks a lot,

So you have mapped your-domain.com to raspi-ip:22300?

Then you would have to go to your-domain.com to login. Did you do that?

Is the proxy manager running on the pi? If so try setting the destination as

If the pi is a different machine to the proxy, check you haven't at some point installed a firewall on the pi like ufw. You'll have to open up port 22300.

Say the local ip address for my RPi4 is 192.168.X.Y and the domain I am using is joplin.xxxxx.com

I have setup CNAME rules with my DNS provider to resolve joplin.xxxxx.com to the pi's public ip address (say 167.248.X.Y). Now in NGINX proxy manager, I set up joplin.xxxxx.com to point to 192.168.X.Y:22300.

I run the same exact setup for a bunch of other apps running on the same pi and they all are accessible without any problems.

For joplin,
If I go to joplin.xxxxxxx.com, I get the '502 Bad Gateway' error.
If I go to 192.168.X.Y:22300, I get the 'This site can't be reached' error.

So, I cannot access the login page, @MrKanister.
@dpoulton, the NGINX proxy manager is running on the same pi and I tried setting the destination to and still have the same issues.

Which suggests that Joplin is possibly not running. For a start do not use the :master tag for the image as I mentioned on GitHub, try with :2.2.7-beta which florider has now uploaded.

What errors do you get if you run docker-compose logs?

Switched to :2.2.7-beta and pulled the latest image.

docker-compose logs doesn't show any obvious errors, the output is pasted here -

db_1   | The files belonging to this database system will be owned by user "postgres".
db_1   | This user must also own the server process.
db_1   |
db_1   | The database cluster will be initialized with locale "en_US.utf8".
db_1   | The default database encoding has accordingly been set to "UTF8".
db_1   | The default text search configuration will be set to "english".
db_1   |
db_1   | Data page checksums are disabled.
db_1   |
db_1   | fixing permissions on existing directory /var/lib/postgresql/data ... ok
db_1   | creating subdirectories ... ok
db_1   | selecting dynamic shared memory implementation ... posix
db_1   | selecting default max_connections ... 100
db_1   | selecting default shared_buffers ... 128MB
db_1   | selecting default time zone ... Etc/UTC
db_1   | creating configuration files ... ok
db_1   | running bootstrap script ... ok
db_1   | performing post-bootstrap initialization ... ok
db_1   | syncing data to disk ... ok
db_1   |
db_1   |
db_1   | Success. You can now start the database server using:
db_1   |
db_1   |     pg_ctl -D /var/lib/postgresql/data -l logfile start
db_1   |
db_1   | initdb: warning: enabling "trust" authentication for local connections
db_1   | You can change this by editing pg_hba.conf or using the option -A, or
db_1   | --auth-local and --auth-host, the next time you run initdb.
db_1   | waiting for server to start....2021-07-12 18:18:31.325 UTC [50] LOG:  starting PostgreSQL 13.1 (Debian 13.1-1.pgdg100+1) on arm-unknown-linux-gnueabihf, compiled by gcc (Debian 8.3.0-6) 8.3.0, 32-bit
db_1   | 2021-07-12 18:18:31.343 UTC [50] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
db_1   | 2021-07-12 18:18:31.391 UTC [51] LOG:  database system was shut down at 2021-07-12 18:18:27 UTC
db_1   | 2021-07-12 18:18:31.447 UTC [50] LOG:  database system is ready to accept connections
db_1   |  done
db_1   | server started
db_1   |
db_1   |
db_1   | /usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*
db_1   |
db_1   | waiting for server to shut down....2021-07-12 18:18:32.896 UTC [50] LOG:  received fast shutdown request
db_1   | 2021-07-12 18:18:32.902 UTC [50] LOG:  aborting any active transactions
db_1   | 2021-07-12 18:18:32.916 UTC [50] LOG:  background worker "logical replication launcher" (PID 57) exited with exit code 1
db_1   | 2021-07-12 18:18:32.918 UTC [52] LOG:  shutting down
db_1   | 2021-07-12 18:18:32.994 UTC [50] LOG:  database system is shut down
db_1   |  done
db_1   | server stopped
db_1   |
db_1   | PostgreSQL init process complete; ready for start up.
db_1   |
db_1   | 2021-07-12 18:18:33.162 UTC [1] LOG:  starting PostgreSQL 13.1 (Debian 13.1-1.pgdg100+1) on arm-unknown-linux-gnueabihf, compiled by gcc (Debian 8.3.0-6) 8.3.0, 32-bit
db_1   | 2021-07-12 18:18:33.162 UTC [1] LOG:  listening on IPv4 address "", port 5432
db_1   | 2021-07-12 18:18:33.162 UTC [1] LOG:  listening on IPv6 address "::", port 5432
db_1   | 2021-07-12 18:18:33.176 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
db_1   | 2021-07-12 18:18:33.194 UTC [78] LOG:  database system was shut down at 2021-07-12 18:18:32 UTC
db_1   | 2021-07-12 18:18:33.222 UTC [1] LOG:  database system is ready to accept connections

I believe these are the logs from the joplin_db_1 container and I am not sure how to get the logs for joplin_app_1, the log files I can access only contain the line No log line matching the '' filter

When I run the logs command I get entries for both db_1 and app_1. Also if you try to access Joplin using http://ipaddress:22300 you should (if Joplin Server is running) get an "Invalid Origin" error.

I am still trying to learn docker myself, but try docker container ls and have a look at the status of the container.

Your GitHub post mentions you got a no matching manifest for linux/arm/v7 in the manifest list entries message when trying to pull the image. Isn't the Pi4 armv8 and isn't v7 32-bit?

Also my Pi4 running docker on RasPiOS Lite x64 pulls the image without complaint and without needing platform: linux/arm64 which I have so far only seen being mentioned as a build option.

I am wondering if you have got docker to pull an image but it is not one that is compatible with your system.

Your kernel is different to mine, what OS are you using?

If not RasPiOS x64 run getconf LONG_BIT on your system and see if the answer is 32 or 64.

Thanks a lot for your help @dpoulton. I believe this is it.

I think I only upgraded my kernel to 64bit and not the OS itself, which is why I am running into the issues I mentioned. joplin_app_1 container doesn't seem to work.

I think I will have to flash a 64 bit OS and start from scratch. :frowning:

Glad that we eventually solved it.

No it won't run on what is actually a 32-bit OS.

I think you will! :slight_smile:

I know I'm kind of hijacking this thread, but if either of you could provide the link to the docker image / github repo / ... where I can find the latest arm64 image (that the posts above hint at), that would be much appreciated :slight_smile:


So your docker-compose file would (as of today) have the image as florider89/joplin-server:2.2.7-beta.

Don't use the master or latest tags because master is an unreliable copy and latest is not in use yet, pending a "release" version. At the moment every image is a beta, just like the official Joplin docker image repo.

1 Like

For anyone finding themselves in my position i.e. have a 32-bit OS setup but want to install 64-bit images -

The alternative for me was to flash a 64-bit OS and start from scratch when I came across this amazing post - Easily run 64-bit Debian Buster packages on a Raspbian system: new RPi4 / RPi3 image released (systemd-nspawn, LXDE) - Page 6 - Raspberry Pi Forums

Sakaki managed to build a containerized 64-bit shell for the RPi4 and now the 'raspbian-nspawn-64' package is installable from the official Raspbian repo making installation a breeze.

My understanding of this method is that it creates a hybrid mode with the 64-bit image (debian-buster) running within a container on top of the base 32-bit Raspbian OS. All network interfaces are available within the 64-bit container, so it's almost like running processes natively on a 64-bit OS.

I was able to set this up on my RPi, as I already had a 64 bit kernel and didn't want to start from scratch. I was able to get the latest joplin server up and running inside the 64-bit container and have set up syncs successfully. It's very stable so far.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.