Compare commits
42 Commits
Author | SHA1 | Date |
---|---|---|
jaschop | 776803fc96 | |
jaschop | 702f4968f6 | |
HerHde | c1285153ef | |
Brain | fdc81844b5 | |
Brain | b804c22a93 | |
jaschop | 9a7a9379e2 | |
jaschop | 5b707ad294 | |
Brain | c05f040313 | |
Brain | 68bf505cd0 | |
Brain | 2ac03d0c26 | |
Brain | 6b46ea5516 | |
jaschop | 4798263c27 | |
jaschop | 274f984994 | |
jaschop | 37f57eadea | |
zeitschlag | d7f4acf251 | |
zeitschlag | c65ef4a95c | |
zeitschlag | f3840f18b7 | |
jaschop | da46d01765 | |
Brain | 0f9f807256 | |
jaschop | 66294cd52f | |
jaschop | d4a5c8f5eb | |
jaschop | 5e4d6d464d | |
jaschop | 6e77647eb9 | |
weeman | f7278bf7ea | |
weeman | cf1a5a532c | |
weeman | 0fd04d4797 | |
weeman | a5bd954bb5 | |
weeman | 881c3d3038 | |
weeman | d60acd169b | |
weeman | f1ecbadf05 | |
weeman | 67cb8c9152 | |
Brain | f7e058d387 | |
Brain | 695c88e159 | |
Brain | 1360b4c738 | |
Brain | 689a5ba33e | |
Brain | 19aebcc327 | |
scammo | 0fcd407006 | |
weeman | dea781cc29 | |
weeman | be9bc8b5cc | |
weeman | 2833e5751f | |
64bit | 4fab7d7cda | |
Benedikt Brückmann | f131ee335c |
124
.drone.yml
|
@ -4,31 +4,107 @@
|
|||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: default
|
||||
name: qa
|
||||
|
||||
trigger:
|
||||
event:
|
||||
- push
|
||||
- pull_request
|
||||
branch:
|
||||
- main
|
||||
|
||||
steps:
|
||||
- name: qa
|
||||
image: registry.wtf-eg.net/ki-backend-builder:1.0.0
|
||||
commands:
|
||||
- pipenv install --dev
|
||||
- pipenv run flake8
|
||||
- pipenv run reuse lint
|
||||
- pipenv run python -m unittest discover ki
|
||||
|
||||
- name: docker-publish
|
||||
image: plugins/docker
|
||||
settings:
|
||||
registry: registry.wtf-eg.net
|
||||
repo: registry.wtf-eg.net/ki-backend
|
||||
target: ki-backend
|
||||
auto_tag: true
|
||||
username:
|
||||
from_secret: "docker_username"
|
||||
password:
|
||||
from_secret: "docker_password"
|
||||
when:
|
||||
branch:
|
||||
- main
|
||||
- name: install-lint-test
|
||||
image: git.wtf-eg.de/kompetenzinventar/builder:1.0.2
|
||||
commands:
|
||||
- pipenv install --dev
|
||||
- pipenv run flake8
|
||||
- pipenv run reuse lint
|
||||
- pipenv run python -m unittest discover ki
|
||||
|
||||
image_pull_secrets:
|
||||
- dockerconfig
|
||||
- dockerconfig
|
||||
|
||||
---
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: build
|
||||
|
||||
trigger:
|
||||
event:
|
||||
- push
|
||||
branch:
|
||||
- main
|
||||
|
||||
depends_on:
|
||||
- qa
|
||||
|
||||
steps:
|
||||
- name: docker-publish
|
||||
image: plugins/docker
|
||||
settings:
|
||||
registry: git.wtf-eg.de
|
||||
repo: git.wtf-eg.de/kompetenzinventar/backend
|
||||
target: ki-backend
|
||||
auto_tag: true
|
||||
username:
|
||||
from_secret: "docker_username"
|
||||
password:
|
||||
from_secret: "docker_password"
|
||||
|
||||
---
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: deploy
|
||||
|
||||
trigger:
|
||||
event:
|
||||
- push
|
||||
branch:
|
||||
- main
|
||||
|
||||
depends_on:
|
||||
- build
|
||||
|
||||
steps:
|
||||
- name: deploy-dev
|
||||
image: appleboy/drone-ssh
|
||||
settings:
|
||||
host:
|
||||
- dev01.wtf-eg.net
|
||||
username: drone_deployment
|
||||
key:
|
||||
from_secret: "dev01_deployment_key"
|
||||
command_timeout: 2m
|
||||
script:
|
||||
- echo "Executing forced command..."
|
||||
|
||||
|
||||
---
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: tag-release
|
||||
|
||||
trigger:
|
||||
event:
|
||||
- tag
|
||||
|
||||
steps:
|
||||
- name: install-lint-test
|
||||
image: git.wtf-eg.de/kompetenzinventar/builder:1.0.2
|
||||
commands:
|
||||
- pipenv install --dev
|
||||
- pipenv run flake8
|
||||
- pipenv run reuse lint
|
||||
- pipenv run python -m unittest discover ki
|
||||
- name: docker-publish
|
||||
image: plugins/docker
|
||||
settings:
|
||||
registry: git.wtf-eg.de
|
||||
repo: git.wtf-eg.de/kompetenzinventar/backend
|
||||
target: ki-backend
|
||||
auto_tag: true
|
||||
username:
|
||||
from_secret: "docker_username"
|
||||
password:
|
||||
from_secret: "docker_password"
|
||||
|
|
|
@ -4,7 +4,7 @@ Upstream-Contact: Michael Weimann <mail@michael-weimann.eu>
|
|||
Source: https://git.wtf-eg.de/kompetenzinventar/ki-backend
|
||||
|
||||
Files: data/imgs/flags/*
|
||||
Copyright: 2017 Go Squared Ltd. http://www.gosquared.com/
|
||||
Copyright: 2013 Panayiotis Lipiridis <https://flagicons.lipis.dev/>
|
||||
License: MIT
|
||||
|
||||
Files: Pipfile.lock migrations/*
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
FROM registry.wtf-eg.net/ki-backend-builder:1.0.0 as builder
|
||||
FROM git.wtf-eg.de/kompetenzinventar/builder:1.0.2 as builder
|
||||
|
||||
COPY Pipfile* ./
|
||||
|
||||
|
@ -10,7 +10,7 @@ RUN PIP_USER=1 PIP_IGNORE_INSTALLED=1 pipenv install --system --deploy --ignore-
|
|||
RUN pip3 uninstall --yes pipenv
|
||||
|
||||
|
||||
FROM registry.wtf-eg.net/ki-backend-base:1.0.0 as ki-backend
|
||||
FROM git.wtf-eg.de/kompetenzinventar/base:1.0.2 as ki-backend
|
||||
|
||||
# Install six explicitly. Otherwise Python complains about it missing.
|
||||
RUN pip3 install six
|
||||
|
@ -22,4 +22,9 @@ WORKDIR /app
|
|||
|
||||
COPY . .
|
||||
|
||||
LABEL org.opencontainers.image.source=https://git.wtf-eg.de/kompetenzinventar/ki-backend.git
|
||||
LABEL org.opencontainers.image.url=https://git.wtf-eg.de/kompetenzinventar/ki-backend
|
||||
LABEL org.opencontainers.image.documentation=https://git.wtf-eg.de/kompetenzinventar/ki-backend#docker
|
||||
LABEL org.opencontainers.image.vendor="WTF Kooperative eG"
|
||||
|
||||
CMD ["python3", "run_prod.py"]
|
||||
|
|
2
Pipfile
|
@ -14,7 +14,7 @@ flask-migrate = "~=3.0.1"
|
|||
flask-sqlalchemy = "~=2.5.1"
|
||||
sqlalchemy = "~=1.4.18"
|
||||
waitress = "~=2.0.0"
|
||||
pyyaml = "~=5.4.1"
|
||||
pyyaml = "~=6.0.1"
|
||||
flask-cors = "~=3.0.10"
|
||||
ldap3 = "~=2.9"
|
||||
pymysql = "~=1.0.2"
|
||||
|
|
45
README.md
|
@ -9,6 +9,32 @@ SPDX-License-Identifier: AGPL-3.0-or-later
|
|||
[![Build Status](https://drone.wtf-eg.de/api/badges/kompetenzinventar/ki-backend/status.svg?ref=refs/heads/main)](https://drone.wtf-eg.de/kompetenzinventar/ki-backend)
|
||||
[![REUSE status](https://api.reuse.software/badge/git.wtf-eg.de/kompetenzinventar/ki-backend)](https://api.reuse.software/info/git.wtf-eg.de/kompetenzinventar/ki-backend)
|
||||
|
||||
## Über
|
||||
|
||||
Dieses Repo enthält das Backend des Projekts Kompentenzinventar - einer Webapplikation zur Erfassung von Userprofilen für die WTF eG.
|
||||
|
||||
Implementiert ist das Backend mit Flask.
|
||||
|
||||
### Mitmachen
|
||||
|
||||
Du kannst gerne bei der Entwicklung des Kompetenzinventars mitmachen.
|
||||
|
||||
- Fehler oder fehlende Funktionen erfassen. Bitte direkt über die [Issues](https://git.wtf-eg.de/kompetenzinventar/ki-backend/issues) in Gitea.
|
||||
- Dokumentation oder Implementierung verbessern. Bitte forke hierzu das Projekt, branche von `main` ab und erstelle dann einen [Pull Request](https://git.wtf-eg.de/kompetenzinventar/ki-backend/pulls).
|
||||
|
||||
### Kommunikation
|
||||
|
||||
Folgende Kanäle gibt es für die Kommunikation über das Kompetenzinventar:
|
||||
|
||||
- Die [Issues](https://git.wtf-eg.de/kompetenzinventar/ki-backend/issues) im WTF Gitea.
|
||||
- Den Bereich [AG Entwicklung](https://forum.wtf-eg.de/c/interna/ag-entwicklung/21) im WTF Forum.
|
||||
- Einen Raum in Matrix. Zutritt per Einladung, frlan lädt ein, eine einfache PN im Forum reicht.
|
||||
|
||||
### Repos
|
||||
|
||||
* **[ki-backend](https://git.wtf-eg.de/kompetenzinventar/ki-backend)** (dieses Repo) enthält das Backend
|
||||
* [ki-frontend](https://git.wtf-eg.de/kompetenzinventar/ki-frontend) enthält das Frontend
|
||||
* Weitere Repositories befinden sich in der Gitea Organisation [Kompetenzinventar](https://git.wtf-eg.de/kompetenzinventar).
|
||||
## Entwicklung
|
||||
|
||||
### Abhängigkeiten
|
||||
|
@ -196,25 +222,6 @@ docker-compose up
|
|||
|
||||
Dann http://localhost:13337 aufrufen.
|
||||
|
||||
### Workaround, falls der Zugriff auf registry.wtf-eg.net nicht möglich ist
|
||||
|
||||
Voraussetzung:
|
||||
|
||||
[ki-backend-docker](https://git.wtf-eg.de/kompetenzinventar/ki-backend-docker) muss parallel zum `ki-backend` ausgecheckt sein.
|
||||
|
||||
```
|
||||
cd ki-backend-docker
|
||||
docker build . --target base -t ki-backend-base
|
||||
docker build . --target builder -t ki-backend-builder
|
||||
```
|
||||
|
||||
Ändern der 2 Einträge im `Dockerfile` des `ki-backend`:
|
||||
|
||||
- registry.wtf-eg.net/ki-backend-builder:1.0.0 -> ki-backend-builder
|
||||
- registry.wtf-eg.net/ki-backend-base:1.0.0 -> ki-backend-base
|
||||
|
||||
Danach sollte `docker-compose up` funktionieren.
|
||||
|
||||
## Lizenzen
|
||||
|
||||
Dieses Projekt erfüllt die [REUSE](https://reuse.software/) Spezifikation.
|
||||
|
|
15
app.py
|
@ -8,22 +8,23 @@ import os
|
|||
from dotenv import load_dotenv, find_dotenv
|
||||
from flask import Flask
|
||||
from flask_cors import CORS
|
||||
from flask.logging import default_handler
|
||||
from flask_migrate import Migrate
|
||||
from flask_sqlalchemy import SQLAlchemy
|
||||
from ldap3.utils.log import logger as ldap3_logger
|
||||
from ldap3.utils.log import set_library_log_detail_level, BASIC
|
||||
|
||||
load_dotenv(find_dotenv())
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
# Configure logging
|
||||
loglevel = os.getenv("KI_LOGLEVEL", logging.WARNING)
|
||||
loglevel = int(loglevel)
|
||||
app.logger.setLevel(loglevel)
|
||||
logging.basicConfig(level=loglevel)
|
||||
|
||||
set_library_log_detail_level(BASIC)
|
||||
ldap3_logger.addHandler(default_handler)
|
||||
app.logger.propagate = False # do not forward messages to the root logger
|
||||
logging.basicConfig(level=loglevel,
|
||||
format='[%(asctime)s] %(levelname)s [%(name)s] %(message)s') # configure root logger as fallback
|
||||
logging.getLogger('werkzeug').propagate = False # werkzeug has its own ColorStreamHandler
|
||||
set_library_log_detail_level(BASIC) # ldap3 has different verbosity levels internally
|
||||
|
||||
app.config["SQLALCHEMY_DATABASE_URI"] = os.getenv("SQLALCHEMY_DATABASE_URI")
|
||||
app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = False
|
||||
|
@ -40,6 +41,6 @@ CORS(app)
|
|||
db = SQLAlchemy(app)
|
||||
migrate = Migrate(app, db, compare_type=True)
|
||||
|
||||
logging.debug("Hello from KI")
|
||||
app.logger.info("Hello from KI")
|
||||
|
||||
from ki import module # noqa
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
[[source]]
|
||||
url = "https://pypi.org/simple"
|
||||
verify_ssl = true
|
||||
name = "pypi"
|
||||
|
||||
[packages]
|
||||
|
||||
[dev-packages]
|
||||
|
||||
[requires]
|
||||
python_version = "3.8"
|
Before Width: | Height: | Size: 977 B |
Before Width: | Height: | Size: 560 B |
Before Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 171 B |
Before Width: | Height: | Size: 614 B |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 181 B |
Before Width: | Height: | Size: 212 B |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 583 B |
Before Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 178 B |
Before Width: | Height: | Size: 541 B |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 168 B |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 3.9 KiB |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 180 B |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 862 B |
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 169 B |
Before Width: | Height: | Size: 295 B |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 617 B |
Before Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 172 B |
Before Width: | Height: | Size: 983 B |
Before Width: | Height: | Size: 639 B |
Before Width: | Height: | Size: 206 B |
Before Width: | Height: | Size: 755 B |
Before Width: | Height: | Size: 734 B |
Before Width: | Height: | Size: 444 B |
Before Width: | Height: | Size: 434 B |
Before Width: | Height: | Size: 178 B |
Before Width: | Height: | Size: 430 B |
Before Width: | Height: | Size: 172 B |
|
@ -0,0 +1,7 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" id="flag-icons-bg" viewBox="0 0 640 480">
|
||||
<g fill-rule="evenodd" stroke-width="1pt">
|
||||
<path fill="#d62612" d="M0 320h640v160H0z"/>
|
||||
<path fill="#fff" d="M0 0h640v160H0z"/>
|
||||
<path fill="#00966e" d="M0 160h640v160H0z"/>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 283 B |
Before Width: | Height: | Size: 340 B |
Before Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 184 B |
Before Width: | Height: | Size: 4.0 KiB |
Before Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 686 B |
Before Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 467 B |
Before Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 178 B |
Before Width: | Height: | Size: 595 B |
Before Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 486 B |
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="810" height="540">
|
||||
<rect width="810" height="540" fill="#FCDD09"/>
|
||||
<path stroke="#DA121A" stroke-width="60" d="M0,90H810m0,120H0m0,120H810m0,120H0"/>
|
||||
</svg>
|
After Width: | Height: | Size: 242 B |
Before Width: | Height: | Size: 1004 B |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 377 B |
Before Width: | Height: | Size: 323 B |
Before Width: | Height: | Size: 175 B |
Before Width: | Height: | Size: 172 B |
Before Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 309 B |
Before Width: | Height: | Size: 367 B |
Before Width: | Height: | Size: 745 B |
Before Width: | Height: | Size: 174 B |
Before Width: | Height: | Size: 184 B |
Before Width: | Height: | Size: 369 B |
|
@ -0,0 +1,5 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" id="flag-icons-cz" viewBox="0 0 640 480">
|
||||
<path fill="#fff" d="M0 0h640v240H0z"/>
|
||||
<path fill="#d7141a" d="M0 240h640v240H0z"/>
|
||||
<path fill="#11457e" d="M360 240 0 0v480z"/>
|
||||
</svg>
|
After Width: | Height: | Size: 225 B |
Before Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 605 B |
Before Width: | Height: | Size: 360 B |
Before Width: | Height: | Size: 441 B |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 369 B |
|
@ -0,0 +1,5 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" id="flag-icons-dk" viewBox="0 0 640 480">
|
||||
<path fill="#c8102e" d="M0 0h640.1v480H0z"/>
|
||||
<path fill="#fff" d="M205.7 0h68.6v480h-68.6z"/>
|
||||
<path fill="#fff" d="M0 205.7h640.1v68.6H0z"/>
|
||||
</svg>
|
After Width: | Height: | Size: 236 B |
Before Width: | Height: | Size: 168 B |
|
@ -0,0 +1,5 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" id="flag-icons-de" viewBox="0 0 640 480">
|
||||
<path fill="#ffce00" d="M0 320h640v160H0z"/>
|
||||
<path d="M0 0h640v160H0z"/>
|
||||
<path fill="#d00" d="M0 160h640v160H0z"/>
|
||||
</svg>
|
After Width: | Height: | Size: 210 B |
Before Width: | Height: | Size: 452 B |
Before Width: | Height: | Size: 180 B |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 588 B |
Before Width: | Height: | Size: 592 B |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 170 B |
Before Width: | Height: | Size: 634 B |
Before Width: | Height: | Size: 577 B |
|
@ -0,0 +1,16 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" id="flag-icons-gr" viewBox="0 0 640 480">
|
||||
<path fill="#005bae" fill-rule="evenodd" stroke-width="6.7" d="M0 0h640v53.3H0z"/>
|
||||
<path fill="#fff" fill-rule="evenodd" stroke-width="6.7" d="M0 53.3h640v53.4H0z"/>
|
||||
<path fill="#005bae" fill-rule="evenodd" stroke-width="6.7" d="M0 106.7h640V160H0z"/>
|
||||
<path fill="#fff" fill-rule="evenodd" stroke-width="6.7" d="M0 160h640v53.3H0z"/>
|
||||
<path fill="#005bae" stroke-width=".9" d="M0 0h266.7v266.7H0z"/>
|
||||
<path fill="#005bae" fill-rule="evenodd" stroke-width="6.7" d="M0 213.3h640v53.4H0z"/>
|
||||
<path fill="#fff" fill-rule="evenodd" stroke-width="6.7" d="M0 266.7h640V320H0z"/>
|
||||
<path fill="#005bae" fill-rule="evenodd" stroke-width="6.7" d="M0 320h640v53.3H0z"/>
|
||||
<path fill="#fff" fill-rule="evenodd" stroke-width="6.7" d="M0 373.3h640v53.4H0z"/>
|
||||
<g fill="#fff" fill-rule="evenodd" stroke-width="1.3">
|
||||
<path d="M20 0h10v50H20z" transform="scale(5.33333)"/>
|
||||
<path d="M0 20h50v10H0z" transform="scale(5.33333)"/>
|
||||
</g>
|
||||
<path fill="#005bae" stroke-width=".6" d="M0 426.7h640V480H0z"/>
|
||||
</svg>
|
After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 680 B |