Update 14.2.2024, nearly two years later:
As you can see in the comments to my original post (see below), there are far more easier ways to install apps with Docker. First, docker compose makes installation and updating easier, and we have the Redirect and the Reverse Proxy apps!
So this how I do it in 2024:
- Add a new subdomain for Trilium with Let’s Encrypt cert in the Webadmin
- Create a folder for Trilium
mkdir /home/TheNomad11/trilium
- add a docker compose file:
sudo nano docker-compose.yml
and paste something like this:
version: '3.3'
services:
trilium:
ports:
- '127.0.0.1:6080:8080'
volumes:
- './trilium-data:/home/node/trilium-data'
container_name: trilium
image: 'zadam/trilium:latest'
restart: unless-stopped
volumes:
trilium:
Then install the Reverse Proxy app YunoHost app store | Reverse Proxy , choose the Trilium domain and then in the field Redirect destination path (unix:/file for socket)
add the Trilium port, in my case 127.0.0.1:6080
That’s it, much easier!
Regarding Trilium, check these news Announcement: Trilium transitions into maintenance mode · Issue #4620 · zadam/trilium · GitHub
Original post from 2022
Hi! I am excited that I was able to install an app with Docker on Yunohost, so I’d like to share how I did it. I am no developper, so I am not sure if I did everything the right way.
I installed the newest version of Trilium Notes as this app does not seem to work well with YH, the recent updates failed: Update to version 0.52.3 by Jules-Bertholet · Pull Request #23 · YunoHost-Apps/trilium_ynh · GitHub
-
So first I installed Docker Install Docker Engine on Debian | Docker Docs
-
Then add a new domain for the app and the Letsencrypt certificate in the YH webadmin
-
Install MyWebapp in the YH webadmin
-
Run the docker command of your app.
In my case I had to create the necessary folder first
mkdir /home/TheNomad11/trilium-data
then for Trilium
docker run -d -p 0.0.0.0:6080:8080 -v /home/TheNomad11/trilium-data:/root/trilium-data --name trilium zadam/trilium:0.53.2 && docker exec -t -i -u root trilium chown -R node:node /root/trilium-data && docker stop trilium && docker run -d -p 0.0.0.0:6080:8080 -v /home/TheNomad11/trilium-data:/home/node/trilium-data zadam/trilium:0.53.2
- Edit the nginx-configuration of the domain your app uses, copy and paste the nginx proxy from the app installation instruction.
In case for Trilium: Nginx proxy setup · zadam/trilium Wiki · GitHub
You just need to replace the domain and the port and don’t forget YH-specific parts of the configuration
In my case it looks like this:
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
# This part is for proxy and HTTPS configure
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name trilium.my-yunohost-domain.com;
include /etc/nginx/conf.d/security.conf.inc;
ssl_certificate /etc/yunohost/certs/trilium.my-yunohost-domain.com/crt.pem;
ssl_certificate_key /etc/yunohost/certs/trilium.my-yunohost-domain.com/key.pem;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_pass http://localhost:6080; #change it to your IP and port
proxy_read_timeout 90;
proxy_redirect http://localhost:6080 https://trilium.my-yunohost-domain.com; #change them based on your IP, port and domain
}
}
# This part is for HTTPS forced
server {
listen 80;
server_name trilium.my-yunohost-domain.com; # change to your domain
return 301 https://$server_name$request_uri;
}
server {
location ^~ '/.well-known/autoconfig/mail/' {
alias /var/www/.well-known/trilium.my-yunohost-domain.com/autoconfig/mail/;
}
access_by_lua_file /usr/share/ssowat/access.lua;
include /etc/nginx/conf.d/trilium.my-yunohost-domain.com/*.conf;
include /etc/nginx/conf.d/yunohost_sso.conf.inc;
include /etc/nginx/conf.d/yunohost_admin.conf.inc;
include /etc/nginx/conf.d/yunohost_api.conf.inc;
access_log /var/log/nginx/trilium.my-yunohost-domain.com-access.log;
error_log /var/log/nginx/trilium.my-yunohost-domain.com-error.log;
}
# vhost dedicated to XMPP http_upload
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name xmpp-upload.trilium.my-yunohost-domain.com;
root /dev/null;
location /upload/ {
alias /var/xmpp-upload/trilium.my-yunohost-domain.com/upload/;
# Pass all requests to metronome, except for GET and HEAD requests.
limit_except GET HEAD {
proxy_pass http://localhost:5290;
}
include proxy_params;
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'HEAD, GET, PUT, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'Authorization';
add_header 'Access-Control-Allow-Credentials' 'true';
client_max_body_size 105M; # Choose a value a bit higher than the max upload configured in XMPP server
}
include /etc/nginx/conf.d/security.conf.inc;
ssl_certificate /etc/yunohost/certs/trilium.my-yunohost-domain.com/crt.pem;
ssl_certificate_key /etc/yunohost/certs/trilium.my-yunohost-domain.com/key.pem;
access_log /var/log/nginx/xmpp-upload.trilium.my-yunohost-domain.com-access.log;
error_log /var/log/nginx/xmpp-upload.trilium.my-yunohost-domain.com-error.log;
}
- Restart or reload Nginx and voila, it’s done!
Does this look okay? For me at least, it works!