forked from kompetenzinventar/ki-backend
Compare commits
88 Commits
docker-lab
...
main
Author | SHA1 | Date | |
---|---|---|---|
06caf796cd | |||
54326129e4 | |||
32bb81b69b | |||
fc8a06e562 | |||
b8b713c620 | |||
186ab9af43 | |||
0d77c8d637 | |||
72fda5df51 | |||
739ce0382b | |||
4c345ecc5f | |||
5882eeaf2e | |||
0512bc0dc3 | |||
319bf9b2f5 | |||
717454e205 | |||
496550a959 | |||
7ebf13edf3 | |||
5409bdeaee | |||
4064a65e63 | |||
afe22e13c1 | |||
e4d0a89053 | |||
78bdd796e0 | |||
c9f83e80b3 | |||
5369de67d8 | |||
54c5246f0a | |||
9a95baf106 | |||
338380ed93 | |||
3d128d771c | |||
6b7517fc7a | |||
5ceb361da3 | |||
4379a06f26 | |||
c43f375e4b | |||
621a90b8ab | |||
033dee7836 | |||
ca81e8bf70 | |||
d507a20a93 | |||
3f2c23c386 | |||
b46ac5e379 | |||
fa4429b6ef | |||
7a0f2434db | |||
8c3fe3fe7d | |||
56ade6de68 | |||
28cf714217 | |||
9ff56f6676 | |||
2412df4960 | |||
469ef511d6 | |||
47d2c94b79 | |||
384dd82454 | |||
b0dcfacd25 | |||
86edb246bf | |||
9424e21edc | |||
f02efab07a | |||
08f1104942 | |||
8dde142f38 | |||
d1b1636aa2 | |||
3fcd1fa20e | |||
8394400e96 | |||
843050f923 | |||
812913ffe2 | |||
dee80c7e14 | |||
de60ec0d46 | |||
6c6fcea81c | |||
166e0d40c6 | |||
c9b5ab62ed | |||
c0005100b4 | |||
d614039cdd | |||
316236a7e5 | |||
c15faabd6d | |||
53eab74e60 | |||
82d908193c | |||
6620a6819a | |||
be6fec18ab | |||
9ebae03550 | |||
763a6efc9f | |||
6f04d23e6c | |||
155ddc556c | |||
a5a85e6032 | |||
6a3458a596 | |||
97be8f4667 | |||
776803fc96 | |||
702f4968f6 | |||
c1285153ef | |||
fdc81844b5 | |||
b804c22a93 | |||
9a7a9379e2 | |||
5b707ad294 | |||
68bf505cd0 | |||
2ac03d0c26 | |||
6b46ea5516 |
13
.dockerignore
Normal file
13
.dockerignore
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# SPDX-FileCopyrightText: WTF Kooperative eG <https://wtf-eg.de/>
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
|
|
||||||
|
*
|
||||||
|
!Pipfile
|
||||||
|
!Pipfile.lock
|
||||||
|
!data/
|
||||||
|
!ki/
|
||||||
|
!LICENSES/
|
||||||
|
!migrations/
|
||||||
|
!app.py
|
||||||
|
!run_prod.py
|
117
.drone.yml
117
.drone.yml
@ -4,48 +4,125 @@
|
|||||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
type: docker
|
type: docker
|
||||||
name: default
|
name: qa
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
event:
|
||||||
|
- push
|
||||||
|
- pull_request
|
||||||
|
branch:
|
||||||
|
- main
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: qa
|
- name: install-lint-test
|
||||||
image: registry.wtf-eg.net/ki-backend-builder:1.0.0
|
image: python:3.8.20-alpine@sha256:3d93b1f77efce339aa77db726656872517b0d67837989aa7c4b35bd5ae7e81ba
|
||||||
|
env:
|
||||||
|
PYROOT: '/pyroot'
|
||||||
|
PYTHONUSERBASE: '/pyroot'
|
||||||
commands:
|
commands:
|
||||||
|
- apk add --no-cache gcc g++ musl-dev python3-dev
|
||||||
|
- pip3 install pipenv
|
||||||
|
- pipenv verify
|
||||||
- pipenv install --dev
|
- pipenv install --dev
|
||||||
- pipenv run flake8
|
- pipenv run flake8
|
||||||
- pipenv run reuse lint
|
- pipenv run reuse lint
|
||||||
- pipenv run python -m unittest discover ki
|
- pipenv run python -m unittest discover ki
|
||||||
|
- name: docker-dry-run
|
||||||
- name: docker-publish
|
image: plugins/docker:20.18.4@sha256:a8d3d86853c721492213264815f1d00d3ed13f42f5c1855a02f47fa4d5f1e042
|
||||||
image: plugins/docker
|
|
||||||
settings:
|
settings:
|
||||||
registry: registry.wtf-eg.net
|
registry: git.wtf-eg.de
|
||||||
repo: registry.wtf-eg.net/ki-backend
|
repo: git.wtf-eg.de/kompetenzinventar/backend
|
||||||
target: ki-backend
|
target: ki-backend
|
||||||
auto_tag: true
|
dry_run: true
|
||||||
username:
|
|
||||||
from_secret: "docker_username"
|
|
||||||
password:
|
|
||||||
from_secret: "docker_password"
|
|
||||||
when:
|
when:
|
||||||
|
event:
|
||||||
|
- pull_request
|
||||||
|
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: build
|
||||||
|
|
||||||
|
trigger:
|
||||||
event:
|
event:
|
||||||
- push
|
- push
|
||||||
branch:
|
branch:
|
||||||
- main
|
- main
|
||||||
|
|
||||||
- name: docker-publish-tag
|
depends_on:
|
||||||
image: plugins/docker
|
- qa
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: docker-publish
|
||||||
|
image: plugins/docker:20.18.4@sha256:a8d3d86853c721492213264815f1d00d3ed13f42f5c1855a02f47fa4d5f1e042
|
||||||
settings:
|
settings:
|
||||||
registry: registry.wtf-eg.net
|
registry: git.wtf-eg.de
|
||||||
repo: registry.wtf-eg.net/ki-backend
|
repo: git.wtf-eg.de/kompetenzinventar/backend
|
||||||
target: ki-backend
|
target: ki-backend
|
||||||
auto_tag: true
|
auto_tag: true
|
||||||
username:
|
username:
|
||||||
from_secret: "docker_username"
|
from_secret: "docker_username"
|
||||||
password:
|
password:
|
||||||
from_secret: "docker_password"
|
from_secret: "docker_password"
|
||||||
when:
|
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: deploy
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
event:
|
||||||
|
- push
|
||||||
|
branch:
|
||||||
|
- main
|
||||||
|
|
||||||
|
depends_on:
|
||||||
|
- build
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: deploy-dev
|
||||||
|
image: appleboy/drone-ssh:1.7.5@sha256:995677e073454912f26d4c0fdd2f9df2e1f5a30d6603d3f2ece667311b6babb3
|
||||||
|
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:
|
event:
|
||||||
- tag
|
- tag
|
||||||
|
|
||||||
image_pull_secrets:
|
steps:
|
||||||
- dockerconfig
|
- name: install-lint-test
|
||||||
|
image: python:3.8.20-alpine@sha256:3d93b1f77efce339aa77db726656872517b0d67837989aa7c4b35bd5ae7e81ba
|
||||||
|
env:
|
||||||
|
PYROOT: '/pyroot'
|
||||||
|
PYTHONUSERBASE: '/pyroot'
|
||||||
|
commands:
|
||||||
|
- apk add --no-cache gcc g++ musl-dev python3-dev
|
||||||
|
- pip3 install pipenv
|
||||||
|
- pipenv install --dev
|
||||||
|
- pipenv run flake8
|
||||||
|
- pipenv run reuse lint
|
||||||
|
- pipenv run python -m unittest discover ki
|
||||||
|
- name: docker-publish
|
||||||
|
image: plugins/docker:20.18.4@sha256:a8d3d86853c721492213264815f1d00d3ed13f42f5c1855a02f47fa4d5f1e042
|
||||||
|
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"
|
||||||
|
1
.python-version
Normal file
1
.python-version
Normal file
@ -0,0 +1 @@
|
|||||||
|
3.8.20
|
12
.reuse/dep5
12
.reuse/dep5
@ -1,12 +0,0 @@
|
|||||||
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
|
||||||
Upstream-Name: Kompetenzinventar
|
|
||||||
Upstream-Contact: Michael Weimann <mail@michael-weimann.eu>
|
|
||||||
Source: https://git.wtf-eg.de/kompetenzinventar/ki-backend
|
|
||||||
|
|
||||||
Files: data/imgs/flags/*
|
|
||||||
Copyright: 2013 Panayiotis Lipiridis <https://flagicons.lipis.dev/>
|
|
||||||
License: MIT
|
|
||||||
|
|
||||||
Files: Pipfile.lock migrations/*
|
|
||||||
Copyright: WTF Kooperative eG <https://wtf-eg.de/>
|
|
||||||
License: AGPL-3.0-or-later
|
|
5
.yapfignore
Normal file
5
.yapfignore
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# SPDX-FileCopyrightText: WTF Kooperative eG <https://wtf-eg.de/>
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
|
|
||||||
|
migrations/*.py
|
17
Dockerfile
17
Dockerfile
@ -2,7 +2,17 @@
|
|||||||
#
|
#
|
||||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
|
|
||||||
FROM registry.wtf-eg.net/ki-backend-builder:1.0.1 as builder
|
FROM python:3.8.20-alpine@sha256:3d93b1f77efce339aa77db726656872517b0d67837989aa7c4b35bd5ae7e81ba AS builder
|
||||||
|
|
||||||
|
ENV PYROOT=/pyroot
|
||||||
|
ENV PYTHONUSERBASE=$PYROOT
|
||||||
|
|
||||||
|
RUN apk add --no-cache \
|
||||||
|
gcc \
|
||||||
|
g++ \
|
||||||
|
musl-dev \
|
||||||
|
python3-dev && \
|
||||||
|
pip3 install pipenv
|
||||||
|
|
||||||
COPY Pipfile* ./
|
COPY Pipfile* ./
|
||||||
|
|
||||||
@ -10,7 +20,10 @@ RUN PIP_USER=1 PIP_IGNORE_INSTALLED=1 pipenv install --system --deploy --ignore-
|
|||||||
RUN pip3 uninstall --yes pipenv
|
RUN pip3 uninstall --yes pipenv
|
||||||
|
|
||||||
|
|
||||||
FROM registry.wtf-eg.net/ki-backend-base:1.0.1 as ki-backend
|
FROM python:3.8.20-alpine@sha256:3d93b1f77efce339aa77db726656872517b0d67837989aa7c4b35bd5ae7e81ba AS ki-backend
|
||||||
|
|
||||||
|
ENV PYROOT=/pyroot
|
||||||
|
ENV PYTHONUSERBASE=$PYROOT
|
||||||
|
|
||||||
# Install six explicitly. Otherwise Python complains about it missing.
|
# Install six explicitly. Otherwise Python complains about it missing.
|
||||||
RUN pip3 install six
|
RUN pip3 install six
|
||||||
|
29
Pipfile
29
Pipfile
@ -8,22 +8,23 @@ verify_ssl = true
|
|||||||
name = "pypi"
|
name = "pypi"
|
||||||
|
|
||||||
[packages]
|
[packages]
|
||||||
flask = "~=2.0.1"
|
flask = "==2.3.3"
|
||||||
python-dotenv = "~=0.17.1"
|
python-dotenv = "==1.0.1"
|
||||||
flask-migrate = "~=3.0.1"
|
flask-migrate = "==4.0.7"
|
||||||
flask-sqlalchemy = "~=2.5.1"
|
flask-sqlalchemy = "==2.5.1"
|
||||||
sqlalchemy = "~=1.4.18"
|
sqlalchemy = "==1.4.54"
|
||||||
waitress = "~=2.0.0"
|
waitress = "==2.1.2"
|
||||||
pyyaml = "~=6.0.1"
|
pyyaml = "==6.0.2"
|
||||||
flask-cors = "~=3.0.10"
|
flask-cors = "==5.0.0"
|
||||||
ldap3 = "~=2.9"
|
ldap3 = "==2.9.1"
|
||||||
pymysql = "~=1.0.2"
|
pymysql = "==1.1.1"
|
||||||
|
werkzeug = "==2.3.8"
|
||||||
|
|
||||||
[dev-packages]
|
[dev-packages]
|
||||||
flake8 = "~=3.9.2"
|
flake8 = "==7.1.1"
|
||||||
yapf = "~=0.31.0"
|
yapf = "==0.40.2"
|
||||||
pre-commit = "~=2.13.0"
|
pre-commit = "==2.21.0"
|
||||||
reuse = "~=0.13.0"
|
reuse = "==4.0.3"
|
||||||
|
|
||||||
[requires]
|
[requires]
|
||||||
python_version = "3.8"
|
python_version = "3.8"
|
||||||
|
1025
Pipfile.lock
generated
1025
Pipfile.lock
generated
File diff suppressed because it is too large
Load Diff
19
README.md
19
README.md
@ -222,25 +222,6 @@ docker-compose up
|
|||||||
|
|
||||||
Dann http://localhost:13337 aufrufen.
|
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
|
## Lizenzen
|
||||||
|
|
||||||
Dieses Projekt erfüllt die [REUSE](https://reuse.software/) Spezifikation.
|
Dieses Projekt erfüllt die [REUSE](https://reuse.software/) Spezifikation.
|
||||||
|
24
REUSE.toml
Normal file
24
REUSE.toml
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
# SPDX-FileCopyrightText: NONE
|
||||||
|
# SPDX-License-Identifier: CC0-1.0
|
||||||
|
|
||||||
|
version = 1
|
||||||
|
SPDX-PackageName = "Kompetenzinventar Backend"
|
||||||
|
SPDX-PackageDownloadLocation = "https://git.wtf-eg.de/kompetenzinventar/ki-backend"
|
||||||
|
|
||||||
|
[[annotations]]
|
||||||
|
path = "data/imgs/flags/**"
|
||||||
|
precedence = "aggregate"
|
||||||
|
SPDX-FileCopyrightText = "2013 Panayiotis Lipiridis <https://flagicons.lipis.dev/>"
|
||||||
|
SPDX-License-Identifier = "MIT"
|
||||||
|
|
||||||
|
[[annotations]]
|
||||||
|
path = ["Pipfile.lock", "migrations/**"]
|
||||||
|
precedence = "aggregate"
|
||||||
|
SPDX-FileCopyrightText = "WTF Kooperative eG <https://wtf-eg.de/>"
|
||||||
|
SPDX-License-Identifier = "AGPL-3.0-or-later"
|
||||||
|
|
||||||
|
[[annotations]]
|
||||||
|
path = ["renovate.json", ".python-version"]
|
||||||
|
precedence = "aggregate"
|
||||||
|
SPDX-FileCopyrightText = "WTF Kooperative eG <https://wtf-eg.de/>"
|
||||||
|
SPDX-License-Identifier = "AGPL-3.0-or-later"
|
5
data/imgs/flags/ca.svg
Normal file
5
data/imgs/flags/ca.svg
Normal file
@ -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 |
@ -17,6 +17,7 @@ content_type_png = "image/png"
|
|||||||
|
|
||||||
|
|
||||||
def token_auth(func):
|
def token_auth(func):
|
||||||
|
|
||||||
@wraps(func)
|
@wraps(func)
|
||||||
def _token_auth(*args, **kwargs):
|
def _token_auth(*args, **kwargs):
|
||||||
auth_header = request.headers.get("Authorization")
|
auth_header = request.headers.get("Authorization")
|
||||||
|
@ -8,6 +8,7 @@ from ki.test.ApiTest import ApiTest
|
|||||||
|
|
||||||
|
|
||||||
class TestContactTypesEndpoint(ApiTest):
|
class TestContactTypesEndpoint(ApiTest):
|
||||||
|
|
||||||
def test_skills_options(self):
|
def test_skills_options(self):
|
||||||
response = self.client.options("/contacttypes")
|
response = self.client.options("/contacttypes")
|
||||||
self.assertEqual(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
|
@ -8,6 +8,7 @@ from ki.test.ApiTest import ApiTest
|
|||||||
|
|
||||||
|
|
||||||
class TestFindProfilesEndpoint(ApiTest):
|
class TestFindProfilesEndpoint(ApiTest):
|
||||||
|
|
||||||
def test_find_profiles_options(self):
|
def test_find_profiles_options(self):
|
||||||
response = self.client.options("/users/profiles")
|
response = self.client.options("/users/profiles")
|
||||||
self.assertEqual(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
|
@ -8,6 +8,7 @@ from ki.test.ApiTest import ApiTest
|
|||||||
|
|
||||||
|
|
||||||
class TestLanguagesEndpoint(ApiTest):
|
class TestLanguagesEndpoint(ApiTest):
|
||||||
|
|
||||||
def test_skills_options(self):
|
def test_skills_options(self):
|
||||||
response = self.client.options("/languages")
|
response = self.client.options("/languages")
|
||||||
self.assertEqual(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
|
@ -10,6 +10,7 @@ from ki.test.ApiTest import ApiTest
|
|||||||
|
|
||||||
|
|
||||||
class TestLoginEndpoint(ApiTest):
|
class TestLoginEndpoint(ApiTest):
|
||||||
|
|
||||||
def test_login(self):
|
def test_login(self):
|
||||||
response1_data = self.login("peter", "geheim")
|
response1_data = self.login("peter", "geheim")
|
||||||
response2_data = self.login("peter", "geheim")
|
response2_data = self.login("peter", "geheim")
|
||||||
|
@ -8,6 +8,7 @@ from ki.test.ApiTest import ApiTest
|
|||||||
|
|
||||||
|
|
||||||
class TestSkillsEndpoint(ApiTest):
|
class TestSkillsEndpoint(ApiTest):
|
||||||
|
|
||||||
def test_skills_options(self):
|
def test_skills_options(self):
|
||||||
response = self.client.options("/skills")
|
response = self.client.options("/skills")
|
||||||
self.assertEqual(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
|
18
renovate.json
Normal file
18
renovate.json
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||||
|
"extends": [
|
||||||
|
"config:best-practices",
|
||||||
|
":disableDependencyDashboard",
|
||||||
|
":maintainLockFilesMonthly",
|
||||||
|
":pinVersions",
|
||||||
|
":separateMultipleMajorReleases"
|
||||||
|
],
|
||||||
|
"packageRules": [
|
||||||
|
{
|
||||||
|
"matchDepNames": ["python"],
|
||||||
|
"groupName": "Python",
|
||||||
|
"separateMinorPatch": true,
|
||||||
|
"separateMultipleMinor": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user