IT/Community/WG/Discourse: Difference between revisions

From MozillaWiki
< IT‎ | Community
Jump to navigation Jump to search
No edit summary
(Update redirect)
 
(11 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{| class="wikitable"
#REDIRECT [[ParticipationSystems/Discourse]]
|-
! Module Name !! Module Owner !! Module Peers
|-
| Discourse || yalam96 || Tanner
|}
 
=Summary=
 
[http://discourse.mozilla-community.org/ Test site] on mozilla-community.org.
 
= Documentation =
[[File:Discourse_diagram.png|200px|thumb|right|Architectural overview]]
== Overview ==
* '''Hosting Provider:''' AWS
* '''Compute Region (AZ):''' US East (N. Virginia)
* '''Discourse Version:''' tests-passed
 
== Monitoring ==
 
 
== Instances ==
All images for webheads are based on <i>ubuntu-precise-12.04-amd64-server-20131003 (ami-acf9cde9)</i>.
 
=== Webheads ===
Webheads are automatically scaled depending on demand. To find instances, search for <i>aws:autoscaling:groupName : csa-discourse-production-as</i>.
 
=== Postgresql ===
* '''Version:''' 9.3.3
 
 
{| class="fullwidth-table"
|-
! Name
! Service
! Flavor
! Volume
! Availability Zone <!-- I don't really want to put the public IP in the public, it's easy enough to find it in AWS -->
|-
| <tt>pgshared-production-c</tt> || postgresql || db.t1.micro || 300GB || us-east-1c
|-
|}
 
Note: Can only be accessed from inside the CSA VPC.
 
=== Redis ===
* '''Version''': 2.8.6
{| class="fullwidth-table"
|-
! Node
! Cluster
! Service
! Flavor
! Availability Zone
|-
| <tt>0001</tt> || csa-discourse-prod || Redis || cache.t1.micro || us-east-1d
|-
|}
== Discourse set-up ==
=== Install Discourse ===
  # Update Ubuntu
  sudo apt-get update && sudo apt-get upgrade   
 
  # Install Docker and git
  wget -qO- https://get.docker.io/ | sh
 
  # Create the directory for Discourse and clone the repo into it
  mkdir /var/discourse
  git clone https://github.com/discourse/discourse_docker.git /var/discourse
  cd /var/discourse
 
  # Copy the web example config
  cp samples/web_only.yml containers/app.yml
 
=== Edit app.yml ===
Open containers/app.yml in your favourite text editor and add/edit the following lines. Note that this is not the full file and YML is sensitive to indentation.
 
  params:
    version: tests-passed
  env:
    DISCOURSE_DEVELOPER_EMAILS: '' # For new instances, add an email address that you will use to sign up to discourse
    DISCOURSE_DB_PASSWORD: PASSWORD # Change this to the password for the database
    DISCOURSE_DB_POOL: 15
    DISCOURSE_DB_HOST: 'pgshared-db.mofoprod.net' # You will most likely be using this server
    DISCOURSE_DB_USERNAME: 'USERNAME' # Change this to the username that can access your database
    DISCOURSE_DB_NAME: 'DBNAME' # Change this to the name of the database for this instance
    DISCOURSE_HOSTNAME: 'HOSTNAME' # Change this to the domain that Discourse will run under
    DISCOURSE_REDIS_HOST: REDIS_HOST # Change this to the URL of the redis server
    # don't forget to set mail
    DISCOURSE_SMTP_ADDRESS: ADDRESS # Change this to the SES
    DISCOURSE_SMTP_PORT: 587
    DISCOURSE_SMTP_USER_NAME: USERNAME # Change this to the Amazon SES username
    DISCOURSE_SMTP_PASSWORD: PASSWORD # Change this to the Amazin SES password
    # New Relic
    NEW_RELIC_LICENSE_KEY: 123456789abcdef # Add a NR key
    NEW_RELIC_APP_NAME: communityit-NAME # Change NAME to something that can identify this Discourse instance
    # disable the annoying mini profiler
    DISCOURSE_ENABLE_MINI_PROFILER: false
 
In the same file, find the line
            - git clone https://github.com/discourse/docker_manager.git
 
Add the following two lines right after the line
 
            - git clone https://github.com/vikhyat/discourse-persona.git
            - git clone https://github.com/davidcelis/new_relic-discourse.git
 
=== Edit web.template.yml ===
Open templates/web.template.yml in your favourite text editor and add/edit the following lines. Note that this is not the full file and YML is sensitive to indentation.
 
Find the exec block with the command <pre>echo "done configuring web"</pre>
Before this block, add the following block. Remember to change HOSTNAME to the hostname of the Discourse instance.
 
    - replace:
        filename: "/etc/nginx/conf.d/discourse.conf"
        from: "server {"
        to: |+
          server {
          #Messy hack to force SSL on only the hostname, not IPs so ELB and Icinga work.
          set $use_https NO;
          if ($host ~* 'HOSTNAME') {
              set $use_https A;
          }
          if ($http_x_forwarded_proto != 'https') {
              set $use_https "${use_https}B";
          }
          if ($use_https = AB) {
              rewrite ^ https://$host$request_uri? permanent;
          }
 
After the edit it should look similar to this:
 
    - replace:
        filename: "/etc/nginx/conf.d/discourse.conf"
        from: "server {"
        to: |+
          server {
          #Messy hack to force SSL on only the hostname, not IPs so ELB and Icinga work.
          set $use_https NO;
          if ($host ~* 'discourse.mozilla-community.org') {
              set $use_https A;
          }
          if ($http_x_forwarded_proto != 'https') {
              set $use_https "${use_https}B";
          }
          if ($use_https = AB) {
              rewrite ^ https://$host$request_uri? permanent;
          }
 
 
    - exec:
        cmd: echo "done configuring web"
        hook: web_config
 
<!--= HP Cloud Reference =
== Flavors ==
<pre>
+-----+------------------+-----------+------+-----------+------+-------+-------------+-----------+
| ID  | Name            | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public |
+-----+------------------+-----------+------+-----------+------+-------+-------------+-----------+
| 100 | standard.xsmall  | 1024      | 10  | 10        |      | 1    | 1.0        | N/A      |
| 101 | standard.small  | 2048      | 30  | 10        |      | 2    | 1.0        | N/A      |
| 102 | standard.medium  | 4096      | 30  | 50        |      | 2    | 1.0        | N/A      |
| 103 | standard.large  | 8192      | 30  | 130      |      | 4    | 1.0        | N/A      |
| 104 | standard.xlarge  | 15360    | 30  | 270      |      | 4    | 1.0        | N/A      |
| 105 | standard.2xlarge | 30720    | 30  | 540      |      | 8    | 1.0        | N/A      |
| 106 | standard.3xlarge | 61440    | 30  | 1070      |      | 8    | 1.0        | N/A      |
| 107 | standard.4xlarge | 92160    | 30  | 1620      |      | 12    | 1.0        | N/A      |
| 108 | standard.5xlarge | 122880    | 30  | 2170      |      | 16    | 1.0        | N/A      |
| 203 | highmem.large    | 16384    | 30  | 130      |      | 4    | 1.0        | N/A      |
| 204 | highmem.xlarge  | 30720    | 30  | 270      |      | 4    | 1.0        | N/A      |
| 205 | highmem.2xlarge  | 61440    | 30  | 540      |      | 8    | 1.0        | N/A      |
+-----+------------------+-----------+------+-----------+------+-------+-------------+-----------+
</pre> I'll update this at some point, but HP isn't relevant right now.-->
 
= Request a category =
Please visit [https://bugzilla.mozilla.org/form.reps.it The Community IT Request Form] to request a category creation. You will need a [https://bugzilla.mozilla.org bugzilla] account for this.

Latest revision as of 15:14, 10 January 2017