Can't relay Discourse traffic for website with nginx and vestacp


(Ann Lee Watson) #1

Hi there, followed this video tutorial step by step but got errors in last step:

FAILED

RuntimeError: mkdir -p /shared/postgres_run failed with return #<Process::Status: pid 39 exit 1>
Location of failure: /pups/lib/pups/exec_command.rb:105:in `spawn’
exec failed with the params "mkdir -p /shared/postgres_run"
5ae6057b3b20d6d1156bec21583a7c6404bb71f7429ffa24f7e09094b2b1e67e
** FAILED TO BOOTSTRAP ** please scroll up and look for earlier error messages, there may be more than one
[root@vps225111 docker]# ./launcher start app
which: no docker.io in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin)

  • /usr/bin/docker run -d --restart=always -e LANG=en_US.UTF-8 -e RAILS_ENV=production -e UNICORN_WORKERS=3 -e UNICORN_SIDEKIQS=1 -e RUBY_GC_MALLOC_LIMIT=40000000 -e RUBY_HEAP_MIN_SLOTS=800000 -e DISCOURSE_DB_SOCKET=/var/run/postgresql -e DISCOURSE_DB_HOST= -e DISCOURSE_DB_PORT= -e HOME=/root -e DISCOURSE_DEVELOPER_EMAILS=gunzxxx@gmail.com -e DISCOURSE_HOSTNAME=51.xx4.x1x.x7 -e DISCOURSE_SMTP_ADDRESS=smtp.gmail.com -h vps225111.ovh.net-app -e DOCKER_HOST_IP=172.17.42.1 --name app -t -p 80:80 -p 2222:22 -v /var/discourse/shared/standalone:/shared -v /var/discourse/shared/standalone/log/var-log:/var/log local_discourse/app /sbin/boot
    Unable to find image ‘local_discourse/app:latest’ locally
    Trying to pull repository docker.io/local_discourse/app … not found
    Error: image local_discourse/app:latest not found
    [root@vps225111 docker]# Unable to find image ‘local_discourse/app:latest’ locally
    -bash: Unable: command not found
    [root@vps225111 docker]# Trying to pull repository docker.io/local_discourse/app … not found
    -bash: Trying: command not found
    [root@vps225111 docker]# Error: image local_discourse/app:latest not found
    -bash: Error:: command not found

certainly, the official tutorial misses a lot fo aspects like installing Ruby, setting up docker and so on

can we expect an improved official tutorial or a step-by-step youtube video? thanks in advance


Discourse + VestaCP
(Matt Palmer) #2

You’ll probably find the 30 minute setup guide a more useful guide. It covers the small amount of configuration necessary for Docker. You don’t need to install Ruby manually at all; that’s all taken care of by the Docker image that is downloaded as part of the installation.

As for a video tutorial, my personal opinion is that they’re near-worthless for the purposes of helping someone with something like software installation. It’s much harder to work along with a video at your own pace (constant pausing is not a good user experience), it’s very difficult to go over a certain part multiple times until you understand what’s being taught, you can’t easily quote or reference a portion of a video for discussion, and you can’t copy/paste commands out of a video into your terminal, so you’ve got to type everything out manually (resulting in typos and confusion).


(Ann Lee Watson) #3

thanks @mpalmer will try again this time with a Docker + Ubuntu 15 from OVH VPS

definitely one needs to be expert to install the whole stuff required (packages, smpt, non-shared hosting…)

a bit offtopic: isn’t it discourse too hungry of resources? I mean, I liked its modern features, but for a VPS with 2GB where it eats like 1GB (yes, it can be reduced), with a lot of stuff to install, which goes in conflict with the Docker’s philosophy (being lightweight)

I have the dilemma of installing discourse vs a typical forums like xenf… ro vani… :triumph:


(Matt Palmer) #4

There have been some reports of people not having too much luck with OVH. We don’t know the cause, but it’s something to bear in mind. DigitalOcean installs, on the other hand, are always smooth.

Well, yes, but that’s not exactly something that is Discourse-specific. Managing systems is a full-time job. That’s why we offer the $99 once-off install, to get you started, and hosting plans for people who would prefer to make the problem go away with a bit of money. If our prices or service aren’t to your liking, there are other companies that offer specialised Discourse hosting, and, through the magic of open source software, you’re never locked in to any arrangement you don’t care for.

Perhaps if compared to a low-traffic, shared-hosting PHP site, but for a low-traffic Discourse site the resource usage could be reduced to around 200MB. The database and workers also fits into that 1GB you mention, which would also be required for an equivalent PHP-based site, and accounts for a goodly portion of that 1GB.

Docker’s “lightweight” philosophy is about avoiding unnecessary overhead, not about doing very little. Plenty of Docker-based systems are very large and consume significant resources, because they’re doing a lot of work.


(Ann Lee Watson) #5

dear @mpalmer I finally managed to install it on cheapest OVH SSD 1 VPS

here is a summary of what I did (so hope this helps the community and myself later):

  • I chose the OVH VPS distro with Docker + Ubuntu 15.04

  • did all the steps but when asked to install Docker, exited because I had it already installed

  • in the step editing: nano containers/app.yml I added the smtp.gmail.com, my server IP and my gmail account, it won’t work to send the activation email, need to set the SMTP server (I will do with vestacp maybe someday)

  • after editing important variation, must install:

1º) apt-get install postgresql postgresql-contrib
2º) wget http://download.redis.io/redis-stable.tar.gz
3º) tar xvzf redis-stable.tar.gz
4º) cd redis-stable
5º) make (apt-get install make if you don’t have it)
6º) apt-get install ruby-full
7º) cd …
8º) ./launcher bootstrap app
9º) ./launcher start app

After all, these are the resources consumption with htop, nothing but a clean install and discourse running (new users can’t post 2 images, remove “()” ):

s9.postimg (.) org/ikazknu4f/image.png

Sadly, it is required the smtp config I didn’t do properly (why validation email for an admin anyways??), but for now I only wanted to test :smile:


(Felix Freiberger) #6

May I ask you why you’re installing postgresql, redis and ruby on the host? Apart from Docker (and Git to clone the repository), Discourse should only require a standard Linux environment on the host.

Postgresql, Redis and Ruby are used within the container, but these are implementation details you shouldn’t need to worry about unless you are developing Discourse.


(Ann Lee Watson) #7

@fefrei as you see above I do installed these 3 packages, I also read this in the installation tutorial:

Software Requirements

Postgres 9.3+
Redis 2.6+
Ruby 2.0+ (we recommend 2.0.0-p353 or higher)

so I would say it is required, btw installing it took about 5 minutes and was easier than installing vanilla


(Felix Freiberger) #8

Then feel free to uninstall them: They are not required and should be unused. A second copy of all these requirements is already running inside the container.


(Ann Lee Watson) #9

okay will retry the steps without these and see if you are right (last time didn’t work)


(Ann Lee Watson) #10

dear @fefrei doing the typical method as you said gave me this error when I launch it:

`starting up existing container

  • /usr/bin/docker start app
    Error response from daemon: Cannot start container app: failed to create endpoint app on network bridge: Error starting userland proxy: listen tcp 0.0.0.0:80: bind: address already in use
    Error: failed to start containers: [app]
    `
    do you have idea how can I fix it? thanks in advance

(Felix Freiberger) #11

Something is already running on port 80 – maybe another installation of Discourse or a web server. Only one program can bind to port 80 at the same time, so terminate the other program or use another port.


(Ann Lee Watson) #12

@fefrei but this is a clean utuntu 15.04 with vestacp which worked previously in root IP, now in a subdomain

anyways, how should I terminate the program running on port 80?


(Felix Freiberger) #13

Run sudo netstat -peanut | grep ":80 " to see which program is binding to port 80.


(Ann Lee Watson) #14

thanks I did: lsof -i :8

I noticed nginx is using port 80, then I stopped nginx and worked: http://community.smartcitylinares.com/

but I need nginx to run the rest of website! lol

The question is, to make it work, do I need to in this order: 1º) launch discourse, 2º) launch nginx everytime I restart the VPS?


(Felix Freiberger) #15

This will not work: nginx will be unable to bind to port 80 while Discourse is running.

The solution is to have nginx handle incoming traffic and forward it to Discourse if needed, which is running on another port or on a socket file. This will need modifications to the container definition and your nginx configuration, and is described in detail in a howto post:


(Ann Lee Watson) #16

wow this makes more complicated :slight_smile: thanks

as suggestion: this should be included in your tutorial, since I believe most of sites will use a website besides discourse


(Jeff Atwood) #17

Nope, most people run Discourse on a different server.


(Ann Lee Watson) #18

okay I don’t have the stats so I don’t know, I simply entered like 3 sites using it as subdomain with a website and assumed most of people do that


(Ann Lee Watson) #19

did all steps, no error, I run it but get “Nothing to do, your container has already started!” and discourse does not load


(Felix Freiberger) #20

I’m not really sure why, but a ./launcher rebuild app run as root in the discourse directory might do the trick.