Skip to content

Commit 6257c48

Browse files
committed
Updated documentation
* added RVM option for single-user install * clarified Web Server options * bluepill sample config: create socket directory if it doesn't exist * add multisite.yml.production-sample * rename production.sample.rb (OCD) * make two database.yml samples (one for dev, one for prod) * fixed travis build (database.yml.sample renamed) * fix other references to database.yml.sample * clean up 'rvm requirements' instructions as per @mpapis
1 parent 2dedd2b commit 6257c48

9 files changed

Lines changed: 98 additions & 72 deletions

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ rvm:
33
- 1.9.3
44
- 2.0.0
55
before_script:
6-
- cp config/database.yml.sample config/database.yml
6+
- cp config/database.yml.development-sample config/database.yml
77
- cp config/redis.yml.sample config/redis.yml
88
- psql -c 'create database discourse_test;' -U postgres
99
- rake db:migrate
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
production:
2+
adapter: postgresql
3+
database: discourse_prod
4+
# username: discourse_prod # if using username/password auth
5+
# password: itisagooddaytovi # if using username/password auth
6+
# host: dbhost # if not localhost
7+
pool: 5 # size of DB connection pool *per process*
8+
timeout: 5000
9+
# db_id: 0 # database ID if hosting multiple sites
10+
host_names:
11+
- production.localhost # Update this to be the domain of your production site
12+
13+
test:
14+
adapter: postgresql
15+
database: discourse_test
16+
# username: discourse_test
17+
# password: 123123123123
18+
min_messages: warning
19+
host: localhost
20+
pool: 5
21+
timeout: 5000
22+
host_names:
23+
- test.localhost

config/discourse.pill.sample

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,11 @@ Bluepill.application("your_app") do |app|
2828
app.uid = user
2929

3030
app.working_dir = rails_root
31+
sockdir = "#{rails_root}/tmp/sockets"
32+
File.directory? sockdir or Dir.mkdir sockdir
3133
num_webs.times do |i|
3234
app.process("thin-#{i}") do |process|
33-
process.start_command = "bundle exec thin start -e production -t 0 --socket #{rails_root}/tmp/sockets/thin.#{i}.sock -P #{rails_root}/tmp/pids/thin#{i}.pid -d"
35+
process.start_command = "bundle exec thin start -e production -t 0 --socket #{sockdir}/thin.#{i}.sock -P #{rails_root}/tmp/pids/thin#{i}.pid -d"
3436

3537
# Alternatively, you can start with a port number instead of a socket. If you do that, then you MUST update
3638
# the upstream section in the nginx config to match.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
mlp:
2+
adapter: postgresql
3+
database: discourse_mlp
4+
username: discourse_mlp
5+
password: applejack
6+
host: dbhost
7+
pool: 5
8+
timeout: 5000
9+
db_id: 1 # ensure db_id is unique for each site
10+
host_names:
11+
- discourse.equestria.com
12+
- discourse.equestria.internal
13+
14+
drwho:
15+
adapter: postgresql
16+
database: discourse_who
17+
username: discourse_who
18+
password: "Up the time stream without a TARDIS"
19+
host: dbhost
20+
pool: 5
21+
timeout: 5000
22+
db_id: # ensure db_id is unique for each site
23+
host_names:
24+
- discuss.tardis.gallifrey
25+
26+

