chore: rename backend to kernel and frontend to app

This commit is contained in:
Thijs Houben 2024-05-21 10:18:47 +02:00
parent bc5f4fd36a
commit 89df2f8eb2
39 changed files with 51 additions and 51 deletions

2
.gitignore vendored
View file

@ -1,2 +1,2 @@
.apikeys.env
backend/.coverage
kernel/.coverage

View file

@ -9,7 +9,7 @@ stages:
# App
.pre_pnpm: &pre_pnpm
- cd frontend
- cd app
- corepack enable
- corepack prepare pnpm@latest-9 --activate
- pnpm config set store-dir .pnpm-store
@ -24,9 +24,9 @@ build:app:
cache:
key:
files:
- frontend/pnpm-lock.yaml
- app/pnpm-lock.yaml
paths:
- frontend/.pnpm-store
- app/.pnpm-store
lint:app:
stage: lint
@ -38,9 +38,9 @@ lint:app:
cache:
key:
files:
- frontend/pnpm-lock.yaml
- app/pnpm-lock.yaml
paths:
- frontend/.pnpm-store
- app/.pnpm-store
test:app:
stage: test
@ -52,14 +52,14 @@ test:app:
cache:
key:
files:
- frontend/pnpm-lock.yaml
- app/pnpm-lock.yaml
paths:
- frontend/.pnpm-store
- app/.pnpm-store
# Kernel
.pre_poetry: &pre_poetry
- cd backend
- cd kernel
- pip install poetry
- poetry config virtualenvs.in-project true
@ -71,7 +71,7 @@ build:kernel:
- poetry install
cache:
paths:
- /backend/.venv
- /kernel/.venv
lint:kernel:
stage: lint
@ -83,7 +83,7 @@ lint:kernel:
- ruff check
cache:
paths:
- /backend/.venv
- /kernel/.venv
test:kernel:
stage: test
@ -100,4 +100,4 @@ test:kernel:
allow_failure: false
cache:
paths:
- /backend/.venv
- /kernel/.venv

View file

@ -39,4 +39,4 @@ repos:
language: system
stages: [pre-commit]
types_or: [ts, javascript, svelte]
entry: bash -c 'cd frontend; pnpm prettier --write . && pnpm eslint --fix .'
entry: bash -c 'cd app; pnpm prettier --write . && pnpm eslint --fix .'

View file

@ -13,7 +13,7 @@ git clone https://github.com/your-username-here/spectral.git
cd spectral
```
There are two main components: the frontend and the backend. Each of them have a separate CONTRIBUTING.md, however there are also some general guidelines that apply to both. Here we continue with the general guidelines.
There are two main components: the app and the kernel. Each of them have a separate CONTRIBUTING.md, however there are also some general guidelines that apply to both. Here we continue with the general guidelines.
Install the [pre-commit hook](https://pre-commit.com/#install). For example:
@ -22,7 +22,7 @@ pip install pre-commit
pre-commit install
```
These hooks use ruff to format the Python backend code, and pyright to lint it. For svelte we use ESLint and Prettier.
These hooks use ruff to format the Python kernel code, and pyright to lint it. For svelte we use ESLint and Prettier.
### conventional-pre-commit
To use the conventional-pre-commit, which enforces [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/), run the following command:

4
ci.py
View file

@ -4,12 +4,12 @@ import sys
stages = {
"app": """
cd frontend &&
cd app &&
pnpm lint &&
pnpm exec vitest run --coverage &&
cd ..
""",
"backend": [],
"kernel": [],
"end-to-end": [],
}

View file

@ -23,22 +23,22 @@ services:
volumes:
- postgres_data:/data
frontend:
app:
restart: unless-stopped
stop_grace_period: 500ms
environment:
PUBLIC_KERNEL_ORIGIN: http://backend
PUBLIC_KERNEL_ORIGIN: http://kernel
PG_CONNECTION_STRING: postgres://user:password@postgres:5432/spectral_db
build:
context: ./frontend
context: ./app
dockerfile: Dockerfile
volumes:
- ./frontend:/frontend
- node_modules:/frontend/node_modules/
- ./app:/app
- node_modules:/app/node_modules/
expose:
- "5173"
depends_on:
- backend
- kernel
nginx:
image: nginx:latest
@ -49,17 +49,17 @@ services:
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf
depends_on:
- frontend
- app
backend:
kernel:
restart: unless-stopped
stop_grace_period: 500ms
build:
context: ./backend
context: ./kernel
dockerfile: Dockerfile
volumes:
- ./backend:/backend
- pip_cache:/backend/.venv
- ./kernel:/kernel
- pip_cache:/kernel/.venv
expose:
- "8000"
depends_on:

View file

