Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker + french localisation #19

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
docker/data
extra/
22 changes: 22 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM ubuntu:impish

ENV DEBIAN_FRONTEND noninteractive


RUN apt update ; apt install -y git python3-pip virtualenv sqlite3 gettext

WORKDIR /app

RUN set -x ; virtualenv -p python3 python-venv ; . python-venv/bin/activate

ADD . /app

COPY docker/entrypoint.sh /app
COPY docker/gdpr.sh /app

RUN . python-venv/bin/activate ; pip install -r requirements.txt

RUN . python-venv/bin/activate ; django-admin compilemessages | grep -v "is already compiled and up to date"

ENTRYPOINT /app/entrypoint.sh
EXPOSE 8000
2 changes: 1 addition & 1 deletion audit/management/commands/populate.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class Command(BaseCommand):
help = 'Load Predefined lists'

def handle(self, *args, **options):
fpath = input('Enter a suitable JSON list file (list.en.json or list.it.json): ')
fpath = input('Enter a suitable JSON list file (list.en.json, list.it.json or list.fr.json): ')
with open(fpath) as f:
d = json.load(f)
key_class = [
Expand Down
Binary file added audit/static/img/fr/activity.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added audit/static/img/fr/add_activity.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added audit/static/img/fr/add_breach_detection.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added audit/static/img/fr/add_breach_response.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added audit/static/img/fr/add_data_audit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added audit/static/img/fr/add_data_policy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added audit/static/img/fr/add_dpia.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added audit/static/img/fr/add_organization.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added audit/static/img/fr/add_process.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
598 changes: 598 additions & 0 deletions audit/static/img/fr/ap.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
840 changes: 840 additions & 0 deletions audit/static/img/fr/asv.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added audit/static/img/fr/breach_detection.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added audit/static/img/fr/breach_response.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added audit/static/img/fr/create_report.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added audit/static/img/fr/data_audit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added audit/static/img/fr/data_policy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added audit/static/img/fr/first_time.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
311 changes: 311 additions & 0 deletions audit/static/img/fr/gdpr_step1.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
311 changes: 311 additions & 0 deletions audit/static/img/fr/gdpr_step2.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
311 changes: 311 additions & 0 deletions audit/static/img/fr/gdpr_step3.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
311 changes: 311 additions & 0 deletions audit/static/img/fr/gdpr_step4.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1,161 changes: 1,161 additions & 0 deletions audit/static/img/fr/incident_response.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added audit/static/img/fr/organization.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added audit/static/img/fr/process.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
321 changes: 321 additions & 0 deletions audit/static/img/fr/registry_app.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@


# docker usage

```
git clone https://github.com/mqu/gdpr-registry-app.git gdpr-registry
cd gdpr-registry/docker
mkdir -p data data/backup data/stamps/ ; touch data/db.sqlite3

docker-compose build
docker-compose up -d

# add an admin user
docker-compose exec app /app/gdpr.sh create-admin

# backup
docker-compose exec app /app/gdpr.sh backup

# restart
docker-compose down ; docker-compose up -d ; docker-compose logs -ft
```
17 changes: 17 additions & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: "3.7"

services:

app:
image: custom-build/gdpr-registry-app
build:
context: ..
volumes:
# - ./build/gdpr-registry-app/gdpr.sh:/app/gdpr.sh
# - ./build/gdpr-registry-app/entrypoint.sh:/app/entrypoint.sh
- ./data/db.sqlite3:/app/db.sqlite3
- ./data/backup:/backup
- ./data/stamps:/app/.stamps/
ports:
- 8000:8000
# entrypoint: sleep 3600
8 changes: 8 additions & 0 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

cd /app ;

[ ! -f .stamps/installed ] && /app/gdpr.sh install
[ ! -f ./.stamps/populated ] && /app/gdpr.sh populate

/app/gdpr.sh run
100 changes: 100 additions & 0 deletions docker/gdpr.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
#!/bin/bash

cd /app ; . python-venv/bin/activate

do_populate(){
echo "list.fr.json" | python manage.py populate
touch ./.stamps/populated
}

# https://github.com/pluribus-one/gdpr-registry-app#base-installation
do_install(){
echo "## installing gdpr application"

mkdir -p .stamps/

# update localisations
# django-admin compilemessages > /dev/null

python manage.py makemigrations axes audit jet dashboard
python manage.py migrate

# python manage.py collectstatic -> error

# need stdin for this command
# python manage.py createsuperuser
# non interractive mode admin user creation
# python manage.py createsuperuser --username foobar --noinput --email [email protected]

touch .stamps/installed
}

# interractive procedure to create admin user
do_create_admin(){
python manage.py createsuperuser $*
}

do_reset() {
echo "## resetting gdpr application"

rm secret.txt
rm db.sqlite3
rm .stamps/*
python manage.py migrate
# python manage.py createsuperuser --username foobar --noinput --email [email protected]
echo "list.en.json" | python manage.py populate

}

# https://github.com/pluribus-one/gdpr-registry-app#updates
do_upgrade(){
echo "## running upgrade for gdpr application"

git pull origin master
python manage.py makemigrations axes audit jet dashboard
python manage.py migrate
do_populate
#python manage.py collectstatic

}

do_backup(){
echo "## making backup"
mkdir -p /backup
cp db.sqlite3 /backup
echo ".dump" | sqlite3 db.sqlite3 > /backup/gdpr.sql
}

do_run() {
echo "## running gdpr application"
python manage.py runserver 0.0.0.0:8000
}

cmd=$1 ; shift
case $cmd in
run)
do_run $*
;;
backup)
do_backup $*
;;
reset)
do_reset $*
;;
upgrade)
do_upgrade $*
;;
install)
do_install $*
;;
upgrade)
do_upgrade $*
;;
populate)
do_populate $*
;;
create-admin)
do_create_admin $*
;;
esac

Loading