Commit d218357c authored by guglielmo's avatar guglielmo

django2 porting, with fork/patch/pull request to the django-admin-row-actions app;

the template has already been transformed into the one used in
dockerised stacks
parent f505e39b
[run]
source=
./project
omit=
./project/tests/*
./project/webapp/migrations/*
./project/webapp/tests/*
/.gitlab
/compose
/config/.dcenv
/config/.env
/docs
/resources
/venv
.dockerignore
.gitignore
.gitlab-ci.yml
.tmuxinator.yml
.python-version
docker-compose.yml
docker-compose.*.yml
Dockerfile
dump*
[flake8]
max-line-length = 120
exclude = docs,venv,migrations
max-complexity = 20
...@@ -4,11 +4,8 @@ ...@@ -4,11 +4,8 @@
__pycache__ __pycache__
# Env file # Env file
.env /config/.env
/config/.dcenv
# Logs
*.log
pip-log.txt
# Unit test / coverage reports # Unit test / coverage reports
.coverage .coverage
...@@ -39,3 +36,5 @@ node_modules/ ...@@ -39,3 +36,5 @@ node_modules/
# osx .DS_Store # osx .DS_Store
.DS_Store .DS_Store
venv
\ No newline at end of file
...@@ -5,68 +5,83 @@ stages: ...@@ -5,68 +5,83 @@ stages:
- deploy - deploy
variables: variables:
CONTAINER_IMAGE: ${CI_REGISTRY}/${CI_PROJECT_PATH}:latest POSTGRES_DB: ${POSTGRES_DB}
DOCKER_DRIVER: overlay2 POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASS}
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache"
# Anchors
.pull_cache_job: &pull_cache_job
cache: # Pull virtual environment from cache
key: "virtualenv-$CI_PROJECT_NAME"
policy: pull
paths:
# - .cache/pip
- venv/
before_script:
- source venv/bin/activate # Activate virtual environment
- pip freeze # List installed packages in virtualenv
.django_tests: &django_tests
# Install geo-spatial libs required by GeoDjango on Debian-based images.
stage: test
services:
- mdillon/postgis:9.6-alpine
variables:
DATABASE_URL: "postgresql://${POSTGRES_USER}:${POSTGRES_PASS}@mdillon__postgis/${POSTGRES_DB}"
DJANGO_SETTINGS_MODULE: "config.settings"
script:
- apt-get update
- apt-get install -y --allow-unauthenticated --no-install-recommends binutils
- coverage run manage.py test
- coverage report --omit="*/test*"
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# build stage # build stage
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# Build: build virtualenv job
build virtualenv: build virtualenv:
image: python:latest image: python:3.6-stretch
stage: build stage: build
variables:
DATABASE_URL: "sqlite://:memory:"
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache"
cache: cache:
key: "virtualenv-$CI_PROJECT_NAME" key: "virtualenv-$CI_PROJECT_NAME"
paths: paths:
- .cache/ - .cache/pip
- venv/ - venv/
script: script:
- pip install virtualenv - pip install -U pip virtualenv safety
- virtualenv venv - virtualenv venv # Create virtual environment
- source venv/bin/activate - source venv/bin/activate # Activate virtual environment
- echo "$(python -V) from $(which python) - $(pip -V)" - pip install --upgrade pip
- pip install -r requirements.txt - pip install -r requirements.txt # Install project requirements inside venv
- pip install safety
- safety check - safety check
- pip freeze # List installed packages in venv
except:
- schedules
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# test stage # test stage
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
django tests:
image: python:latest
stage: test
variables:
DATABASE_URL: "sqlite://:memory:"
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache"
cache:
key: "virtualenv-$CI_PROJECT_NAME"
paths:
- .cache/
- venv/
before_script:
- source venv/bin/activate
- echo "$(python -V) from $(which python) - $(pip -V)"
- pip install coverage factory_boy Faker safety
script:
- coverage run manage.py test && coverage report
allow_failure: true
# Test: flake8 job
flake8: flake8:
image: python:latest image: python:3.6-stretch
stage: test stage: test
variables: <<: *pull_cache_job
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache"
cache:
key: "virtualenv-$CI_PROJECT_NAME-$CI_JOB_NAME"
paths:
- .cache/
before_script:
- pip install flake8
script: script:
- pip install flake8
- flake8 - flake8
allow_failure: true allow_failure: true
except:
- schedules
# Test: django tests job
django tests:
image: python:3.6-stretch
<<: *pull_cache_job
<<: *django_tests
except:
- schedules
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# deploy stage # deploy stage
...@@ -81,6 +96,7 @@ deploy_staging: ...@@ -81,6 +96,7 @@ deploy_staging:
DOCKER_HOST: "tcp://${STAGING_HOST_IP}:2376" DOCKER_HOST: "tcp://${STAGING_HOST_IP}:2376"
DOCKER_CERT_PATH: "certs" DOCKER_CERT_PATH: "certs"
DOMAINS: ${DOMAINS_STAGING} DOMAINS: ${DOMAINS_STAGING}
SECRET_KEY: ${STAGING_SECRET_KEY}
USE_EMAIL_SMTP: 0 USE_EMAIL_SMTP: 0
EMAIL_HOST_PORT: 0 EMAIL_HOST_PORT: 0
EMAIL_HOST_USE_TLS: 0 EMAIL_HOST_USE_TLS: 0
...@@ -89,9 +105,9 @@ deploy_staging: ...@@ -89,9 +105,9 @@ deploy_staging:
- echo "$CA" > $DOCKER_CERT_PATH/ca.pem - echo "$CA" > $DOCKER_CERT_PATH/ca.pem
- echo "$CLIENT_CERT" > $DOCKER_CERT_PATH/cert.pem - echo "$CLIENT_CERT" > $DOCKER_CERT_PATH/cert.pem
- echo "$CLIENT_KEY" > $DOCKER_CERT_PATH/key.pem - echo "$CLIENT_KEY" > $DOCKER_CERT_PATH/key.pem
- docker build --compress -t depp/senato-ragazzi-2:latest . - docker build --compress -t openpolis/sources-verification:latest .
- docker-compose down - docker-compose down
- docker-compose up -d - docker-compose up -d --build
- docker exec spir_web python manage.py collectstatic --noinput - docker exec spir_web python manage.py collectstatic --noinput
- docker exec spir_web python manage.py migrate - docker exec spir_web python manage.py migrate
- rm -rf $DOCKER_CERT_PATH - rm -rf $DOCKER_CERT_PATH
...@@ -113,12 +129,13 @@ deploy_staging: ...@@ -113,12 +129,13 @@ deploy_staging:
DOCKER_HOST: "tcp://${PRODUCTION_HOST_IP}:2376" DOCKER_HOST: "tcp://${PRODUCTION_HOST_IP}:2376"
DOCKER_CERT_PATH: "certs" DOCKER_CERT_PATH: "certs"
DOMAINS: ${DOMAINS_PRODUCTION} DOMAINS: ${DOMAINS_PRODUCTION}
SECRET_KEY: ${PRODUCTION_SECRET_KEY}
script: script:
- mkdir $DOCKER_CERT_PATH - mkdir $DOCKER_CERT_PATH
- echo "$CA" > $DOCKER_CERT_PATH/ca.pem - echo "$CA" > $DOCKER_CERT_PATH/ca.pem
- echo "$CLIENT_CERT" > $DOCKER_CERT_PATH/cert.pem - echo "$CLIENT_CERT" > $DOCKER_CERT_PATH/cert.pem
- echo "$CLIENT_KEY" > $DOCKER_CERT_PATH/key.pem - echo "$CLIENT_KEY" > $DOCKER_CERT_PATH/key.pem
- docker build --compress -t depp/senato-ragazzi-2:latest . - docker build --compress -t openpolis/sources-verification:latest .
- docker-compose down - docker-compose down
- docker-compose up -d --build --force-recreate - docker-compose up -d --build --force-recreate
- docker exec senato-ragazzi-2_web_1 python manage.py collectstatic --noinput - docker exec senato-ragazzi-2_web_1 python manage.py collectstatic --noinput
......
# ~/.tmuxinator/opdm-service.yml
name: op-sources-verification
root: ./
# Optional tmux socket
# socket_name: foo
# Ensure used daemons are used before start
pre: pg_ctl -D /usr/local/var/postgres start
# Runs after everything. Use it to attach to tmux with custom options etc.
post: pg_ctl -D /usr/local/var/postgres stop
windows:
- shell_plus:
- source venv/bin/activate
- python manage.py shell_plus --ipython
- free_shell:
- source venv/bin/activate
- redis_server:
- redis-server
...@@ -15,7 +15,7 @@ COPY locales.txt /etc/locale.gen ...@@ -15,7 +15,7 @@ COPY locales.txt /etc/locale.gen
RUN locale-gen RUN locale-gen
# upgrade pip # upgrade pip
RUN pip3 install --upgrade pip RUN pip3 install --upgrade pip setuptools
# initialize app # initialize app
RUN mkdir -p /app RUN mkdir -p /app
......
server { server {
listen 80; listen 80;
server_name localhost senato2.staging.deppsviluppo.org; server_name localhost staging.verificafonti.openpolis.it verificafonti.openpolis.it;
charset utf-8; charset utf-8;
client_max_body_size 64M; client_max_body_size 16M;
location /static { location /static {
alias /app/public/static; alias /app/public/static;
......
FROM solr
MAINTAINER Guglielmo Celata "guglielmo@openpolis.it"
COPY config /opt/solr/server/solr/mycores/senatoragazzi/conf
COPY core.properties /opt/solr/server/solr/mycores/senatoragazzi/
USER root
RUN chown -R solr:solr /opt/solr/server/solr/mycores/senatoragazzi \
&& mkdir -p /opt/solr/server/solr/mycores/senatoragazzi/data \
&& chown -R solr:solr /opt/solr/server/solr/mycores/senatoragazzi/data \
&& mkdir -p /home/solr \
&& echo 'alias ll="ls -l"' >> /home/solr/.bashrc \
&& echo 'alias la="ls -la"' >> /home/solr/.bashrc \
&& chown -R solr:solr /home/solr
USER solr
CMD ["/opt/solr/bin/solr", "-f"]
# Set of Catalan contractions for ElisionFilter
# TODO: load this as a resource from the analyzer and sync it in build.xml
d
l
m
n
s
t
# Set of French contractions for ElisionFilter
# TODO: load this as a resource from the analyzer and sync it in build.xml
l
m
t
qu
n
s
j
d
c
jusqu
quoiqu
lorsqu
puisqu
# Set of Irish contractions for ElisionFilter
# TODO: load this as a resource from the analyzer and sync it in build.xml
d
m
b
# Set of Italian contractions for ElisionFilter
# TODO: load this as a resource from the analyzer and sync it in build.xml
c
l
all
dall
dell
nell
sull
coll
pell
gl
agl
dagl
degl
negl
sugl
un
m
t
s
v
d
# Set of Irish hyphenations for StopFilter
# TODO: load this as a resource from the analyzer and sync it in build.xml
h
n
t
# Set of overrides for the dutch stemmer
# TODO: load this as a resource from the analyzer and sync it in build.xml
fiets fiets
bromfiets bromfiets
ei eier
kind kinder
This diff is collapsed.
# This file was created by Jacques Savoy and is distributed under the BSD license.
# See http://members.unine.ch/jacques.savoy/clef/index.html.
# Also see http://www.opensource.org/licenses/bsd-license.html
# Cleaned on October 11, 2009 (not normalized, so use before normalization)
# This means that when modifying this list, you might need to add some
# redundant entries, for example containing forms with both أ and ا
من
ومن
منها
منه
في
وفي
فيها
فيه
و
ف
ثم
او
أو
ب
بها
به
ا
أ
اى
اي
أي
أى
لا
ولا
الا
ألا
إلا
لكن
ما
وما
كما
فما
عن
مع
اذا
إذا
ان
أن
إن
انها
أنها
إنها
انه
أنه
إنه
بان
بأن
فان
فأن
وان
وأن
وإن
التى
التي
الذى
الذي
الذين
الى
الي
إلى
إلي
على
عليها
عليه
اما
أما
إما
ايضا
أيضا
كل
وكل
لم
ولم
لن
ولن
هى
هي
هو
وهى
وهي
وهو
فهى
فهي
فهو
انت
أنت
لك
لها
له
هذه
هذا
تلك
ذلك
هناك
كانت
كان
يكون
تكون
وكانت
وكان
غير
بعض
قد
نحو
بين
بينما
منذ
ضمن
حيث
الان
الآن
خلال
بعد
قبل
حتى
عند
عندما
لدى
جميع
# This file was created by Jacques Savoy and is distributed under the BSD license.
# See http://members.unine.ch/jacques.savoy/clef/index.html.
# Also see http://www.opensource.org/licenses/bsd-license.html
а
аз
ако
ала
бе
без
беше
би
бил
била
били
било
близо
бъдат
бъде
бяха
в
вас
ваш
ваша
вероятно
вече
взема
ви
вие
винаги
все
всеки
всички
всичко
всяка
във
въпреки
върху
г
ги
главно
го
д
да
дали
до
докато
докога
дори
досега
доста
е
едва
един
ето
за
зад
заедно
заради
засега
затова
защо
защото
и
из
или
им
има
имат
иска
й
каза
как
каква
какво
както
какъв
като
кога
когато
което
които
кой
който
колко
която
къде
където
към
ли
м
ме
между
мен
ми
мнозина
мога
могат
може
моля
момента
му
н
на
над
назад
най
направи
напред
например
нас
не
него
нея
ни
ние
никой
нито
но
някои
някой
няма
обаче
около
освен
особено
от
отгоре
отново
още
пак
по
повече
повечето
под
поне
поради
после
почти
прави
пред
преди
през
при
пък
първо
с
са
само
се
сега
си
скоро
след
сме
според
сред
срещу
сте
съм
със
също
т
тази
така
такива
такъв
там
твой
те
тези
ти
тн
то
това
тогава
този
той
толкова
точно
трябва
тук
тъй
тя
тях
у
харесва
ч
че
често
чрез
ще
щом