Best way to install Discourse on my server?


(AstonJ) #1

I think it’s about time I get a Discourse forum up in production, but I’m not sure which method will be best for me and my server, which is running…

CentOS 6
Virtualmin
Apache
Passenger
Postgres
Latest Ruby, various gems etc

I currently have several sites on the server, some are PHP (forums) and some are Rails apps, and until now they have all lived happily together, and I’d like to add Discourse to tha family without sacrificing any of the features I currently enjoy (like being able to easily set up emails for each domain, etc).

Any idea what’s the best way to get a Discourse forum on my server please? (And hopefully at some point, several Discourse forums!)

I don’t mind installing software and configuring things if that will mean I get the best performance.


(Zane Beckman) #2

Have a look at the advanced install instructions, as well as the sample nginx config.

Just be sure not to leave Discourse configured for a development environment when it goes public!


(Manthan Mallikarjun) #3

Even though you have everything installed, I would still recommend Docker!


(a slightly fluffy latex coated steel ball) #4

The docker install worked great for me… But it presents an obstacle to tinkering under the hood. If you want to get into the code then install as a regular rails app ( advanced as above )

I just went docker to try it out but I’m now installing again without docker so I can checkin out easily with my fork

MB


(Kane York) #5

Due to the weirdness of Ruby versioning and gems, I will still recommend that you use a Docker container. If the kernel is too old to run Docker, I’m pretty sure the one in CentOS 7 will be new enough.

One more important thing is that you could consider using the existing Postgres outside the container. Set up a symlink to the socket connection in /var/discourse/shared/web_redis/$SOMETHING and set…uh… is it DISCOURSE_DB_SOCKET? Set that to /shared/$SAME_SOMETHING.

(where web_redis is a container definition created by removing the postgres template from the samples/standalone.yml)

Summarizing the information from another topic about apache:

  • Set up a VirtualHost forwarding to the port that Docker is bound to
  • Make sure that Apache is using the “evented” request processor, or the message bus will have major perf issues

(Kane York) #6

rails c will work just as you’re used to if you enter the container with ./launcher enter <container>.

Changing files is a bit harder, admittedly, but you can create file: or replace: Pups rules in the container definition file for non-discourse files and a plugin to change Discourse JS or Ruby.


(AstonJ) #7

Thanks for the replies everyone.

So would we treat this then as a normal Rails app? I.e. Simply use Capistrano to deploy to production server?

How does this fair when it comes to upgrading Discourse? And do you have to have nginix?

There is a guide here that shows how to install it for CentOS 6.5 How To Install Docker on CentOS 6 | Liquid Web Knowledge Base

Would there be any problems with other sites on the server? I thought I read a thread here that said when Docker was used all other sites stopped working :confused:


(bubill) #8

CentOS is better than Ubuntu.


(Zane Beckman) #9

I don’t know whether capistrano could be used to deploy it.

As far as updating Discourse, doing git pull, then bundle exec rake db:migrate should do it. There may be a few other rake tasks that need to be run. I’m not sure.

The nginx config is useful to look at for seeing how nginx is configured when using a docker container. It’s not required, but you would need something on the front side to handle virtual hosting.


(Kane York) #10

That would be due to Docker binding to port 80, which is the default configuration. See this thread:


.


bundle install
bundle exec rake multisite:migrate
bundle exec rake assets:precompile

(Stuart Alexander) #11

To clarify: If I want my own fork with my own plugins etc, I should install as a normal rails app and not use docker?


(AstonJ) #12

That was going to be my next question - how do plugins work and how do the different install methods impact them?


(a slightly fluffy latex coated steel ball) #13

Once you can get into the actual running container with

./launcher ssh app

You can see exactly whats going on in the docker as you can access the file system and so on, until you get to that point it’s a mysterious black box. I can see the value in the docker because configuring rails apps can be a bit aof a pain as there are so many dependencies and version sensitivity, it means that you can literally get started in minutes rather than hours and for some users thats all they need. ( Docker basically appears to launch a sort of virtual machine on your server that has all the pre reqs to run a production discourse

For me though I just used docker to test out the app initially but I’m now switching over to manual / traditional as there are various things I need to see running and get my hands on before I gallop into the sunset on my herd of unicorns


(AstonJ) #14

Ok I’ve got DC installed on my dev machine, just adding these notes for future reference or in case they are useful to anyone else.

Set up Ruby dev environment as usual, and if not already installed install the following via homebrew:

  • Postgres
  • Imagemagick
  • Redis
  • phantomjs

Also install sidekiq and mailcatcher via rubygems.

Then git clone GitHub - discourse/discourse: A platform for community discussion. Free, open, simple., git pull, and bundle install.

In terminal open a tab for each of the following and start with: mailcatcher, redis-server, bundle exec sidekiq.

Set up your db as you normally would in database.yml (I had to add host: localhost).

Finally:

rake db:migrate
rake db:test:prepare
rake db:seed_fu```

Tho you might need to ```psql discourse_development``` and create extensions manually:

```CREATE EXTENSION hstore;
CREATE EXTENSION pg_trgm;```

(Gamonics) #15

Noob here. Will this set of install instructions work for my own Ubuntu 14.04 machine as well as Ubuntu at Digital Ocean?

Apologies if this is a daft question, but I can’t find anything else. This guide also addresses installs only on Digital Ocean cloud server. I want to install it on my own Ubuntu 14.04 server.


(山) #16

Here is the official documentation for setup. If you are running a VPS from any provider, the DO parts can easily be translated for your service provider.

As for an actual server in your possession? Hmm.


(Gamonics) #17

Right: an actual server in my possession. I don’t think the site will have many users, so I don’t foresee a problem any time in the next year or two. So I guess I just use the Digital Ocean guide for Ubuntu 14.04 machines and make changes in that guide to fit my server where appropriate?

Anyone see any impending problems with that plan?


(Jeff Atwood) #18

Nope should work great! Any Ubuntu 14.04 x64 LTS system is perfect and follows the guide exactly. Has to be 64-bit though!

(Where we run into trouble is oddball distros, or distros with very old kernels.)