Commit 703af73d7a6e6b0c467033ce2fa13c25f4734c1e

Authored by Alexandre Barbosa
Committed by Sergio Oliveira
1 parent 76e57b77

Convert existents Colab yaml files to py

- database config file
- logging config file
- sentry config file
- remove settings.yaml

Signed-off-by: Alexandre Barbosa <alexandreab@live.com>
Signed-off-by: Paulo Tada <paulohtfs@gmail.com>
cookbooks/colab/templates/00-database.py.erb 0 → 100644
... ... @@ -0,0 +1,8 @@
  1 +DATABASES = {
  2 + 'default': {
  3 + 'ENGINE': 'django.db.backends.postgresql_psycopg2',
  4 + 'HOST': "<%= node['peers']['database'] %>",
  5 + 'NAME': 'colab',
  6 + 'USER': 'colab'
  7 + }
  8 +}
... ...
cookbooks/colab/templates/00-database.yaml.erb
... ... @@ -1,6 +0,0 @@
1   -DATABASES:
2   - default:
3   - ENGINE: django.db.backends.postgresql_psycopg2
4   - NAME: colab
5   - USER: colab
6   - HOST: <%= node['peers']['database'] %>
cookbooks/colab/templates/02-logging.py.erb 0 → 100644
... ... @@ -0,0 +1,26 @@
  1 +LOGGING = {
  2 + 'loggers': {
  3 + 'revproxy': {
  4 + 'handlers': ['file'],
  5 + 'level': 'ERROR'},
  6 + 'django': {
  7 + 'handlers': ['file'],
  8 + 'level': 'DEBUG'},
  9 + },
  10 + 'version': 1, 'formatters': {
  11 + 'verbose': {
  12 + 'format': '%(asctime)s (%(name)s) %(levelname)s: %(message)s'
  13 + }
  14 + },
  15 + 'disable_existing_loggers': True, 'handlers': {
  16 + 'file': {
  17 + 'level': 'DEBUG',
  18 + 'interval': 24,
  19 + 'backupCount': 7,
  20 + 'encoding': 'UTF-8',
  21 + 'formatter': 'verbose',
  22 + 'class': 'logging.handlers.TimedRotatingFileHandler',
  23 + 'filename': '/var/log/colab/colab.log'
  24 + }
  25 + }
  26 +}
... ...
cookbooks/colab/templates/02-logging.yaml.erb
... ... @@ -1,39 +0,0 @@
1   -LOGGING:
2   - version: 1
3   - disable_existing_loggers: True
4   -
5   - formatters:
6   - verbose:
7   - format: '%(asctime)s (%(name)s) %(levelname)s: %(message)s'
8   -
9   - simple:
10   - format: '[colab-spb] (%(name)s) %(levelname)s: %(message)s'
11   -
12   - handlers:
13   - syslog:
14   - level: WARNING
15   - class: logging.handlers.SysLogHandler
16   - formatter: simple
17   - address: /dev/log
18   -
19   - file:
20   - level: DEBUG
21   - class: logging.handlers.TimedRotatingFileHandler
22   - filename: /var/log/colab/colab.log
23   - interval: 24 # 24 hours
24   - backupCount: 7 # keep last 7 backups
25   - encoding: UTF-8
26   - formatter: verbose
27   -
28   - loggers:
29   - django:
30   - handlers:
31   - - file
32   - - syslog
33   - level: DEBUG
34   -
35   - revproxy:
36   - handlers:
37   - - file
38   - - syslog
39   - level: ERROR
cookbooks/colab/templates/03-sentry.py.erb 0 → 100644
... ... @@ -0,0 +1 @@
  1 +RAVEN_DSN = "<%= node['config']['raven_dsn'] %>"
... ...
cookbooks/colab/templates/03-sentry.yaml.erb
... ... @@ -1,2 +0,0 @@
1   -
2   -RAVEN_DSN: <%= node['config']['raven_dsn'] %>
cookbooks/colab/templates/settings.yaml.erb
... ... @@ -1,47 +0,0 @@
1   -
2   -## Set to false in production
3   -DEBUG: false
4   -TEMPLATE_DEBUG: false
5   -
6   -## System admins
7   -ADMINS: &admin
8   -<%- node['config']['admins'].each do |admin| %>
9   - -
10   - <%- admin.each do |item| %>
11   - - <%= item %>
12   - <%- end %>
13   -<% end %>
14   -
15   -MANAGERS: *admin
16   -
17   -# general Django settings
18   -DEFAULT_FROM_EMAIL: '<%= node['config']['colab_from_address'] %>'
19   -
20   -# colab-specific
21   -COLAB_FROM_ADDRESS: '<%= node['config']['colab_from_address'] %>'
22   -SERVER_EMAIL: '<%= node['config']['server_email'] %>'
23   -
24   -EMAIL_HOST: localhost
25   -EMAIL_PORT: 25
26   -EMAIL_SUBJECT_PREFIX: <%= node['config']['email_subject_prefix'] %>
27   -
28   -SECRET_KEY: <%= File.read('/etc/colab/secret.key').strip %>
29   -
30   -SITE_URL: <%= node['config']['site_url'] %>
31   -BROWSERID_AUDIENCES:
32   - - <%= node['config']['site_url'].sub('http:', 'https:') %>
33   - - <%= node['config']['site_url'].sub('https:', 'http:') %>
34   -
35   -ALLOWED_HOSTS:
36   - - <%= node['config']['external_hostname'] %>
37   -
38   -## Disable indexing
39   -ROBOTS_NOINDEX: false
40   -
41   -## Disable planet
42   -FEEDZILLA_ENABLED: false
43   -
44   -## Set URL of Colab home
45   -COLAB_HOME_URL: '/social'
46   -
47   -GOOGLE_ANALYTICS_TRACKING_ID: '<%= node['config']['google_analytics_id'] %>'