Discourse is a 100% open source discussion platform built for the next decade of the Internet. Use it as a mailing list, discussion forum, long-form chat room, and more! This guide will detail how to deploy a development discourse server using a SkySilk VPS. 

*Note: Production Discourse Servers require Docker support for installation. Docker is not currently supported by SkySilk. This method is intended to instruct for development Discourse only. This guide assumes that you are using Ubuntu, but the set-up instructions will work for any Debian based distribution.


How to Install Discourse on Ubuntu 16.04 (without Docker) using SkySilk VPS


  1. Deploy a SkySilk VPS running Ubuntu 16.04.

  2. Login to your VPS. SSH into your VPS using [email protected] and the password you set in the SkySilk dashboard.

    If you are connecting from a Unix-like machine (Mac OS or Linux), or by using PuTTY with Windows then the command to connect is simply:

    ssh [user]@[ip address] 
     

    where [user] is your username, typically root, and [ip address] is the IP address of the virtual machine, for example:

     
    ssh [email protected]
    (Read: How To Access Linux VPS via SSH Key)

  3. Create a new user. To create a new user type the following:
    adduser [newuser]
    where [newuser] is your desired new username.

  4. Run the following as your new user:
    bash <(wget -qO- https://raw.githubusercontent.com/techAPJ/install-rails/master/linux)
    Wait for the packages to install.

  5. Run the following, enter each command separately:
    cd /usr/local/share
    sudo wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.8-linux-x86_64.tar.bz2
    sudo tar xvf phantomjs-1.9.8-linux-x86_64.tar.bz2
    sudo rm phantomjs-1.9.8-linux-x86_64.tar.bz2
    sudo ln -s /usr/local/share/phantomjs-1.9.8-linux-x86_64/bin/phantomjs /usr/local/bin/phantomjs
    cd
     


  6. Clone the Discourse repository in ~/discourse folder:

    git clone https://github.com/discourse/discourse.git ~/discourse


  7. Open psql prompt as postgres user:
    sudo -u postgres psql postgres
     


  8. Create a role with the same name as your ubuntu system username with 'discourse' as password:

    CREATE ROLE user WITH LOGIN ENCRYPTED PASSWORD 'discourse' CREATEDB SUPERUSER;


    Check that you have successfully created the role:

    \du


  9. Create discourse_development and discourse_test database:

    CREATE DATABASE discourse_development WITH OWNER user ENCODING 'UTF8' TEMPLATE template0;
    CREATE DATABASE discourse_test WITH OWNER user ENCODING 'UTF8' TEMPLATE template0;


    Exit psql prompt by pressing 'ctrl+d'

  10. Now access psql prompt in discourse_development database as user (your username):

    psql -d discourse_development -U user -h 127.0.0.1

    where 'user' is your username entered above and '127.0.0.1' is the localhost address of your SkySilk VPS.

    When prompted for a password, provide the password which you set at the time of creating the role, if you followed the guide as is, the password is discourse.

  11. Run the following commands, separately:

    CREATE EXTENSION pg_trgm;
    CREATE EXTENSION hstore;


    Exit psql prompt by pressing 'ctrl+d'

  12. Access psql prompt in discourse_test database as user (your username):

    psql -d discourse_test -U user -h your.ipaddress


    When prompted for a password, provide the password which you set at the time of creating the role, if you followed the guide as is, the password is discourse.


    If you receive a FATAL error, you may need to adjust the /pg_hba.conf file. If so, you need to do the following:

    Access the file:

    sudo nano /etc/postgresql/9.5/main/pg_hba.conf


    Add the following to the end of the file:

    host all all      ::1/128      md5
    host all postgres 127.0.0.1/32 md5


    Then, then restart postgresql service:

    /etc/init.d/postgresql restart


    From there you should be able to enter the discourse psql password and continue with the install process.


  13. Run following commands, separately:
    CREATE EXTENSION pg_trgm;
    CREATE EXTENSION hstore;
     
    Exit psql prompt by pressing 'ctrl+d'

    You have set-up the database successfully!

  14. Bootstrap Discourse. Switch to your Discourse folder:
    cd ~/discourse
     
    Install the needed gems:
    source ~/.bashrc
    bundle install
     
  15. Start Rails Server. Now that you have successfully configured database connection, run this command:
    bundle exec rake db:migrate db:test:prepare db:seed_fu
     
    Now, try running the specs:
    bundle exec rake autospec
     
    Start rails server using this command to have it listening on all interfaces and available remotely:
    bundle exec rails server --binding=0.0.0.0
     
  16. Create New Admin. To create a new admin, run the following commands:
    RAILS_ENV=development
    bundle exec rake admin:create
     


  17. Configure Mail. Run MailCatcher:
    mailcatcher --http-ip 0.0.0.0


    You should now be able to connect to discourse app on http://your.ipaddress:3000! ('your.ipaddress' should be the IP Address of your SkySilk VPS)

For additional resources on specifics of using Discourse, please consult Discourse Support and Community reference material:

Discourse.org

Support and Community


CLICK TO DEPLOY A HOSTED DISCOURSE SERVER