Skip to content

Commit

Permalink
Merge branch 'main' into add-checkboxes-to-data-input
Browse files Browse the repository at this point in the history
  • Loading branch information
MaHaWo committed Sep 25, 2024
2 parents c14813c + c12c462 commit 8d46de5
Show file tree
Hide file tree
Showing 46 changed files with 1,993 additions and 905 deletions.
17 changes: 16 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,15 @@ jobs:
cache: 'pnpm'
cache-dependency-path: frontend/pnpm-lock.yaml
- run: pnpm install
- run: pnpm build
- run: pnpm run test
- uses: codecov/codecov-action@v4
with:
files: ./frontend/coverage/coverage-final.json
name: frontend
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
verbose: true
backend-unit-tests:
runs-on: ubuntu-latest
defaults:
Expand All @@ -36,4 +44,11 @@ jobs:
with:
python-version: "3.12"
- run: pip install -e .[tests]
- run: python -m pytest -sv
- run: python -m pytest --cov=mondey_backend --cov-report=xml -svvv
- uses: codecov/codecov-action@v4
with:
files: ./mondey_backend/coverage.xml
name: backend
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
verbose: true
40 changes: 40 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: docker containers
on:
push:
branches:
- main
pull_request:
branches:
- main

concurrency:
group: docker-${{ github.ref }}
cancel-in-progress: true

