# Fresh installation support (Joplin server / Portainer / Docker)

**URL:** <https://discourse.joplinapp.org/t/fresh-installation-support-joplin-server-portainer-docker/25563>\
**Category:** Support\
**Created:** [8 May 2022 17:32 UTC](https://discourse.joplinapp.org/t/fresh-installation-support-joplin-server-portainer-docker/25563 "2022-05-08T17:32:56Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![benj29](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/benj29/32/13771_2.png) [@benj29](https://discourse.joplinapp.org/u/benj29)\
**Post date:** [8 May 2022 17:32 UTC](https://discourse.joplinapp.org/t/fresh-installation-support-joplin-server-portainer-docker/25563/1 "2022-05-08T17:32:56Z")

</div>

Hi,

I've tried to explain my installation.

I want to try Joplin and Joplin Server to replace my Evernote usage since more than 10y... (when Ever was a startup !).

My physical installation is :

- a "server" with lot of VM ; one on Debian10 + Docker + Portainer including yml for db/joplin server
- a NAS where a /Notes is share with a "joplin" user. The aim of this storage is to have a reliable directory where DB & notes are stored (synchronized with an another NAS outside and an encrypted harddrive in parallel).

So, i've installed my VM based on Debian10 ; in proxmox.  
Please note that i have a separated VM apache where all my vhost are configured (see after).

Just for the directory mount on the VM, my fstab is:

```auto
//NASIP/Notes /mnt/QNAP cifs user=joplin,pass=password,dir_mode=0755,file_mode=0755,uid=1000,gid=1000 0 0

```

After docker installation, portainer is launched.  
I added a stack:

```auto
version: '2'

services:
    db:
        image: postgres:13
        volumes:
            - /mnt/QNAP:/var/lib/postgresql/data
        ports:
            - "5432:5432"
        restart: unless-stopped
        environment:
            - POSTGRES_PASSWORD=db_password_stupid
            - POSTGRES_USER=db_admin
            - POSTGRES_DB=db_joplin
    app:
        image: joplin/server:latest
        depends_on:
            - db
        ports:
            - "22300:22300"
        restart: unless-stopped
        environment:
            - APP_PORT=22300
            - APP_BASE_URL=http://192.168.2.81:22300
            - DB_CLIENT=pg
            - POSTGRES_PASSWORD=db_password_stupid
            - POSTGRES_DATABASE=db_joplin
            - POSTGRES_USER=db_admin
            - POSTGRES_PORT=5432
            - POSTGRES_HOST=db

```

After, i've access in my local network to  
`http://192.168.2.81:22300/login`  
Seems to be good 😃 ... No.

In the log for postgre db:

```auto
The files belonging to this database system will be owned by user "postgres".,
This user must also own the server process.,
,
The database cluster will be initialized with locale "en_US.utf8".,
The default database encoding has accordingly been set to "UTF8".,
The default text search configuration will be set to "english".,
,
Data page checksums are disabled.,
,
fixing permissions on existing directory /var/lib/postgresql/data ... ok,
creating subdirectories ... ok,
selecting dynamic shared memory implementation ... posix,
selecting default max_connections ... 100,
selecting default shared_buffers ... 128MB,
selecting default time zone ... Etc/UTC,
creating configuration files ... ok,
running bootstrap script ... ok,
performing post-bootstrap initialization ... ok,
syncing data to disk ... ok,
,
initdb: warning: enabling "trust" authentication for local connections,
You can change this by editing pg_hba.conf or using the option -A, or,
--auth-local and --auth-host, the next time you run initdb.,
,
Success. You can now start the database server using:,
,
    pg_ctl -D /var/lib/postgresql/data -l logfile start,
,
waiting for server to start....2022-05-08 16:44:13.175 UTC [48] LOG: starting PostgreSQL 13.6 (Debian 13.6-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit,
2022-05-08 16:44:13.179 UTC [48] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432",
2022-05-08 16:44:13.191 UTC [49] LOG: database system was shut down at 2022-05-08 16:44:12 UTC,
2022-05-08 16:44:13.197 UTC [48] LOG: database system is ready to accept connections,
 done,
server started,
CREATE DATABASE,
,
,
/usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*,
,
2022-05-08 16:44:13.621 UTC [48] LOG: received fast shutdown request,
waiting for server to shut down....2022-05-08 16:44:13.625 UTC [48] LOG: aborting any active transactions,
2022-05-08 16:44:13.627 UTC [48] LOG: background worker "logical replication launcher" (PID 55) exited with exit code 1,
2022-05-08 16:44:13.629 UTC [50] LOG: shutting down,
2022-05-08 16:44:13.651 UTC [48] LOG: database system is shut down,
 done,
server stopped,
,
PostgreSQL init process complete; ready for start up.,
,
2022-05-08 16:44:13.746 UTC [1] LOG: starting PostgreSQL 13.6 (Debian 13.6-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit,
2022-05-08 16:44:13.746 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432,
2022-05-08 16:44:13.746 UTC [1] LOG: listening on IPv6 address "::", port 5432,
2022-05-08 16:44:13.752 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432",
2022-05-08 16:44:13.764 UTC [62] LOG: database system was shut down at 2022-05-08 16:44:13 UTC,
2022-05-08 16:44:13.772 UTC [1] LOG: database system is ready to accept connections,
2022-05-08 16:44:18.070 UTC [69] ERROR: relation "knex_migrations" does not exist at character 20,
2022-05-08 16:44:18.070 UTC [69] STATEMENT: select "name" from "knex_migrations" order by "id" desc limit $1,

```

Is it normal to see ????

```auto
2022-05-08 16:44:13.772 UTC [1] LOG: database system is ready to accept connections,
2022-05-08 16:44:18.070 UTC [69] ERROR: relation "knex_migrations" does not exist at character 20,
2022-05-08 16:44:18.070 UTC [69] STATEMENT: select "name" from "knex_migrations" order by "id" desc limit $1,

```

Maybe, i'm not sure, but i can't access with my sudo user on the VM to /mnt/QNAP where are stored the DB. Docker user is 998 (guid) ; my user is 1000 (gid). Is it okay ?

![](https://i.imgur.com/gpdUobS.png)

On my NAS, i don't see the files in the mounted directory (mount is okay without error)...

Another problem, maybe due to i'm not an expert on vhost.  
My router maps the 22300 to 22300 / IP - VM (where joplin server & db).  
I'm not sure if i do correctly.

**I want to expose only SSL/HTTPS on the web to access & sync outside my notes.**

My conf is not working. I have an error message (i've tried https, http etc)

```auto
2022-05-08 17:06:22: [error] App: 404: GET /login: ::ffff:IPIP: Invalid origin: https://subdomain.domain.ovh:22300

```

joplin-ssl.conf (with a2ensite ; reload):

```auto
<IfModule mod_ssl.c>
<VirtualHost *:443>

       ProxyPreserveHost On
       ServerName subdom.dom.ovh

       ProxyRequests Off
       ProxyPreserveHost On
       ProxyPass / http://192.168.2.81:22300/ keepalive=On retry=5
       ProxyPassReverse / http://192.168.2.81:22300/

       ErrorLog /var/log/apache2/joplin_error.log
       CustomLog /var/log/apache2/joplin_access.log combined

       Include /etc/letsencrypt/options-ssl-apache.conf
       RewriteEngine on
       SSLEngine on

<IfModule mod_headers.c>
        <FilesMatch "\.(css|js|png|jpeg|jpg|ttf|woff)$">
                Header set Cache-Control "max-age=7200"
        </FilesMatch>
        <FilesMatch ".*(getResources.php)">
                Header set Cache-Control "max-age=7200"
        </FilesMatch>
        <FilesMatch ".*(getJS.php)">
                Header set Cache-Control "max-age=7200"
        </FilesMatch>
</IfModule>

              SSLCertificateFile /etc/letsencrypt/live/subdom.dom.ovh-0001/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/subdom.dom.ovh-0001/privkey.pem
</VirtualHost>
</IfModule>

```

Last questions, how i can add:

- a 2nd authentification factor like authenticator ?
- an email server configuration (to send email) ?
- is it possible to send email directly to joplin (like evernote) ?

Thanks for your help 🙂 !!!!!

---

<div class="post-metadata">

**Author:** ![MrKanister](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/mrkanister/32/20054_2.png) [@MrKanister](https://discourse.joplinapp.org/u/MrKanister)\
**Post date:** [8 May 2022 21:36 UTC](https://discourse.joplinapp.org/t/fresh-installation-support-joplin-server-portainer-docker/25563/2 "2022-05-08T21:36:43Z")

</div>

> [@benj29](#):
>
> On my NAS, i don't see the files in the mounted directory (mount is okay without error)...

I don't know what could cause the problems, but if you don't see the files on the NAS, try to create the whole database within a local folder first to see if everything works. If so, then the cifs mount is somehow related to the problem and we have to investigate further.

* * *

> [@benj29](#):
>
> My conf is not working. I have an error message (i've tried https, http etc)

The `APP_BASE_URL` in the stack has to be the one used to access the system from the outside, so in your case just `https://subdom.dom.ovh`.

* * *

> [@benj29](#):
>
> a 2nd authentification factor like authenticator ?

Currently not supported.

> [@benj29](#):
>
> an email server configuration (to send email) ?

See this thread: [Jopling Server 2.7.4 - Email Configuration](https://discourse.joplinapp.org/t/jopling-server-2-7-4-email-configuration/25326)

> [@benj29](#):
>
> is it possible to send email directly to joplin (like evernote) ?

No, it is not supported.

---

<div class="post-metadata">

**Author:** ![nokoa77](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/nokoa77/32/3207_2.png) [@nokoa77](https://discourse.joplinapp.org/u/nokoa77)\
**Post date:** [9 May 2022 14:08 UTC](https://discourse.joplinapp.org/t/fresh-installation-support-joplin-server-portainer-docker/25563/3 "2022-05-09T14:08:57Z")

</div>

> [@MrKanister](#):
>
> > [@benj29](#):
> >
> > is it possible to send email directly to joplin (like evernote) ?
> 
> No, it is not supported.

Hi, I succeded with a combination of :

- My Nextcloud server (not used to sync Joplin) ;
- Nextcloud plugin Files From Mail : [GitHub - nextcloud/files\_frommail: Recover your email attachments from your cloud](https://github.com/nextcloud/files_frommail) ;
- "Hotfolder" Joplin plugin.

And it works 🙂

But ok, it a bit "tiré par les cheveux" as we say in French

Good luck

Bruno

---

<div class="post-metadata">

**Author:** ![benj29](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/benj29/32/13771_2.png) [@benj29](https://discourse.joplinapp.org/u/benj29)\
**Post date:** [9 May 2022 18:46 UTC](https://discourse.joplinapp.org/t/fresh-installation-support-joplin-server-portainer-docker/25563/4 "2022-05-09T18:46:42Z")

</div>

Thanks to all, i will try this week to change some points and update my configuration.  
Keep U in touch.

---

<div class="post-metadata">

**Author:** ![benj29](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/benj29/32/13771_2.png) [@benj29](https://discourse.joplinapp.org/u/benj29)\
**Post date:** [11 May 2022 12:04 UTC](https://discourse.joplinapp.org/t/fresh-installation-support-joplin-server-portainer-docker/25563/5 "2022-05-11T12:04:51Z")

</div>

I've tried to setup my env file with your recommandations and a fresh installation.

When i'm writing:

```auto
            - APP_PORT=22300
            - APP_BASE_URL=https://sub.domain.ovh

```

And if i'm trying to connect on my local network:

- on the` http://192.168.2.81:22300` (which is the local IP) i've on navigator:  
`Invalid origin: http://192.168.2.81:22300`

- when i'm writing `https:// or http://sub.domain.ovh` (same as env file)  
i will be sent on my router page. Same thing if i'm outside my local network.

Maybe i'll do something wrong.

My conf apache ssl file is given on the first topic (with `http://192.168.2.81:22300`).  
My router has 22300 port routing from outside to the joplin ip.

What is not corrected ?

I will try email when i can connect to joplin server :D.  
I have done a fresh installation WITHOUT nas connection for files (cifs). I will mounted after.

---

<div class="post-metadata">

**Author:** ![MrKanister](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/mrkanister/32/20054_2.png) [@MrKanister](https://discourse.joplinapp.org/u/MrKanister)\
**Post date:** [11 May 2022 13:36 UTC](https://discourse.joplinapp.org/t/fresh-installation-support-joplin-server-portainer-docker/25563/6 "2022-05-11T13:36:18Z")

</div>

Please take a look at my guide for setting up Joplin Server. It is for arm, but the general things will work for you, too.

> [@Guide for Joplin-Server on Raspberry Pi](https://discourse.joplinapp.org/t/guide-for-joplin-server-on-raspberry-pi/14702):
>
> Hi, this is an extensive guide on how to host your own Joplin server on a Raspberry Pi. I had a setup like this running on a Pi 4 and a Pi 5. Technically it would also work on Pi 3 models which support 64-bit operating systems. If you spot any mistakes, please reply to me! The guide was updated on 11.06.2025. 1 Dynamic DNS If you don't get a static IP address from your ISP, you will need a Dynamic DNS service. This sets a hostname which will be redirected to your IP. There are a lot of pro…

You can't connect from your local network and the internet at the same time, because then the URL doesn't match with the set Base URL in the config in one of the cases (exect you set up a local DNS, but that's an other topic).

In your Router you have to forward Port 80 and/or 443. You connect over regular http(s) to your server, which internally routes the traffic to port 22300.

---

<div class="post-metadata">

**Author:** ![benj29](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/benj29/32/13771_2.png) [@benj29](https://discourse.joplinapp.org/u/benj29)\
**Post date:** [11 May 2022 19:35 UTC](https://discourse.joplinapp.org/t/fresh-installation-support-joplin-server-portainer-docker/25563/7 "2022-05-11T19:35:06Z")

</div>

Yes, i follow it expect apache part.  
**Do i need to install apache on my Joplin server ? even if i have a dedicated apache server on a VM ?**

As i explained before, i have set only an ssl https conf file on my dedicated apache joplin but i have replaced only the pass/passreserve part ; due to sub.dom.ovh instead of domain.ovh/sub on your:

```auto
ProxyPreserveHost On
ProxyPass "/joplin" http://localhost:22300
ProxyPassReverse "/joplin" http://localhost:22300
....

```

Mine:

```auto

<IfModule mod_ssl.c>
<VirtualHost *:443>

       ProxyPreserveHost On
       ServerName joplin.xxxxxx.ovh

       ProxyRequests Off
       ProxyPreserveHost On
       ProxyPass / http://192.168.2.81:22300/ keepalive=On retry=5
       ProxyPassReverse / http://192.168.2.81:22300/

       ErrorLog /var/log/apache2/joplin_error.log
       CustomLog /var/log/apache2/joplin_access.log combined

       Include /etc/letsencrypt/options-ssl-apache.conf
       RewriteEngine on
       SSLEngine on

<IfModule mod_headers.c>
        <FilesMatch "\.(css|js|png|jpeg|jpg|ttf|woff)$">
                Header set Cache-Control "max-age=7200"
        </FilesMatch>
        <FilesMatch ".*(getResources.php)">
                Header set Cache-Control "max-age=7200"
        </FilesMatch>
        <FilesMatch ".*(getJS.php)">
                Header set Cache-Control "max-age=7200"
        </FilesMatch>
</IfModule>

              SSLCertificateFile /etc/letsencrypt/live/sub.XXXXX.ovh-0001/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/sub.XXXXXX.ovh-0001/privkey.pem
</VirtualHost>
</IfModule>

```

Anytime, i just want to thank you for your time.  
On my router, 80 and 443 are redirected since few years on my apache VM.

---

<div class="post-metadata">

**Author:** ![MrKanister](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/mrkanister/32/20054_2.png) [@MrKanister](https://discourse.joplinapp.org/u/MrKanister)\
**Post date:** [11 May 2022 20:04 UTC](https://discourse.joplinapp.org/t/fresh-installation-support-joplin-server-portainer-docker/25563/8 "2022-05-11T20:04:46Z")

</div>

Okay, I have a little trouble following you...

> [@benj29](#):
>
> when i'm writing `https:// or http://sub.domain.ovh` (same as env file)  
> i will be sent on my router page. Same thing if i'm outside my local network.

You have port 80 and 443 forwarded to the Apache VM, but get to the router page if you connect to your domain?! Then there's a mistake at the router, as at least something apache related should show up...like a 404 or a 500 error if the ReverseProxy config isn't quite right...

> [@benj29](#):
>
> Do i need to install apache on my Joplin server ? even if i have a dedicated apache server on a VM ?

No. But then the machine with Joplin Server must have port 22300 open to the local network.

---

<div class="post-metadata">

**Author:** ![benj29](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/benj29/32/13771_2.png) [@benj29](https://discourse.joplinapp.org/u/benj29)\
**Post date:** [12 May 2022 04:33 UTC](https://discourse.joplinapp.org/t/fresh-installation-support-joplin-server-portainer-docker/25563/9 "2022-05-12T04:33:57Z")

</div>

Yes, 80 & 443 are redirected to APACHE VM (2.96)

![](https://i.imgur.com/6dLDRSK.png)

All my redirections working correctly as:  
qnap.dom.ovh =\> ip of my nas and http connexion page  
router.dom.ovh =\> ip of my router and http connexion page  
jeedom.dom.ovh =\> ip of my domotic portal and http connexion page  
etc.

But yes, if I tried to redirect only a port to a subdomain as joplin, it is not working.

---

<div class="post-metadata">

**Author:** ![MrKanister](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/mrkanister/32/20054_2.png) [@MrKanister](https://discourse.joplinapp.org/u/MrKanister)\
**Post date:** [12 May 2022 08:47 UTC](https://discourse.joplinapp.org/t/fresh-installation-support-joplin-server-portainer-docker/25563/10 "2022-05-12T08:47:48Z")

</div>

Just to be sure, your `ServerName` matches with your `APP_BASE_URL` (just with `https://` in front of it), right?  
Any errors in the apache logs? Can you confirm with the access logs if the connection gets through to the Apache VM and is routed from there to the router, or if the request hangs at the router?

---

<div class="post-metadata">

**Author:** ![benj29](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/benj29/32/13771_2.png) [@benj29](https://discourse.joplinapp.org/u/benj29)\
**Post date:** [12 May 2022 10:41 UTC](https://discourse.joplinapp.org/t/fresh-installation-support-joplin-server-portainer-docker/25563/11 "2022-05-12T10:41:58Z")

</div>

Hi,  
On stack:

```auto
            - APP_BASE_URL=https://joplin.DOMAIN.ovh

```

On apache conf (SSL one) (without https right ?)  
2.81 is the IP of the VM where docker is working with 22300 port routing (in the env ` ports: - "22300:22300"`. My conf:

```auto
<IfModule mod_ssl.c>
<VirtualHost *:443>

       ProxyPreserveHost On
       ServerName joplin.DOMAIN.ovh

       ProxyRequests Off
       ProxyPreserveHost On
       ProxyPass / http://192.168.2.81:22300 keepalive=On retry=5
       ProxyPassReverse / http://192.168.2.81:22300

```

---

<div class="post-metadata">

**Author:** ![MrKanister](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/mrkanister/32/20054_2.png) [@MrKanister](https://discourse.joplinapp.org/u/MrKanister)\
**Post date:** [12 May 2022 11:12 UTC](https://discourse.joplinapp.org/t/fresh-installation-support-joplin-server-portainer-docker/25563/12 "2022-05-12T11:12:32Z")

</div>

> [@MrKanister](#):
>
> Any errors in the apache logs? Can you confirm with the access logs if the connection gets through to the Apache VM and is routed from there to the router, or if the request hangs at the router?

After this I don't have ideas anymore...the configs look ok, if your router really forwards correctly and the vm with joplin cloud has port 22300 opened to the network, I don't see the problem

---

<div class="post-metadata">

**Author:** ![benj29](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/benj29/32/13771_2.png) [@benj29](https://discourse.joplinapp.org/u/benj29)\
**Post date:** [12 May 2022 15:12 UTC](https://discourse.joplinapp.org/t/fresh-installation-support-joplin-server-portainer-docker/25563/13 "2022-05-12T15:12:43Z")

</div>

I've found !  
I have modified:  
SSL conf with `http://localip:22300/` both lines (proxypass & reverse).  
And now i can access outside and inside to [https://subdom.dom.ovh](https://subdom.dom.ovh)

Last point. If i want to change email on admin account, i received an error email because system want to send email to admin@localhost. Bullshit...  
Do I need to create another account and keeping admin with this email ?

---

<div class="post-metadata">

**Author:** ![MrKanister](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/mrkanister/32/20054_2.png) [@MrKanister](https://discourse.joplinapp.org/u/MrKanister)\
**Post date:** [12 May 2022 15:38 UTC](https://discourse.joplinapp.org/t/fresh-installation-support-joplin-server-portainer-docker/25563/14 "2022-05-12T15:38:37Z")

</div>

You can view all sent emails under the Admin tab to the right of the Logs tab...there you are also able to change the admin (or every other) email without confirmation mail.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex028/uploads/cozic/original/3X/1/c/1c948e33314e232a0927789508474d8624f4270b.png) [@system](https://discourse.joplinapp.org/u/system)\
**Post date:** [11 June 2022 15:39 UTC](https://discourse.joplinapp.org/t/fresh-installation-support-joplin-server-portainer-docker/25563/15 "2022-06-11T15:39:25Z")

</div>

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