Commit b20a64b537b4d81d51043fa49f4659e43b6eede8

Authored by Antonio Terceiro
1 parent 04719471
Exists in master and in 90 other branches 3.x, add_sisp_to_chef, add_super_archives_plugin, api_for_colab, automates_core_packing, backup, backup_not_prod, cdtc_configuration, changes_in_buttons_on_content_panel, colab_automated_login, colab_spb_plugin_recipe, colab_widgets_settings, design_validation, dev-lappis, dev_env_minimal, disable_email_dev, docs, 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, performance, prezento, r3, refactor_download_block, refactor_software_communities, refactor_software_for_sisp, register_page, release-process, release-process-v2, remove-unused-images, remove_backup_emails, 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, stable-devel, support_docs, syslog, temp_soft_comm_refactoring, theme_header, theme_javascript_refactory, thread_dropdown, thread_page, update_search_by_categories, update_software_api, update_softwares_boxes

finish colab installation

Pending: nginx for colab
config/roles/integration_server.rb
1 1 name "integration_server"
2 2 description "Application that manages user authentication, visual integration and gamification"
3   -run_list 'recipe[colab]'
  3 +
  4 +# TODO colab and mailman-api should be able to run in separate hosts at some
  5 +# point in the future
  6 +run_list 'recipe[mailman-api]', 'recipe[colab]'
... ...
cookbooks/colab/recipes/default.rb
1   -# TODO colab and mailman-api should be able to run in separate hosts at some
2   -# point in the future
3   -include_recipe 'mailman-api'
4   -
5 1 if node['platform'] == 'centos'
6 2 cookbook_file '/etc/yum.repos.d/colab.repo' do
7 3 owner 'root'
... ... @@ -11,6 +7,29 @@ end
11 7  
12 8 package 'colab'
13 9  
  10 +directory '/etc/colab' do
  11 + owner 'root'
  12 + group 'root'
  13 + mode 0755
  14 +end
  15 +
  16 +execute 'secret-key' do
  17 + f = '/etc/colab/secret.key'
  18 + command "openssl rand -hex 32 -out #{f} && chown root:colab #{f} && chmod 0640 #{f}"
  19 + not_if { File.exists?(f) }
  20 + notifies :create, 'template[/etc/colab/settings.yaml]'
  21 +end
  22 +
  23 +template '/etc/colab/settings.yaml' do
  24 + owner 'root'
  25 + group 'colab'
  26 + mode 0640
  27 +end
  28 +
  29 +execute 'colab-admin migrate'
  30 +execute 'colab-admin collectstatic --noinput'
  31 +
14 32 service 'colab' do
15 33 action :start
  34 + supports :restart => true
16 35 end
... ...
cookbooks/colab/templates/settings.yaml.erb 0 → 100644
... ... @@ -0,0 +1,42 @@
  1 +DATABASES:
  2 + default:
  3 + ENGINE: django.db.backends.postgresql_psycopg2
  4 + NAME: colab
  5 + USER: colab
  6 + HOST: <%= node['peers']['database'] %>
  7 +
  8 +## Set to false in production
  9 +DEBUG: false
  10 +TEMPLATE_DEBUG: false
  11 +
  12 +## System admins
  13 +ADMINS: &admin
  14 +<%- node['config']['admins'].each do |admin| %>
  15 + -
  16 + <%- admin.each do |item| %>
  17 + - <%= item %>
  18 + <%- end %>
  19 +<% end %>
  20 +
  21 +MANAGERS: *admin
  22 +
  23 +COLAB_FROM_ADDRESS: '<%= node['config']['colab_from_address'] %>'
  24 +SERVER_EMAIL: '<%= node['config']['server_email'] %>'
  25 +
  26 +EMAIL_HOST: localhost
  27 +EMAIL_PORT: 25
  28 +EMAIL_SUBJECT_PREFIX: <%= node['config']['email_subject_prefix'] %>
  29 +
  30 +SECRET_KEY: <%= File.read('/etc/colab/secret.key').strip %>
  31 +
  32 +SITE_URL: <%= node['config']['site_url'] %>
  33 +BROWSERID_AUDIENCES:
  34 + - <%= node['config']['site_url'].sub('http:', 'https:') %>
  35 + - <%= node['config']['site_url'].sub('https:', 'http:') %>
  36 +
  37 +ALLOWED_HOSTS:
  38 + - localhost # for tests
  39 + - <%= node['config']['external_hostname'] %>
  40 +
  41 +## Disable indexing
  42 +ROBOTS_NOINDEX: false
... ...
nodes.yaml
... ... @@ -2,6 +2,16 @@ vagrant@integration:
2 2 run_list:
3 3 - role[server]
4 4 - role[integration_server]
  5 + config: &CONFIG
  6 + admins:
  7 + -
  8 + - Paulo Meirelles
  9 + - paulo@softwarelivre.org
  10 + external_hostname: beta.softwarepublico.gov.br
  11 + site_url: https://beta.softwarepublico.gov.br
  12 + colab_from_address: '"Portal do Software Publico" <noreply@beta.softwarepublico.gov.br>'
  13 + server_email: '"Portal do Software Publico" <noreply@beta.softwarepublico.gov.br>'
  14 + email_subject_prefix: '[spb]'
5 15 peers: &PEERS
6 16 integration: 10.10.10.2
7 17 email: 10.10.10.3
... ...
test/colab_test.sh
1 1 . $(dirname $0)/test_helper.sh
2 2  
  3 +test_database_connectivity() {
  4 + assertTrue 'colab database connectivity' 'run_on integration psql -h database -U colab < /dev/null'
  5 +}
  6 +
3 7 test_colab_config_is_in_place() {
4   - assertTrue 'colab settings.yml is in place' 'run_on colab test -f /etc/colab/settings.yml'
  8 + assertTrue 'colab settings.yml is in place' 'run_on integration test -f /etc/colab/settings.yaml'
  9 +}
  10 +
  11 +test_colab_running() {
  12 + assertTrue 'colab service running' 'run_on integration pgrep -fa colab.wsgi'
5 13 }
6 14  
7   -test_colab_installed_and_running() {
8   - assertTrue 'colab service running' 'run_on colab pgrep -fa colab.wsgi'
  15 +test_colab_responds() {
  16 + assertTrue 'colab responds' 'run_on integration curl --fail http://localhost:8001'
9 17 }
10 18  
11 19 . shunit2
... ...