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

Initial commit #1237

Merged
merged 44 commits into from
Jul 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
15975c2
Initial commit
remyvdwereld Jun 23, 2024
a4c09c6
Update action
remyvdwereld Jun 23, 2024
61560d1
Updated codeql analyze
remyvdwereld Jun 23, 2024
082c6c8
Puin specific version pip
remyvdwereld Jun 23, 2024
86eb876
Updated CodeQL action
remyvdwereld Jun 23, 2024
421b208
Updated dependencies
remyvdwereld Jun 24, 2024
aab1197
Updated bpmn linting
remyvdwereld Jun 24, 2024
2d8a9c9
Updated actions
remyvdwereld Jun 24, 2024
9d9596d
Updated python version
remyvdwereld Jun 24, 2024
9c2cac7
Added check to migration
remyvdwereld Jun 24, 2024
4331c2b
Undo migration
remyvdwereld Jun 24, 2024
2b27a82
Remove migration 24
remyvdwereld Jun 25, 2024
2a37e41
Removed spaghetti
remyvdwereld Jun 25, 2024
1a4f27d
Removed migrations
remyvdwereld Jun 25, 2024
b824da1
Updated tests
remyvdwereld Jun 27, 2024
0f3f06e
Updated tests
remyvdwereld Jun 27, 2024
43f64a2
Merge branch 'main' into update/action
remyvdwereld Jun 27, 2024
acfeb70
Updated urllib
remyvdwereld Jun 29, 2024
195b755
Test if server reponse
remyvdwereld Jun 29, 2024
d5f1abb
test Github action
remyvdwereld Jun 30, 2024
86b612b
Test
remyvdwereld Jun 30, 2024
38ce73c
Updated dependencies
remyvdwereld Jul 1, 2024
b2e16fb
Uncommented docker-entrypoint users_user
remyvdwereld Jul 1, 2024
7c74f69
Test removing volume
remyvdwereld Jul 1, 2024
bdd0b47
Commented e2e tests
remyvdwereld Jul 1, 2024
72f1535
Tests
remyvdwereld Jul 1, 2024
79b803f
Added docker compose tests
remyvdwereld Jul 1, 2024
057b058
Removed detach
remyvdwereld Jul 1, 2024
ca893ca
Updated docker compose
remyvdwereld Jul 1, 2024
e78f363
update waitfor
NvdLaan Jul 1, 2024
f1c30cb
Updated actions
remyvdwereld Jul 1, 2024
d99f7a1
add on failure
NvdLaan Jul 1, 2024
63408b0
rm detach
NvdLaan Jul 1, 2024
26a0e45
undo
NvdLaan Jul 1, 2024
4ae1a5b
test multiple actions
remyvdwereld Jul 1, 2024
93fdfa1
Test
remyvdwereld Jul 1, 2024
92bc5d3
Revert "add on failure"
NvdLaan Jul 1, 2024
e85f263
separate entrypoint files
NvdLaan Jul 2, 2024
d4ec599
Action and entrypoint changes
remyvdwereld Jul 2, 2024
7550766
Updated migration with default user manager
remyvdwereld Jul 2, 2024
5279f51
fix test
NvdLaan Jul 3, 2024
25d2b28
Added script for adding user groups
remyvdwereld Jul 3, 2024
ea0915f
Merge branch 'main' into update/action
remyvdwereld Jul 23, 2024
40826cb
Updated test
remyvdwereld Jul 23, 2024
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
5 changes: 2 additions & 3 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ DATABASE_USER=zaken
DATABASE_PASSWORD=insecure
DATABASE_HOST=database
DATABASE_PORT=5432
SENTRY_DSN=https://[email protected]/0
LOCAL_DEVELOPMENT_AUTHENTICATION=False
LOGGING_LEVEL=WARNING # To prevent flooding the logging in local development. Default is DEBUG.
LOCAL_DEVELOPMENT_AUTHENTICATION=True
LOGGING_LEVEL=WARNING # To prevent flooding the logging in local development. Default is DEBUG. WARNING
SECRET_KEY_TOP_ZAKEN=SECRET_KEY_TOP_ZAKEN
SECRET_KEY_TON_ZAKEN=SECRET_KEY_TON_ZAKEN
BELASTING_API_URL=https://api-acc.belastingen.centric.eu/bel/inn/afne/vora/v1/vorderingenidentificatienummer/
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/bpmn.workflow.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: 'Validate BPMN'
name: 'BPMN validation'
on:
push:
branches: [ main ]
Expand All @@ -11,11 +11,11 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Use Node.js for BPMN Linting
uses: actions/setup-node@v3.1.1
uses: actions/setup-node@v4
with:
node-version: '12.x'
node-version: '16.x'
- name: Install dependencies for BPMN Linting
run: npm install -g bpmnlint
- name: Linting BPMN models
Expand Down
15 changes: 8 additions & 7 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "Discovering vulnerabilities using CodeQL"
name: "CodeQL analysis for vulnerabilities "