docs/DEVELOPER-ADVANCED.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ to rails, you are likely much better off with our **[Discourse Vagrant Developer
1010
3. Install Ruby 1.9.3 and Bundler.
1111
3. Clone the project.
1212
4. Create development and test databases in postgres.
13-
5. Copy `config/database.yml.sample` and `config/redis.yml.sample` to `config/database.yml` and `config/redis.yml` and input the correct values to point to your postgres and redis instances.
13+
5. Copy `config/database.yml.development-sample` and `config/redis.yml.sample` to `config/database.yml` and `config/redis.yml` and input the correct values to point to your postgres and redis instances.
1414
6. Install the seed data to set up an admin account and meta topic: `psql DATABASE_NAME < pg_dumps/production-image.sql`
1515

1616

docs/DEVELOPMENT-OSX-NATIVE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ Homebrew loves you.
140140

141141
## Now, test it out!
142142

143-
Copy `config/database.yml.sample` and `config/redis.yml.sample` to `config/database.yml` and `config/redis.yml` and input the correct values to point to your postgres and redis instances. If you stuck to all the defaults above, chances are the samples will work out of the box!
143+
Copy `config/database.yml.development-sample` and `config/redis.yml.sample` to `config/database.yml` and `config/redis.yml` and input the correct values to point to your postgres and redis instances. If you stuck to all the defaults above, chances are the samples will work out of the box!
144144

145145
bundle install # Yes, this DOES take a while. No, it's not really cloning all of rubygems :-)
146146
rake db:migrate

docs/INSTALL-ubuntu.md

Lines changed: 43 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@ Install necessary packages:
1616
# Run these commands as your normal login (e.g. "michael")
1717
sudo apt-get -y install build-essential libssl-dev libyaml-dev git libtool libxslt-dev libxml2-dev redis-server libpq-dev gawk curl pngcrush
1818

19-
## Install nginx
19+
## Web Server Option: nginx
2020

21-
At Discourse, we recommend the latest version of nginx. To install on Ubuntu:
21+
At Discourse, we recommend the latest version of nginx (we like the new and
22+
shiny). To install on Ubuntu:
2223

2324
# Run these commands as your normal login (e.g. "michael")
2425
# Remove any existing versions of nginx
@@ -36,9 +37,10 @@ At Discourse, we recommend the latest version of nginx. To install on Ubuntu:
3637

3738
# install nginx
3839
sudo apt-get update && sudo apt-get -y install nginx
39-
40-
## You could use Apache2
41-
In the case you want Apache2 INSTEAD nginx to serve your static pages:
40+
41+
## Web Server Option: apache2
42+
43+
If you instead want to use apache2 to serve the static pages:
4244

4345
# Run these commands as your normal login (e.g. "michael")
4446
# If you don't have apache2 yet
@@ -93,7 +95,7 @@ If you get any errors starting or reloading apache, please check the paths above
9395

9496
## Install rvm and ruby environment
9597

96-
### Systemwide installation
98+
### RVM Option: Systemwide installation
9799

98100
Taken from http://rvm.io/, the commands below installs RVM and users in the 'rvm' group have access to modify state:
99101

@@ -108,13 +110,20 @@ Taken from http://rvm.io/, the commands below installs RVM and users in the 'rvm
108110
rvm install 2.0.0
109111
gem install bundler
110112

113+
### RVM Option: Single-user installation
114+
115+
Another sensible option (especially if only one Ruby app is on the machine) is
116+
to install RVM isolated to a user's environment. Further instructions are
117+
below.
111118

112119
## Discourse setup
113120

114121
Create discourse user:
115122

116123
# Run these commands as your normal login (e.g. "michael")
117124
sudo adduser --shell /bin/bash discourse
125+
# If this fails, it's because you're doing the RVM single-user install.
126+
# In that case, you could just not run it if errors make you squirrely
118127
sudo adduser discourse rvm
119128

120129
Give postgres DB rights to the `discourse` user:
@@ -128,12 +137,32 @@ Change to the 'discourse' user:
128137
# Run this command as your normal login (e.g. "michael"), further commands should be run as 'discourse'
129138
sudo su - discourse
130139

140+
Install RVM if doing a single-user RVM installation:
141+
142+
# Install RVM
143+
\curl -s -S -L https://get.rvm.io | bash -s stable
144+
. ~/.profile
145+
146+
# Install necessary packages for building ruby
147+
rvm requirements
148+
149+
# If discourse does not have sudo permissions (likely the case), run:
150+
rvm --autolibs=read-fail requirements
151+
# and rvm will tell you which packages you (or your sysadmin) need
152+
# to install before it can proceed. Do that and then resume next:
153+
154+
Continue with discourse installation
155+
156+
# Build and install ruby
157+
rvm install 2.0.0
158+
gem install bundler
159+
131160
# Pull down the latest release
132161
git clone git://github.com/discourse/discourse.git
162+
cd discourse
133163
git checkout latest-release
134164

135165
# Install necessary gems
136-
cd discourse
137166
bundle install --deployment
138167

139168
_If you have errors building the native extensions, ensure you have sufficient free system memory. 1GB with no swap won't cut it._
@@ -142,15 +171,17 @@ Configure discourse:
142171

143172
# Run these commands as the discourse user
144173
cd ~/discourse/config
145-
for i in {database,redis}.yml discourse.pill; do cp $i.sample $i; done
146-
cp environments/production.sample.rb environments/production.rb
174+
cp database.yml.production-sample database.yml
175+
cp redis.yml.sample redis.yml
176+
cp discourse.pill.sample discourse.pill
177+
cp environments/production.rb.sample environments/production.rb
147178

148179
Edit discourse/config/database.yml
149180

150-
- remove profile and development
151-
- leave in production and perhaps test
152181
- change production db name to: `discourse_prod`
153-
- Change `host_names` to the name you'll use to access the discourse site
182+
- change username/password if appropriate
183+
- set db_id if using multisite
184+
- change `host_names` to the name you'll use to access the discourse site
154185

155186
Edit discourse/config/redis.yml
156187

@@ -182,9 +213,6 @@ Initialize the database:
182213
RUBY_GC_MALLOC_LIMIT=900000000 RAILS_ENV=production bundle exec rake db:migrate
183214
RUBY_GC_MALLOC_LIMIT=900000000 RAILS_ENV=production bundle exec rake assets:precompile
184215

185-
# TEMPORARY BUG WORKAROUND:
186-
mkdir -p ~/discourse/tmp/sockets
187-
188216
## nginx setup
189217

190218
# Run these commands as your normal login (e.g. "michael")
@@ -221,56 +249,3 @@ Add the following line:
221249
@reboot RUBY_GC_MALLOC_LIMIT=900000000 RAILS_ROOT=~/discourse RAILS_ENV=production NUM_WEBS=4 bluepill --no-privileged -c ~/.bluepill load ~/discourse/config/discourse.pill
222250

223251
Congratulations! You've got Discourse installed and running!
224-
225-
<!--
226-
Now you have to deliver the service to your users.
227-
228-
<strong>CDN</strong>
229-
230-
<h3>haproxy</h3>
231-
<pre>listen http-in
232-
bind 64.71.148.2:80
233-
acl is_bare hdr(host) -i discourse.org
234-
acl is_home hdr(host) -i www.discourse.org
235-
acl is_blog hdr(host) -i blog.discourse.org
236-
# Discourse
237-
acl is_app hdr(host) -i meta.discourse.org
238-
acl is_app hdr(host) -i try.discourse.org
239-
# How-To-Geek
240-
acl is_app hdr(host) -i discuss.howtogeek.com
241-
242-
# Redirect to www
243-
redirect prefix http://www.discourse.org if is_bare
244-
use_backend home if is_home
245-
use_backend blog if is_blog
246-
use_backend app if is_app
247-
default_backend app
248-
249-
backend app
250-
mode http
251-
balance roundrobin
252-
option http-server-close
253-
option forwardfor # This sets X-Forwarded-For
254-
option httpchk GET /srv/status HTTP/1.1\r\nHost:\ meta.discourse.org
255-
server app2_00 10.0.0.2:9100 check
256-
server app2_01 10.0.0.2:9101 check
257-
server app3_00 10.0.0.3:9100 check
258-
server app3_01 10.0.0.3:9101 check
259-
server app4_00 10.0.0.4:9100 check
260-
server app4_01 10.0.0.4:9101 check
261-
server app5_00 10.0.0.5:9100 check
262-
server app5_01 10.0.0.5:9101 check
263-
264-
backend home
265-
mode http
266-
balance roundrobin
267-
option http-server-close
268-
option forwardfor # This sets X-Forwarded-For
269-
server home_app1_1 10.0.0.2:80
270-
271-
backend blog
272-
mode http
273-
balance roundrobin
274-
server app1_1 10.0.0.40:80
275-
</pre>
276-
-->

0 commit comments

Comments
 (0)