Skip to content

Commit ddabc47

Browse files
committed
Awesome documentation updates
1 parent e7e0060 commit ddabc47

5 files changed

+278
-119
lines changed

config/nginx.sample.conf

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ server {
1717
sendfile on;
1818

1919
keepalive_timeout 65;
20+
client_max_body_size 2m;
2021

2122
location / {
2223
root /home/discourse/discourse/public;

docs/INSTALL-alternatives.md

+82
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# Alternative Install Options
2+
3+
Here lie some alternative installation options for Discourse. They're not the
4+
recommended way of doing things, hence they're a bit out of the way.
5+
6+
Oh, and dragons. Lots of dragons.
7+
8+
## Web Server Alternative: apache2
9+
10+
If you instead want to use apache2 to serve the static pages:
11+
12+
# Run these commands as your normal login (e.g. "michael")
13+
# If you don't have apache2 yet
14+
sudo apt-get install apache2
15+
16+
# Edit your site details in a new apache2 config file
17+
sudo vim /etc/apache2/sites-available/your-domain.com
18+
19+
# Put these info inside and change accordingly
20+
21+
<VirtualHost *:80>
22+
ServerName your-domain.com
23+
ServerAlias www.your-domain.com
24+
25+
DocumentRoot /srv/www/apps/discourse/public
26+
27+
<Directory /srv/www/apps/discourse/public>
28+
AllowOverride all
29+
Options -MultiViews
30+
</Directory>
31+
32+
# Custom log file locations
33+
ErrorLog /srv/www/apps/discourse/log/error.log
34+
CustomLog /srv/www/apps/discourse/access.log combined
35+
</VirtualHost>
36+
37+
# Install the Passenger Phusion gem and run the install
38+
gem install passenger
39+
passenger-install-apache2-module
40+
41+
# Next, we "create" a new apache2 module, passenger
42+
sudo vim /etc/apache2/mods-available/passenger.load
43+
44+
# Inside paste (change the user accodingly)
45+
LoadModule passenger_module /home/YOUR-USER/.rvm/gems/ruby-2.0.0-p0/gems/passenger-4.0.2/libout/apache2/mod_passenger.so
46+
47+
# Now the passenger module configuration
48+
sudo vim /etc/apache2/mods-available/passenger.conf
49+
50+
# Inside, paste (change the user accodingly)
51+
PassengerRoot /home/YOUR-USER/.rvm/gems/ruby-2.0.0-p0/gems/passenger-4.0.2
52+
PassengerDefaultRuby /home/YOUR-USER/.rvm/wrappers/ruby-2.0.0-p0/ruby
53+
54+
# Now activate them all
55+
56+
sudo a2ensite your-domain.com
57+
sudo a2enmod passenger
58+
sudo service apache2 reload
59+
sudo service apache2 restart
60+
61+
If you get any errors starting or reloading apache, please check the paths above - Ruby 2.0 should be there if you are using RVM, but it could get tricky.
62+
63+
## RVM Alternative: Systemwide installation
64+
65+
Taken from http://rvm.io/, the commands below installs RVM and users in the 'rvm' group have access to modify state:
66+
67+
# Run these commands as your normal login (e.g. "michael") \curl -s -S -L https://get.rvm.io | sudo bash -s stable
68+
sudo adduser $USER rvm
69+
newgrp rvm
70+
. /etc/profile.d/rvm.sh
71+
rvm requirements
72+
73+
# Build and install ruby
74+
rvm install 2.0.0
75+
gem install bundler
76+
77+
When creating the `discourse` user, add him/her/it to the RVM group:
78+
79+
# Run these commands as your normal login (e.g. "michael")
80+
sudo adduser discourse rvm
81+
82+
RVM will be located in `/usr/local/rvm` directory instead of `/home/discourse/.rvm`, so update the crontab line respectively.

docs/INSTALL-ubuntu.md

+83-88
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,16 @@
22

33
## What kind of hardware do you have?
44

5-
- We *strongly* recommend 2GB of memory minimum if you don't want to deal with swap partitions during the install.
6-
- We recommend at least a dual core CPU.
5+
- Recommended minimum configuration is:
6+
- 2GiB of RAM
7+
- 2GiB of swap
8+
- 2 processor cores
9+
- With 2GB of memory and dual cores, you can run two instances of the thin
10+
server (`NUM_WEBS=2`)
711

8-
1 GB of memory and a single core CPU are the minimums for a steady state, running Discourse forum -- but it's simpler to just throw a bit more hardware at the problem if you can, particularly during the install.
12+
1 GiB of memory, 3GiB of swap and a single core CPU are the minimums for a
13+
steady state, running Discourse forum -- but it's simpler to just throw a bit
14+
more hardware at the problem if you can, particularly during the install.
915

1016
## Install Ubuntu Server 12.04 LTS with the package groups:
1117

@@ -51,7 +57,13 @@ Install necessary packages:
5157
sudo apt-get update
5258
sudo apt-get install redis-server
5359

54-
## Web Server Option: nginx
60+
## Web Server: nginx
61+
62+
nginx is used for:
63+
64+
* reverse proxy (i.e. load balancer)
65+
* static asset serving (since you don't want to do that from ruby)
66+
* anonymous user cache
5567

5668
At Discourse, we recommend the latest version of nginx (we like the new and
5769
shiny). To install on Ubuntu:
@@ -73,93 +85,18 @@ shiny). To install on Ubuntu:
7385
# install nginx
7486
sudo apt-get update && sudo apt-get -y install nginx
7587

76-
## Web Server Option: apache2
77-
78-
If you instead want to use apache2 to serve the static pages:
79-
80-
# Run these commands as your normal login (e.g. "michael")
81-
# If you don't have apache2 yet
82-
sudo apt-get install apache2
83-
84-
# Edit your site details in a new apache2 config file
85-
sudo vim /etc/apache2/sites-available/your-domain.com
86-
87-
# Put these info inside and change accordingly
88-
89-
<VirtualHost *:80>
90-
ServerName your-domain.com
91-
ServerAlias www.your-domain.com
92-
93-
DocumentRoot /srv/www/apps/discourse/public
94-
95-
<Directory /srv/www/apps/discourse/public>
96-
AllowOverride all
97-
Options -MultiViews
98-
</Directory>
99-
100-
# Custom log file locations
101-
ErrorLog /srv/www/apps/discourse/log/error.log
102-
CustomLog /srv/www/apps/discourse/access.log combined
103-
</VirtualHost>
104-
105-
# Install the Passenger Phusion gem and run the install
106-
gem install passenger
107-
passenger-install-apache2-module
108-
109-
# Next, we "create" a new apache2 module, passenger
110-
sudo vim /etc/apache2/mods-available/passenger.load
111-
112-
# Inside paste (change the user accodingly)
113-
LoadModule passenger_module /home/YOUR-USER/.rvm/gems/ruby-2.0.0-p0/gems/passenger-4.0.2/libout/apache2/mod_passenger.so
114-
115-
# Now the passenger module configuration
116-
sudo vim /etc/apache2/mods-available/passenger.conf
117-
118-
# Inside, paste (change the user accodingly)
119-
PassengerRoot /home/YOUR-USER/.rvm/gems/ruby-2.0.0-p0/gems/passenger-4.0.2
120-
PassengerDefaultRuby /home/YOUR-USER/.rvm/wrappers/ruby-2.0.0-p0/ruby
121-
122-
# Now activate them all
123-
124-
sudo a2ensite your-domain.com
125-
sudo a2enmod passenger
126-
sudo service apache2 reload
127-
sudo service apache2 restart
128-
129-
If you get any errors starting or reloading apache, please check the paths above - Ruby 2.0 should be there if you are using RVM, but it could get tricky.
130-
13188
## Install Ruby with RVM
13289

133-
### RVM Option: Systemwide installation
134-
135-
Taken from http://rvm.io/, the commands below installs RVM and users in the 'rvm' group have access to modify state:
136-
137-
# Run these commands as your normal login (e.g. "michael")
138-
\curl -s -S -L https://get.rvm.io | sudo bash -s stable
139-
sudo adduser $USER rvm
140-
newgrp rvm
141-
. /etc/profile.d/rvm.sh
142-
rvm requirements
143-
144-
# Build and install ruby
145-
rvm install 2.0.0
146-
gem install bundler
147-
148-
### RVM Option: Single-user installation
90+
### RVM : Single-user installation
14991

150-
Another sensible option (especially if only one Ruby app is on the machine) is
151-
to install RVM isolated to a user's environment. Further instructions are
152-
below.
92+
We recommend installing RVM isolated to a single user's environment.
15393

15494
## Discourse setup
15595

15696
Create Discourse user:
15797

15898
# Run these commands as your normal login (e.g. "michael")
15999
sudo adduser --shell /bin/bash discourse
160-
# If this fails, it's because you're doing the RVM single-user install.
161-
# In that case, you could just not run it if errors make you squirrely
162-
sudo adduser discourse rvm
163100

164101
Give Postgres database rights to the `discourse` user:
165102

@@ -172,7 +109,7 @@ Change to the 'discourse' user:
172109
# Run this command as your normal login (e.g. "michael"), further commands should be run as 'discourse'
173110
sudo su - discourse
174111

175-
Install RVM if doing a single-user RVM installation:
112+
Install RVM
176113

177114
# As 'discourse'
178115
# Install RVM
@@ -304,7 +241,7 @@ Configure Bluepill:
304241
Start Discourse:
305242

306243
# Run these commands as the discourse user
307-
RUBY_GC_MALLOC_LIMIT=90000000 RAILS_ROOT=~/discourse RAILS_ENV=production NUM_WEBS=4 bluepill --no-privileged -c ~/.bluepill load ~/discourse/config/discourse.pill
244+
RUBY_GC_MALLOC_LIMIT=90000000 RAILS_ROOT=~/discourse RAILS_ENV=production NUM_WEBS=2 bluepill --no-privileged -c ~/.bluepill load ~/discourse/config/discourse.pill
308245

309246
Add the Bluepill startup to crontab.
310247

@@ -313,10 +250,7 @@ Add the Bluepill startup to crontab.
313250

314251
Add the following lines:
315252

316-
@reboot RUBY_GC_MALLOC_LIMIT=90000000 RAILS_ROOT=~/discourse RAILS_ENV=production NUM_WEBS=4 /home/discourse/.rvm/bin/bootup_bluepill --no-privileged -c ~/.bluepill load ~/discourse/config/discourse.pill
317-
318-
319-
Note: in case of RVM system-wide installation RVM will be located in `/usr/local/rvm` directory instead of `/home/discourse/.rvm`, so update the line above respectively.
253+
@reboot RUBY_GC_MALLOC_LIMIT=90000000 RAILS_ROOT=~/discourse RAILS_ENV=production NUM_WEBS=2 /home/discourse/.rvm/bin/bootup_bluepill --no-privileged -c ~/.bluepill load ~/discourse/config/discourse.pill
320254

321255
## Log rotation setup
322256

@@ -360,16 +294,77 @@ The corresponding site setting is:
360294

361295
# Run these commands as the discourse user
362296
bluepill stop
297+
bluepill quit
298+
# Back up your install
299+
DATESTAMP=$(TZ=UTC date +%F-%T)
300+
pg_dump --no-owner --clean discourse_prod | gzip -c > ~/discourse-db-$DATESTAMP.sql.gz
301+
tar cfz ~/discourse-dir-$DATESTAMP.tar.gz -C ~ discourse
363302
# Pull down the latest release
364303
cd ~/discourse
365304
git checkout master
366305
git pull
367306
git fetch --tags
368307
# To run on the latest version instead of bleeding-edge:
369308
#git checkout latest-release
309+
#
310+
# Follow the section below titled:
311+
# "Check sample configuration files for new settings"
312+
#
370313
bundle install --without test --deployment
371314
RUBY_GC_MALLOC_LIMIT=90000000 RAILS_ENV=production rake db:migrate
372315
RUBY_GC_MALLOC_LIMIT=90000000 RAILS_ENV=production rake assets:precompile
373-
bluepill start
316+
# restart bluepill
317+
crontab -l
318+
# Here, run the command to start bluepill.
319+
# Get it from the crontab output above.
374320

375321
Note that if bluepill *itself* needs to be restarted, it must be killed with `bluepill quit` and restarted with the same command that's in crontab
322+
323+
### Check sample configuration files for new settings
324+
325+
Check the sample configuration files provided in the repo with the ones being used for additional recommended settings and merge those in:
326+
327+
# Run these commands as the discourse user
328+
cd ~/discourse
329+
diff -u config/discourse.pill.sample config/discourse.pill
330+
diff -u config/nginx.sample.conf /etc/nginx/conf.d/discourse.conf
331+
diff -u config/environments/production.rb.sample config/environments/production.rb
332+
333+
#### Example 1
334+
335+
$ diff -u config/discourse.pill.sample config/discourse.pill
336+
--- config/discourse.pill.sample 2013-07-15 17:38:06.501507001 +0000
337+
+++ config/discourse.pill 2013-07-05 06:38:27.133506896 +0000
338+
@@ -46,7 +46,7 @@
339+
340+
app.working_dir = rails_root
341+
sockdir = "#{rails_root}/tmp/sockets"
342+
- File.directory? sockdir or FileUtils.mkdir_p sockdir
343+
+ File.directory? sockdir or Dir.mkdir sockdir
344+
num_webs.times do |i|
345+
app.process("thin-#{i}") do |process|
346+
347+
This change reflects us switching to using `FileUtils.mkdir_p` instead of `Dir.mkdir`.
348+
349+
#### Example 2
350+
351+
$ diff -u config/nginx.sample.conf /etc/nginx/conf.d/discourse.conf
352+
--- config/nginx.sample.conf 2013-07-15 17:38:06.521507000 +0000
353+
+++ /etc/nginx/conf.d/discourse.conf 2013-07-15 17:52:46.649507024 +0000
354+
@@ -12,17 +12,18 @@
355+
gzip_min_length 1000;
356+
gzip_types application/json text/css application/x-javascript;
357+
358+
- server_name enter.your.web.hostname.here;
359+
+ server_name webtier.discourse.org;
360+
361+
sendfile on;
362+
363+
keepalive_timeout 65;
364+
- client_max_body_size 2m;
365+
location / {
366+
root /home/discourse/discourse/public;
367+
368+
This change reflects a change in placeholder information plus (importantly)
369+
adding the `client_max_body_size 2m;` directive to the nginx.conf. This change
370+
should also be made to your production file.

0 commit comments

Comments
 (0)