on:
push:
Expand All @@ -35,12 +35,13 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v3.1.2
uses: actions/setup-python@v5
with:
python-version: '3.9.16'
python-version: '3.10'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand All @@ -54,7 +55,7 @@ jobs:

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# Override the default behavior so that the action doesn't attempt
Expand All @@ -68,7 +69,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
uses: github/codeql-action/autobuild@v3

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
Expand All @@ -82,4 +83,4 @@ jobs:
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
uses: github/codeql-action/analyze@v3
20 changes: 13 additions & 7 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# action.yml
name: "Run Integration test"
name: "Run e2e-tests"
on:
push:
branches:
Expand All @@ -14,7 +14,7 @@ jobs:
###################################################

- name: Checkout backend
uses: actions/checkout@v3
uses: actions/checkout@v4

###################################################
# BACKEND
Expand All @@ -23,6 +23,7 @@ jobs:
- run: docker network create zaken_network
- run: docker network create top_and_zaak_backend_bridge
- run: docker-compose -f docker-compose.local.yml up --detach
# - run: docker-compose -f docker-compose.tests.yml up
- run: sleep 30
- run: bash bin/setup_credentials.sh
- run: ./e2e-tests/fix_models.sh
Expand All @@ -31,15 +32,20 @@ jobs:
# TEST
###################################################

- run: sudo apt-get install python3.9
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.10'

# Test version
- run: python --version
- name: Test version
run: python --version

- run: python3 -m pip install -r requirements.txt
- name: Install requirements
run: python3 -m pip install -r requirements.txt
working-directory: e2e-tests

- run: API_HOST=http://127.0.0.1:8080/api/v1 python3 -m unittest
- name: Run tests
run: API_HOST=http://127.0.0.1:8080/api/v1 python3 -m unittest
working-directory: e2e-tests

###################################################
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/git revert --no-commit f1c30cb2e2fd0d3bd
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
git revert --no-commit f1c30cb2e2fd0d3bd0d865ec86e8b7546aa91d2e..HEAD
6 changes: 3 additions & 3 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# action.yml
name: 'Start frontend'
name: 'Run integration-tests'
on: pull_request
jobs:
main:
Expand All @@ -9,13 +9,13 @@ jobs:
# CHECKOUT
###################################################
- name: Checkout frontend
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: frontend
repository: amsterdam/zaken-frontend

- name: Checkout backend
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: backend

Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/main.workflow.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: 'Install, lint, test & build'
name: 'Main, lint, build & manage.py test'
on:
push:
branches: [ main ]
Expand All @@ -9,20 +9,20 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v3.1.2
uses: actions/setup-python@v5
with:
python-version: 3.9.16
python-version: '3.10'
- name: Linting
run: bash bin/cleanup_pre_commit.sh
- name: Build Docker image
run: docker-compose build -f docker-compose.local.yml
run: docker-compose -f docker-compose.local.yml build
- name: Create Docker network
run: docker network create zaken_network
- name: Create TOP and Zaken Docker network
run: docker network create top_and_zaak_backend_bridge
- name: Start images
run: docker-compose -f docker-compose.local.yml up -d
run: docker-compose -f docker-compose.local.yml up -d
- name: Run Tests
run: docker-compose exec -T zaak-gateway python manage.py test
run: docker-compose -f docker-compose.local.yml exec -T zaak-gateway python manage.py test
53 changes: 34 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,38 +53,52 @@ docker-compose -f docker-compose.local.yml up

To create all necessary credentials run the following command:

```
```bash
bash bin/setup_credentials.sh
```

This will create superuser admin account with the following credentials

```
```bash
email: [email protected]
password: admin
password: insecure
```

Visit the Admin at http://localhost:8080/admin/

Check the health page to see if all services are up and running:
http://localhost:8080/health

To create all necessary user groups run the following command:

```bash
bash bin/setup_user_groups.sh
```

## Running tests

Set LOCAL_DEVELOPMENT_AUTHENTICATION environment variable to True (default)

Run unit tests locally with:

```
docker compose run --rm zaak-gateway python manage.py test
```bash
docker compose -f docker-compose.local.yml run --rm zaak-gateway python manage.py test
```

To run tests for a specific module, add a path:

```bash
docker compose -f docker-compose.local.yml run --rm zaak-gateway python manage.py test apps/cases

