Commit 5755b94709905fe79beea6e52aeb5661319e3dd7
Exists in
master
and in
79 other branches
Merge branch 'colab_config'
This merge makes the necessary changes for updated colab packages for SPB release 4
Showing
17 changed files
with
228 additions
and
106 deletions
Show diff stats
.gitignore
cookbooks/colab/recipes/default.rb
@@ -11,13 +11,12 @@ if node['platform'] == 'centos' | @@ -11,13 +11,12 @@ if node['platform'] == 'centos' | ||
11 | end | 11 | end |
12 | end | 12 | end |
13 | 13 | ||
14 | -# FIXME should not be needed; colab should depend on the right version of | ||
15 | -# colab-deps | ||
16 | -package 'colab-deps' do | 14 | +package 'colab' do |
17 | action :upgrade | 15 | action :upgrade |
16 | + notifies :restart, 'service[colab]' | ||
18 | end | 17 | end |
19 | 18 | ||
20 | -package 'colab' do | 19 | +package 'colab-spb-theme' do |
21 | action :upgrade | 20 | action :upgrade |
22 | notifies :restart, 'service[colab]' | 21 | notifies :restart, 'service[colab]' |
23 | end | 22 | end |
@@ -44,7 +43,7 @@ execute 'secret-key' do | @@ -44,7 +43,7 @@ execute 'secret-key' do | ||
44 | f = '/etc/colab/secret.key' | 43 | f = '/etc/colab/secret.key' |
45 | command "openssl rand -hex 32 -out #{f} && chown root:colab #{f} && chmod 0640 #{f}" | 44 | command "openssl rand -hex 32 -out #{f} && chown root:colab #{f} && chmod 0640 #{f}" |
46 | not_if { File.exists?(f) } | 45 | not_if { File.exists?(f) } |
47 | - notifies :create, 'template[/etc/colab/settings.yaml]' | 46 | + notifies :create, 'template[/etc/colab/settings.d/00-custom_settings.py]' |
48 | end | 47 | end |
49 | 48 | ||
50 | template '/etc/sysconfig/colab' do | 49 | template '/etc/sysconfig/colab' do |
@@ -54,20 +53,21 @@ template '/etc/sysconfig/colab' do | @@ -54,20 +53,21 @@ template '/etc/sysconfig/colab' do | ||
54 | notifies :restart, 'service[colab]' | 53 | notifies :restart, 'service[colab]' |
55 | end | 54 | end |
56 | 55 | ||
57 | -template '/etc/colab/settings.yaml' do | 56 | +template '/etc/colab/settings.d/00-custom_settings.py' do |
58 | owner 'root' | 57 | owner 'root' |
59 | group 'colab' | 58 | group 'colab' |
60 | mode 0640 | 59 | mode 0640 |
61 | notifies :restart, 'service[colab]' | 60 | notifies :restart, 'service[colab]' |
62 | end | 61 | end |
63 | 62 | ||
64 | -template '/etc/colab/settings.d/00-database.yaml' do | 63 | +template '/etc/colab/settings.d/01-database.py' do |
65 | owner 'root' | 64 | owner 'root' |
66 | group 'colab' | 65 | group 'colab' |
67 | mode 0640 | 66 | mode 0640 |
68 | notifies :restart, 'service[colab]' | 67 | notifies :restart, 'service[colab]' |
69 | end | 68 | end |
70 | 69 | ||
70 | +# Creating a gitlab admin user | ||
71 | template '/tmp/admin-gitlab.json' do | 71 | template '/tmp/admin-gitlab.json' do |
72 | 72 | ||
73 | password = SecureRandom.random_number.to_s | 73 | password = SecureRandom.random_number.to_s |
@@ -96,12 +96,40 @@ execute 'create-admin-token-gitlab' do | @@ -96,12 +96,40 @@ execute 'create-admin-token-gitlab' do | ||
96 | user 'git' | 96 | user 'git' |
97 | end | 97 | end |
98 | 98 | ||
99 | -template '/etc/colab/settings.d/01-apps.yaml' do | 99 | +# Adding settings.d files |
100 | +template '/etc/colab/settings.d/02-logging.py' do | ||
100 | owner 'root' | 101 | owner 'root' |
101 | group 'colab' | 102 | group 'colab' |
102 | mode 0640 | 103 | mode 0640 |
103 | notifies :restart, 'service[colab]' | 104 | notifies :restart, 'service[colab]' |
105 | +end | ||
104 | 106 | ||
107 | +template '/etc/colab/settings.d/03-sentry.py' do | ||
108 | + owner 'root' | ||
109 | + group 'colab' | ||
110 | + mode 0640 | ||
111 | + notifies :restart, 'service[colab]' | ||
112 | +end | ||
113 | + | ||
114 | +template '/etc/colab/settings.d/04-memcached.py' do | ||
115 | + owner 'root' | ||
116 | + group 'colab' | ||
117 | + mode 0640 | ||
118 | + notifies :restart, 'service[colab]' | ||
119 | +end | ||
120 | + | ||
121 | +template '/etc/colab/settings.d/05-celery.py' do | ||
122 | + owner 'root' | ||
123 | + group 'colab' | ||
124 | + mode 0640 | ||
125 | + notifies :restart, 'service[colab]' | ||
126 | +end | ||
127 | + | ||
128 | +# Adding plugins for colab | ||
129 | +template '/etc/colab/plugins.d/gitlab.py' do | ||
130 | + owner 'root' | ||
131 | + group 'colab' | ||
132 | + mode 0640 | ||
105 | get_private_token = lambda do | 133 | get_private_token = lambda do |
106 | Dir.chdir '/usr/lib/gitlab' do | 134 | Dir.chdir '/usr/lib/gitlab' do |
107 | `sudo -u git RAILS_ENV=production bundle exec rails runner \"puts User.find_by_name(\'admin-gitlab\').private_token\"`.strip | 135 | `sudo -u git RAILS_ENV=production bundle exec rails runner \"puts User.find_by_name(\'admin-gitlab\').private_token\"`.strip |
@@ -111,22 +139,34 @@ template '/etc/colab/settings.d/01-apps.yaml' do | @@ -111,22 +139,34 @@ template '/etc/colab/settings.d/01-apps.yaml' do | ||
111 | variables( | 139 | variables( |
112 | :get_private_token => get_private_token | 140 | :get_private_token => get_private_token |
113 | ) | 141 | ) |
142 | + | ||
143 | + notifies :restart, 'service[colab]' | ||
114 | end | 144 | end |
115 | 145 | ||
116 | -template '/etc/colab/settings.d/02-logging.yaml' do | ||
117 | - owner 'root' | ||
118 | - group 'colab' | ||
119 | - mode 0640 | 146 | +template '/etc/colab/plugins.d/noosfero.py' do |
147 | + owner 'root' | ||
148 | + group 'colab' | ||
149 | + mode 0640 | ||
120 | notifies :restart, 'service[colab]' | 150 | notifies :restart, 'service[colab]' |
121 | end | 151 | end |
122 | 152 | ||
123 | -template '/etc/colab/settings.d/03-sentry.yaml' do | ||
124 | - owner 'root' | ||
125 | - group 'colab' | ||
126 | - mode 0640 | 153 | +template '/etc/colab/plugins.d/spb.py' do |
154 | + owner 'root' | ||
155 | + group 'colab' | ||
156 | + mode 0640 | ||
157 | + notifies :restart, 'service[colab]' | ||
158 | +end | ||
159 | + | ||
160 | +template '/etc/colab/plugins.d/raven.py' do | ||
161 | + owner 'root' | ||
162 | + group 'colab' | ||
163 | + mode 0640 | ||
127 | notifies :restart, 'service[colab]' | 164 | notifies :restart, 'service[colab]' |
128 | end | 165 | end |
129 | 166 | ||
167 | +execute 'colab-admin migrate' | ||
168 | + | ||
169 | +# Static files | ||
130 | directory '/var/lib/colab-assets/spb/' do | 170 | directory '/var/lib/colab-assets/spb/' do |
131 | owner 'root' | 171 | owner 'root' |
132 | group 'root' | 172 | group 'root' |
@@ -0,0 +1,37 @@ | @@ -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.yaml.erb
cookbooks/colab/templates/01-apps.yaml.erb
@@ -0,0 +1,26 @@ | @@ -0,0 +1,26 @@ | ||
1 | +LOGGING = { | ||
2 | + 'loggers': { | ||
3 | + 'revproxy': { | ||
4 | + 'handlers': ['file'], | ||
5 | + 'level': 'ERROR'}, | ||
6 | + 'django': { | ||
7 | + 'handlers': ['file'], | ||
8 | + 'level': 'DEBUG'}, | ||
9 | + }, | ||
10 | + 'version': 1, 'formatters': { | ||
11 | + 'verbose': { | ||
12 | + 'format': '%(asctime)s (%(name)s) %(levelname)s: %(message)s' | ||
13 | + } | ||
14 | + }, | ||
15 | + 'disable_existing_loggers': True, 'handlers': { | ||
16 | + 'file': { | ||
17 | + 'level': 'DEBUG', | ||
18 | + 'interval': 24, | ||
19 | + 'backupCount': 7, | ||
20 | + 'encoding': 'UTF-8', | ||
21 | + 'formatter': 'verbose', | ||
22 | + 'class': 'logging.handlers.TimedRotatingFileHandler', | ||
23 | + 'filename': '/var/log/colab/colab.log' | ||
24 | + } | ||
25 | + } | ||
26 | +} |
cookbooks/colab/templates/02-logging.yaml.erb
@@ -1,28 +0,0 @@ | @@ -1,28 +0,0 @@ | ||
1 | -LOGGING: | ||
2 | - version: 1 | ||
3 | - disable_existing_loggers: True | ||
4 | - | ||
5 | - formatters: | ||
6 | - verbose: | ||
7 | - format: '%(asctime)s (%(name)s) %(levelname)s: %(message)s' | ||
8 | - | ||
9 | - handlers: | ||
10 | - file: | ||
11 | - level: DEBUG | ||
12 | - class: logging.handlers.TimedRotatingFileHandler | ||
13 | - filename: /var/log/colab/colab.log | ||
14 | - interval: 24 # 24 hours | ||
15 | - backupCount: 7 # keep last 7 backups | ||
16 | - encoding: UTF-8 | ||
17 | - formatter: verbose | ||
18 | - | ||
19 | - loggers: | ||
20 | - django: | ||
21 | - handlers: | ||
22 | - - file | ||
23 | - level: DEBUG | ||
24 | - | ||
25 | - revproxy: | ||
26 | - handlers: | ||
27 | - - file | ||
28 | - level: ERROR |
@@ -0,0 +1 @@ | @@ -0,0 +1 @@ | ||
1 | +RAVEN_DSN = "<%= node['config']['raven_dsn'] %>" |
cookbooks/colab/templates/03-sentry.yaml.erb
@@ -0,0 +1,39 @@ | @@ -0,0 +1,39 @@ | ||
1 | +from django.utils.translation import ugettext_lazy as _ | ||
2 | +from colab.plugins.utils.menu import colab_url_factory | ||
3 | + | ||
4 | +# Gitlab plugin - Put this in plugins.d/gitlab.py to actiate ## | ||
5 | + | ||
6 | +name = 'colab_gitlab' | ||
7 | +verbose_name = 'Gitlab Plugin' | ||
8 | + | ||
9 | +upstream = 'http://<%= node['peers']['integration'] %>:81/gitlab/' | ||
10 | + | ||
11 | +private_token = '<%= @get_private_token.call %>' | ||
12 | + | ||
13 | +urls = { | ||
14 | + 'include': 'colab_gitlab.urls', | ||
15 | + 'namespace': 'gitlab', # TODO: do not allow to change namespace | ||
16 | + 'prefix': '^gitlab/', | ||
17 | +} | ||
18 | + | ||
19 | +menu_title = _('Development') | ||
20 | + | ||
21 | +url = colab_url_factory('gitlab') | ||
22 | + | ||
23 | +menu_urls = ( | ||
24 | + url(display=_('Public Projects'), viewname='gitlab', | ||
25 | + kwargs={'path': 'public/projects'}, auth=False), | ||
26 | + url(display=_('Profile'), viewname='gitlab', | ||
27 | + kwargs={'path': 'profile'}, auth=True), | ||
28 | + url(display=_('New Project'), viewname='gitlab', | ||
29 | + kwargs={'path': 'projects/new'}, auth=True), | ||
30 | + url(display=_('Projects'), viewname='gitlab', | ||
31 | + kwargs={'path': 'dashboard/projects'}, auth=True), | ||
32 | + url(display=_('Groups'), viewname='gitlab', | ||
33 | + kwargs={'path': 'profile/groups'}, auth=True), | ||
34 | + url(display=_('Issues'), viewname='gitlab', | ||
35 | + kwargs={'path': 'dashboard/issues'}, auth=True), | ||
36 | + url(display=_('Merge Requests'), viewname='gitlab', | ||
37 | + kwargs={'path': 'merge_requests'}, auth=True), | ||
38 | + | ||
39 | +) |
@@ -0,0 +1,33 @@ | @@ -0,0 +1,33 @@ | ||
1 | +from django.utils.translation import ugettext_lazy as _ | ||
2 | +from colab.plugins.utils.menu import colab_url_factory | ||
3 | + | ||
4 | +# Noosfero plugin - Put this in plugins.d/noosfero.py to actiate ## | ||
5 | +# from django.utils.translation import ugettext_lazy as _ | ||
6 | +# from colab.plugins.utils.menu import colab_url_factory | ||
7 | + | ||
8 | +name = 'colab_noosfero' | ||
9 | +verbose_name = 'Noosfero Plugin' | ||
10 | + | ||
11 | +upstream = 'http://<%= node['peers']['social'] %>:80/social/' | ||
12 | + | ||
13 | +urls = { | ||
14 | + 'include': 'colab_noosfero.urls', | ||
15 | + 'namespace': 'noosfero', # TODO: do not allow to change namespace | ||
16 | + 'prefix': '^social/', | ||
17 | +} | ||
18 | + | ||
19 | +menu_title = _('Social') | ||
20 | + | ||
21 | +url = colab_url_factory('noosfero') | ||
22 | + | ||
23 | +menu_urls = ( | ||
24 | + url(display=_('Users'), viewname='noosfero', | ||
25 | + kwargs={'path': 'search/people'}, auth=False), | ||
26 | + url(display=_('Communities'), viewname='noosfero', | ||
27 | + kwargs={'path': 'search/communities'}, auth=False), | ||
28 | + url(display=_('Profile'), viewname='noosfero', | ||
29 | + kwargs={'path': 'profile/~/'}, auth=True), | ||
30 | + url(display=_('Control Panel'), viewname='noosfero', | ||
31 | + kwargs={'path': 'myprofile/~/'}, auth=True), | ||
32 | + | ||
33 | +) |
cookbooks/colab/templates/settings.yaml.erb
@@ -1,47 +0,0 @@ | @@ -1,47 +0,0 @@ | ||
1 | - | ||
2 | -## Set to false in production | ||
3 | -DEBUG: false | ||
4 | -TEMPLATE_DEBUG: false | ||
5 | - | ||
6 | -## System admins | ||
7 | -ADMINS: &admin | ||
8 | -<%- node['config']['admins'].each do |admin| %> | ||
9 | - - | ||
10 | - <%- admin.each do |item| %> | ||
11 | - - <%= item %> | ||
12 | - <%- end %> | ||
13 | -<% end %> | ||
14 | - | ||
15 | -MANAGERS: *admin | ||
16 | - | ||
17 | -# general Django settings | ||
18 | -DEFAULT_FROM_EMAIL: '<%= node['config']['colab_from_address'] %>' | ||
19 | - | ||
20 | -# colab-specific | ||
21 | -COLAB_FROM_ADDRESS: '<%= node['config']['colab_from_address'] %>' | ||
22 | -SERVER_EMAIL: '<%= node['config']['server_email'] %>' | ||
23 | - | ||
24 | -EMAIL_HOST: localhost | ||
25 | -EMAIL_PORT: 25 | ||
26 | -EMAIL_SUBJECT_PREFIX: <%= node['config']['email_subject_prefix'] %> | ||
27 | - | ||
28 | -SECRET_KEY: <%= File.read('/etc/colab/secret.key').strip %> | ||
29 | - | ||
30 | -SITE_URL: <%= node['config']['site_url'] %> | ||
31 | -BROWSERID_AUDIENCES: | ||
32 | - - <%= node['config']['site_url'].sub('http:', 'https:') %> | ||
33 | - - <%= node['config']['site_url'].sub('https:', 'http:') %> | ||
34 | - | ||
35 | -ALLOWED_HOSTS: | ||
36 | - - <%= node['config']['external_hostname'] %> | ||
37 | - | ||
38 | -## Disable indexing | ||
39 | -ROBOTS_NOINDEX: false | ||
40 | - | ||
41 | -## Disable planet | ||
42 | -FEEDZILLA_ENABLED: false | ||
43 | - | ||
44 | -## Set URL of Colab home | ||
45 | -COLAB_HOME_URL: '/social' | ||
46 | - | ||
47 | -GOOGLE_ANALYTICS_TRACKING_ID: '<%= node['config']['google_analytics_id'] %>' |
@@ -0,0 +1,15 @@ | @@ -0,0 +1,15 @@ | ||
1 | +from django.utils.translation import ugettext_lazy as _ | ||
2 | +from colab.plugins.utils.menu import colab_url_factory | ||
3 | + | ||
4 | +name = "colab_spb" | ||
5 | +verbose_name = "SPB Plugin" | ||
6 | + | ||
7 | +middlewares = ['colab_spb.middleware.ForceLangMiddleware'] | ||
8 | + | ||
9 | +urls = { | ||
10 | + "include":"colab_spb.urls", | ||
11 | + "prefix": '^spb/', | ||
12 | + "namespace":"colab_spb" | ||
13 | + } | ||
14 | + | ||
15 | +url = colab_url_factory('colab_spb') |