Difficulty installing on vm that includes CPanel and Apache

Hi everyone!

**This is my first post. **

I’m a new Discourse user coming from phpBB.
Two weeks ago, I installed Discourse in a Docker container using Nginx, since Apache uses ports 80 and 443 by default. I carefully followed the steps outlined in the installation guides and the Nginx multisite configuration.

**I was able to run and use the forum for a week, only occasionally logging in to familiarize myself with the platform. When I asked one of the users to register and test it, the forum crashed the next day. The browser displayed the message: “The software powering this discussion forum encountered an unexpected problem.” I couldn’t fix it, so I reinstalled the entire forum from scratch and then restored the threads from the last available backup. This was last Thursday. After all this, the forum was back up and running. Now, it’s back up again with a 502 Bad Gateway Nginx error. I went straight for the rebuild app and it crashed again with the error:

Pups::ExecError: cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate' failed with return #<Process::Status: pid 580 exit 1>.

This same thing happened over and over again last week and it led me to reinstall everything from scratch. The forum is practically inactive because I haven’t made it public yet. I’m scared of the idea that if it keeps crashing without activity, what could happen with a larger user group? Run these commands: ./launcher enter app**

**cd /var/www/discourse**
**su discourse -c 'bundle exec rake db:migrate'**

**And in the response, I see this that caught my attention:

connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL: the database system is starting up**

I tried restarting Postgress manually and running the rebuild again, but the process was interrupted again with this error message:

**FAILED**
**--------------------**
**Pups::ExecError: if [ -f /root/install_postgres ]; then**
**/root/install_postgres && rm -f /root/install_postgres**
**elif [ -e /shared/postgres_run/.s.PGSQL.5432 ]; then**
**socat /dev/null UNIX-CONNECT:/shared/postgres_run/.s.PGSQL.5432 || exit 0 && echo postgres already running stop container ; exit 1**
**fi**
** failed with return #<Process::Status: pid 18 exit 1>**
**Location of failure: /usr/local/lib/ruby/gems/3.3.0/gems/pups-1.2.1/lib/pups/exec_command.rb:132:in `spawn'**
**exec failed with the params {"tag"=>"db", "cmd"=>"if [ -f /root/install_postgres ]; then\n /root/install_postgres && rm -f /root/install_postgres\nelif [ -e /shared/postgres_run/.s.PGSQL.5432 ]; then\n socat /dev/null UNIX-CONNECT:/shared/postgres_run/.s.PGSQL.5432 || exit 0 && echo postgres already running stop container exit ; 1\nfi\n"}**
**bootstrap failed with exit code 1**

I’m not really an experienced user to identify the error, but I suspect that Postgres will break at some point. This led me to restart everything and start over last week, but I don’t think this is a common or healthy practice for anyone.

Discourse is running on a server with 4 cores, 6GB of RAM, and 180GB of disk space. I’m currently only running this installation of Discourse, so from what I understand, I’m not limited by hardware.

Welcome, @Gustavo_Rip ! Sorry you’re having trouble.

Did you do a standard install? WIth a standard install, you need neither Nginx, nor Apache (and both use ports 80 and 443 by default). If you have either of those installed, you should remove them before starting.

Do you need multisite? Even if you do, I would recommend first doing a standard install, and then go about following this guide: Setup Multisite Configuration with Let’s Encrypt and no Reverse Proxy. I helped someone with it yesterday, and it looks like if you use the correct hostnames and don’t use Cloudflare with orange cloud it works just fine.

2 Likes

Thanks pfaffmann!!

Fortunately, I’m not one of those people who gives up easily, although these subsequent problems worry me, especially since I’m not 100% familiar with this platform.

By default, my CloudServer has Apache installed, and if I remove it, it causes problems with CPanel and other features. I tried it during the first installation because I read that nginx was much better and faster, but I had the issues I mentioned. Therefore, I reinstalled the OS on the server and started over, following this recommendation:

It’s not like I have multiple sites, at least not yet, because my CloudServer allows up to 5 accounts.

As for the standard installation, I followed all the steps to install Docker, Discourse, Certbot, and download the Let’s Encrypt certificates, but when I ran discourse-setup, I had to perform the manual configuration following the link above and configuring manually app.yml file to perform the rebuild.

You really don’t want CPanel. It adds nothing and makes it much harder to install Discourse. And if you have it, you can’t follow the NGinx instructions since Apache is already in the way.

If you can remove Apache and CPanel, do that. If you can’t, I’d recommend a different hosting service.

Actually, what you have might not work at all, can you run

 docker run hello-world
1 Like

Which hosting service do you recommend? or which is the most used for Discourse instalations?

Yes! this is the message:

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/

Anything that doesn’t install CPanel. There are several topics about recommended ones. Digital Ocean is easy.

Ah. Then if you could just get rid of Apache and CPanel, you’d been in good shape. This seems like the easiest way forward from where you are.

The other way to go is keep CPanel and contrive to get your existing Apache to be a reverse proxy. You’ll be on your own, though, as there are too many install-specific holes to fall in for people to be of much help here.

Lot of suggestions here:

Thanks @pfaffman for your time and responses!!

I don’t think it’s likely I’ll remove Apache and CPanel. Perhaps my cloud server provider can modify Apache’s ports so it doesn’t use the same ones as Discourse, thus eliminating nginx, or modify CPanel for Ferozo or another service. I don’t know, but I’ll ask.

Best regards!

1 Like