← 1. What is Disraptor?
→ 3. Deploy Discourse with Disraptor
sudo apt update
sudo apt install docker postgresql
sudo usermod -aG docker $USER
git clone https://github.com/discourse/discourse.git
git clone https://github.com/disraptor/disraptor.git
cd discourse/plugins
ln -s ../../disraptor disraptor
cd ..
d/boot_dev --init
the --init
flag is only needed for setting up. Whenever you have to use boot_dev
again you may use the command without that flag.
d/ember_cli
d/rails s
And done! You should be able to connect to https://127.0.0.1:4200/ now and see the Discourse setup wizard.
NOTE: Since Discourse and Disraptor run in a docker container now your web it cannot see your web application by default since it is not yet using the host network but rather the docker internal network.
To fix this you can change the docker run
command at the bottom of the d/boot_dev
script to include the --network="host"
flag.
(Closely following discourse.org: Beginners Guide to Install Discourse on Ubuntu for Development)
Install the following packages:
sudo apt update
sudo apt install git build-essential libxslt1-dev libcurl4-openssl-dev libksba8 libksba-dev libqtwebkit-dev libreadline-dev libssl-dev zlib1g-dev libsnappy-dev libsqlite3-dev sqlite3 postgresql postgresql-server-dev-all postgresql-contrib redis-server curl imagemagick advancecomp gifsicle jpegoptim libjpeg-progs optipng pngcrush pngquant jhead
Install a current version of Ruby (via rvm or rbenv).
Restart your terminal and check whether you’re using the correct Ruby version.
Install the following ruby gems:
gem install rails postgresql
Setup the PostgreSQL database.
4.1. Open the PostgreSQL prompt.
sudo -u postgres psql postgres
4.2. Create a new database user with the same name as your system user account with the password discourse
.
CREATE ROLE ubuntuusername WITH LOGIN ENCRYPTED PASSWORD 'discourse' CREATEDB SUPERUSER;
4.3. Create the discourse_development
and discourse_test
databases.
CREATE DATABASE discourse_development WITH OWNER ubuntuusername ENCODING 'UTF8' TEMPLATE template0;
CREATE DATABASE discourse_test WITH OWNER ubuntuusername ENCODING 'UTF8' TEMPLATE template0;
4.4. Exit the prompt by pressing Ctrl+D.
Configure discourse_development
database.
5.1. Login to the discourse_development
with the newly created database user and the previously set password.
psql -d discourse_development -U ubuntuusername -h localhost
5.2. Create the extensions pg_trgm
and hstore
.
CREATE EXTENSION pg_trgm;
CREATE EXTENSION hstore;
5.3. Exit the prompt by pressing Ctrl+D.
discourse_test
(instead of discourse_development
).Setup Discourse.
7.1. Clone the Discourse repository (github.com/discourse/discourse).
7.2. Navigate to the local repository.
cd discourse
7.3. Install Discourse’s dependencies.
bundle install
7.4. Run this:
bundle exec rake db:create db:migrate
RAILS_ENV=test bundle exec rake db:create db:migrate
7.5. Start the local development server.
RAILS_ENV=development bundle exec rails server
Create a new admin user. With this user, you can log in to Discourse once the server was started.
RAILS_ENV=development bundle exec rake admin:create
Start the local development server like this:
RAILS_ENV=development bundle exec rails server
or like this to have the server be available remotely:
RAILS_ENV=development bundle exec rails server --binding=0.0.0.0
10.1. Clone the Disraptor repository (github.com/disraptor/disraptor).
10.2. Navigate to Discourse’s plugin directory.
cd discourse/plugins
10.3. Create a symbolic link to the location of the Disraptor plugin (the following command assumes that the Disraptor repository is located right next to the Discourse repository).
ln -s ../../disraptor disraptor
Activate the Disraptor plugin.
12.1. Navigate to localhost:3000/admin/plugins
12.2. Click Settings next to “disraptor”.
12.3. Check Enable Disraptor and apply the changes by pressing the tick mark next to the checkbox.