Commit 70531817 authored by Odair M.'s avatar Odair M.

j

parents afe2e068 810a9890
Pipeline #19600 failed with stage
in 1 minute and 20 seconds
<<<<<<< HEAD
version: '3'
services:
db:
......@@ -42,3 +43,45 @@ services:
volumes:
- ./static:/adega/static
- /etc/ssl:/ssl
||||||| merged common ancestors
=======
version: '3'
services:
db:
image: postgres
environment:
- POSTGRES_USER=adega
- POSTGRES_PASSWORD=adega
- POSTGRES_DB=adega
web:
build:
context: .
dockerfile: ./docker_scripts/Dockerfile
command: bash "./docker_scripts/on_docker_init_production.sh"
volumes:
- .:/adega
# ports:
# - "8000:8000"
links:
- db
depends_on:
- db
environment:
- POSTGRES_USER=adega
- POSTGRES_PASSWORD=adega
- POSTGRES_DB=adega
- POSTGRES_HOST=adega_db
- VERSION=PRODUCTION
nginx:
restart: always
build: ./nginx/
ports:
- "8000:80"
depends_on:
- web
links:
- web:web
volumes:
- ./static:/adega/static
>>>>>>> origin/issue/141
......@@ -28,6 +28,7 @@ clean-docs:
@rm -rf docs
install:
<<<<<<< HEAD
apt-get update -qq
apt-get install -y python3-dev python3-pip libpq-dev postgresql postgresql-contrib
......@@ -69,5 +70,63 @@ args = `arg="$(filter-out $@,$(MAKECMDGOALS))" && echo $${arg:-${1}}`
docker-manage:
@echo $(call args,"")
docker exec -it adega_web bash -c "cd src; python3 manage.py $(call args,'')"
||||||| merged common ancestors
apt-get update
apt-get install -y python3-dev
apt-get install -y python3-pip
apt-get install -y libpq-dev
apt-get install -y postgresql postgresql-contrib
pip3 install -U pip setuptools
pip3 install -r requirements.txt
install-dev: install
pip3 install -r requirements-dev.txt
create-db:
mysql -u root < configure-db.sql
python3 manage.py migrate
=======
apt-get update -qq
apt-get install -y python3-dev python3-pip libpq-dev postgresql postgresql-contrib
install-user:
pip3 install --user -U pip setuptools pipenv==9.0.3
pipenv install
# TODO: Create the files in docker with $USER owner
docker-fix:
chown -R $USER:$USER *
docker-up:
docker-compose --project-directory . -f docker_scripts/docker-compose.yml -p adega up
docker-production:
docker-compose --project-directory . -f docker_scripts/docker-production.yml -p adega up
docker-remove-all:
docker rm adega_web_1 adega_db_1
docker rmi adega_web
# Maybe this will not works in all OS systems
docker-install:
apt-get install docker
apt-get install docker-compose
# The follows commands permit to use manage.py with make. Examples:
# make docker-manage migrate
# make docker-manage makemigrations uploads
%:
@:
args = `arg="$(filter-out $@,$(MAKECMDGOALS))" && echo $${arg:-${1}}`
docker-manage:
@echo $(call args,"")
docker exec -it adega_web_1 bash -c "cd src; python3 manage.py $(call args,'')"
>>>>>>> origin/issue/141
##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##
upstream adega {
server unix:/var/www/adega/adega.sock fail_timeout=10;
}
# Default server configuration
#
server {
listen 80 default_server;
listen [::]:80 default_server;
# Redirect all HTTP requests to HTTPS with a 301 Moved Permanently response.
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
charset utf-8;
# certs sent to the client in SERVER HELLO are concatenated in ssl_certificate
ssl_certificate /etc/ssl/adega/adega.crt;
ssl_certificate_key /etc/ssl/adega/adega.key;
ssl_session_timeout 1d;
ssl_session_cache shared:SSL:50m;
ssl_session_tickets off;
# modern configuration. tweak to your needs.
ssl_protocols TLSv1.2;
ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256';
ssl_prefer_server_ciphers on;
# HSTS (ngx_http_headers_module is required) (15768000 seconds = 6 months)
add_header Strict-Transport-Security max-age=15768000;
# OCSP Stapling ---
# fetch OCSP records from URL in ssl_certificate and cache them
ssl_stapling on;
ssl_stapling_verify on;
## verify chain of trust of OCSP response using Root CA and Intermediate certs
#ssl_trusted_certificate /path/to/root_CA_cert_plus_intermediates;
# resolver <IP DNS resolver>;
root /var/www/html;
# Add index.php to the list if you are using PHP
index index.php index.html index.htm index.nginx-debian.html;
server_name _;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
autoindex on;
try_files $uri $uri/ =404;
disable_symlinks off;
}
location /adega {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
include proxy_params;
proxy_redirect off;
proxy_pass http://adega/;
}
location /adega/static {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
root /var/www;
autoindex on;
try_files $uri $uri/ =404;
disable_symlinks on;
}
location ~ /\.ht {
deny all;
}
}
##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##
upstream adega {
server unix:/var/www/adega/adega.sock fail_timeout=10;
}
# Default server configuration
#
server {
listen 80 default_server;
listen [::]:80 default_server;
# Redirect all HTTP requests to HTTPS with a 301 Moved Permanently response.
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
charset utf-8;
# certs sent to the client in SERVER HELLO are concatenated in ssl_certificate
ssl_certificate /etc/ssl/adega/adega.crt;
ssl_certificate_key /etc/ssl/adega/adega.key;
ssl_session_timeout 1d;
ssl_session_cache shared:SSL:50m;
ssl_session_tickets off;
# modern configuration. tweak to your needs.
ssl_protocols TLSv1.2;
ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256';
ssl_prefer_server_ciphers on;
# HSTS (ngx_http_headers_module is required) (15768000 seconds = 6 months)
add_header Strict-Transport-Security max-age=15768000;
# OCSP Stapling ---
# fetch OCSP records from URL in ssl_certificate and cache them
ssl_stapling on;
ssl_stapling_verify on;
## verify chain of trust of OCSP response using Root CA and Intermediate certs
#ssl_trusted_certificate /path/to/root_CA_cert_plus_intermediates;
# resolver <IP DNS resolver>;
root /var/www/html;
# Add index.php to the list if you are using PHP
index index.php index.html index.htm index.nginx-debian.html;
server_name _;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
autoindex on;
try_files $uri $uri/ =404;
disable_symlinks off;
}
location /adega {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
include proxy_params;
proxy_redirect off;
proxy_pass http://adega/;
}
location /adega/static {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
root /var/www;
autoindex on;
try_files $uri $uri/ =404;
disable_symlinks on;
}
location ~ /\.ht {
deny all;
}
}
<<<<<<< HEAD
server {
listen 80 default_server;
server_name adega.c3sl.ufpr.br;
......@@ -35,3 +36,32 @@ server {
}
}
||||||| merged common ancestors
=======
server {
listen 80;
server_name localhost;
charset utf-8;
client_max_body_size 100M;
proxy_connect_timeout 600;
proxy_read_timeout 600;
uwsgi_read_timeout 600;
fastcgi_read_timeout 600;
keepalive_timeout 600;
location /static/ {
alias /adega/static/;
}
location / {
proxy_pass http://web:8000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
>>>>>>> origin/issue/141
......@@ -2,8 +2,16 @@ coverage
ipython
Django==1.11.10
django-widget-tweaks
<<<<<<< HEAD
django-guardian
pandas==0.22
||||||| merged common ancestors
pandas==0.18.1
django-extension
psycopg2
=======
pandas==0.22
>>>>>>> origin/issue/141
xlrd
django-extensions
ujson
......
......@@ -11,9 +11,18 @@ https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
<<<<<<< HEAD:src/adega/settings.py
from django.contrib import messages
env = os.environ.copy()
||||||| merged common ancestors:src/uploads/settings.py
=======
from django.contrib import messages
# copy envioment variables to env
env = os.environ.copy()
>>>>>>> origin/issue/141:src/adega/settings.py
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
......@@ -39,6 +48,7 @@ INSTALLED_APPS = [
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
<<<<<<< HEAD:src/adega/settings.py
'django_extensions',
'widget_tweaks',
'guardian',
......@@ -52,6 +62,23 @@ INSTALLED_APPS = [
'student',
'report_api',
'submission'
||||||| merged common ancestors:src/uploads/settings.py
'uploads.core'
=======
'django_extensions',
'widget_tweaks',
'adega',
'public',
'degree',
'educator',
'admission',
'course',
'student',
'report_api',
'submission'
>>>>>>> origin/issue/141:src/adega/settings.py
]
MIDDLEWARE_CLASSES = [
......@@ -92,6 +119,7 @@ WSGI_APPLICATION = 'adega.wsgi.application'
# Database
# https://docs.djangoproject.com/en/1.9/ref/settings/#databases
<<<<<<< HEAD:src/adega/settings.py
#DATABASES = {
# 'default': {
......@@ -101,17 +129,36 @@ WSGI_APPLICATION = 'adega.wsgi.application'
#}
||||||| merged common ancestors:src/uploads/settings.py
=======
# verifica se informação do banco de dados está definido em variavel de
# ambiente, caso não esteja setado usa se informações default.
>>>>>>> origin/issue/141:src/adega/settings.py
DATABASES = {
'default': {
<<<<<<< HEAD:src/adega/settings.py
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'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_1"),
'PORT': env.get("POSTGRES_PORT", "5432")
||||||| merged common ancestors:src/uploads/settings.py
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
=======
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'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")
>>>>>>> origin/issue/141:src/adega/settings.py
}
}
<<<<<<< HEAD:src/adega/settings.py
AUTHENTICATION_BACKENDS = [
'public.auth.EmailBackend',
'guardian.backends.ObjectPermissionBackend',
......@@ -121,6 +168,13 @@ AUTHENTICATION_BACKENDS = [
ANONYMOUS_USER_NAME = "Público"
LOGIN_URL = 'public:index'
||||||| merged common ancestors:src/uploads/settings.py
=======
AUTHENTICATION_BACKENDS = ['public.auth.EmailBackend']
LOGIN_URL = 'public:index'
>>>>>>> origin/issue/141:src/adega/settings.py
# Password validation
# https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators
......@@ -176,7 +230,16 @@ else:
STATIC_ROOT = os.path.join(PROJECT_DIR, 'static')
MEDIA_URL = '/script/base/'
<<<<<<< HEAD:src/adega/settings.py
MEDIA_ROOT = os.path.join(PROJECT_DIR, 'submission')
# MEDIA_URL = None # a gente não quer ninguem fazendo download disso
# MEDIA_ROOT = os.path.join(PROJECT_DIR, 'submission')
||||||| merged common ancestors:src/uploads/settings.py
MEDIA_ROOT = os.path.join(BASE_DIR, 'script/base')
=======
MEDIA_ROOT = os.path.join(PROJECT_DIR, 'submission')
# MEDIA_URL = None # a gente não quer ninguem fazendo download disso
# MEDIA_ROOT = os.path.join(PROJECT_DIR, 'uploads')
>>>>>>> origin/issue/141:src/adega/settings.py
<<<<<<< HEAD
html {
height: 100%;
......@@ -181,4 +182,182 @@ footer h3 {
margin-left:10px;
margin-right:10px;
cursor: pointer;
}
\ No newline at end of file
}
||||||| merged common ancestors
=======
html {
height: 100%;
font-size: 100%; /* Fix bootstrap resizing problem */
}
body {
min-height: 100%;
display: flex;
flex-direction: column;
}
#header {
}
#wrap-page {
flex-grow: 1;
}
#content {
min-height: 100px;
padding: 2em 2em 48px;
}
h1#title {
color: #33d333;
font-size: 44px;
}
.navbar-text {
color: #afb0c5 !important;
}
/* ========================================= MESSAGES */
.alert {
border-radius: 0;
}
#messages {
margin-left: -15px;
margin-right: -15px;
margin-bottom: 1.7em;
}
#messages div[role=alert] {
margin: 0;
}
/* ========================================= FOOTER */
footer {
background-color: #263646;
border-top: 4px solid #31c2e4;
padding-top: 20px;
padding-bottom: 20px;
color: #FFF;
}
footer a {
color: #FFF;
font-size: 1.1em;
}
footer a:hover {
color: #18BC9C;
}
footer h3 {
padding-bottom: 4px;
border-bottom: 2px solid #FFF;
}
/* =================== SIDEBAR ======================== */
.sidebar {
transition: all 0.5s ease-in-out;
padding: 0;
background-color: #2f4861;
min-height: 100%;
}
.sidebar ul {
list-style:none;
margin:0;
padding:0;
}
.nav-item {
display: flex;
}
.sidebar li a {
flex-grow: 1;
outline: none;
}
.sidebar .drop {
display: inline-block;
padding: 14px 18px 12px 20px;
flex-grow: 0;
}
.rotate {
-webkit-transform: rotate(0deg);
-moz-transform: rotate(0deg);
transform: rotate(0deg);
transition: all .25s ease-in;
}
.collapsed .rotate {
-webkit-transform: rotate(0deg);
-moz-transform: rotate(0deg);
transform: rotate(0deg);
transition: all .25s ease-out;
}
.sidebar li a {
padding: 14px 0px 12px 20px;
color: #d3d5d8;
border-left: 0px solid #159e83;
text-decoration: none
}
.sidebar li li a {
padding: 8px auto;
}
.sidebar li a:hover {
color: #FFF !important;
background-color: #132940;
}
.sidebar li .sub-menu li a {
position:relative;
}
.sidebar li .sub-menu li a:hover:after {
content: "";
position: absolute;
left: -5px;
top: 0;
width: 5px;
background-color: #111;
height: 100%;
}
.sidebar .sub-menu li a:hover{
background-color:#222;
padding-left:20px;
transition: all 0.5s ease-in-out
}
.sub-menu {
border-left:5px solid #4a7d73;
}
.content {
padding: 2em;
}
.paginate_button{
margin-left:10px;
margin-right:10px;
cursor: pointer;
}
>>>>>>> origin/issue/141
<<<<<<< HEAD
// This module simplify the use of Plotly library on this project
class AdegaChart{
......@@ -173,4 +174,173 @@ AdegaChart.sort_object_by_key = function(obj){
});
return [keys,values];
}
\ No newline at end of file
}
||||||| merged common ancestors
=======
// This module simplify the use of Plotly library on this project
class AdegaChart{
constructor(config){
//Object with two arrays (two charts), and the key is the x-axis
this.data = config.data || null;
this.hide_charts = config.hide_charts || null;
this.legend = config.legend || null;
this.barmode = config.barmode || "stack";
this.yaxis_title = config.yaxis_title || "";
this.yaxis2_title = config.yaxis2_title || "";
this.xaxis_title = config.xaxis_title || "";
this.mode = config.mode;
this.marker = config.marker;
if(config.data == null){
this.data_x = config.data_x;
this.data_y = config.data_y;
this.error_y = config.error_y || null;
}
else{
this.data_x = [];
this.data_y = [];
var first_element = Object.keys(this.data)[0];
first_element = this.data[first_element];
var multiplePlots = Array.isArray(first_element);