Skip to content
Snippets Groups Projects
Commit 4f47a3d1 authored by Ismael Posada Trobo's avatar Ismael Posada Trobo
Browse files

Bump version from v2.1.3 to v2.1.4.

Tune down the processes and concurrency of sidekiq.
Fixed documentation to point to our SE.
parent 093b0002
No related branches found
No related tags found
No related merge requests found
...@@ -29,7 +29,7 @@ RUN apt update && \ ...@@ -29,7 +29,7 @@ RUN apt update && \
### Set up Discourse ################################## ### Set up Discourse ##################################
# - So we can overrride it with --build_arg # - So we can overrride it with --build_arg
ARG DISCOURSE_VERS='v2.1.3' ARG DISCOURSE_VERS='v2.1.4'
ENV DISCOURSE_RELEASE=$DISCOURSE_VERS RAILS_ENV=production RAILS_ROOT=/discourse HOME=/discourse ENV DISCOURSE_RELEASE=$DISCOURSE_VERS RAILS_ENV=production RAILS_ROOT=/discourse HOME=/discourse
RUN mkdir -p discourse && \ RUN mkdir -p discourse && \
......
...@@ -4,74 +4,8 @@ This template will create the basic structure of an OpenShift service running Di ...@@ -4,74 +4,8 @@ This template will create the basic structure of an OpenShift service running Di
The real project comes from [https://www.discourse.org/](https://www.discourse.org/). The real project comes from [https://www.discourse.org/](https://www.discourse.org/).
## How to deploy a new instance ## How to create a new instance
In order to deploy a new instance of discourse, first we need to create the project under Openshift, then we need a database and finally deploy the template.
### Create Openshift Project (PaaS Application) In order to create a new instance of discourse, please open a ticket at [PaaS Web App](https://cern.service-now.com/service-portal/report-ticket.do?name=request&se=PaaS-Web-App).
Just going to Web Services > [Create New Site](https://webservices.web.cern.ch/webservices/Services/CreateNewSite/Default.aspx).
- **Site category**: Official or Test, up to you.
- **Site name**: up to you. Keep in mind that this name will be used as your entrypoint once it is everything working. If I set the name as myproject1, this will be reachable as myproject1.web.cern.ch.
- **Description**: bla bla
- **Site type**: Paas Web Application
### Configure user and database We will guide you over the next steps to have your instance ready!
> I strongly recommend to use the ones DB on Demand Team provides, reachable at [https://dbod.web.cern.ch/](https://dbod.web.cern.ch/). \ No newline at end of file
> In here, you will ask for a **postgresql database**.
- Create the database.
```CREATE DATABASE '<database_name>';```
- Create an specific user for managing the database (we don't want to use admin).
```CREATE USER '<user_discourse>' WITH PASSWORD '<xxxx>';```
- Then, we need to grant permissions to the user.
```GRANT ALL PRIVILEGES ON DATABASE '<database_name>' to '<user_discourse>';
GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO '<user_discourse>';
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO '<user_discourse>';```
All this previous operations can be performed also through and IDE like [pgAdmin](https://www.pgadmin.org/).
Also, we need to add the following **extensions** to the created database. In the case of DB on Demand, you should contact them as this operation can only be performed by super admins (you can contact them through [mattermost](https://mattermost.web.cern.ch/it-dep/channels/dbod) or just opening a ticket).
The extensions, needed to run discourse, are:
- **hstore**
- **pg_trgm**
### Configure pg_hba.conf
We just need to add the following lines to this file:
```
# User related -- PLEASE EDIT HERE
host all admin 0.0.0.0/0 md5
host <database_name> <user_discourse> 0.0.0.0/0 md5
host postgres <user_discourse> 0.0.0.0/0 md5
```
### Deploy the template
Once we have database configured, it's time to deploy the template. To do this, go to https://openshift.cern.ch (official sites) or https://openshift-dev.cern.ch (test sites).
Under our project, click on **Add to Project**. Under Technologies, click on **Uncategorized** and then select **discourse-cern** template.
You will be asked for filling some fields.
Just note that the variable **DISCOURSE_DB_NAME**, **DISCOURSE_DB_USERNAME** and **DISCOURSE_DB_PASSWORD** must match with the values you set at the time of configuring the database.
Finally, create and it's done.
### Misc
If you want to have CERN SSO on your discourse instance, by default an OAuth plugin was added to the discourse image. To configure it, register your application at [Single Sign-On Management](https://sso-management.web.cern.ch/OAuth/RegisterOAuthClient.aspx), setting the following values:
- **client_id**: up to you, can be something like mynewproject_discourse
- **redirect_uri**: https://mynewproject.web.cern.ch/auth/oauth2_basic/callback
- Generate a **secret**
- **Application Homepage**: https://mynewproject.web.cern.ch
- **Application description**: bla bla.
- **Send Registration Request** (you will get a confirmation email).
Once we have this done, go to your new forum, and under Admin > Settings > Login or directly to https://mynewforum.web.cern.ch/admin/site_settings/category/login, set the following:
```
oauth2_enabled -> checked
oauth2_client_id = **client_id** from the previous paragraph.
oauth2_client_secret = **secret** from the previous paragraph.
oauth2_authorize_url = https://oauth.web.cern.ch/OAuth/Authorize
oauth2_token_url = https://oauth.web.cern.ch/OAuth/Token
oauth2_user_json_url = https://oauthresource.web.cern.ch/api/User?oauth_token=:token
oauth2_json_user_id_path = id
oauth2_json_username_path = username
oauth2_json_name_path = name
oauth2_json_email_path = email
```
\ No newline at end of file
...@@ -511,8 +511,8 @@ objects: ...@@ -511,8 +511,8 @@ objects:
name: "discourse-configmap" name: "discourse-configmap"
data: data:
discourse.conf: |2 discourse.conf: |2
# connection pool size, sidekiq is set to 5, allowing an extra 3 for bg threads # connection pool size, sidekiq is set to 1, allowing an extra 3 for bg threads
db_pool = 8 db_pool = 4
# database timeout in milliseconds # database timeout in milliseconds
db_timeout = 5000 db_timeout = 5000
...@@ -619,7 +619,7 @@ objects: ...@@ -619,7 +619,7 @@ objects:
serve_static_assets = true serve_static_assets = true
# number of sidekiq workers (launched via unicorn master) # number of sidekiq workers (launched via unicorn master)
sidekiq_workers = 5 sidekiq_workers = 1
# adjust stylesheets to rtl (requires "rtlit" gem) # adjust stylesheets to rtl (requires "rtlit" gem)
rtl_css = false rtl_css = false
...@@ -720,7 +720,7 @@ objects: ...@@ -720,7 +720,7 @@ objects:
bind "tcp://0.0.0.0:8080" bind "tcp://0.0.0.0:8080"
sidekiq.yml: |2 sidekiq.yml: |2
:concurrency: 5 :concurrency: 1
:pidfile: /discourse/tmp/pids/sidekiq.pid :pidfile: /discourse/tmp/pids/sidekiq.pid
production: production:
:queues: :queues:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment