Commit aee8cd59871bc972e7a1ffb14379987b0dbfe075

Authored by Sergio Oliveira
1 parent 67f18a4c
Exists in colab-master

Updated colab settings

Signed-off-by: Sergio Oliveira <sergio@tracy.com.br>
Showing 1 changed file with 91 additions and 60 deletions   Show diff stats
colab/colab.spec
... ... @@ -95,72 +95,103 @@ if ! id colab; then
95 95 useradd --system --gid colab --home-dir /usr/lib/colab --no-create-home colab
96 96 fi
97 97  
98   -if [ ! -f /etc/colab/settings.yaml ]; then
  98 +if [ ! -f /etc/colab/settings.py ]; then
99 99 SECRET_KEY=$(openssl rand -hex 32)
100   - cat > /etc/colab/settings.yaml <<EOF
101   -## Set to false in production
102   -DEBUG: true
103   -TEMPLATE_DEBUG: true
104   -
105   -## System admins
106   -ADMINS: &admin
107   - -
108   - - John Foo
109   - - john@example.com
110   - -
111   - - Mary Bar
112   - - mary@example.com
113   -
114   -MANAGERS: *admin
115   -
116   -COLAB_FROM_ADDRESS: '"Colab" <noreply@example.com>'
117   -SERVER_EMAIL: '"Colab" <noreply@example.com>'
118   -
119   -EMAIL_HOST: localhost
120   -EMAIL_PORT: 25
121   -EMAIL_SUBJECT_PREFIX: '[colab]'
122   -
123   -SECRET_KEY: '$SECRET_KEY'
124   -
125   -SITE_URL: 'http://localhost:8001/'
126   -BROWSERID_AUDIENCES:
127   - - http://localhost:8001
128   -# - http://example.com
129   -# - https://example.org
130   -# - http://example.net
131   -
132   -ALLOWED_HOSTS:
133   - - localhost
134   -# - example.com
135   -# - example.org
136   -# - example.net
137   -
138   -## Disable indexing
139   -ROBOTS_NOINDEX: false
140   -
141   -## Disable browser id authentication
142   -# BROWSERID_ENABLED: true
  100 + cat > /etc/colab/settings.py <<EOF
  101 +
  102 +# Set to false in production
  103 +DEBUG = True
  104 +TEMPLATE_DEBUG = True
  105 +
  106 +# System admins
  107 +ADMINS = [['John Foo', 'john@example.com'], ['Mary Bar', 'mary@example.com']]
  108 +
  109 +MANAGERS = ADMINS
  110 +
  111 +COLAB_FROM_ADDRESS = '"Colab" <noreply@example.com>'
  112 +SERVER_EMAIL = '"Colab" <noreply@example.com>'
  113 +
  114 +EMAIL_HOST = 'localhost'
  115 +EMAIL_PORT = 25
  116 +EMAIL_SUBJECT_PREFIX = '[colab]'
  117 +
  118 +SECRET_KEY = '$(openssl rand -hex 32)'
  119 +
  120 +ALLOWED_HOSTS = [
  121 + 'localhost',
  122 +# 'example.com',
  123 +# 'example.org',
  124 +# 'example.net',
  125 +]
  126 +
  127 +# Database settings
  128 +#
  129 +# When DEBUG is True colab will create the DB on
  130 +# the repository root. In case of production settings
  131 +# (DEBUG False) the DB settings must be set.
  132 +#
  133 +# DATABASES = {
  134 +# 'default': {
  135 +# 'ENGINE': 'django.db.backends.sqlite3',
  136 +# 'NAME': '/path/to/colab.sqlite3',
  137 +# }
  138 +# }
  139 +
  140 +# Disable indexing
  141 +ROBOTS_NOINDEX = False
  142 +
  143 +LOGGING = {
  144 + 'version': 1,
  145 + 'disable_existing_loggers': True,
  146 +
  147 + 'formatters': {
  148 + 'colab': '[colab] (%(name)s) %(levelname)s: %(message)s',
  149 + 'verbose': '%(asctime)s (%(name)s) %(levelname)s: %(message)s',
  150 + },
  151 +
  152 + 'handlers': {
  153 + 'null': {
  154 + 'level': 'DEBUG',
  155 + 'class': 'logging.NullHandler',
  156 + },
  157 + 'syslog': {
  158 + 'level': 'WARNING',
  159 + 'class': 'logging.handlers.SysLogHandler',
  160 + 'formatter': 'colab',
  161 + 'address': '/dev/log',
  162 + },
  163 + 'file': {
  164 + 'level': 'DEBUG',
  165 + 'class': 'logging.handlers.TimedRotatingFileHandler',
  166 + 'filename': '/var/log/colab/colab.log',
  167 + 'interval': 24, # 24 hours
  168 + 'backupCount': 7, # keep last 7 backups
  169 + 'encoding': 'UTF-8',
  170 + 'formatter': 'verbose',
  171 + },
  172 + },
  173 +
  174 + 'loggers': {
  175 + 'django': {
  176 + 'handlers': ['file', 'syslog'],
  177 + 'propagate': False,
  178 + },
  179 + 'revproxy': {
  180 + 'handlers': ['file', 'syslog'],
  181 + 'propagate': False,
  182 + 'level': 'ERROR',
  183 + },
  184 + },
  185 +}
  186 +
143 187 EOF
144   - chown root:colab /etc/colab/settings.yaml
145   - chmod 0640 /etc/colab/settings.yaml
  188 +
  189 + chown root:colab /etc/colab/settings.py
  190 + chmod 0640 /etc/colab/settings.py
146 191 fi
147 192  
148 193 mkdir -p /etc/colab/settings.d
149 194  
150   -if [ ! -f /etc/colab/settings.d/00-database.yaml ]; then
151   - cat > /etc/colab/settings.d/00-database.yaml <<EOF
152   -DATABASES:
153   - default:
154   - ENGINE: django.db.backends.postgresql_psycopg2
155   - NAME: colab
156   - USER: colab
157   - HOST: localhost
158   - PORT: 5432
159   -EOF
160   - chown root:colab /etc/colab/settings.d/00-database.yaml
161   - chmod 0640 /etc/colab/settings.d/00-database.yaml
162   -fi
163   -
164 195 # only applies if there is a local PostgreSQL server
165 196 if [ -x /usr/bin/postgres ]; then
166 197  
... ...