Advertisement
Guest User

Untitled

a guest
Nov 19th, 2017
695
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 5.69 KB | None | 0 0
  1. # this is the all-in-one, standalone Discourse Docker container template
  2. ##
  3. ## After making changes to this file, you MUST rebuild
  4. ## /var/discourse/launcher rebuild app
  5. ##
  6. ## BE *VERY* CAREFUL WHEN EDITING!
  7. ## YAML FILES ARE SUPER SUPER SENSITIVE TO MISTAKES IN WHITESPACE OR ALIGNMENT!
  8. ## visit http://www.yamllint.com/ to validate this file as needed
  9.  
  10. templates:
  11.  - "templates/postgres.template.yml"
  12.   - "templates/redis.template.yml"
  13.   - "templates/web.template.yml"
  14.   - "templates/web.ratelimited.template.yml"
  15. ## Uncomment these two lines if you wish to add Lets Encrypt (https)
  16.   - "templates/web.ssl.template.yml"
  17.   - "templates/web.letsencrypt.ssl.template.yml"
  18.  
  19. ## which TCP/IP ports should this container expose?
  20. ## If you want Discourse to share a port with another webserver like Apache or nginx,
  21. ## see https://meta.discourse.org/t/17247 for details
  22. expose:
  23.  - "80:80"   # http
  24.   - "443:443" # https
  25.  
  26. params:
  27.   db_default_text_search_config: "pg_catalog.english"
  28.  
  29.   ## Set db_shared_buffers to a max of 25% of the total memory.
  30.   ## will be set automatically by bootstrap based on detected RAM, or you can override
  31.   db_shared_buffers: "2048MB"
  32.  
  33.   ## can improve sorting performance, but adds memory usage per-connection
  34.   #db_work_mem: "40MB"
  35.  
  36.   ## Which Git revision should this container use? (default: tests-passed)
  37.   #version: tests-passed
  38.  
  39. env:
  40.   LANG: en_US.UTF-8
  41.   # DISCOURSE_DEFAULT_LOCALE: en
  42.  
  43.   ## How many concurrent web requests are supported? Depends on memory and CPU cores.
  44.   ## will be set automatically by bootstrap based on detected CPUs, or you can override
  45.   UNICORN_WORKERS: 8
  46.  
  47.   ## TODO: The domain name this Discourse instance will respond to
  48.   DISCOURSE_HOSTNAME: domain1.com
  49.  
  50.   ## Uncomment if you want the container to be started with the same
  51.   ## hostname (-h option) as specified above (default "$hostname-$config")
  52.   #DOCKER_USE_HOSTNAME: true
  53.  
  54.   ## TODO: List of comma delimited emails that will be made admin and developer
  55.   ## on initial signup example 'user1@example.com,user2@example.com'
  56.   DISCOURSE_DEVELOPER_EMAILS: 'mail...'
  57.  
  58.   ## TODO: The SMTP mail server used to validate new accounts and send notifications
  59.   DISCOURSE_SMTP_ADDRESS: smtp..
  60.   DISCOURSE_SMTP_PORT: 587
  61.   DISCOURSE_SMTP_USER_NAME: mail..
  62.   DISCOURSE_SMTP_PASSWORD: "password..."
  63.   #DISCOURSE_SMTP_ENABLE_START_TLS: true    
  64.    #DISCOURSE_SMTP_ENABLE_START_TLS: true           # (optional, default true)
  65.  
  66.   ## If you added the Lets Encrypt template, uncomment below to get a free SSL certificate
  67.   LETSENCRYPT_ACCOUNT_EMAIL: mail..
  68.  
  69.   ## The CDN address for this Discourse instance (configured to pull)
  70.   ## see https://meta.discourse.org/t/14857 for details
  71.   #DISCOURSE_CDN_URL: //discourse-cdn.example.com
  72.  
  73. ## The Docker container is stateless; all data is stored in /shared
  74. volumes:
  75.   - volume:
  76.       host: /var/discourse/shared/standalone
  77.       guest: /shared
  78.   - volume:
  79.       host: /var/discourse/shared/standalone/log/var-log
  80.       guest: /var/log
  81.  
  82. ## Plugins go here
  83. ## see https://meta.discourse.org/t/19157 for details
  84. hooks:
  85.   after_postgres:
  86.      - exec: sudo -u postgres createdb b_discourse || exit 0
  87.      - exec:
  88.           stdin: |
  89.            grant all privileges on database b_discourse to discourse;
  90.           cmd: sudo -u postgres psql b_discourse
  91.           raise_on_fail: false
  92.  
  93.      - exec: /bin/bash -c 'sudo -u postgres psql b_discourse <<< "alter schema public owner to discourse;"'
  94.      - exec: /bin/bash -c 'sudo -u postgres psql b_discourse <<< "create extension if not exists hstore;"'
  95.      - exec: /bin/bash -c 'sudo -u postgres psql b_discourse <<< "create extension if not exists pg_trgm;"'
  96.  
  97.   after_code:
  98.     - exec:
  99.         cd: $home/plugins
  100.         cmd:
  101.          - mkdir -p plugins
  102.           - git clone https://github.com/discourse/docker_manager.git
  103.   before_bundle_exec:
  104.     - file:
  105.         path: $home/config/multisite.yml
  106.         contents: |
  107.          secondsite:
  108.            adapter: postgresql
  109.            database: b_discourse
  110.            pool: 25
  111.            timeout: 5000
  112.            db_id: 2
  113.            host_names:
  114.             - domain2.com
  115. after_bundle_exec:
  116.     - exec: cd /var/www/discourse && sudo -E -u discourse bundle exec rake multisite:migrate
  117. after_ssl:
  118.     - replace:
  119.         filename: "/etc/runit/1.d/letsencrypt"
  120.         from: /-k 4096 -w \/var\/www\/discourse\/public/
  121.         to: |
  122.           -d www.domain1.com -d doman1.com -d www.domain2.com -d domain2.com -k 4096 -w /var/www/discourse/public
  123.  
  124.     - replace:
  125.         filename: "/etc/runit/1.d/letsencrypt"
  126.         from: /-k 4096 --force -w \/var\/www\/discourse\/public/
  127.         to: |
  128.          -d www.domain1.com -d doman1.com -d www.domain2.com -d domain2.com -k 4096 --force -w /var/www/discourse/public
  129.  
  130.     - replace:
  131.         filename: "/etc/nginx/conf.d/discourse.conf"
  132.         from: /return 301 https.+/
  133.         to: |
  134.          return 301 https://$host$request_uri;
  135.  
  136.     - replace:
  137.         filename: "/etc/nginx/conf.d/discourse.conf"
  138.         from: /gzip on;[^\}]+\}/m
  139.         to: |
  140.          gzip on;
  141.           add_header Strict-Transport-Security 'max-age=31536000'; # remember the certificate for a year and automatically connect to HTTPS for th$
  142. ## Any custom commands to run after building
  143. run:
  144.   - exec: echo "Beginning of custom commands"
  145. ## If you want to set the 'From' email address for your first registration, uncomment and change:
  146. ## After getting the first signup email, re-comment the line. It only needs to run once.
  147. #- exec: rails r "SiteSetting.notification_email='info@unconfigured.discourse.org'"
  148.   - exec: echo "End of custom commands"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement