Rocket.Chat icon indicating copy to clipboard operation
Rocket.Chat copied to clipboard

snap.rocketchat-server.rocketchat-caddy.service ACTIVE: failed

Open vatixxx opened this issue 9 years ago • 38 comments

Hi, I've got problem with new rocketchat-server, after snap install rocketchat-server , rocket not working. OS: ubuntu 17.10 snap: core:16-2.28.5 Rev.3247 rocketchat-server 0.59.0 Rev.1170 I have checked logs of rocket and every time problem is in caddy.

paź 19 13:35:30 ubuntuserver systemd[1]: Started Service for snap application rocketchat-server.rocketchat-caddy.
paź 19 13:35:30 ubuntuserver rocketchat-server.rocketchat-caddy[2212]: 2017/10/19 13:35:30 loading Caddyfile via flag: open /C
paź 19 13:35:30 ubuntuserver systemd[1]: snap.rocketchat-server.rocketchat-caddy.service: Main process exited, code=exited, status=1/FAILURE
paź 19 13:35:30 ubuntuserver systemd[1]: snap.rocketchat-server.rocketchat-caddy.service: Unit entered failed state.
paź 19 13:35:30 ubuntuserver systemd[1]: snap.rocketchat-server.rocketchat-caddy.service: Failed with result 'exit-code'.
paź 19 13:35:31 ubuntuserver systemd[1]: snap.rocketchat-server.rocketchat-caddy.service: Service hold-off time over, scheduling restart.
paź 19 13:35:31 ubuntuserver systemd[1]: Stopped Service for snap application rocketchat-server.rocketchat-caddy.

snap refresh rocketchat-server --candidate or beta or stable not working for me. What I can do?

vatixxx avatar Oct 19 '17 12:10 vatixxx

Caddy actually stops like that out of the box. So caddy isn't the issue. Can you provide additional logs? Also did you try accessing at: localhost:3000 or {yourserver ip}:3000 . Double check firewall if on a vps.

geekgonecrazy avatar Oct 25 '17 20:10 geekgonecrazy

do sudo systemctl status snap.rocketchat-server.rocketchat-caddy.service

You should get an output like the following. caddy

If it doesn't then: edit your /etc/hosts file and add your public IP and the FQDN you are planning to use

Then cd /var/snap/rocketchat-server/1188

Verify your Caddyfile looks like:

YOUR.HOSTNAME.com{ proxy / localhost:3000 { websocket transparent } }

Then run sudo /usr/bin/snap run rocketchat-server.rocketchat-caddy

Post the results after running the last command if it still doesnt work.

707eric avatar Nov 03 '17 00:11 707eric

Hi, I have a similar issue starting rocketchat-caddy service. The journal entry for the failure is:

Activating privacy features... 2018/04/24 17:58:09 open /root/snap/rocketchat-server/1254/.caddy/acme/acme-v02.api.letsencrypt.org/sites/<MY_DNS_NAME>/<MY_DNS_NAME>.crt: no such file or directory

I used nautilus to observe the directory of /root/snap/rocketchat-server/1254/.caddy/acme/acme-v02.api.letsencrypt.org/sites/<MY_DNS_NAME>. I saw the crt file was briefly generated and then disappeared. So there is nothing in that directory.

This is a fresh install of rocketchat. I researched the previous discussion. There was a similar case of "missing .crt file causing rocketchat-caddy to fail". However, that was related to a refreshing of installation. For me, this is a fresh installation.

The <MY_DNS_NAME> I use is a valid Domain name registered with GoDaddy.

Much appreciate if you could help me in this case.

Kind regards LC

zenglicheng avatar Apr 24 '18 08:04 zenglicheng

What are the contents of you Caddy file?

It should be located in /var/snap/rocketchat-server/current/Caddyfile

707eric avatar Apr 24 '18 08:04 707eric

Wow, you responded so quickly. Appreciate it, Eric.

The contents of my Caddy file are: <MY_DOMAIN_NAME> proxy / localhost:3000 { websocket transparent }

I just follow the instructions of https://rocket.chat/docs/installation/manual-installation/ubuntu/snaps/autossl/ to configure Caddy.

Could you please advise the reason why <MY_DOMAIN_NAME>.crt cannot be created? I saw briefly <MY_DOMAIN_NAME>.crt.lock file was created while rocketserver-caddy service is being restarted.

zenglicheng avatar Apr 24 '18 09:04 zenglicheng

I think you are just missing some brackets in your Caddyfile.

MYDOMAIN.COM { proxy / localhost:3000 { websocket transparent } }

That's the how my Caddyfile looks

707eric avatar Apr 25 '18 04:04 707eric

