Installing Discourse With Plesk Onyx (Ubuntu 14.04)


(Douglas Teles) #1

Install Discourse on Plesk Onyx is simple!
Lie, I’ve been trying for two days until it works.

Update: This method will works with Ubuntu 14.04, 16.04 and Debian only.

First install Docker on Plesk Extensions.

Install Docker

https://content.screencast.com/users/DougasTeles/folders/Snagit/media/4f60c154-eec0-4493-a66e-17ec684e258c/07.04.2017-11.51.png

https://content.screencast.com/users/DougasTeles/folders/Snagit/media/67692595-d3bc-4529-a3d8-99a1c4c9eca4/07.04.2017-11.53.png

https://content.screencast.com/users/DougasTeles/folders/Snagit/media/e62dd341-791c-4773-9697-b764c8010af8/07.04.2017-13.03.png

Now install Redis and Nginx containers

Redis & Nginx

https://content.screencast.com/users/DougasTeles/folders/Snagit/media/ebf20e85-dcbe-49c2-96db-3bdd421761b3/07.04.2017-13.06.png

https://content.screencast.com/users/DougasTeles/folders/Snagit/media/310d1056-e131-4a71-aa0f-bb5ec50ea86f/07.04.2017-13.07.png

Go to discourse/INSTALL-cloud.md at master · discourse/discourse · GitHub and follow this steps, starting on Install Discourse

