Commit 9130ad3f authored by Odair M.'s avatar Odair M. Committed by Bruno Meyer

#155: Enable and configure CI

parent e21f1fa0
#image: ubuntu:16.04
variables:
POSTGRES_USER: "adega"
POSTGRES_PASSWORD: "adega"
POSTGRES_DB: "adega"
POSTGRES_HOST: "postgres"
POSTGRES_PORT: "5432"
VERSION: "DEVELOPMENT"
services:
- postgres:9.6
before_script:
- export LC_ALL=C.UTF-8
- export LANG=C.UTF-8
# - apt-get update -qq
# - apt-get install -y make
# - make install
# - make install-user
#- pip3 install -U pip setuptools pipenv==9.0.3
## pip3 --version
#- pipenv install
#- source $(pipenv --venv)/bin/activate
# - pipenv shell
# - python --version
# - pip3 show django | grep Version
django-tests:
tags:
- ubuntu
- regular
script:
- cd src
# - python manage.py makemigrations degree
# - python manage.py makemigrations educator
# - python manage.py makemigrations upload
# - python manage.py migrate
#- python manage.py test
# apt-get --quiet=2 não é efetivo, com >> /dev/null só mostra erros da saída
# stderr
- apt-get update --assume-yes >> /dev/null
- apt-get install --assume-yes python3-pip libpq-dev postgresql-client >> /dev/null
- pip3 install --quiet -r requirements.txt
- pip3 show django | grep Version
django-tests:
tags:
- ubuntu
- regular
script:
- cd src
- python3 manage.py makemigrations degree
- python3 manage.py makemigrations educator
- python3 manage.py makemigrations submission
- python3 manage.py makemigrations student
- python3 manage.py makemigrations admission
- python3 manage.py migrate
- python3 manage.py test
version: '3'
services:
db:
container_name: adega_db_1
container_name: adega_db
image: postgres
environment:
- POSTGRES_USER=adega
- POSTGRES_PASSWORD=adega
- POSTGRES_DB=adega
web:
container_name: adega_web_1
container_name: adega_web
build:
context: .
dockerfile: ./docker_scripts/Dockerfile
......@@ -25,5 +25,5 @@ services:
- POSTGRES_USER=adega
- POSTGRES_PASSWORD=adega
- POSTGRES_DB=adega
- POSTGRES_HOST=adega_db_1
- POSTGRES_HOST=adega_db
- VERSION=DEVELOPMENT
......@@ -23,7 +23,7 @@ services:
- POSTGRES_USER=adega
- POSTGRES_PASSWORD=adega
- POSTGRES_DB=adega
- POSTGRES_HOST=adega_db_1
- POSTGRES_HOST=adega_db
- VERSION=PRODUCTION
nginx:
......
......@@ -13,8 +13,9 @@ https://docs.djangoproject.com/en/1.9/ref/settings/
import os
from django.contrib import messages
import os
print()
# copy envioment variables to env
env = os.environ.copy()
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
......@@ -90,27 +91,19 @@ WSGI_APPLICATION = 'adega.wsgi.application'
# Database
# https://docs.djangoproject.com/en/1.9/ref/settings/#databases
#DATABASES = {
# 'default': {
# 'ENGINE': 'django.db.backends.sqlite3',
# 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
# }
#}
# verifica se informação do banco de dados está definido em variavel de
# ambiente, caso não esteja setado usa se informações default.
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'adega',
'USER': 'adega',
'PASSWORD': 'adega',
'HOST': 'adega_db_1',
'PORT': '5432',
'NAME': env.get("POSTGRES_DB", "adega"),
'USER': env.get("POSTGRES_USER", "adega"),
'PASSWORD': env.get("POSTGRES_PASSWORD", "adega"),
'HOST': env.get("POSTGRES_HOST", "adega_db"),
'PORT': env.get("POSTGRES_PORT", "5432")
}
}
AUTHENTICATION_BACKENDS = ['public.auth.EmailBackend']
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment