-
So, I've gone through the process defined here: https://github.com/zadam/trilium/wiki/Apache-proxy-setup (which could be a lot more helpful BTW) (Used this as a "guide" for the "missing" parts https://discourse.joplinapp.org/t/guide-for-joplin-server-on-raspberry-pi/14702. I get to the end and when I enter: sudo systemctl enable trilium.service I get this: Unit /lib/systemd/system/trilium.service is added as a dependency to a non-existent unit local.target. This is my trilium.service file: `[Unit] [Service] [Install] my /etc/apache2/sites-available/mywebsitehere.com.conf looks like
` I managed to get the server working without the Apache part, but I want to access this from outside my home network. Any guidance would be greatly appreciated. chris |
Beta Was this translation helpful? Give feedback.
Replies: 8 comments 10 replies
-
IS ANYONE HOME? I've gone through this about 5 times. There are a myriad of "typos" in the instructions. Is there a succinct (and complete) directive on how to set the server up with Apache, with certs, etc, etc? https://github.com/zadam/trilium/wiki/Apache-proxy-setup is NOT it..... |
Beta Was this translation helpful? Give feedback.
-
Would highly recommend Caddy, I use it to deploy Trilium at a large scale and it works great (I have never once thought about certificates). I'll drop my own personal config: site.com {
reverse_proxy localhost:8080
} Yep, it's that easy. As long as the Caddy service runs as root and the DNS A records point to the machine's IP, caddy will handle certificate renewals. I've ran trilium.cc for two and a half years using Caddy and retrieved over 4000 certificates (96% renewals/staging, 4% customers) with Caddy and it handled them all perfectly without me doing a single thing. |
Beta Was this translation helpful? Give feedback.
-
Well, I've gone through the entire process again for the umteenth time. The Apache stuff works now. I can go to my website and see the Apache Default page. I've created the container via: sudo docker pull zadam/trilium:latest sudo docker create --name trilium -t -p 127.0.0.1:8080:8080 -v /mnt/trilium:/home/node/trilium-data zadam/trilium:latest /lib/systemd/system/trilium.service is: ` [Service] [Install] sudo systemctl daemon-reload then sudo systemctl enable trilium.service I get: Unit /lib/systemd/system/trilium.service is added as a dependency to a non-existent unit local.target. Any suggestions would be appreciated. Thanks |
Beta Was this translation helpful? Give feedback.
-
I'm a little behind on the conversation here and I do not run on a Pi. Instead I run an Ubuntu 22.04 server in a vm for my docker box. I may be way off base at the end of this overly long day. But one thing I am trying to understand looking at your config.. Why are you setting up Apache and using the Trilium docker container. With the container you should not need Apache on the host. Also, where are you wanting to access the install from? LAN only, or LAN + WAN? This is my entire docker-compose.yml file #version: '3.3' |
Beta Was this translation helpful? Give feedback.
-
Ok LAN server works. WAN does not: I've got a URL from afraiddns that points to my UDM SE. On the UDM I've setup a port forwards for 443, 80 and 8080 Why did you map 8290 to 8080 BTW? If I goto https://MYURL I get the Apache Default page: If I go to my https://MYURL:8080, I get bupkis. Yes, I've set up the config.ini file to point at the certs If I try to load https://MYURL:8080 in Palemoon (an old browser) I'm told: SSL received a record that exceeded the maximum permissible length. (Error code: SSL_ERROR_RX_RECORD_TOO_LONG) And, the Trilium service doesn't restart when the pi is rebooted. I have to manually start it. Cheers |
Beta Was this translation helpful? Give feedback.
-
I see. Well, I have virtually no experience with Caddy at this point. I can try to recreate your environment to try to figure out the exact steps but with my current schedule that may have to wait until the weekend.. Caddy is on my todo list of things to learn/play with though. I used port 8290 because I have a few docker things running on that VM and 8080 was already in use and sometimes I get a little contrary with ports. ;-). It works fine to change the port so long as you only change the port number on the left side of the : I am going to avoid Caddy for the moment. Lets see if we can just get Trilium itself working. So I am going to just focus on Trilium for the moment.. To be fair, I am doing a lot of this from memory and could be missing a step. If this doesnt work I will try to spin an instance up from scratch tomorrow (as time allows) and document the steps. I first install docker and docker compose. Here are my steps for that. #==== Update the host and install docker and docker compose==== echo apt update #Modify your non-root user and add them to the docker group #==== Install Trilium ==== Switch to your non-root user. For reference mine is named dockerman in the steps belowcd ~ Create the folder structuremkdir -p ~/trilium/trilium-data/{backup,log,sessions} Create a docker-compose.yml file then close and save it.nano ~/trilium/docker-compose.yml #== Begin Contents of the docker-compose.yml file == == Start the Trilium container ==cd ~/trilium At this point if all went well and you dont have any services competing for port 8080 on your host, your Trilium instance should be accessible at http://IPADDRESS:8080 Also FWIW, I dont like managing docker networks form the command line and I usually cheat and install Portainer for that. But that is a whole other story and I do not think you will need it for this build. |
Beta Was this translation helpful? Give feedback.
-
LOL. I got the WAN stuff working. For completeness in reference to the sequence described above: Stopped Apache2 Deleted /etc/apache2/sites-available/www.mytrilium.com.conf Deleted /etc/apache2/sites-enabled/www.mytrilium.com.conf sudo nano /etc/apache2/sites-enabled/000-default-le-ssl.conf Added the following between <VirtualHost *:443> and : ProxyPreserveHost On sudo apachectl -k graceful And voila! It works. |
Beta Was this translation helpful? Give feedback.
-
Things have been going well for my server install. It works on all my portable devices and with all three of my desktop boxes. However I noticed the dates on the files in the mounted folder are still a month ago. So I went looking around, and unfortunately it's saving files locally even though I specifically called out the mounted folder in the config. A little bit of spelunking around the web indicates I need to mount the folder from "within" the docker stratosphere, but I can't find a straightforward way of doing that. Can someone more knowledgeable of docker than I please chime in? Thanks! |
Beta Was this translation helpful? Give feedback.
LOL.
I got the WAN stuff working.
For completeness in reference to the sequence described above:
Stopped Apache2
Deleted /etc/apache2/sites-available/www.mytrilium.com.conf
Deleted /etc/apache2/sites-enabled/www.mytrilium.com.conf
sudo nano /etc/apache2/sites-enabled/000-default-le-ssl.conf
Added the following between <VirtualHost *:443> and :
ProxyPreserveHost On
ProxyPass "/" http://localhost:8080 nocanon
ProxyPassReverse "/" http://localhost:8080
sudo apachectl -k graceful
And voila! It works.