Skip to content

Commit

Permalink
Merge pull request #125 from forza-mor-rotterdam/develop
Browse files Browse the repository at this point in the history
develop -> main
  • Loading branch information
mguikema committed Apr 3, 2024
2 parents 4caeb18 + f6094e8 commit 6b91329
Show file tree
Hide file tree
Showing 57 changed files with 10,876 additions and 5,121 deletions.
3 changes: 3 additions & 0 deletions .djlintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"ignore": "H006, H013, H023"
}
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
ENVIRONMENT=development
APP_ENV=productie

DJANGO_SECRET_KEY=secret_key

Expand Down
62 changes: 52 additions & 10 deletions .github/workflows/ci-cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ jobs:
- name: Linting
run: bash bin/cleanup_pre_commit.sh

docker-build-and-test:
name: Create Docker image and test
create-docker-test-image-and-test:
name: Create Docker test image and test
runs-on: ubuntu-latest
needs: django-lint
steps:
Expand All @@ -41,22 +41,22 @@ jobs:
- name: Run Tests
run: docker compose -f docker-compose.test.yaml run app python manage.py test

deploy-acc:
name: Acceptance release
environment: acc
build-and-push-docker-image:
name: Build and push Docker image
if: github.ref == 'refs/heads/develop'
needs: docker-build-and-test
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
needs: create-docker-test-image-and-test
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Get current date
id: get_date
run: echo "::set-output name=DATE::$(date +'%d-%m-%Y-%H-%M-%S')"

- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
Expand All @@ -66,9 +66,12 @@ jobs:

- name: Extract metadata (tags, labels) for Docker
id: meta_app
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-app
tags: |
type=raw,develop
type=raw,test
- name: Build and push app Docker image
uses: docker/build-push-action@v3
Expand All @@ -79,7 +82,46 @@ jobs:
labels: ${{ steps.meta_app.outputs.labels }}
build-args: |
GIT_SHA=${{ github.sha }}
DEPLOY_DATE=${{ steps.get_date.outputs.DATE }}
deploy-acc:
name: Acceptance release
if: github.ref == 'refs/heads/develop'
needs: build-and-push-docker-image
runs-on: ubuntu-latest
environment: acc
permissions:
contents: read
packages: write
steps:
- name: Start rollout on k8s platform
uses: actions-hub/kubectl@master
env:
KUBE_HOST: ${{ vars.KUBE_HOST }}
KUBE_CERTIFICATE: ${{ vars.KUBE_CERTIFICATE }}
KUBE_TOKEN: ${{ secrets.KUBE_TOKEN }}
with:
args: rollout restart deployment/app --namespace=${{ vars.KUBE_NAMESPACE }}

- name: Status rollout on k8s platform
uses: actions-hub/kubectl@master
env:
KUBE_HOST: ${{ vars.KUBE_HOST }}
KUBE_CERTIFICATE: ${{ vars.KUBE_CERTIFICATE }}
KUBE_TOKEN: ${{ secrets.KUBE_TOKEN }}
with:
args: rollout status deployment/app --namespace=${{ vars.KUBE_NAMESPACE }}

deploy-test:
name: Test release
if: github.ref == 'refs/heads/develop'
needs: build-and-push-docker-image
runs-on: ubuntu-latest
environment: test
permissions:
contents: read
packages: write
steps:
- name: Start rollout on k8s platform
uses: actions-hub/kubectl@master
env:
Expand Down
58 changes: 42 additions & 16 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,26 +1,52 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- id: detect-private-key
- repo: https://github.com/humitos/mirrors-autoflake.git
rev: v1.1
hooks:
- repo: https://github.com/humitos/mirrors-autoflake.git
rev: v1.1
hooks:
- id: autoflake
args: ['--in-place', '--remove-all-unused-imports', '--remove-unused-variable']
- repo: https://github.com/timothycrosley/isort
rev: '5.12.0'
hooks:
args:
[
"--in-place",
"--remove-all-unused-imports",
"--remove-unused-variable",
]
- repo: https://github.com/timothycrosley/isort
rev: "5.13.2"
hooks:
- id: isort
- repo: https://github.com/ambv/black
rev: '23.10.1'
hooks:
- repo: https://github.com/ambv/black
rev: "23.10.1"
hooks:
- id: black
language_version: python3
- repo: https://github.com/pycqa/flake8
rev: '6.1.0'
hooks:
- repo: https://github.com/pycqa/flake8
rev: "6.1.0"
hooks:
- id: flake8
- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v3.0.3"
hooks:
- id: prettier
additional_dependencies:
- prettier@3.0.3
files: '\.(js|ts|jsx|tsx|scss|css)$'
- repo: https://github.com/djlint/djLint
rev: v1.34.1
hooks:
- id: djlint-reformat-django
- id: djlint-django
args: ["--ignore", "H006,H013,H023"]
- repo: https://github.com/pre-commit/mirrors-eslint
rev: 'v8.56.0'
hooks:
- id: eslint
additional_dependencies:
- eslint@8.57.0
- eslint-config-prettier@9.1.0
- eslint-plugin-prettier@5.1.3
2 changes: 2 additions & 0 deletions app/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,7 @@ USER $APP_USER

