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