Skip to content

Instantly share code, notes, and snippets.

@gdamjan
Last active August 26, 2019 19:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gdamjan/692990b2bad17b740ea1905cd437d6ef to your computer and use it in GitHub Desktop.
Save gdamjan/692990b2bad17b740ea1905cd437d6ef to your computer and use it in GitHub Desktop.
Install discourse

Tested on debian 10

Build

# build deps
sudo apt install build-essential zlib1g-dev liblzma-dev libpq-dev libxml2-dev libxslt-dev \
    ruby-dev ruby-bundler
# runtime deps
sudo apt install uwsgi-plugin-rack-ruby2.5 imagemagick \
    pngquant optipng jhead jpegoptim gifsicle
sudo npm install -g svgo
    
# discourse
git clone https://github.com/discourse/discourse.git
cd discourse
bundle config build.nokogiri --use-system-libraries
bundle install --path vendor/bundle --without test development

Local setup

sudo apt install redis-server postgresql

# lets create a postgres superuser for the current unix user
sudo -u postgres createuser -s "$USER"
DISCOURSE_DB_USERNAME=$USER RAILS_ENV=production bundle exec rake db:create db:migrate
pwgen 10
DISCOURSE_DB_USERNAME=$USER RAILS_ENV=production bundle exec rake admin:create

uwsgi --ini uwsgi.ini --env DISCOURSE_DB_USERNAME=$USER
[uwsgi]
; default for local testing run it like "uwsgi --ini discourse.ini"
ini = :discourse
http-socket = :8000
http-socket-modifier1 = 7
static-check = %(discourse_dir)
static-skip-ext = .rb
offload-threads = 2
[service]
ini = :discourse
plugin = systemd_logger
logger = systemd
[discourse]
master = true
processes = 6
cheaper = 2
discourse_dir = /srv/discourse
chdir = %(discourse_dir)
env = RAILS_ENV=production
plugin = rack
rack = config.ru
rbrequire = rubygems
rbrequire = bundler/setup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment