RocketChat / Rocket.Chat.RaspberryPi

Run a private social network on your Pi for iPhone and Android devices !
MIT License
337 stars 59 forks source link

Caddy Error When Enabling HTTPS #41

Closed AlexanderKrall closed 4 years ago

AlexanderKrall commented 4 years ago

To whom it may concern:

I followed the installation instructions listed for the Raspberry Pi version of Rocket Chat. The software installs properly. However, I am having an issue enabling HTTPS using caddy. The instructions state that I have to run the following commands:

  1. sudo snap set rocketchat-server caddy-url=https://<your-domain-name>
  2. sudo snap set rocketchat-server caddy=enable
  3. sudo snap set rocketchat-server https=enable
  4. sudo rocketchat-server.initcaddy

When running the third command, I get this error: error: cannot perform the following tasks: - Run configure hook of "rocketchat-server" snap (run hook "configure": ----- ERROR: ld.so: object '/usr/lib/arm-linux-gnueabihf/libarmmem-${PLATFORM}.so' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored. ERROR: ld.so: object '/usr/lib/arm-linux-gnueabihf/libarmmem-${PLATFORM}.so' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored. ERROR: ld.so: object '/usr/lib/arm-linux-gnueabihf/libarmmem-${PLATFORM}.so' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored. ERROR: ld.so: object '/usr/lib/arm-linux-gnueabihf/libarmmem-${PLATFORM}.so' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored. dig: error while loading shared libraries: libdns.so.162: cannot open shared object file: No such file or directory ERROR: ld.so: object '/usr/lib/arm-linux-gnueabihf/libarmmem-${PLATFORM}.so' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored. Error: Can't resolve DNS query for <your-domain-name>, check your DNS configuration, disabling https . . . -----)

Note:

Any help would be much appreciated!

AlexanderKrall commented 4 years ago

It seems like the main issue is that the rocketchat software install on snap points to the wrong location for dig. Is there anyway I can fix this so that it points to the right location?

ignasurba commented 4 years ago

Found myself in the same boat. This worked:

sudo nano /etc/ld.so.preload and comment out the line: /usr/lib/arm-linux-gnueabihf/libarmmem.so

but now: dig: error while loading shared libraries: libdns.so.162: cannot open shared object file: No such file or directory

drasbeck commented 4 years ago

I am experiencing the same issue as OP.

Environment: Rpi4 4GB running Linux 4.19.80-v8-james #15 SMP PREEMPT Sun Oct 27 21:58:14 PDT 2019 aarch64 GNU/Linux from here

Installation method: snap --edge channel, so server version 1.3.2

Ed-80 commented 4 years ago

I ran into a similar problem. I followed the instructions how to set up caddy manually and that seemed to reslove it for me. I was then experiencing the pi would drop the wired ethernet connection after a few hours. The work around I did for this was manually setup a static IP address on the pi. I hope this helps. -Ed

Joonas-M commented 4 years ago

I had the same problem with the Raspbian OS (I have RaspberryPi 4 with 4GB RAM). I didn't really find a proper workaround for it but there are couple of problems. The snap gives only version one from rocketchat-server and not the newest one (version 3). Also, the OS does not have dnsutils installed so dig cannot be used for dns lookups.

Because Raspbian failed, I started to try Ubuntu images provided by the Imager software. Unfortunately I first installed Ubuntu 20.04 as that does not work either. The Mongo db does not start up. That is probably because it is not supported as stated here https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/

I finally installed Ubuntu core 18 64 bit version. Installing and using that image is a bit of a pain because you need to create an Ubuntu SSO account and copy your SSH key there (as stated here https://ubuntu.com/download/raspberry-pi-core). After that, you cannot just use the OS after installing it on the Pi. You need to access your rbp from another computer using SSH. From there, installing the rocketchat-server snap version 3 works fine.

However, to enable HTTPS using caddy, you need to follow the manual configuration steps set here https://rocket.chat/docs/installation/manual-installation/ubuntu/snaps/autossl/#enabling-caddy Basically the first option set forth on that page does not work because sudo snap set rocketchat-server https=enable fails. What I did was more like

sudo snap set rocketchat-server caddy-url=https://<your-domain-name>
sudo snap set rocketchat-server caddy=enable
sudo snap run rocketchat-server.initcaddy

edit /var/snap/rocketchat-server/current/Caddyfile to look like

<your-domain-name> {
  proxy / localhost:3000 {
    websocket
    transparent
  }
}

as stated in the documentation. Then run

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

I don't remember if those were the exact steps to get it work. Hopefully this helps someone!

Sing-Li commented 4 years ago

Because Raspbian failed, I started to try Ubuntu images provided by the Imager software. Unfortunately I first installed Ubuntu 20.04 as that does not work either. The Mongo db does not start up. That is probably because it is not supported as stated here https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/

@Joonas-M did you try the 64bit version of Unbuntu 20.04 ? It should actually work fine.

image

Joonas-M commented 4 years ago

Hi, I'll leave a comment here for others to read as well, as we discussed about this with Sing-Li at https://open.rocket.chat/channel/raspberrypi So the issue was not with the Ubuntu 20.04 version but with the user :) Mongo was complaining "start request repeated too quickly", which could have been fixed if the following was done

Stopping both services first. THEN Restarting in this order -> first mongo, then watch logs until it stablize THEN RC

as stated by Li.

So, if you want to try Ubuntu 20.04, remember those steps as well.

Sing-Li commented 4 years ago

I finally got a chance to try 20.04lts with the snap (containing latest arm64 mongodb). And there is some fundamental compatibility problem.

MongoDB's official support literature currently do not cover 20.04lts.

I have updated our README to reflect this.

All production servers should use Arm64 Ubuntu 18.04lts in the meantime.