jobs:
docker:
runs-on: ubuntu-latest
name: "Docker"
steps:
- uses: actions/checkout@v4
- run: docker compose build
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
- run: |
echo $MONDEY_DOCKER_IMAGE_TAG
docker compose build
docker compose push
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
env:
MONDEY_DOCKER_IMAGE_TAG: ${{ github.sha }}
- run: |
echo $MONDEY_DOCKER_IMAGE_TAG
docker compose build
docker compose push
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
env:
MONDEY_DOCKER_IMAGE_TAG: "latest"
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
# [mondey-frontend-prototype](https://ssciwr.github.io/mondey-frontend-prototype)
# [mondey](https://ssciwr.github.io/mondey)
[![run tests](https://github.com/ssciwr/mondey/actions/workflows/ci.yml/badge.svg)](https://github.com/ssciwr/mondey/actions/workflows/ci.yml)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=ssciwr_mondey&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=ssciwr_mondey)
[![codecov](https://codecov.io/gh/ssciwr/mondey/graph/badge.svg?token=1YBO3KUDAR)](https://codecov.io/gh/ssciwr/mondey)

Initial frontend prototyping for the MONDEY project.
Initial development for the MONDEY project.

The static website is automatically built and deployed to
[ssciwr.github.io/mondey-frontend-prototype](https://ssciwr.github.io/mondey-frontend-prototype)
[ssciwr.github.io/mondey](https://ssciwr.github.io/mondey)
on every push to the main branch using this [Github Action](.github/workflows/deploy.yml).

## Component demos

- [Milestone](https://ssciwr.github.io/mondey-frontend-prototype/milestone)
- [Milestonegroup](https://ssciwr.github.io/mondey-frontend-prototype/milestonegroup)
- [Milestone](https://ssciwr.github.io/mondey/milestone)
- [Milestonegroup](https://ssciwr.github.io/mondey/milestonegroup)
34 changes: 34 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
services:
backend:
image: ghcr.io/ssciwr/mondey_backend:${MONDEY_DOCKER_IMAGE_TAG:-latest}
build: ./mondey_backend
volumes:
- ${STATIC_FILES_PATH:-./static}:/app/static
- ${DATABASE_PATH:-./db}:/app/db
environment:
- SECRET=${SECRET:-}
- STATIC_FILES_PATH=/app/static
- DATABASE_PATH=/app/db
- ENABLE_CORS=${ENABLE_CORS:-false}
- HOST=${HOST:-backend}
- PORT=${PORT:-80}
- RELOAD=${RELOAD:-false}
- LOG_LEVEL=${LOG_LEVEL:-info}
frontend:
image: ghcr.io/ssciwr/mondey_frontend:${MONDEY_DOCKER_IMAGE_TAG:-latest}
build:
context: ./frontend
args:
- MONDEY_API_URL=/api
ports:
- "80:80"
- "443:443"
# volumes:
# - ${MONDEY_SSL_CERT:-./cert.pem}:/MONDEY_ssl_cert.pem
# - ${MONDEY_SSL_KEY:-./key.pem}:/MONDEY_ssl_key.pem
# email:
# image: "boky/postfix"
# environment:
# - ALLOW_EMPTY_SENDER_DOMAINS="true"
# networks:
# - mondey-network
3 changes: 2 additions & 1 deletion frontend/.env
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
VITE_MONDEY_API_URL=http://localhost:8000
# api location for local development:
VITE_MONDEY_API_URL=http://localhost:8000/api
3 changes: 3 additions & 0 deletions frontend/.prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@
package-lock.json
pnpm-lock.yaml
yarn.lock
# build artefacts
.svelte-kit
build
22 changes: 22 additions & 0 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM node:22-slim AS builder

LABEL org.opencontainers.image.source=https://github.com/ssciwr/mondey
LABEL org.opencontainers.image.description="MONDEY frontend production image"

ARG MONDEY_API_URL

WORKDIR /app

COPY package*.json ./

RUN npm install -g pnpm && pnpm install

COPY . .

RUN echo "VITE_MONDEY_API_URL=${MONDEY_API_URL}" > .env && pnpm run build

FROM nginx:1.27.1

COPY --from=builder /app/build /usr/share/nginx/html

COPY nginx.conf /etc/nginx/conf.d/default.conf
2 changes: 2 additions & 0 deletions frontend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ Initial setup to edit the frontend locally:
To start a development server:

- `pnpm run dev`

This will serve the website at [http://localhost:5173](http://localhost:5173)
48 changes: 48 additions & 0 deletions frontend/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
server {
listen 80;
# listen 443 ssl;
# listen [::]:443 ssl;
http2 on;
server_name localhost;
# ssl_certificate /ssl_cert.pem;
# ssl_certificate_key /ssl_key.pem;

# Maximum file upload size
client_max_body_size 20M;

# Improve HTTPS performance with session resumption
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;

# Enable server-side protection against BEAST attacks
ssl_protocols TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers "ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384";

# Aditional Security Headers
# ref: https://developer.mozilla.org/en-US/docs/Security/HTTP_Strict_Transport_Security
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains";

# ref: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options
add_header X-Frame-Options DENY always;

# ref: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Content-Type-Options
add_header X-Content-Type-Options nosniff always;

# ref: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-XSS-Protection
add_header X-Xss-Protection "1; mode=block" always;

location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}

location /api/ {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://backend:80;
}
}
36 changes: 19 additions & 17 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,40 +8,42 @@
"preview": "vite preview",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"test": "vitest",
"test": "vitest --coverage",
"lint": "prettier --check . && eslint .",
"format": "prettier --write ."
},
"devDependencies": {
"@sveltejs/adapter-auto": "^3.0.0",
"@sveltejs/adapter-static": "^3.0.4",
"@sveltejs/kit": "^2.5.25",
"@sveltejs/adapter-auto": "^3.2.5",
"@sveltejs/adapter-static": "^3.0.5",
"@sveltejs/kit": "^2.5.28",
"@sveltejs/vite-plugin-svelte": "^3.1.2",
"@tailwindcss/typography": "^0.5.15",
"@testing-library/svelte": "^5.2.1",
"@types/eslint": "^9.6.1",
"@vitest/coverage-v8": "^2.1.1",
"autoprefixer": "^10.4.20",
"eslint": "^9.9.1",
"eslint": "^9.11.1",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-svelte": "^2.36.0",
"eslint-plugin-svelte": "^2.44.0",
"flowbite": "^2.5.1",
"flowbite-svelte": "^0.46.15",
"flowbite-svelte": "^0.46.17",
"flowbite-svelte-icons": "^1.6.1",
"globals": "^15.0.0",
"jsdom": "^25.0.0",
"prettier": "^3.1.1",
"prettier-plugin-svelte": "^3.1.2",
"prettier-plugin-tailwindcss": "^0.6.5",
"globals": "^15.9.0",
"jsdom": "^25.0.1",
"prettier": "^3.3.3",
"prettier-plugin-svelte": "^3.2.6",
"prettier-plugin-tailwindcss": "^0.6.6",
"svelte": "^4.2.19",
"svelte-check": "^3.8.6",
"tailwindcss": "^3.4.9",
"typescript": "^5.0.0",
"typescript-eslint": "^8.3.0",
"vite": "^5.4.2",
"vitest": "^2.0.0"
"tailwindcss": "^3.4.13",
"typescript": "^5.6.2",
"typescript-eslint": "^8.7.0",
"vite": "^5.4.7",
"vitest": "^2.1.1"
},
"type": "module",
"dependencies": {
"iso-639-1": "3.1.3",
"svelte-i18n": "^4.0.0"
}
}
Loading

0 comments on commit 8d46de5

Please sign in to comment.