Commit ac9e413a080b36761b7fd8de5b67dddc6cfd1256

Authored by Sergio Oliveira
Committed by Rodrigo Siqueira de Melo
1 parent 1e4072e3
Exists in master and in 79 other branches add_sisp_to_chef, add_super_archives_plugin, api_for_colab, automates_core_packing, backup_not_prod, changes_in_buttons_on_content_panel, colab_automated_login, colab_spb_plugin_recipe, colab_widgets_settings, design_validation, dev_env_minimal, disable_email_dev, fix_breadcrumbs_position, fix_categories_software_link, fix_edit_institution, fix_edit_software_with_another_license, fix_get_license_info, fix_gitlab_assets_permission, fix_list_style_inside_article, fix_list_style_on_folder_elements, fix_members_pagination, fix_merge_request_url, fix_models_translations, fix_no_license, fix_software_api, fix_software_block_migration, fix_software_communities_translations, fix_software_communities_unit_test, fix_style_create_institution_admin_panel, fix_superarchives_imports, fix_sym_links_noosfero, focus_search_field_theme, gov-user-refactoring, gov-user-refactoring-rails4, header_fix, institution_modal_on_rating, kalibro-conf-refactoring, kalibro-processor-package, lxc_settings, margin_fix, mezuro_cookbook, prezento, refactor_download_block, refactor_software_communities, refactor_software_for_sisp, register_page, release-process, release-process-v2, remove-unused-images, remove_broken_theme, remove_secondary_email_from_user, remove_sisp_buttons, removing_super_archives_email, review_message, scope2method, signals_user_noosfero, sisp_catalog_header, sisp_colab_config, sisp_dev, sisp_dev_master, sisp_simple_version, software_as_organization, software_catalog_style_fix, software_communities_html_refactor, software_infos_api, spb_minimal_env, spb_to_rails4, spec_refactor, stable-4.1, stable-4.2, stable-4.x, temp_soft_comm_refactoring, theme_header, theme_javascript_refactory, thread_dropdown, thread_page, update_search_by_categories, update_software_api, update_softwares_boxes

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 94 useradd --system --gid colab --home-dir /usr/lib/colab --no-create-home colab
95 95 fi
96 96  
97   -if [ ! -f /etc/colab/settings.yaml ]; then
  97 +if [ ! -f /etc/colab/settings.py ]; then
98 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 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 190 fi
146 191  
147 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 194 # only applies if there is a local PostgreSQL server
164 195 if [ -x /usr/bin/postgres ]; then
165 196  
... ...