Many thanks for your reply, Eric. I tried with your method, but still no luck.

However, I managed to get it working with self-signed certificate. https://mydomain.com tls self_signed proxy / localhost:3000 { websocket transparent }

I guess the reason my domain name causes the Caddy service to fail is that, "letsencrypt" service could not generate a SSL certificate for my domain name. And the reason it couldn't generate the certificate is because my domain name, although it is registered with a DNS provider, has no CNAME record, I haven't mapped the name to any IP address yet. I haven't tried mapping my domain name to an IP address yet, as my computer I am using is sitting behind a modem/router.

In your case, I suppose your DNS name is bound to some IP address or has a CNAME attached to it?

thank you for your help

zenglicheng avatar Apr 25 '18 11:04 zenglicheng

Oh, in that case you just need to make an A record to the public IP where your server is located. Then setup NAT and firewall rules to point to your server and the DNS test will succeed.

I have Caddy working as a proxy for multiple sites . I prefer expose only one point of entry vs multiple.

707eric avatar Apr 26 '18 05:04 707eric

Eric,

Thanks for the advice. Next step I want to experiment is to embed rochetchat with my website. Do you experience with this? As we know the documentation is quite terse, if you can share an actual example of a custom site embedding RochetChat, that would be great.

regards

lzeng avatar Apr 27 '18 09:04 lzeng

I have the exact same issue. I have had a install just break randomly I suspect snap automatically refreshed/updated.

Running sudo /usr/bin/snap run rocketchat-server.rocketchat-caddy I get no such file or directory

In my /var/log/syslog I get the same error too.

I have had the CaddyFile working fine before and it appears to be the same config now.

2E0PGS avatar May 12 '18 16:05 2E0PGS

I guess since it was working fine before this rules out it being something to do with my domain name unless something changed upstream which makes my sub domain invalid for certification.

2E0PGS avatar May 12 '18 16:05 2E0PGS

Run sudo systemctl restart snap.rocketchat-server.rocketchat-caddy.service

then

journalctl -xe

and look if it says it fails and if so why it might have failed.

I have been running multiple instances of Rocket with two different users groups with the system available 24/7 for about 6 months now while updating and using customizations like a custom auth provider (Auth0) and so far it has been smooth without any issues with Caddy except the one time initially.

707eric avatar May 13 '18 01:05 707eric

You can also check for the existence of the Caddyfile and permissions

ls -l /var/snap/rocketchat-server/current

and if it is there

cat /var/snap/rocketchat-server/current/Caddyfile

verify the contents are accurate

707eric avatar May 13 '18 01:05 707eric

The Caddy file is present and correct syntax as I stated above. Its permissions are: -rw-r--r-- 1 root root 83 May 12 17:42 Caddyfile

Running journalctl -xe shows me the same error of file not present: MYDOMAINNAME.crt: no such file or directory

2E0PGS avatar May 13 '18 10:05 2E0PGS

Related posts I found while researching this issue:

  • https://wyldeplayground.net/rocket-chat-snap-doesnt-start/
  • https://askubuntu.com/questions/894670/rocket-chat-snap-doesnt-start
  • Useful Caddy tutorial: https://caddyserver.com/docs/automatic-https

Also a side note my rocket chat is accessible without going via Caddy proxy. So I can connect to my rocket chat using its internal IP and default port non HTTPS.

2E0PGS avatar May 13 '18 13:05 2E0PGS

That sounds like the similar issue above where the crt file wasn't being retained due to an with the Caddyfile. Please paste the contents of the Caddyfile.

707eric avatar May 14 '18 08:05 707eric

cat /var/snap/rocketchat-server/current/Caddyfile

https://subdomain.domain.org
proxy / localhost:3000 {
  websocket
  transparent
}

2E0PGS avatar May 17 '18 18:05 2E0PGS

However I just tried @zenglicheng comment and it works with self sign cert.

cat /var/snap/rocketchat-server/current/Caddyfile

https://subdomain.domain.org
tls self_signed
proxy / localhost:3000 {
  websocket
  transparent
}

2E0PGS avatar May 17 '18 18:05 2E0PGS

Drop the https part and it will work. The Let's Encrypt is failing because Caddy isn't responding on port 80, its responding on 443.

MYDOMAIN.COM { proxy / localhost:3000 { websocket transparent } }

707eric avatar May 17 '18 21:05 707eric

Your statement doesn't make much sense it contradicts itself (remove HTTPS because it responds on the port for HTTPS is what your saying in other words). Also I tried that and it didn't work.

That's the CA for the cert as far as i'm aware.

2E0PGS avatar May 17 '18 21:05 2E0PGS