Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #1 from EditionOpenAccess/molgen
Molgen
  • Loading branch information
mvogl committed Jun 13, 2018
2 parents 44c6477 + 45ca16b commit 0cdec88
Show file tree
Hide file tree
Showing 168 changed files with 15,548 additions and 1 deletion.
7 changes: 7 additions & 0 deletions .dockerignore
@@ -0,0 +1,7 @@
# excluded files are not sent to build context
# this keeps docker files smaller and file transfers lower
.dockerignore
.gitignore
.gitlab-ci.yml
myvenv
eoa-venv
12 changes: 12 additions & 0 deletions .gitignore
@@ -0,0 +1,12 @@
*.pyc
*~
*.key
*.pem
*.crt
__pychache__
myvenv
eoa-venv
db.sqlite3
/static
.DS_Store
**/migrations
42 changes: 42 additions & 0 deletions .gitlab-ci.yml
@@ -0,0 +1,42 @@
image: django:latest

.shared_hidden_key: &test
services:
- postgres:latest

.shared_hidden_key: &deploy
before_script:
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
- eval $(ssh-agent -s)
- ssh-add <(echo "$SSH_PRIVATE_KEY")
- mkdir -p ~/.ssh
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'

stages:
- test
- deploy

variables:
POSTGRES_DB: postgres
POSTGRES_USER: postgres
POSTGRES_PASSWORD: dev

all_tests:
<<: *test
stage: test
script:
- pip install -r config/requirements.txt
- PGPASSWORD=dev psql -h postgres -U postgres -d template1 -c 'create extension hstore;'
- sh scripts/run_tests.sh

deploy:
<<: *deploy
stage: deploy
script:
- ssh -t cloud@$DEPLOYHOST "export ADMIN_PWD=$DJANGO_ADMIN_PWD && cd django/eoa-django-test && git fetch --all && git reset --hard origin/master && sh scripts/start_deploy.sh "
environment:
name: production
url: https://c105-187.cloud.gwdg.de/publications/studies/312/index.html
only:
- master
when: manual
8 changes: 8 additions & 0 deletions Dockerfile
@@ -0,0 +1,8 @@
FROM python:3.5
ENV PYTHONUNBUFFERED 1
RUN mkdir /code
WORKDIR /code
ADD config/requirements.txt /code/
RUN apt-get update && apt-get install -y postgresql-client
RUN pip3 install -r requirements.txt
ADD . /code/
4 changes: 3 additions & 1 deletion README.md → README
@@ -1,5 +1,7 @@
Using TEI importer for Django models
------------------------------------

This example shows how to use Django models to import a TEI document.
This example shows how to use Django models to import a TEI document.
A view for TEI documents is used to display the database entry as a basic html side.

Mirror is maintained. Or not.
1 change: 1 addition & 0 deletions config/certs/placeholder.txt
@@ -0,0 +1 @@
no text
43 changes: 43 additions & 0 deletions config/nginx/mydjango.conf
@@ -0,0 +1,43 @@
upstream web {
ip_hash;
server web:8000;
}

server {
listen 80;
listen [::]:80;
return 301 https://$host$request_uri;
}


server {

location /static/ {
autoindex on;
alias /static/;
}

location / {
proxy_pass http://web/;
}

location /.well-known {
alias /var/www/c105-187.cloud.gwdg.de/.well-known;
}

listen 443 ssl default_server;
listen [::]:443 ssl default_server;
server_name c105-187.cloud.gwdg.de;
ssl_certificate /etc/nginx/certs/fullchain.pem;
ssl_certificate_key /etc/nginx/certs/privkey.pem;

ssl_stapling on;
ssl_stapling_verify on;

ssl_session_cache shared:le_nginx_SSL:1m;
ssl_session_timeout 1440m;

ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers "ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS";
}
8 changes: 8 additions & 0 deletions config/requirements.txt
@@ -0,0 +1,8 @@
Django
psycopg2
Pillow
xmltodict
django-cms
django-sekizai
lxml
beautifulsoup4
32 changes: 32 additions & 0 deletions docker-compose.yml
@@ -0,0 +1,32 @@
version: '3'

services:
nginx:
image: nginx:latest
environment:
- DEPLOYHOST
ports:
- "80:80"
- "443:443"
volumes:
- .:/code
- ./config/certs:/etc/nginx/certs:ro
- ./config/nginx:/etc/nginx/conf.d
- ./static:/static
depends_on:
- web
web:
build: .
environment:
- ADMIN_PWD
command: ["scripts/wait_for_pg.sh","postgres","sh","scripts/loaddjango.sh"]
depends_on:
- postgres
volumes:
- .:/code
- ./static:/static
#expose:
# - "8000"

postgres:
build: ./scripts/pghstore/.
Empty file added eoa/__init__.py
Empty file.
17 changes: 17 additions & 0 deletions eoa/admin.py
@@ -0,0 +1,17 @@
from django.contrib import admin
from .models import *

admin.site.register(Publication)
admin.site.register(Author)
admin.site.register(Citation)
admin.site.register(Part)
admin.site.register(Chapter)
admin.site.register(Section)
admin.site.register(Subsection)
admin.site.register(Subsubsection)
admin.site.register(Paragraph)
admin.site.register(MixedContent)
admin.site.register(Text)
admin.site.register(Table)
admin.site.register(Figure)
# Register your models here.
5 changes: 5 additions & 0 deletions eoa/apps.py
@@ -0,0 +1,5 @@
from django.apps import AppConfig


class EoaConfig(AppConfig):
name = 'eoa'

0 comments on commit 0cdec88

Please sign in to comment.