@ -19,7 +19,7 @@ Ideally, of course, we want a 10. However, the grade that we have decided we wou
## Products
In the end, we should deliver a web application that can be accessed on the website [spectral.ewi.tudelft.nl](http://spectral.ewi.tudelft.nl/). It will be hosted on a TU Delft server just like the backend and documentation website that we will create. The code will be stored on both the EEMCS Gitlab server and Github, where the goal for Github is to open-source the project.
In the end, we should deliver a web application that can be accessed on the website [spectral.ewi.tudelft.nl](http://spectral.ewi.tudelft.nl/). It will be hosted on a TU Delft server just like the kernel and documentation website that we will create. The code will be stored on both the EEMCS Gitlab server and Github, where the goal for Github is to open-source the project.
We will also have to create a final report about the project that will be handed in on Brightspace. We will create this report throughout the project by handing in the sub-assignments on Brightspace as well. We will work on the report using Typst, which allows us to work on the project together in real-time.

View file

@ -22,9 +22,9 @@
- `P2(eventually)`
- `P3(not-scheduled)`
- `domain::` one of
- `backend`
- `frontend`
- `docs` (have priority over the frontend/backend)
- `kernel`
- `app`
- `docs` (have priority over the app/kernel)
- `question`: Contains a question that needs to be answered to move forward the issue
- `duplicate`: Seems to be a duplicate of another issue
- `refactoring`: Rewrite that doesnt change functionality

View file

@ -12,7 +12,7 @@ Then clone the library and go to the app folder.
```bash
git clone https://github.com/your-username-here/spectral.git
cd spectral/frontend
cd spectral/app
```
## Contributing
@ -50,13 +50,13 @@ Now make your changes. Make sure to include additional tests if necessary.
### Running the application
While making code changes, it might be required to be in contact with another service other than frontend. To simulate this, we provide a docker-compose file in the root directory of this project. To run the docker services, go to _project's root folder_ and write:
While making code changes, it might be required to be in contact with another service other than app. To simulate this, we provide a docker-compose file in the root directory of this project. To run the docker services, go to _project's root folder_ and write:
```bash
docker compose up --build
```
The frontend service should be accessible from `http://localhost`.
The app service should be accessible from `http://localhost`.
### Before committing!!

View file

@ -1,8 +1,8 @@
# Dockerfile for Svelte Frontend
# Dockerfile for Svelte app
FROM node:20-alpine
# Set the working directory
WORKDIR /frontend
WORKDIR /app
RUN corepack enable

View file

@ -1,4 +1,4 @@
Frontend for the application, using [SvelteKit](https://kit.svelte.dev/).
app for the application, using [SvelteKit](https://kit.svelte.dev/).
## Developing

View file

@ -1,5 +1,5 @@
{
"name": "frontend",
"name": "app",
"version": "0.0.1",
"private": true,
"scripts": {

View file

@ -8,7 +8,7 @@ import { error } from '@sveltejs/kit';
import { browser } from '$app/environment';
/**
* Main way to fetch stuff for backend
* Main way to fetch stuff for kernel
*/
export function getURL(path: string): URL {
if (!browser) {

View file

@ -1,6 +1,6 @@
# Contributing
Contributions (pull requests) are very welcome! Here's how to get started on the backend.
Contributions (pull requests) are very welcome! Here's how to get started on the kernel.
## Dependencies

View file

@ -50,7 +50,7 @@ RUN poetry self add poetry-plugin-export
COPY poetry.lock pyproject.toml ./
# will become mountpoint of our code
WORKDIR /backend
WORKDIR /kernel
# Expose the necessary port
EXPOSE 8000

View file

@ -1,8 +1,8 @@
# Spectral backend
# Spectral kernel
## Run backend locally
## Run kernel locally
For the backend we are using fastapi. To start up the server locally run:
For the kernel we are using fastapi. To start up the server locally run:
```bash
fastapi dev spectral/main.py

View file

@ -1,7 +1,7 @@
[tool.poetry]
name = "spectral"
version = "0.0.1"
description = "Backend for spectral: atypical speech analysis and recognition platform"
description = "kernel for spectral: atypical speech analysis and recognition platform"
authors = [
"Roman Knyazhitskiy <mail@knyaz.tech>",
"Ody Machairas",
@ -48,4 +48,4 @@ coverage = "^7.5.1"
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
build-kernel = "poetry.core.masonry.api"

0
backend/spectral/main.py → kernel/spectral/main.py Executable file → Normal file
View file

View file

@ -11,9 +11,9 @@ http {
server {
listen 80;
# Configuration for the frontend service
# Configuration for the app service
location / {
proxy_pass http://frontend:5173; # Proxies requests to the frontend service
proxy_pass http://app:5173; # Proxies requests to the app service
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
@ -22,9 +22,9 @@ http {
client_max_body_size 100M; # Allows file uploads up to 100MB
}
# Configuration for the backend service
# Configuration for the kernel service
location /api/ {
proxy_pass http://backend:8000; # Proxies requests to the backend service
proxy_pass http://kernel:8000; # Proxies requests to the kernel service
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';