Commit 7b6c4df18558d321cb8bf75ff3754adef0c6784b
Exists in
master
and in
79 other branches
Merge branch 'colab-master'
Showing
4 changed files
with
184 additions
and
103 deletions
Show diff stats
colab-deps/colab-deps.spec
| 1 | 1 | %define name colab-deps |
| 2 | -%define version 1.10 | |
| 2 | +%define version 1.11 | |
| 3 | 3 | %define release 1 |
| 4 | 4 | |
| 5 | -Summary: Collaboration platform for communities (Pyton dependencies) | |
| 5 | +Summary: Collaboration platform for communities (Python dependencies) | |
| 6 | 6 | Name: %{name} |
| 7 | 7 | Version: %{version} |
| 8 | 8 | Release: %{release} |
| ... | ... | @@ -19,12 +19,14 @@ BuildRequires: gettext, libxml2-devel, libxslt-devel, openssl-devel, libffi-deve |
| 19 | 19 | Integrated software development platform (Python dependencies). |
| 20 | 20 | |
| 21 | 21 | %prep |
| 22 | -%setup -n %{name}-%{version} -n %{name}-%{version} | |
| 22 | +%setup -q | |
| 23 | 23 | |
| 24 | 24 | %build |
| 25 | +cd %{_builddir} | |
| 25 | 26 | make |
| 26 | 27 | |
| 27 | 28 | %install |
| 29 | +cd %{_builddir} | |
| 28 | 30 | %make_install |
| 29 | 31 | |
| 30 | 32 | %clean | ... | ... |
| ... | ... | @@ -0,0 +1,37 @@ |
| 1 | +Name: colab-spb-theme | |
| 2 | +Version: 0.2.0 | |
| 3 | +Release: 1 | |
| 4 | +Summary: SPB-specific Colab theme | |
| 5 | +Group: Applications/Publishing | |
| 6 | +License: GPLv3 | |
| 7 | +URL: https://portal.softwarepublico.gov.br/gitlab/softwarepublico/colab-spb-theme-plugin | |
| 8 | +Source0: %{name}-%{version}.tar.gz | |
| 9 | +BuildArch: noarch | |
| 10 | +BuildRequires: colab >= 1.11 | |
| 11 | +Requires: colab >= 1.11 | |
| 12 | +%description | |
| 13 | +This package contains Colab theme for Software Público Brasileiro platform. | |
| 14 | + | |
| 15 | +%prep | |
| 16 | +%setup -q | |
| 17 | + | |
| 18 | +%build | |
| 19 | +make | |
| 20 | + | |
| 21 | +%install | |
| 22 | + | |
| 23 | +install -d %{buildroot}/etc/colab/settings.d/ | |
| 24 | + | |
| 25 | +cat > %{buildroot}/etc/colab/settings.d/spb_theme.py << EOF | |
| 26 | +COLAB_STATICS=['/usr/lib/colab/colab-spb-theme/colab_spb_theme/static'] | |
| 27 | +COLAB_TEMPLATES=('/usr/lib/colab/colab-spb-theme/colab_spb_theme/templates',) | |
| 28 | +EOF | |
| 29 | + | |
| 30 | +make install DESTDIR=%{buildroot} | |
| 31 | + | |
| 32 | +%post | |
| 33 | +yes yes | colab-admin collectstatic | |
| 34 | + | |
| 35 | +%files | |
| 36 | +/usr/lib/colab | |
| 37 | +/etc/colab | ... | ... |
colab/colab.spec
| 1 | 1 | %define name colab |
| 2 | -%define version 1.10.3 | |
| 3 | -%define default_release 4 | |
| 2 | +%define version 1.11.0 | |
| 3 | +%define default_release 1 | |
| 4 | 4 | %{!?release: %define release %{default_release}} |
| 5 | 5 | %define buildvenv /var/tmp/%{name}-%{version} |
| 6 | 6 | |
| ... | ... | @@ -14,10 +14,11 @@ Group: Development/Tools |
| 14 | 14 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot |
| 15 | 15 | Prefix: %{_prefix} |
| 16 | 16 | Vendor: Sergio Oliveira <sergio@tracy.com.br> |
| 17 | -Url: https://github.com/colab-community/colab | |
| 17 | +Url: https://github.com/colab/colab | |
| 18 | 18 | BuildArch: noarch |
| 19 | -BuildRequires: colab-deps >= 1.10, python-virtualenv | |
| 20 | -Requires: colab-deps >= 1.10, solr, mailman-api | |
| 19 | +BuildRequires: colab-deps >= 1.11, python-virtualenv | |
| 20 | +# TODO: Set mailman-api version (0.3c1) | |
| 21 | +Requires: colab-deps >= 1.11, solr, mailman-api | |
| 21 | 22 | |
| 22 | 23 | %description |
| 23 | 24 | Integrated software development platform. |
| ... | ... | @@ -29,7 +30,7 @@ Integrated software development platform. |
| 29 | 30 | # install colab into virtualenv to make sure dependencies are OK |
| 30 | 31 | rm -rf %{buildvenv} |
| 31 | 32 | cp -r /usr/lib/colab %{buildvenv} |
| 32 | -PATH=%{buildvenv}/bin:$PATH pip install --no-index . | |
| 33 | +PATH=%{buildvenv}/bin:$PATH pip install --use-wheel --no-index . | |
| 33 | 34 | virtualenv --relocatable %{buildvenv} |
| 34 | 35 | |
| 35 | 36 | # cleanup virtualenv |
| ... | ... | @@ -43,13 +44,30 @@ rm -f cleanup.list |
| 43 | 44 | find %{buildvenv} -type d -empty -delete |
| 44 | 45 | |
| 45 | 46 | %install |
| 46 | -mkdir -p %{buildroot}/etc/colab | |
| 47 | -mkdir -p %{buildroot}/usr/lib | |
| 47 | + | |
| 48 | +# install config file | |
| 49 | +install -d -m 0755 %{buildroot}/etc/colab | |
| 50 | +install -m 0644 misc/etc/colab/gunicorn.py %{buildroot}/etc/colab/gunicorn.py.example | |
| 51 | + | |
| 52 | +# Create settings dirs | |
| 53 | +install -d -m 0755 %{buildroot}/etc/colab/settings.d | |
| 54 | +install -d -m 0755 %{buildroot}/etc/colab/plugins.d | |
| 55 | + | |
| 56 | +# create log dir | |
| 57 | +install -d -m 0755 %{buildroot}/var/log/colab | |
| 58 | + | |
| 59 | +# create celery dir | |
| 60 | +install -d -m 0755 %{buildroot}/var/lib/colab/celery | |
| 61 | + | |
| 62 | +# Create assets dir (stores static files) | |
| 63 | +install -d -m 0755 %{buildroot}/var/lib/colab/assets | |
| 48 | 64 | |
| 49 | 65 | # install virtualenv |
| 66 | +install -d -m 0755 %{buildroot}/usr/lib | |
| 50 | 67 | rm -rf %{buildroot}/usr/lib/colab |
| 51 | 68 | cp -r %{buildvenv} %{buildroot}/usr/lib/colab |
| 52 | 69 | mkdir -p %{buildroot}/%{_bindir} |
| 70 | + | |
| 53 | 71 | cat > %{buildroot}/%{_bindir}/colab-admin <<EOF |
| 54 | 72 | #!/bin/sh |
| 55 | 73 | set -e |
| ... | ... | @@ -65,6 +83,8 @@ chmod +x %{buildroot}/%{_bindir}/colab-admin |
| 65 | 83 | # install initscript |
| 66 | 84 | install -d -m 0755 %{buildroot}/lib/systemd/system |
| 67 | 85 | install -m 0644 misc/lib/systemd/system/colab.service %{buildroot}/lib/systemd/system |
| 86 | +install -m 0644 misc/lib/systemd/system/celeryd.service %{buildroot}/lib/systemd/system | |
| 87 | +install -m 0644 misc/lib/systemd/system/celerybeat.service %{buildroot}/lib/systemd/system | |
| 68 | 88 | # install crontab |
| 69 | 89 | install -d -m 0755 %{buildroot}/etc/cron.d |
| 70 | 90 | install -m 0644 misc/etc/cron.d/colab %{buildroot}/etc/cron.d |
| ... | ... | @@ -74,10 +94,22 @@ rm -rf $RPM_BUILD_ROOT |
| 74 | 94 | rm -rf %{buildvenv} |
| 75 | 95 | |
| 76 | 96 | %files |
| 97 | +%defattr(-, root, root) | |
| 98 | + | |
| 77 | 99 | /usr/lib/colab |
| 100 | +#/var/lib/colab # XXX: remove if doesnt break | |
| 101 | +/var/lib/colab/assets | |
| 102 | +%attr(-, colab, colab) /var/lib/colab/celery | |
| 103 | +%attr(-, colab, colab) /var/log/colab | |
| 78 | 104 | %{_bindir}/* |
| 79 | 105 | /etc/cron.d/colab |
| 106 | +#/etc/colab # XXX: remove if doesnt break | |
| 107 | +/etc/colab/settings.d | |
| 108 | +/etc/colab/plugins.d | |
| 109 | +/etc/colab/gunicorn.py.example | |
| 80 | 110 | /lib/systemd/system/colab.service |
| 111 | +/lib/systemd/system/celeryd.service | |
| 112 | +/lib/systemd/system/celerybeat.service | |
| 81 | 113 | |
| 82 | 114 | %post |
| 83 | 115 | groupadd colab || true |
| ... | ... | @@ -85,112 +117,122 @@ if ! id colab; then |
| 85 | 117 | useradd --system --gid colab --home-dir /usr/lib/colab --no-create-home colab |
| 86 | 118 | fi |
| 87 | 119 | |
| 88 | -mkdir -p /etc/colab | |
| 120 | +mv /etc/colab/gunicorn.py.example /etc/colab/gunicorn.py | |
| 89 | 121 | |
| 90 | -if [ ! -f /etc/colab/settings.yaml ]; then | |
| 122 | +if [ ! -f /etc/colab/settings.py ]; then | |
| 91 | 123 | SECRET_KEY=$(openssl rand -hex 32) |
| 92 | - cat > /etc/colab/settings.yaml <<EOF | |
| 93 | -## Set to false in production | |
| 94 | -DEBUG: true | |
| 95 | -TEMPLATE_DEBUG: true | |
| 96 | - | |
| 97 | -## System admins | |
| 98 | -ADMINS: &admin | |
| 99 | - - | |
| 100 | - - John Foo | |
| 101 | - - john@example.com | |
| 102 | - - | |
| 103 | - - Mary Bar | |
| 104 | - - mary@example.com | |
| 105 | - | |
| 106 | -MANAGERS: *admin | |
| 107 | - | |
| 108 | -COLAB_FROM_ADDRESS: '"Colab" <noreply@example.com>' | |
| 109 | -SERVER_EMAIL: '"Colab" <noreply@example.com>' | |
| 110 | - | |
| 111 | -EMAIL_HOST: localhost | |
| 112 | -EMAIL_PORT: 25 | |
| 113 | -EMAIL_SUBJECT_PREFIX: '[colab]' | |
| 114 | - | |
| 115 | -SECRET_KEY: '$SECRET_KEY' | |
| 116 | - | |
| 117 | -SITE_URL: 'http://localhost:8001/' | |
| 118 | -BROWSERID_AUDIENCES: | |
| 119 | - - http://localhost:8001 | |
| 120 | -# - http://example.com | |
| 121 | -# - https://example.org | |
| 122 | -# - http://example.net | |
| 123 | - | |
| 124 | -ALLOWED_HOSTS: | |
| 125 | - - localhost | |
| 126 | -# - example.com | |
| 127 | -# - example.org | |
| 128 | -# - example.net | |
| 129 | - | |
| 130 | -## Disable indexing | |
| 131 | -ROBOTS_NOINDEX: false | |
| 132 | - | |
| 133 | -## Disable browser id authentication | |
| 134 | -# BROWSERID_ENABLED: true | |
| 135 | -EOF | |
| 136 | - chown root:colab /etc/colab/settings.yaml | |
| 137 | - chmod 0640 /etc/colab/settings.yaml | |
| 138 | -fi | |
| 124 | + cat > /etc/colab/settings.py <<EOF | |
| 125 | + | |
| 126 | +# Set to false in production | |
| 127 | +DEBUG = True | |
| 128 | +TEMPLATE_DEBUG = True | |
| 129 | + | |
| 130 | +# System admins | |
| 131 | +ADMINS = [['John Foo', 'john@example.com'], ['Mary Bar', 'mary@example.com']] | |
| 132 | + | |
| 133 | +MANAGERS = ADMINS | |
| 134 | + | |
| 135 | +COLAB_FROM_ADDRESS = '"Colab" <noreply@example.com>' | |
| 136 | +SERVER_EMAIL = '"Colab" <noreply@example.com>' | |
| 137 | + | |
| 138 | +EMAIL_HOST = 'localhost' | |
| 139 | +EMAIL_PORT = 25 | |
| 140 | +EMAIL_SUBJECT_PREFIX = '[colab]' | |
| 141 | + | |
| 142 | +SECRET_KEY = '$(openssl rand -hex 32)' | |
| 143 | + | |
| 144 | +ALLOWED_HOSTS = [ | |
| 145 | + 'localhost', | |
| 146 | +# 'example.com', | |
| 147 | +# 'example.org', | |
| 148 | +# 'example.net', | |
| 149 | +] | |
| 150 | + | |
| 151 | +# Database settings | |
| 152 | +# | |
| 153 | +# When DEBUG is True colab will create the DB on | |
| 154 | +# the repository root. In case of production settings | |
| 155 | +# (DEBUG False) the DB settings must be set. | |
| 156 | +# | |
| 157 | +# DATABASES = { | |
| 158 | +# 'default': { | |
| 159 | +# 'ENGINE': 'django.db.backends.sqlite3', | |
| 160 | +# 'NAME': '/path/to/colab.sqlite3', | |
| 161 | +# } | |
| 162 | +# } | |
| 163 | + | |
| 164 | +# Disable indexing | |
| 165 | +ROBOTS_NOINDEX = False | |
| 166 | + | |
| 167 | +LOGGING = { | |
| 168 | + 'version': 1, | |
| 169 | + 'disable_existing_loggers': True, | |
| 170 | + | |
| 171 | + 'formatters': { | |
| 172 | + 'colab': { 'format' : '[colab] (%%(name)s) %%(levelname)s: %%(message)s'}, | |
| 173 | + 'verbose': { 'format' : '%%(asctime)s (%%(name)s) %%(levelname)s: %%(message)s'}, | |
| 174 | + }, | |
| 175 | + | |
| 176 | + 'handlers': { | |
| 177 | + 'null': { | |
| 178 | + 'level': 'DEBUG', | |
| 179 | + 'class': 'logging.NullHandler', | |
| 180 | + }, | |
| 181 | + 'syslog': { | |
| 182 | + 'level': 'WARNING', | |
| 183 | + 'class': 'logging.handlers.SysLogHandler', | |
| 184 | + 'formatter': 'colab', | |
| 185 | + 'address': '/dev/log', | |
| 186 | + }, | |
| 187 | + 'file': { | |
| 188 | + 'level': 'DEBUG', | |
| 189 | + 'class': 'logging.handlers.TimedRotatingFileHandler', | |
| 190 | + 'filename': '/var/log/colab/colab.log', | |
| 191 | + 'interval': 24, # 24 hours | |
| 192 | + 'backupCount': 7, # keep last 7 backups | |
| 193 | + 'encoding': 'UTF-8', | |
| 194 | + 'formatter': 'verbose', | |
| 195 | + }, | |
| 196 | + }, | |
| 197 | + | |
| 198 | + 'loggers': { | |
| 199 | + 'django': { | |
| 200 | + 'handlers': ['file', 'syslog'], | |
| 201 | + 'propagate': False, | |
| 202 | + }, | |
| 203 | + 'revproxy': { | |
| 204 | + 'handlers': ['file', 'syslog'], | |
| 205 | + 'propagate': False, | |
| 206 | + 'level': 'ERROR', | |
| 207 | + }, | |
| 208 | + }, | |
| 209 | +} | |
| 139 | 210 | |
| 140 | -mkdir -p /etc/colab/settings.d | |
| 141 | - | |
| 142 | -if [ ! -f /etc/colab/settings.d/00-database.yaml ]; then | |
| 143 | - cat > /etc/colab/settings.d/00-database.yaml <<EOF | |
| 144 | -DATABASES: | |
| 145 | - default: | |
| 146 | - ENGINE: django.db.backends.postgresql_psycopg2 | |
| 147 | - NAME: colab | |
| 148 | - USER: colab | |
| 149 | - HOST: localhost | |
| 150 | - PORT: 5432 | |
| 151 | 211 | EOF |
| 152 | - chown root:colab /etc/colab/settings.d/00-database.yaml | |
| 153 | - chmod 0640 /etc/colab/settings.d/00-database.yaml | |
| 154 | -fi | |
| 155 | 212 | |
| 156 | -# only applies if there is a local PostgreSQL server | |
| 157 | -if [ -x /usr/bin/postgres ]; then | |
| 158 | - | |
| 159 | - # start/enable the service | |
| 160 | - postgresql-setup initdb || true | |
| 161 | - systemctl start postgresql | |
| 162 | - systemctl enable postgresql | |
| 163 | - | |
| 164 | - if [ "$(sudo -u postgres -i psql --quiet --tuples-only -c "select count(*) from pg_user where usename = 'colab';")" -eq 0 ]; then | |
| 165 | - # create user | |
| 166 | - sudo -u postgres -i createuser colab | |
| 167 | - fi | |
| 168 | - | |
| 169 | - if [ "$(sudo -u postgres -i psql --quiet --tuples-only -c "select count(1) from pg_database where datname = 'colab';")" -eq 0 ]; then | |
| 170 | - # create database | |
| 171 | - sudo -u postgres -i createdb --owner=colab colab | |
| 172 | - fi | |
| 173 | - | |
| 174 | - colab-admin migrate | |
| 213 | + chown root:colab /etc/colab/settings.py | |
| 214 | + chmod 0640 /etc/colab/settings.py | |
| 175 | 215 | fi |
| 176 | 216 | |
| 177 | -mkdir -p /var/lock/colab | |
| 178 | -chown colab:colab /var/lock/colab | |
| 179 | - | |
| 180 | -mkdir -p /var/lib/colab-assets | |
| 181 | -chown colab:colab /var/lib/colab-assets | |
| 217 | +install -d -m 0750 -o root -g colab /etc/colab/settings.d | |
| 182 | 218 | |
| 183 | -mkdir -p /usr/share/nginx/ | |
| 219 | +install -d -m 0755 -o colab -g colab /var/lib/colab-assets | |
| 184 | 220 | |
| 185 | -ln -s /var/lib/colab-assets /usr/share/nginx/colab | |
| 221 | +# If nginx is available serve assets using it | |
| 222 | +if [ -d /usr/share/nginx ]; then | |
| 223 | + ln -s /var/lib/colab/assets /usr/share/nginx/colab | |
| 224 | +fi | |
| 186 | 225 | |
| 187 | -yes yes | colab-admin collectstatic | |
| 226 | +chown -R colab:colab /var/lib/colab/assets | |
| 227 | +colab-admin collectstatic --noinput | |
| 188 | 228 | |
| 189 | 229 | if [ $1 -gt 1 ]; then |
| 190 | 230 | # upgrade; restart if running |
| 191 | 231 | systemctl try-restart colab |
| 192 | 232 | fi |
| 193 | 233 | |
| 234 | +systemctl daemon-reload | |
| 235 | + | |
| 194 | 236 | %preun |
| 195 | 237 | if [ $1 -eq 0 ]; then |
| 196 | 238 | # package being removed | ... | ... |
mailman-api/mailman-api.spec