```
docker compose run --rm zaak-gateway python manage.py test apps/cases

Or a specific test:

```bash
docker-compose -f docker-compose.local.yml exec -T zaak-gateway python manage.py test apps.addresses.tests.tests_models.AddressModelTest.test_can_create_address_with_bag_result_without_stadsdeel
```


## API documentation (Swagger)

You can access the documentation at:
Expand All @@ -105,24 +119,25 @@ Create a `.env.local` file, on the root of your project, and override the variab

Start your project with the newly created environment variables, like so:

```
docker compose --env-file .env.local up
```bash
docker compose -f docker-compose.local.yml --env-file .env.local up
```

## Enabling Keycloak authentication for a locally run zaken-frontend

Set LOCAL_DEVELOPMENT_AUTHENTICATION environment variable to False
Set `LOCAL_DEVELOPMENT_AUTHENTICATION` environment variable to False

## Generating Mock Data

You can generate mock data easily (from the API swagger environment) by executing the /api/v1/generate-mock/ GET request.
You can generate mock data easily (from the API swagger environment) by executing the `/api/v1/generate-mock/` GET request.

## Update fixtures

Generate new fixtures json file:

```
docker-compose run --rm zaak-gateway python manage.py dumpdata --indent 2 -o temp_fixture.json [app_name]
```bash
docker compose -f docker-compose.local.yml run --rm zaak-gateway python manage.py dumpdata --indent 2 -o temp_fixture.json [app_name]

```

Now manually copy changes you need to the corresponding fixtures file.
Expand All @@ -131,13 +146,13 @@ Now manually copy changes you need to the corresponding fixtures file.

You can add pre-commit hooks for checking and cleaning up your changes:

```
```bash
bash bin/install_pre_commit.sh
```

You can also run the following command to ensure all files adhere to coding conventions:

```
```bash
bash bin/cleanup_pre_commit.sh
```

Expand Down Expand Up @@ -167,7 +182,7 @@ Note that the apps and models should be updated whenever applications and models

For changes to the model you have to migrate the DB.

```python
```bash
python manage.py makemigrations --name <name_of_your_migration> <name_of_apps>

python manage.py migrate
Expand All @@ -193,14 +208,14 @@ Try the online modeler for BPMN-models: https://bpmn.io/. This is a lightweight

Clone the bpmn-io Github repo for editing: https://github.com/bpmn-io/bpmn-js-examples.

```
```bash
git clone [email protected]:bpmn-io/bpmn-js-examples.git
```

If you'd like to use Camunda Platform execution related properties, include the camunda-bpmn-moddle dependency which tells the modeler about camunda:XXX extension properties: https://github.com/bpmn-io/bpmn-js-examples/tree/master/properties-panel#camunda-platform

Follow next steps:
```
```bash
cd bpmn-js-examples

cd properties-panel
Expand Down Expand Up @@ -265,7 +280,7 @@ So if you think existing cases will get stuck in the model, just create a new ve

Example: `housing_corporation` has a new minor version model and the latest version was `5.0.0` but `debrief` has latest version `6.0.0`. Then the new minor version of `housing_corporation` will be `6.1.0`.

```
```json
bpmn_models/default/
├─ debrief/
│ ├─ 0.1.0/
Expand All @@ -280,7 +295,7 @@ bpmn_models/default/

- Add the new version to `WORKFLOW_SPEC_CONFIG` in `settings.py`:

```python
```json
"housing_corporation": {
"versions": {
"5.0.0": {},
Expand Down
18 changes: 12 additions & 6 deletions app/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
FROM amsterdam/python:3.9-buster
LABEL maintainer="[email protected]"
FROM python:3.10-bullseye

ENV REQUESTS_CA_BUNDLE /etc/ssl/certs/ca-certificates.crt

Expand All @@ -10,11 +9,16 @@ RUN chmod 644 /usr/local/share/ca-certificates/adp_rootca.crt \

ENV PYTHONUNBUFFERED 1

RUN apt-get update && apt-get install -y
# RUN pip install --upgrade pip
RUN pip install uwsgi
# Update and install necessary packages including GDAL
RUN apt-get update && apt-get install -y \
gdal-bin \
libgdal-dev \
graphviz \
graphviz-dev \
postgresql-client

RUN apt-get install graphviz graphviz-dev -y
RUN pip install --upgrade pip
RUN pip install uwsgi
RUN pip install pygraphviz

RUN echo "10.240.5.72 acc.api.data.amsterdam.nl" >> /etc/hosts || echo "Could not write to /etc/hosts"
Expand All @@ -30,6 +34,8 @@ RUN chmod +x /app/wait-for.sh
RUN chmod +x /app/celery.sh
RUN chmod +x /app/deploy/docker-entrypoint.sh

# Set the GDAL_LIBRARY_PATH environment variable
ENV GDAL_LIBRARY_PATH /usr/lib/libgdal.so

ENTRYPOINT ["/app/deploy/docker-entrypoint.sh"]
CMD ["uwsgi", "--ini", "/app/deploy/config.ini"]
Loading
Loading