1. The problem I’m having:
I installed RocketChat using Snaps. If you google RocketChat Snap you can easily see their installation documentation. Everything went well and my server currently works. I want to run a websocket app however it’s failing every time. I did a little digging and found that the only service that was tossing out errors was Caddy. Please note the Caddyfile I currently have is BLANK. The snap runs this if/else if it encounters a blank CaddyFile:
if [[ -s $SNAP_DATA/Caddyfile ]]; then
# Prioritize v2 over v1
start_caddy_v2_with_config || start_caddy_v1_with_config
else
caddy_v2_reverse_proxy $(snapctl get siteurl) http://127.0.0.1:$(snapctl get port)
fi
The .sh prioritizes starting Caddy V2
2. Error messages and/or full log output:
Here are my error messages when I run:
sudo systemctl status snap.rocketchat-server.rocketchat-caddy
(My server is not called myservername.com I am just redacting that information along with my servers IP address. The from command lists my real server when I run this from my system. Just imagine myservername.com is a real server address that is in use right now)
snap.rocketchat-server.rocketchat-caddy.service - Service for snap application rocketchat-server.rocketchat-caddy
Loaded: loaded (/etc/systemd/system/snap.rocketchat-server.rocketchat-caddy.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2024-02-08 22:04:16 UTC; 19min ago
Main PID: 387 (start_caddy.sh)
Tasks: 8 (limit: 4442)
Memory: 83.5M
CPU: 3.749s
CGroup: /system.slice/snap.rocketchat-server.rocketchat-caddy.service
├─387 /bin/bash /snap/rocketchat-server/1602/bin/start_caddy.sh
└─710 caddy2 reverse-proxy --change-host-header --from=https://myservername.com --to=http://127.0.0.1:3000
Feb 08 22:04:45 [IP_ADDRESS] rocketchat-server.rocketchat-caddy[710]: {"level":"error","ts":1707429885.3187242,"logger":"http.log.error","msg":"dial tcp 127.0.0.1:3000: connect: connection refused","reques>
Feb 08 22:04:45 [IP_ADDRESS] rocketchat-server.rocketchat-caddy[710]: {"level":"error","ts":1707429885.7395024,"logger":"http.log.error","msg":"dial tcp 127.0.0.1:3000: connect: connection refused","reques>
Feb 08 22:04:47 [IP_ADDRESS] rocketchat-server.rocketchat-caddy[710]: {"level":"error","ts":1707429887.2157943,"logger":"http.log.error","msg":"dial tcp 127.0.0.1:3000: connect: connection refused","reques>
Feb 08 22:04:47 [IP_ADDRESS] rocketchat-server.rocketchat-caddy[710]: {"level":"error","ts":1707429887.5334787,"logger":"http.log.error","msg":"dial tcp 127.0.0.1:3000: connect: connection refused","reques>
Feb 08 22:04:47 [IP_ADDRESS] rocketchat-server.rocketchat-caddy[710]: {"level":"error","ts":1707429887.6165545,"logger":"http.log.error","msg":"dial tcp 127.0.0.1:3000: connect: connection refused","reques>
Feb 08 22:04:48 [IP_ADDRESS] rocketchat-server.rocketchat-caddy[710]: {"level":"error","ts":1707429888.1892583,"logger":"http.log.error","msg":"dial tcp 127.0.0.1:3000: connect: connection refused","reques>
Feb 08 22:04:48 [IP_ADDRESS] rocketchat-server.rocketchat-caddy[710]: {"level":"error","ts":1707429888.4584205,"logger":"http.log.error","msg":"dial tcp 127.0.0.1:3000: connect: connection refused","reques>
Feb 08 22:04:48 [IP_ADDRESS] rocketchat-server.rocketchat-caddy[710]: {"level":"error","ts":1707429888.5101721,"logger":"http.log.error","msg":"dial tcp 127.0.0.1:3000: connect: connection refused","reques>
Feb 08 22:04:48 [IP_ADDRESS] rocketchat-server.rocketchat-caddy[710]: {"level":"error","ts":1707429888.6714916,"logger":"http.log.error","msg":"dial tcp 127.0.0.1:3000: connect: connection refused","reques>
Feb 08 22:04:48 [IP_ADDRESS] rocketchat-server.rocketchat-caddy[710]: {"level":"error","ts":1707429888.7319
3. Caddy version:
I really wish I could help here. I know its Version 2 because the sh command prioritizes it, but it looks like it was packaged with a snap install and I can’t seem to find this information. Could use help here I guess too.
→
4. How I installed and ran Caddy:
I followed the instructions here:
→
a. System environment:
Ubuntu Jammy 22.04 Amd64 server on an AWS EC2
I have a bog standard security group set up with this EC2 but just to get it out of the way, I ran a test with ALL PORTS AND IPs open and it still failed. I did this to rule out security group issues. I have since returned to the secure security group settings.
d. My complete Caddy config:
My Caddyfile is BLANK. This is the recommended setting for the snap install. I know where the Caddyfile is and I can edit and change it if necessary.