This repository has been archived by the owner on May 17, 2018. It is now read-only.
forked from colab/colab
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Containing Audiencias Interativas and Wikilegis Signed-off-by: Matheus Fernandes <[email protected]>
- Loading branch information
1 parent
80df78c
commit 766464e
Showing
12 changed files
with
522 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
from django.core.management.base import BaseCommand | ||
from django.contrib.auth import get_user_model | ||
from django.contrib.sites.models import Site | ||
import re | ||
import os | ||
import sys | ||
|
||
|
||
User = get_user_model() | ||
|
||
|
||
class Command(BaseCommand): | ||
help = ('Create admin and set site domain') | ||
|
||
def handle(self, *args, **kwargs): | ||
self.create_admin() | ||
self.set_site_domain() | ||
|
||
def set_site_domain(self): | ||
site = Site.objects.get_current() | ||
site_domain = os.environ.get('SITE_DOMAIN', None) | ||
site_name = os.environ.get('SITE_NAME', None) | ||
|
||
if None not in [site_domain, site_name]: | ||
print('Updating site infos...') | ||
regex = re.compile('^(http|https)://') | ||
if not regex.findall(site_domain): | ||
site_domain = 'http://' + site_domain | ||
|
||
site.domain, site.name = site_domain, site_name | ||
site.save() | ||
print('Done!') | ||
else: | ||
print('Missing SITE_DOMAIN or SITE_NAME environment variable.') | ||
sys.exit(2) | ||
|
||
def create_admin(self): | ||
admin_email = os.environ.get('ADMIN_EMAIL', None) | ||
admin_username = os.environ.get('ADMIN_USERNAME', None) | ||
admin_passwd = os.environ.get('ADMIN_PASSWORD', None) | ||
|
||
if None not in [admin_email, admin_passwd, admin_username]: | ||
print('Creating superuser...') | ||
user = User.objects.get_or_create(email=admin_email, | ||
username=admin_username)[0] | ||
user.set_password(admin_passwd) | ||
user.is_superuser = True | ||
user.is_staff = True | ||
user.save() | ||
print('Done!') | ||
else: | ||
print('Missing ADMIN_EMAIL, ADMIN_USERNAME or ADMIN_PASSWORD ' | ||
'environment variable.') | ||
sys.exit(1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,231 @@ | ||
version: '2.3' | ||
services: | ||
nginx: | ||
image: nginx | ||
depends_on: | ||
- colab | ||
volumes: | ||
- ./misc/etc/nginx/conf.d/:/etc/nginx/conf.d/:z | ||
- colab_assets:/var/labhacker/colab/public:z | ||
- audiencias:/var/labhacker/audiencias:z | ||
- wikilegis:/var/labhacker/wikilegis:z | ||
ports: | ||
- "8000:80" | ||
links: | ||
- 'audienciasweb' | ||
|
||
db: | ||
image: postgres | ||
volumes: | ||
- ./scripts/pgsql/create-databases.sh:/docker-entrypoint-initdb.d/create-databases.sh:z | ||
healthcheck: | ||
test: runuser postgres -c "pg_isready" | ||
interval: 10s | ||
timeout: 10s | ||
retries: 5 | ||
environment: | ||
POSTGRES_USER: root | ||
POSTGRES_PASSWORD: root | ||
POSTGRES_DB: root | ||
|
||
colab: | ||
build: . | ||
command: ./start-colab.sh | ||
environment: | ||
DEBUG: 'True' | ||
TEMPLATE_DEBUG: 'True' | ||
DEFAULT_FROM_EMAIL: '"Portal e-Democracia" <[email protected]>' | ||
SERVER_EMAIL: '' | ||
EMAIL_HOST: '' | ||
EMAIL_PORT: 587 | ||
EMAIL_HOST_USER: '' | ||
EMAIL_HOST_PASSWORD: '' | ||
EMAIL_USE_TLS: '' | ||
EMAIL_SUBJECT_PREFIX: '[e-Democracia]' | ||
SECRET_KEY: 'secret' | ||
ALLOWED_HOSTS: '*' | ||
ROBOTS_NOINDEX: "True" | ||
SOCIAL_AUTH_GOOGLE_OAUTH2_KEY: '' | ||
SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET: '' | ||
SOCIAL_AUTH_FACEBOOK_KEY: '' | ||
SOCIAL_AUTH_FACEBOOK_SECRET: '' | ||
DATABASE_HOST: 'db' | ||
DATABASE_NAME: 'colab' | ||
DATABASE_USER: 'root' | ||
DATABASE_PASSWORD: 'root' | ||
MEMCACHED_LOCATION: 'memcached:1234' | ||
ADMIN_EMAIL: [email protected] | ||
ADMIN_USERNAME: admin | ||
ADMIN_PASSWORD: 123 | ||
SITE_DOMAIN: http://127.0.0.1:8000 | ||
SITE_NAME: Câmara dos Deputados | ||
SITE_LOGO: '' | ||
SITE_BACKGROUND_IMAGE: '' | ||
AUDIENCIAS_API_KEY: secret_key | ||
WIKILEGIS_API_KEY: api_key | ||
volumes: | ||
- .:/var/labhacker/colab/colab | ||
- colab_assets:/var/labhacker/colab/public:z | ||
links: | ||
- 'audienciasweb' | ||
expose: | ||
- "8000" | ||
depends_on: | ||
db: | ||
condition: service_healthy | ||
|
||
redis: | ||
image: redis:alpine | ||
healthcheck: | ||
test: redis-cli ping | ||
interval: 10s | ||
timeout: 10s | ||
retries: 5 | ||
|
||
audienciasweb: | ||
image: labhackercd/audiencias-publicas | ||
command: ./start-web.sh | ||
restart: on-failure | ||
links: | ||
- db | ||
- redis | ||
volumes: | ||
- audiencias:/var/labhacker/audiencias | ||
environment: | ||
EMAIL_HOST: '' | ||
EMAIL_HOST_USER: '' | ||
EMAIL_HOST_PASSWORD: '' | ||
EMAIL_PORT: 25 | ||
EMAIL_USE_TLS: 'False' | ||
DEFAULT_FROM_EMAIL: '"Portal e-Democracia[audiencias]" <[email protected]>' | ||
NOTIFICATION_EMAIL_LIST: [email protected],[email protected] | ||
DJANGO_SECRET_KEY: secret_key | ||
DEBUG: 'False' | ||
ENABLE_REMOTE_USER: 'True' | ||
URL_PREFIX: audiencias | ||
FORCE_SCRIPT_NAME: /audiencias | ||
STATIC_URL: /audiencias/static/ | ||
SESSION_COOKIE_NAME: audiencias_session | ||
LOGIN_URL: /home | ||
LOGIN_REDIRECT_URL: /home | ||
LOGOUT_REDIRECT_URL: /home | ||
ALLOWED_HOSTS: 'audienciasweb, 127.0.0.1' | ||
YOUTUBE_API_KEY: '' | ||
YOUTUBE_CHANNEL_ID: '' | ||
YOUTUBE_SEARCH_QUERY: '' | ||
GOOGLE_ANALYTICS_ID: '' | ||
OLARK_ID: '' | ||
ADMIN_PASSWORD: 123 | ||
ADMIN_EMAIL: [email protected] | ||
ADMIN_USERNAME: admin | ||
DATABASE_URL: postgres://root:root@db:5432/audiencias | ||
DEBUG: 'False' | ||
REDIS_SERVER: redis | ||
WEBSERVICE_URL: https://infoleg.camara.leg.br/ws-pauta/evento/interativo | ||
COMPRESS_OFFLINE: 'True' | ||
expose: | ||
- "8000" | ||
depends_on: | ||
db: | ||
condition: service_healthy | ||
redis: | ||
condition: service_healthy | ||
|
||
audienciasworker: | ||
image: labhackercd/audiencias-publicas | ||
command: ./start-worker.sh | ||
links: | ||
- redis | ||
- db | ||
environment: | ||
EMAIL_HOST: '' | ||
EMAIL_HOST_USER: '' | ||
EMAIL_HOST_PASSWORD: '' | ||
EMAIL_PORT: 25 | ||
EMAIL_USE_TLS: 'False' | ||
DEFAULT_FROM_EMAIL: '"Portal e-Democracia[audiencias]" <[email protected]>' | ||
NOTIFICATION_EMAIL_LIST: [email protected],[email protected] | ||
DJANGO_SECRET_KEY: secret_key | ||
DEBUG: 'False' | ||
ENABLE_REMOTE_USER: 'True' | ||
URL_PREFIX: audiencias | ||
FORCE_SCRIPT_NAME: /audiencias | ||
STATIC_URL: /audiencias/static/ | ||
SESSION_COOKIE_NAME: audiencias_session | ||
LOGIN_URL: /home | ||
LOGIN_REDIRECT_URL: /home | ||
LOGOUT_REDIRECT_URL: /home | ||
ALLOWED_HOSTS: 'audienciasweb, 127.0.0.1' | ||
YOUTUBE_API_KEY: '' | ||
YOUTUBE_CHANNEL_ID: '' | ||
YOUTUBE_SEARCH_QUERY: '' | ||
GOOGLE_ANALYTICS_ID: '' | ||
OLARK_ID: '' | ||
ADMIN_PASSWORD: 123 | ||
ADMIN_EMAIL: [email protected] | ||
ADMIN_USERNAME: admin | ||
DATABASE_URL: postgres://root:root@db:5432/audiencias | ||
DEBUG: 'False' | ||
REDIS_SERVER: redis | ||
WEBSERVICE_URL: https://infoleg.camara.leg.br/ws-pauta/evento/interativo | ||
COMPRESS_OFFLINE: 'True' | ||
volumes: | ||
- audiencias:/var/labhacker/audiencias | ||
depends_on: | ||
- 'audienciasweb' | ||
|
||
wikilegisweb: | ||
image: labhackercd/wikilegis | ||
command: ./start.sh | ||
restart: on-failure | ||
links: | ||
- db | ||
volumes: | ||
- wikilegis:/var/labhacker/wikilegis | ||
environment: | ||
API_KEY: api_key | ||
SECRET_KEY: secret_key | ||
FORCE_SCRIPT_NAME: /wikilegis | ||
DEBUG: 'False' | ||
ALLOWED_HOSTS: '*' | ||
LOGIN_URL: /home | ||
LOGIN_REDIRECT_URL: / | ||
AUTH_USER_MODEL: accounts.User | ||
ENABLE_REMOTE_USER: 'True' | ||
SESSION_COOKIE_NAME: wikilegis_session | ||
ACCOUNT_ACTIVATION_REQUIRED: 0 | ||
ACCOUNT_ACTIVATION_DAYS: 7 | ||
ENABLE_SOCIAL_AUTH: 'False' | ||
EMAIL_HOST: '' | ||
EMAIL_PORT: 25 | ||
EMAIL_HOST_USER: '' | ||
EMAIL_HOST_PASSWORD: '' | ||
EMAIL_USE_TLS: 'False' | ||
DEFAULT_FROM_EMAIL: '"Portal e-Democracia[Wikilegis]" <[email protected]>' | ||
LANGUAGE_CODE: pt-br | ||
TIME_ZONE: America/Sao_Paulo | ||
STATIC_URL: /wikilegis/static/ | ||
MEDIA_URL: /wikilegis/media/ | ||
COMPRESS_OFFLINE: 'True' | ||
ADMIN_PASSWORD: 123 | ||
ADMIN_EMAIL: [email protected] | ||
DATABASE_ENGINE: postgresql_psycopg2 | ||
DATABASE_NAME: wikilegis | ||
DATABASE_PASSWORD: root | ||
DATABASE_USER: root | ||
DATABASE_HOST: db | ||
DATABASE_PORT: 5432 | ||
DEBUG: 'False' | ||
expose: | ||
- "8000" | ||
depends_on: | ||
db: | ||
condition: service_healthy | ||
|
||
volumes: | ||
colab_assets: | ||
driver: local | ||
audiencias: | ||
driver: local | ||
wikilegis: | ||
driver: local |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from decouple import config | ||
|
||
name = 'colab_audiencias' | ||
verbose_name = 'Colab Audiencias Plugin Plugin' | ||
|
||
upstream = 'http://audienciasweb:8000/audiencias/' | ||
api_key = config('AUDIENCIAS_API_KEY') | ||
|
||
urls = { | ||
'include': 'colab_audiencias.urls', | ||
'prefix': '^audiencias/', | ||
'login': '/audiencas/accounts/login/', | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name = 'colab_edemocracia' | ||
verbose_name = 'Colab eDemocracia Plugin' | ||
|
||
urls = { | ||
'include': 'colab_edemocracia.urls', | ||
'prefix': '', | ||
'namespace': 'colab_edemocracia', | ||
'login': '/home' | ||
} | ||
|
||
middlewares = ['colab_edemocracia.middlewares.ForceLangMiddleware'] | ||
|
||
dependencies = ['djangobower', 'compressor', 'easy_thumbnails', | ||
'image_cropping', 'widget_tweaks', 'macros'] | ||
|
||
settings_variables = { | ||
'STATICFILES_FINDERS': ( | ||
'django.contrib.staticfiles.finders.FileSystemFinder', | ||
'django.contrib.staticfiles.finders.AppDirectoriesFinder', | ||
'djangobower.finders.BowerFinder', | ||
'compressor.finders.CompressorFinder', | ||
), | ||
'BOWER_COMPONENTS_ROOT': | ||
'/usr/lib/python2.7/site-packages/colab_edemocracia/static', | ||
'BOWER_INSTALLED_APPS': ( | ||
'foundation-sites#6.2.3', | ||
'jquery-mask-plugin', | ||
'https://github.com/labhackercd/fontastic-labhacker.git', | ||
), | ||
'COMPRESS_PRECOMPILERS': ( | ||
('text/x-scss', 'django_libsass.SassCompiler'), | ||
), | ||
'LIBSASS_SOURCEMAPS': 'DEBUG', | ||
'COMPRESS_ROOT': "/usr/lib/python2.7/site-packages/colab_edemocracia/static", | ||
'COLAB_TEMPLATES': ( | ||
"/usr/lib/python2.7/site-packages/colab_edemocracia/templates", | ||
), | ||
'COLAB_STATICS': [ | ||
'/usr/lib/python2.7/site-packages/colab_edemocracia/static', | ||
'/usr/lib/python2.7/site-packages/colab_edemocracia/templates/components/edem-navigation/static', | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from decouple import config | ||
|
||
name = 'colab_wikilegis' | ||
verbose_name = 'Colab Wikilegis Plugin Plugin' | ||
|
||
upstream = 'http://wikilegisweb:8000/' | ||
|
||
api_key = config('WIKILEGIS_API_KEY') | ||
|
||
urls = { | ||
'include': 'colab_wikilegis.urls', | ||
'prefix': '^wikilegis/', | ||
'login': '/wikilegis/accounts/login/', | ||
} | ||
|
||
settings_variables = { | ||
'COLAB_STATICS': [ | ||
'/usr/lib/python2.7/site-packages/colab_wikilegis/static' | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from decouple import config | ||
|
||
|
||
DATABASES = { | ||
'default': { | ||
'ENGINE': 'django.db.backends.postgresql_psycopg2', | ||
'HOST': config('DATABASE_HOST', default='127.0.0.1'), | ||
'NAME': config('DATABASE_NAME', default='colab'), | ||
'PASSWORD': config('DATABASE_PASSWORD', default=''), | ||
'USER': config('DATABASE_USER', default='root') | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from decouple import config | ||
|
||
CACHES = { | ||
'default': { | ||
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache', | ||
'LOCATION': config('MEMCACHED_LOCATION', default='127.0.0.1'), | ||
} | ||
} |
Oops, something went wrong.