Note: I forgot a detail. Before perform ./discourse-setup, you need edit discourse-setup.
Open discourse-setup with text editor, search for check_ports() { and change this:

check_port "80"
check_port "443"

To something like this:

check_port "8060"
check_port "9443"

Done.

After the fist installation, you get an error because 80 and 443 ports are in use by Plesk
Don’t worry!

Go to /containers/ and open app.yml with text editor (nano or wathever)
Find this lines:

  • “80:80” # fwd host port 80 to container port 80 (http)
  • “443:443” # fwd host port 443 to container port 443 (https)

Change to something like this:

  • “8060:80” # fwd host port 80 to container port 8060 (http)
  • “9443:443” # fwd host port 443 to container port 9443 (https)

Save and perform ./launcher rebuild app

Now, go back to Plesk panel, enter on your domain and find Docker Proxy Rules

Click on Add Rule

And select the app and port like this:

Now, open you domain on browser and boom! You are running Discourse with Plesk :slight_smile:


[PAID] Install Discourse on Plesk and import phpBB data
Advanced Setup Only: Allowing SSL / HTTPS for your Discourse Docker setup
Running other websites on the same machine as Discourse
[PAID] Install Discourse on Plesk and import phpBB data
Need a fast troubleshoot - installation
(Jay Pfaffman) #2

Nice work!

I’m pretty sure that you don’t need to install redis or postgres, as they are in the container.


#3

Hi!!!

Congrats and thank you for this tutorial. I have problems with installation…

Just yerterday I installed a new website version, but now with discourse community discussion software:
https://ashesofcreation.es (in development)
comunidad.ashesofcreation.es (discourse)

I can’t install Let’s Encrypt certificate to subdomain (discourse app are inside)

Somebody could help me?

Thanks & Regards

JaPeMo


(Jay Pfaffman) #4

That looks like a question for Plesk folks, as that error comes from Plesk, not Discourse.


#5

I think that is come from Plesk, but I don’t know what happen…


(Carlo) #6

Hi and thanks for that!

Do you think it works on Centos 7?
I’ve just installed Plesk 17 (Onyx) and docker is already installed by default.

I’m just curious to see if Discourse can be setup there.


(Jay Pfaffman) #7

People often have trouble with Centos and docker, but if it’s already installed, perhaps it’s properly configured. If that’s the case, the install instructions should work just fine. Try it and see.


(Carlo) #8

Do you think is it possible to install Discourse image straight away ?


(Joshua Rosenfeld) #9

That will not work. You need to follow the official install instructions on Github: discourse/INSTALL-cloud.md at master · discourse/discourse · GitHub

See Can Discourse ship frequent Docker images that do not need to be bootstrapped? for more details on why you can’t simply install the container.


(Dave) #11

Thanks for the article… I’m quite new to Discourse.

I tried installing it on my Debian Plesk system.

At first all seemed working fine… I did all as it is described above. But I had problems with discourse sending mails. So I changed the smtp settings (used mailgun) in app.yml and used ./launcher rebuild app
Afterwards discourse was not accessible via browser anymore…

I also tried to remove the container in plesk and running setup again but id didn’t help. I probably screwd up the installation even more…

Can anybody help?

thanks,
Dave


(Makary Gołosz) #12

What was the result?


(Dave) #13

A lot of stuff scrolling over my screen… But as far as I could see without errors…

How can I uninstall everything and start from the beginning? Can I just delete the /var/discourse folder?


(Makary Gołosz) #14

That’s great news! Show me your app.yml please, I’ll try to help you find out and fix the problem :slightly_smiling_face:


(Dave) #15

Thanks, here is the file:

  templates:
  - "templates/postgres.template.yml"
  - "templates/redis.template.yml"
  - "templates/web.template.yml"
  - "templates/web.ratelimited.template.yml"
## Uncomment these two lines if you wish to add Lets Encrypt (https)
  #- "templates/web.ssl.template.yml"
  #- "templates/web.letsencrypt.ssl.template.yml"

## which TCP/IP ports should this container expose?
## If you want Discourse to share a port with another webserver like Apache or nginx,
## see https://meta.discourse.org/t/17247 for details
expose:
  - "8060:80"   # http
  - "9443:443" # https

params:
  db_default_text_search_config: "pg_catalog.english"

  ## Set db_shared_buffers to a max of 25% of the total memory.
  ## will be set automatically by bootstrap based on detected RAM, or you can override
  db_shared_buffers: "4096MB"

  ## can improve sorting performance, but adds memory usage per-connection
  #db_work_mem: "40MB"

  ## Which Git revision should this container use? (default: tests-passed)
  #version: tests-passed
  
 env:
  LANG: en_US.UTF-8
  # DISCOURSE_DEFAULT_LOCALE: en

  ## How many concurrent web requests are supported? Depends on memory and CPU cores.
  ## will be set automatically by bootstrap based on detected CPUs, or you can override
  UNICORN_WORKERS: 8

  ## TODO: The domain name this Discourse instance will respond to
  DISCOURSE_HOSTNAME: XXXXX

  ## Uncomment if you want the container to be started with the same
  ## hostname (-h option) as specified above (default "$hostname-$config")
  #DOCKER_USE_HOSTNAME: true

  ## TODO: List of comma delimited emails that will be made admin and developer
  ## on initial signup example 'user1@example.com,user2@example.com'
  DISCOURSE_DEVELOPER_EMAILS: 'XXXXX'

  ## TODO: The SMTP mail server used to validate new accounts and send notifications
  DISCOURSE_SMTP_ADDRESS: smtp.mailgun.org
  DISCOURSE_SMTP_PORT: 587
  DISCOURSE_SMTP_USER_NAME: XXXXX
  DISCOURSE_SMTP_PASSWORD: "XXXXX"
  #DISCOURSE_SMTP_ENABLE_START_TLS: true           # (optional, default true)

  ## If you added the Lets Encrypt template, uncomment below to get a free SSL certificate
  #LETSENCRYPT_ACCOUNT_EMAIL: me@example.com

  ## The CDN address for this Discourse instance (configured to pull)
  ## see https://meta.discourse.org/t/14857 for details
  #DISCOURSE_CDN_URL: //discourse-cdn.example.com 
  
  ## The Docker container is stateless; all data is stored in /shared
volumes:
  - volume:
      host: /var/discourse/shared/standalone
      guest: /shared
  - volume:
      host: /var/discourse/shared/standalone/log/var-log
      guest: /var/log

## Plugins go here
## see https://meta.discourse.org/t/19157 for details
hooks:
  after_code:
    - exec:
        cd: $home/plugins
        cmd:
          - git clone https://github.com/discourse/docker_manager.git
          
          
## Any custom commands to run after building
run:
  - exec: echo "Beginning of custom commands"
  ## If you want to set the 'From' email address for your first registration, uncomment and change:
  ## After getting the first signup email, re-comment the line. It only needs to run once.
  #- exec: rails r "SiteSetting.notification_email='info@unconfigured.discourse.org'"
  - exec: echo "End of custom commands"

(Jay Pfaffman) #16

You could just delete app.yml (or rename it) and run. /disourse-setup.


(Dave) #17

Already tried that…

I guess that something with the port/proxy stuff went wront…


(Jay Pfaffman) #18

Yes, you’ll then need to edit it by hand (that is to say with nano or vim) and replace the ports as it was in your earlier example.


(Dave) #19

Yes, I also did that (using nano)… Deleted the old file run setup and than changed the ports.


(Dave) #20

I tried again, removed the discourse folder and started from the beginning…

Now I can’teven get it to run at all (maybe deleting the folder wasn’t such a good idea ):

2017-11-01 21:25:14.996 UTC [47] LOG:  database system shutdown was interrupted; last known up at 2017-11-01 21:19:10 UTC
2017-11-01 21:25:15.604 UTC [47] LOG:  database system was not properly shut down; automatic recovery in progress
2017-11-01 21:25:15.655 UTC [47] LOG:  redo starts at 0/170E300
2017-11-01 21:25:19.266 UTC [47] LOG:  invalid record length at 0/25C6630
2017-11-01 21:25:19.266 UTC [47] LOG:  redo done at 0/25C6608
2017-11-01 21:25:19.266 UTC [47] LOG:  last completed transaction was at log time 2017-11-01 21:11:57.661238+00
I, [2017-11-01T21:25:19.509808 #15]  INFO -- :
I, [2017-11-01T21:25:19.510076 #15]  INFO -- : > su postgres -c 'createdb discourse' || true
2017-11-01 21:25:19.578 UTC [51] postgres@postgres FATAL:  the database system is starting up
2017-11-01 21:25:19.580 UTC [52] postgres@template1 FATAL:  the database system is starting up
createdb: could not connect to database template1: FATAL:  the database system is starting up
I, [2017-11-01T21:25:19.581747 #15]  INFO -- :
I, [2017-11-01T21:25:19.582022 #15]  INFO -- : > su postgres -c 'psql discourse -c "create user discourse;"' || true
2017-11-01 21:25:19.647 UTC [63] postgres@discourse FATAL:  the database system is starting up
psql: FATAL:  the database system is starting up
I, [2017-11-01T21:25:19.649514 #15]  INFO -- :
I, [2017-11-01T21:25:19.649722 #15]  INFO -- : > su postgres -c 'psql discourse -c "grant all privileges on database discourse to discourse;"' || true
2017-11-01 21:25:19.705 UTC [74] postgres@discourse FATAL:  the database system is starting up
psql: FATAL:  the database system is starting up
I, [2017-11-01T21:25:19.707270 #15]  INFO -- :
I, [2017-11-01T21:25:19.707449 #15]  INFO -- : > su postgres -c 'psql discourse -c "alter schema public owner to discourse;"'
2017-11-01 21:25:19.754 UTC [85] postgres@discourse FATAL:  the database system is starting up
psql: FATAL:  the database system is starting up
I, [2017-11-01T21:25:19.755549 #15]  INFO -- :
I, [2017-11-01T21:25:19.755797 #15]  INFO -- : Terminating async processes
I, [2017-11-01T21:25:19.755835 #15]  INFO -- : Sending INT to HOME=/var/lib/postgresql USER=postgres exec chpst -u postgres:postgres:ssl-cert -U postgres:postgres:ssl-cert /usr/lib/postgresql/9.5/bin/postmaster -D /etc/postgresql/9.5/main pid: 44
2017-11-01 21:25:19.755 UTC [44] LOG:  received fast shutdown request
I, [2017-11-01T21:25:29.756377 #15]  INFO -- : HOME=/var/lib/postgresql USER=postgres exec chpst -u postgres:postgres:ssl-cert -U postgres:postgres:ssl-cert /usr/lib/postgresql/9.5/bin/postmaster -D /etc/postgresql/9.5/main pid:44 did not terminate cleanly, forcing termination!


FAILED
--------------------
Pups::ExecError: su postgres -c 'psql discourse -c "alter schema public owner to discourse;"' failed with return #<Process::Status: pid 75 exit 2>
Location of failure: /pups/lib/pups/exec_command.rb:108:in `spawn'
exec failed with the params "su postgres -c 'psql $db_name -c \"alter schema public owner to $db_user;\"'"
3bf8e9a04c7bf43219bb1b7ae3bb1c733345ba6074ea1068a070422e2d10fb5e
** FAILED TO BOOTSTRAP ** please scroll up and look for earlier error messages, there may be more than one

How can I correctely delete discourse completeley, so I can start all over?

thanks
Dave


(Jay Pfaffman) #21

You can

rm -fr /var/discourse

or

mv /var/discourse /var/discourse.broken

Then clone it again as per the install instructions.