Commit a2d9bf5a authored by Guilhem Saurel's avatar Guilhem Saurel
Browse files

dashboard: clean, django 2.0, dockerisation

parent 736e0081
Pipeline #97 failed with stage
in 7 seconds
variables:
GIT_SSL_NO_VERIFY: "true"
dashboard:
stage: deploy
image: eur0c.laas.fr:4567/stack-of-tasks/pinocchio-tutorials/deploy
before_script:
- mkdir -p ~/.ssh
- eval $(ssh-agent -s)
- ssh-add <(echo "$SSH_PRIVATE_KEY")
- echo "$SSH_SERVER_HOSTKEYS" > ~/.ssh/known_hosts
script: "ssh web@eur0c ./deploy-dashboard.sh"
FROM python:3.6-alpine3.6
ENV PYTHONUNBUFFERED 1
RUN mkdir /app /static
WORKDIR /app
COPY requirements.txt .
# Get Dependencies
RUN apk update && apk add --virtual deps \
gcc \
python-dev \
linux-headers \
musl-dev \
postgresql-dev \
&& apk add --no-cache libpq
RUN pip install -r requirements.txt
RUN apk del deps
COPY . .
# Collect Static
ENV REDMINE_TOKEN=placeholder \
GITHUB_TOKEN=placeholder \
DJANGO_SECRET_KEY=placeholder \
POSTGRES_PASSWORD=placeholder
RUN python manage.py collectstatic
version: '3'
volumes:
db:
static:
services:
db:
image: postgres:10-alpine
restart: unless-stopped
env_file:
- .env
volumes:
- "db:/var/lib/postgresql/data"
web:
build: .
restart: unless-stopped
command: python manage.py runserver 0.0.0.0:8000
depends_on:
- db
env_file:
- .env
volumes:
- "static:/static"
ports:
- 8000:8000
migrate:
build: .
command: python manage.py migrate
depends_on:
- db
env_file:
- .env
......@@ -2,17 +2,14 @@
# Generated by Django 1.11.7 on 2017-11-09 15:55
from __future__ import unicode_literals
from os.path import expanduser
from django.conf import settings
from django.db import migrations
import requests
GITHUB_API = 'https://api.github.com'
with open(expanduser('~/.githubtoken')) as f:
TOKEN = f.read().strip()
HEADERS = {
'Authorization': f'token {TOKEN}',
'Authorization': f'token {settings.GITHUB_TOKEN}',
'Accept': 'application/vnd.github.drax-preview+json',
}
......
......@@ -2,8 +2,7 @@
# Generated by Django 1.11.7 on 2017-11-14 09:29
from __future__ import unicode_literals
from os.path import expanduser
from django.conf import settings
from django.db import migrations
import requests
......@@ -12,10 +11,8 @@ REDMINE_APIS = [
'https://redmine.laas.fr',
# 'https://git.openrobots.org',
]
with open(expanduser('~/.redminetoken')) as f:
TOKEN = f.read().strip()
HEADERS = {
'X-Redmine-API-Key': TOKEN,
'X-Redmine-API-Key': settings.REDMINE_TOKEN,
}
PACKAGES = [
'openhrp3-hrp2',
......
......@@ -18,9 +18,9 @@ class License(NamedModel):
class Package(NamedModel, TimeStampedModel):
project = models.ForeignKey(Project)
project = models.ForeignKey(Project, on_delete=models.CASCADE)
homepage = models.URLField(max_length=200, blank=True, null=True)
license = models.ForeignKey(License, blank=True, null=True)
license = models.ForeignKey(License, on_delete=models.CASCADE, blank=True, null=True)
class Meta:
ordering = ('name',)
......@@ -33,10 +33,10 @@ class Package(NamedModel, TimeStampedModel):
class Repo(TimeStampedModel):
package = models.ForeignKey(Package)
package = models.ForeignKey(Package, on_delete=models.CASCADE)
url = models.URLField(max_length=200, unique=True)
homepage = models.URLField(max_length=200, blank=True, null=True)
license = models.ForeignKey(License, blank=True, null=True)
license = models.ForeignKey(License, on_delete=models.CASCADE, blank=True, null=True)
default_branch = models.CharField(max_length=50)
open_issues = models.PositiveSmallIntegerField(blank=True, null=True)
open_pr = models.PositiveSmallIntegerField(blank=True, null=True)
......
"""
Django settings for gepkg project.
Generated by 'django-admin startproject' using Django 1.11.7.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
import os
PROJECT = 'gepkg'
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'c=6-%df*+_4*8vphwwqm1v4^fdv*fc+zb*13ouw-bn7u=pexei'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = ['localhost']
# Application definition
DEBUG = 'DJANGO_DEBUG' in os.environ
ALLOWED_HOSTS = ['localhost', 'eur0c', 'eur0c.laas.fr']
INSTALLED_APPS = [
'django.contrib.admin',
......@@ -74,21 +48,16 @@ TEMPLATES = [
WSGI_APPLICATION = f'{PROJECT}.wsgi.application'
# Database
# https://docs.djangoproject.com/en/1.11/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
'ENGINE': 'django.db.backends.postgresql',
'HOST': 'db',
'USER': 'postgres',
'NAME': 'postgres',
'PASSWORD': os.environ['POSTGRES_PASSWORD'],
}
}
# Password validation
# https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
......@@ -104,24 +73,17 @@ AUTH_PASSWORD_VALIDATORS = [
},
]
# Internationalization
# https://docs.djangoproject.com/en/1.11/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
LANGUAGE_CODE = 'fr-FR'
TIME_ZONE = 'Europe/Paris'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.11/howto/static-files/
STATIC_URL = '/static/'
STATIC_ROOT = '/static/'
SITE_ID = 1
REDMINE_TOKEN = os.environ['REDMINE_TOKEN']
GITHUB_TOKEN = os.environ['GITHUB_TOKEN']
SECRET_KEY = os.environ['DJANGO_SECRET_KEY']
Django
django-autoslug
django-bootstrap3
psycopg2
requests
-e git://github.com/Nim65s/ndh.git#egg=ndh
https://github.com/nim65s/ndh/archive/master.zip#egg=ndh
https://github.com/nim65s/django-autoslug/archive/master.zip#egg=django-autoslug
......@@ -4,13 +4,14 @@
#
# pip-compile --output-file requirements.txt requirements.in
#
-e git+git://github.com/Nim65s/ndh.git#egg=ndh
certifi==2017.11.5 # via requests
chardet==3.0.4 # via requests
django-autoslug==1.9.3
https://github.com/nim65s/django-autoslug/archive/master.zip#egg=django-autoslug
django-bootstrap3==9.1.0
django==1.11.7
django==2.0
idna==2.6 # via requests
https://github.com/nim65s/ndh/archive/master.zip#egg=ndh
psycopg2==2.7.3.2
pytz==2017.3 # via django
requests==2.18.4
urllib3==1.22 # via requests
Supports Markdown
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