ARG GIT_SHA
ENV GIT_SHA=$GIT_SHA
ARG DEPLOY_DATE
ENV DEPLOY_DATE=$DEPLOY_DATE

CMD ["bash", "/app/deploy/docker-entrypoint.sh"]
2 changes: 1 addition & 1 deletion app/apps/health/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from health_check.plugins import plugin_dir


class HealthConfig(AppConfig):
class ServicesConfig(AppConfig):
name = "apps.health"
verbose_name = "Health"

Expand Down
94 changes: 94 additions & 0 deletions app/apps/health/templates/health_check/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
<!DOCTYPE html>
<html lang="nl">
<head>
<title>
{% block title %}
System status
{% endblock title %}
</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description"
content="Serviceformulier voor Begraven en Cremeren meldingen op de MOR-keten">
<meta name="keywords"
content="MOR, Meldingen openbare ruimte, gemeente Rotterdam, MBC, begraven en cremeren">
<meta name="robots" content="noindex">
<style>
html, body {
margin: 0 auto;
font-family: sans-serif;
line-height: 1.5;
max-width: 900px;
}

h1 {
text-align: center;
margin: 10px;
font-weight: lighter;
}

table {
border-collapse: collapse;
width: 100%;
text-align: left;
}

table tr:nth-child(2n) {
background-color: #f1f1f1;
}

td, th {
padding: 8px;
}

.align-right {
text-align: right;
}

table thead {
background-color: lightskyblue;
}

table .icons {
text-align: center;
width: 50px;
}
</style>
{% block extra_head %}
{% endblock extra_head %}
</head>
<body>
{% block content %}
<h1>System status</h1>
<small>Git sha: {{ GIT_SHA }}</small>
{% if DEPLOY_DATE %}
<br />
<small>Deploy date: {{ DEPLOY_DATE }}</small>
{% endif %}
<table>
<thead>
<th colspan="2">Service</th>
<th>Status</th>
<th class="align-right">Time Taken</th>
</thead>
<tbody>
{% for plugin in plugins %}
<tr>
<td class="icons">
<span aria-hidden="true">
{% if plugin.status %}
&#9989;
{% else %}
&#10060;
{% endif %}
</span>
</td>
<td>{{ plugin.identifier }}</td>
<td>{{ plugin.pretty_status | linebreaks }}</td>
<td class="align-right">{{ plugin.time_taken|floatformat:4 }} seconds</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endblock content %}
</body>
</html>
6 changes: 4 additions & 2 deletions app/apps/main/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,8 +325,10 @@ def signaal_data(self, files=[]):
},
"origineel_aangemaakt": now.isoformat(),
"onderwerpen": self.get_onderwerp_urls(data.get("categorie", [])),
"omschrijving_kort": data.get("toelichting", "")[:500],
"omschrijving": data.get("toelichting", "")[:5000],
"omschrijving_melder": data.get("toelichting", "")[:500],
"aanvullende_informatie": data.get("aanvullende_informatie", "")[
:5000
], # currently not used
"meta": data,
"meta_uitgebreid": labels,
"graven": [
Expand Down
29 changes: 14 additions & 15 deletions app/apps/main/templates/404.html
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
{% extends 'base.html' %}
{% block title %}404 Pagina niet gevonden{% endblock %}

{% extends "base.html" %}
{% block title %}
404 Pagina niet gevonden
{% endblock title %}
{% block javascripts %}
{% endblock %}

{% endblock javascripts %}
{% block body %}
<div>
<section class="section--seperated">
<div class="container__details">
<h1>De pagina is niet gevonden</h1>
<strong>404</strong>
</div>
</section>

</div>
{% endblock %}
<div>
<section class="section--seperated">
<div class="container__details">
<h1>De pagina is niet gevonden</h1>
<strong>404</strong>
</div>
</section>
</div>
{% endblock body %}
29 changes: 14 additions & 15 deletions app/apps/main/templates/500.html
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
{% extends 'base.html' %}
{% block title %}500 Er ging iets mis{% endblock %}

{% extends "base.html" %}
{% block title %}
500 Er ging iets mis
{% endblock title %}
{% block javascripts %}
{% endblock %}

{% endblock javascripts %}
{% block body %}
<div>
<section class="section--seperated">
<div class="container__details">
<h1>Er ging iets mis!</h1>
<strong>500</strong>
</div>
</section>

</div>
{% endblock %}
<div>
<section class="section--seperated">
<div class="container__details">
<h1>Er ging iets mis!</h1>
<strong>500</strong>
</div>
</section>
</div>
{% endblock body %}
Loading

0 comments on commit 6b91329

Please sign in to comment.