Skip to content
This repository has been archived by the owner on May 17, 2018. It is now read-only.

Commit

Permalink
Add tos colab plugin and logging configuration
Browse files Browse the repository at this point in the history
Signed-off-by: Matheus Fernandes <[email protected]>
  • Loading branch information
msfernandes committed Nov 21, 2017
1 parent f3e1595 commit 8ad8cbf
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 4 deletions.
11 changes: 8 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,29 @@ ENV BUILD_PACKAGES python-dev python3 python3-dev linux-headers \
RUN apk add --update --no-cache $BUILD_PACKAGES
RUN mkdir -p /etc/colab /etc/colab/settings.d /etc/colab/plugins.d \
/etc/colab/widgets.d /var/labhacker/colab/public/media \
/etc/cron.d/
/etc/cron.d/ /var/log/colab/

ADD . /var/labhacker/colab
WORKDIR /var/labhacker/colab

RUN pip install . psycopg2 gunicorn elasticsearch python-memcached easy_thumbnails && \
rm -r /root/.cache

RUN pip install colab-edemocracia colab-audiencias colab-discourse colab-wikilegis
RUN pip install colab-edemocracia colab-audiencias colab-discourse \
colab-wikilegis colab-mkdocs-tos

COPY ./misc/etc/colab/settings.py ./misc/etc/colab/gunicorn.py /etc/colab/
COPY ./misc/etc/colab/settings.d/01-database.py \
./misc/etc/colab/settings.d/02-memcached.py \
./misc/etc/colab/settings.d/03-logging.py \
/etc/colab/settings.d/

COPY ./misc/etc/colab/plugins.d/edemocracia.py /etc/colab/plugins.d/
COPY ./misc/etc/colab/plugins.d/edemocracia.py \
./misc/etc/colab/plugins.d/tos.py \
/etc/colab/plugins.d/

RUN npm install -g bower && \
colab-admin bower_install --allow-root && \
colab-admin collectstatic --noinput && \
colab-admin build_mkdocs && \
colab-admin compilemessages
22 changes: 22 additions & 0 deletions misc/etc/colab/plugins.d/tos.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-

name = 'colab_mkdocs_tos'
verbose_name = 'Colab Mkdocs Plugin Plugin'

upstream = ''

docs_title = "Sobre"

pages = [
('Página Inicial', 'index.md'),
('Wikilegis', 'wikilegis.md'),
('Audiências Interativas', 'audiencias.md'),
('Expressão', 'expressao.md'),
('Termos de Serviço', 'tos.md'),
]


urls = {
'include': 'colab_mkdocs_tos.urls',
'prefix': '^sobre/',
}
34 changes: 34 additions & 0 deletions misc/etc/colab/settings.d/03-logging.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
LOGGING = {
'version': 1,
'disable_existing_loggers': True,
'formatters': {
'verbose': {
'format': '%(asctime)s (%(name)s) %(levelname)s: %(message)s'
}
},
'handlers': {
'file': {
'level': 'DEBUG',
'interval': 24,
'backupCount': 7,
'encoding': 'UTF-8',
'formatter': 'verbose',
'class': 'logging.handlers.TimedRotatingFileHandler',
'filename': '/var/log/colab/colab.log',
}
},
'loggers': {
'revproxy': {
'handlers': ['file'],
'level': 'ERROR',
},
'django': {
'handlers': ['file'],
'level': 'ERROR',
},
'colab': {
'handlers': ['file'],
'level': 'ERROR',
},
},
}
3 changes: 2 additions & 1 deletion start-colab.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

PLUGINS_SETTINGS="/etc/colab/plugins.d/"
if [ "$(ls -A $PLUGINS_SETTINGS)" ]; then
find $PLUGINS_SETTINGS ! -name 'edemocracia.py' -type f -exec rm -f {} +
find $PLUGINS_SETTINGS ! -name 'edemocracia.py' ! -name 'tos.py' -type f -exec rm -f {} +
fi

PLUGINS_WIDGETS="/etc/colab/widgets.d/"
Expand Down Expand Up @@ -44,6 +44,7 @@ PGPASSWORD=$DATABASE_PASSWORD psql -U $DATABASE_USER -w -h $DATABASE_HOST -c "CR
colab-admin migrate
colab-admin initdb

colab-admin bower_install --allow-root
colab-admin compress --force
colab-admin collectstatic --noinput

Expand Down

0 comments on commit 8ad8cbf

Please sign in to comment.