Commit 67f3a5d6a787b101f0c0f2a1c4c6247fc8515e1b

Authored by Sergio Oliveira
1 parent 40d68fe6
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

Redefined colab settings order

Signed-off-by: Sergio Oliveira <sergio@tracy.com.br>
cookbooks/colab/recipes/default.rb
... ... @@ -38,7 +38,7 @@ execute &#39;secret-key&#39; do
38 38 f = '/etc/colab/secret.key'
39 39 command "openssl rand -hex 32 -out #{f} && chown root:colab #{f} && chmod 0640 #{f}"
40 40 not_if { File.exists?(f) }
41   - notifies :create, 'template[/etc/colab/settings.d/04-custom_settings.py]'
  41 + notifies :create, 'template[/etc/colab/settings.d/00-custom_settings.py]'
42 42 end
43 43  
44 44 template '/etc/sysconfig/colab' do
... ... @@ -48,14 +48,14 @@ template &#39;/etc/sysconfig/colab&#39; do
48 48 notifies :restart, 'service[colab]'
49 49 end
50 50  
51   -template '/etc/colab/settings.d/00-database.py' do
  51 +template '/etc/colab/settings.d/00-custom_settings.py' do
52 52 owner 'root'
53 53 group 'colab'
54 54 mode 0640
55 55 notifies :restart, 'service[colab]'
56 56 end
57 57  
58   -template '/etc/colab/settings.d/04-custom_settings.py' do
  58 +template '/etc/colab/settings.d/01-database.py' do
59 59 owner 'root'
60 60 group 'colab'
61 61 mode 0640
... ... @@ -104,13 +104,13 @@ template &#39;/etc/colab/settings.d/03-sentry.py&#39; do
104 104 mode 0640
105 105 end
106 106  
107   -template '/etc/colab/settings.d/memcached.py' do
  107 +template '/etc/colab/settings.d/04-memcached.py' do
108 108 owner 'root'
109 109 group 'colab'
110 110 mode 0640
111 111 end
112 112  
113   -template '/etc/colab/settings.d/redis.py' do
  113 +template '/etc/colab/settings.d/05-redis.py' do
114 114 owner 'root'
115 115 group 'colab'
116 116 mode 0640
... ...
cookbooks/colab/templates/00-custom_settings.py.erb 0 → 100644
... ... @@ -0,0 +1,37 @@
  1 +## Set to false in production
  2 +DEBUG = False
  3 +TEMPLATE_DEBUG = False
  4 +
  5 +## System admins
  6 +ADMINS = [
  7 +<%- node['config']['admins'].each do |admin| %>
  8 + ("<%= admin[0] %>", "<%= admin[1] %>"),
  9 +<% end %>
  10 +]
  11 +
  12 +MANAGERS = ADMINS
  13 +
  14 +# general Django settings
  15 +DEFAULT_FROM_EMAIL = '<%= node['config']['colab_from_address'] %>'
  16 +
  17 +# colab-specific
  18 +COLAB_FROM_ADDRESS = '<%= node['config']['colab_from_address'] %>'
  19 +SERVER_EMAIL = '<%= node['config']['server_email'] %>'
  20 +
  21 +EMAIL_HOST = "localhost"
  22 +EMAIL_PORT = 25
  23 +EMAIL_SUBJECT_PREFIX = "<%= node['config']['email_subject_prefix'] %>"
  24 +
  25 +SECRET_KEY = "<%= File.read('/etc/colab/secret.key').strip %>"
  26 +
  27 +SITE_URL = "<%= node['config']['site_url'] %>"
  28 +
  29 +ALLOWED_HOSTS = ["<%= node['config']['external_hostname'] %>"]
  30 +
  31 +## Disable indexing
  32 +ROBOTS_NOINDEX = False
  33 +
  34 +## Set URL of Colab home
  35 +COLAB_HOME_URL = '/social'
  36 +
  37 +GOOGLE_ANALYTICS_TRACKING_ID = "<%= node['config']['google_analytics_id'] %>"
... ...
cookbooks/colab/templates/00-database.py.erb
... ... @@ -1,8 +0,0 @@
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/01-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/04-custom_settings.py.erb
... ... @@ -1,37 +0,0 @@
1   -## Set to false in production
2   -DEBUG = False
3   -TEMPLATE_DEBUG = False
4   -
5   -## System admins
6   -ADMINS = [
7   -<%- node['config']['admins'].each do |admin| %>
8   - ("<%= admin[0] %>", "<%= admin[1] %>"),
9   -<% end %>
10   -]
11   -
12   -MANAGERS = ADMINS
13   -
14   -# general Django settings
15   -DEFAULT_FROM_EMAIL = '<%= node['config']['colab_from_address'] %>'
16   -
17   -# colab-specific
18   -COLAB_FROM_ADDRESS = '<%= node['config']['colab_from_address'] %>'
19   -SERVER_EMAIL = '<%= node['config']['server_email'] %>'
20   -
21   -EMAIL_HOST = "localhost"
22   -EMAIL_PORT = 25
23   -EMAIL_SUBJECT_PREFIX = "<%= node['config']['email_subject_prefix'] %>"
24   -
25   -SECRET_KEY = "<%= File.read('/etc/colab/secret.key').strip %>"
26   -
27   -SITE_URL = "<%= node['config']['site_url'] %>"
28   -
29   -ALLOWED_HOSTS = ["<%= node['config']['external_hostname'] %>"]
30   -
31   -## Disable indexing
32   -ROBOTS_NOINDEX = False
33   -
34   -## Set URL of Colab home
35   -COLAB_HOME_URL = '/social'
36   -
37   -GOOGLE_ANALYTICS_TRACKING_ID = "<%= node['config']['google_analytics_id'] %>"
cookbooks/colab/templates/04-memcached.py.erb 0 → 100644
... ... @@ -0,0 +1,6 @@
  1 +CACHES = {
  2 + 'default': {
  3 + 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
  4 + 'LOCATION': '127.0.0.1:11211',
  5 + }
  6 +}
... ...
cookbooks/colab/templates/05-redis.py.erb 0 → 100644
... ... @@ -0,0 +1,2 @@
  1 +BROKER_URL = 'redis://<%= node['peers']['database'] %>:6379/0'
  2 +CELERY_RESULT_BACKEND = 'redis://<%= node['peers']['database'] %>:6379/0'
... ...
cookbooks/colab/templates/memcached.py.erb
... ... @@ -1,6 +0,0 @@
1   -CACHES = {
2   - 'default': {
3   - 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
4   - 'LOCATION': '127.0.0.1:11211',
5   - }
6   -}
cookbooks/colab/templates/redis.py.erb
... ... @@ -1,2 +0,0 @@
1   -BROKER_URL = 'redis://<%= node['peers']['database'] %>:6379/0'
2   -CELERY_RESULT_BACKEND = 'redis://<%= node['peers']['database'] %>:6379/0'