change config of services

This commit is contained in:
2026-10-26 19:35:40 +01:00
parent 9c17b2a495
commit 63d3e2db07
11 changed files with 135 additions and 101 deletions
+8 -1
View File
@@ -1,2 +1,9 @@
DB_PASSWORD= DB_PASSWORD=
DB_PASSWORD_V2= BACKEND_URL=
MAIL_HOST=
MAIL_PORT=
MAIL_USER=
MAIL_PASSWORD=
MAIL_SENDEES_CONTACT=
MAIL_SENDEES=
NAAS_URL=
+2
View File
@@ -11,6 +11,8 @@ dist/
build/ build/
out/ out/
docker-compose.override.yml
# Environment variables # Environment variables
.env .env
.env.local .env.local
+78
View File
@@ -0,0 +1,78 @@
# Docker
## Prerequisites
You have created an empty `docker-compose.override.yml` file in the root directory of this repository.
## Docker Network
If you want to run the stack in a docker network, you need to change the `BACKEND_HOST` variable in the root `.env` file
to `stockhome-backend`. To add a docker network, create a `docker-compose.override.yml` file in the root directory of
this repository with the following content:
```yaml
services:
admin-frontend:
networks:
- proxynet
backend:
networks:
- proxynet
usr-frontend:
networks:
- proxynet
no-as-a-service:
networks:
- proxynet
mysql:
networks:
- proxynet
networks:
proxynet:
external: true
```
To start off I recommend to set the `BACKEND_HOST` variable to `localhost` and start the stack without a docker network.
After you have started the stack and everything is working, you can add a docker network.
## Ports
### Change Exposed Ports
If you want to change the exposed ports, you can do this in the `docker-compose.yml` file like so:
```yaml
services:
mysql:
ports:
- "3306:3306"
backend:
ports:
- "8004:8004"
usr-frontend:
ports:
- "80:80"
```
### Remove Exposed Ports
If you want to remove the exposed ports, you can do this in the `docker-compose.override.yml` file like so:
```yaml
services:
mysql:
ports: !override [ ]
backend:
ports: !override [ ]
usr-frontend:
ports: !override [ ]
```
+23 -20
View File
@@ -19,17 +19,21 @@ A small full‑stack system to log in, view available items, reserve them for a
## Contents ## Contents
- Frontend: [frontend/](frontend) - Frontend: [frontend/](frontend)
- Vite/Tailwind config: [frontend/vite.config.ts](frontend/vite.config.ts), [frontend/tailwind.config.js](frontend/tailwind.config.js) - Vite/Tailwind
- App entry: [frontend/src/main.tsx](frontend/src/main.tsx), [frontend/src/App.tsx](frontend/src/App.tsx) config: [frontend/vite.config.ts](frontend/vite.config.ts), [frontend/tailwind.config.js](frontend/tailwind.config.js)
- UI: [frontend/src/layout/Layout.tsx](frontend/src/layout/Layout.tsx), [frontend/src/components](frontend/src/components) - App entry: [frontend/src/main.tsx](frontend/src/main.tsx), [frontend/src/App.tsx](frontend/src/App.tsx)
- Data/utilities: [frontend/src/utils/fetchData.ts](frontend/src/utils/fetchData.ts), [frontend/src/utils/userHandler.ts](frontend/src/utils/userHandler.ts), [frontend/src/utils/toastify.ts](frontend/src/utils/toastify.ts) -
UI: [frontend/src/layout/Layout.tsx](frontend/src/layout/Layout.tsx), [frontend/src/components](frontend/src/components)
-
Data/utilities: [frontend/src/utils/fetchData.ts](frontend/src/utils/fetchData.ts), [frontend/src/utils/userHandler.ts](frontend/src/utils/userHandler.ts), [frontend/src/utils/toastify.ts](frontend/src/utils/toastify.ts)
- Backend: [backend/](backend) - Backend: [backend/](backend)
- Server: [backend/server.js](backend/server.js) - Server: [backend/server.js](backend/server.js)
- Routes: [backend/routes/api.js](backend/routes/api.js), [backend/routes/apiV2.js](backend/routes/apiV2.js) - Routes: [backend/routes/api.js](backend/routes/api.js), [backend/routes/apiV2.js](backend/routes/apiV2.js)
- DB + services: [backend/services/database.js](backend/services/database.js), [backend/services/tokenService.js](backend/services/tokenService.js) - DB +
- Schema/seed: [backend/scheme.sql](backend/scheme.sql) services: [backend/services/database.js](backend/services/database.js), [backend/services/tokenService.js](backend/services/tokenService.js)
- Schema/seed: [backend/scheme.sql](backend/scheme.sql)
- Docs: [docs/](docs) - Docs: [docs/](docs)
- API docs (see below): [docs/backend_API_docs/README.md](docs/backend_API_docs/README.md) - API docs (see below): [docs/backend_API_docs/README.md](docs/backend_API_docs/README.md)
## Features (high‑level) ## Features (high‑level)
@@ -41,7 +45,8 @@ A small full‑stack system to log in, view available items, reserve them for a
Key frontend utilities: Key frontend utilities:
- [`utils.fetchData.fetchAllData`](frontend/src/utils/fetchData.ts): loads items, loans, and user loans after login. - [`utils.fetchData.fetchAllData`](frontend/src/utils/fetchData.ts): loads items, loans, and user loans after login.
- [`utils.fetchData.getBorrowableItems`](frontend/src/utils/fetchData.ts): fetches borrowable items for the selected time range. - [`utils.fetchData.getBorrowableItems`](frontend/src/utils/fetchData.ts): fetches borrowable items for the selected
time range.
- [`utils.userHandler.createLoan`](frontend/src/utils/userHandler.ts): creates a new loan for selected items. - [`utils.userHandler.createLoan`](frontend/src/utils/userHandler.ts): creates a new loan for selected items.
- [`utils.userHandler.handleDeleteLoan`](frontend/src/utils/userHandler.ts): deletes a loan and syncs local state. - [`utils.userHandler.handleDeleteLoan`](frontend/src/utils/userHandler.ts): deletes a loan and syncs local state.
- [`utils.toastify.myToast`](frontend/src/utils/toastify.ts): toast notifications. - [`utils.toastify.myToast`](frontend/src/utils/toastify.ts): toast notifications.
@@ -54,20 +59,18 @@ UI flow (main screens):
## Development ## Development
- Scripts: see [frontend/package.json](frontend/package.json) and [backend/package.json](backend/package.json) - The NAAS (no-as-a-service) and the mysql database are running in a docker container
- Frontend: `npm run dev`, `npm run build`, `npm run preview`, `npm run lint` - `frontend`, `backend` and `admin` are both in a vite dev server and can be started by `npm run dev` in the root
- Backend: `npm start` directory.
- Linting: ESLint configured via [frontend/eslint.config.js](frontend/eslint.config.js)
- TypeScript configs: [frontend/tsconfig.app.json](frontend/tsconfig.app.json), [frontend/tsconfig.node.json](frontend/tsconfig.node.json)
## Configuration notes ## Configuration notes
- Vite/Tailwind integration via [frontend/vite.config.ts](frontend/vite.config.ts) and `@tailwindcss/vite`; CSS entry uses `@import "tailwindcss"` in [frontend/src/index.css](frontend/src/index.css). - Vite/Tailwind integration via [frontend/vite.config.ts](frontend/vite.config.ts) and `@tailwindcss/vite`; CSS entry
uses `@import "tailwindcss"` in [frontend/src/index.css](frontend/src/index.css).
- Toasts wired in [frontend/src/main.tsx](frontend/src/main.tsx) with `react-toastify`. - Toasts wired in [frontend/src/main.tsx](frontend/src/main.tsx) with `react-toastify`.
- Local state is stored in `localStorage` keys: `allItems`, `allLoans`, `userLoans`, `borrowableItems`. Cross‑component updates are signaled via window events from [`utils.fetchData`](frontend/src/utils/fetchData.ts). - Local state is stored in `localStorage` keys: `allItems`, `allLoans`, `userLoans`, `borrowableItems`. Cross‑component
updates are signaled via window events from [`utils.fetchData`](frontend/src/utils/fetchData.ts).
## API documentation ## API documentation
Refer to the dedicated API docs: Refer to the dedicated [API-Docs](docs/backend_API_docs/README.md)
`docs/backend_API_docs/README.md`
+1 -1
View File
@@ -14,7 +14,7 @@ server {
} }
location /backend/ { location /backend/ {
proxy_pass http://borrow_system-backend_v2:8004/; proxy_pass http://borrow-system_backend:8004/;
} }
location ~* \.(?:js|mjs|css|png|jpg|jpeg|gif|ico|svg|woff2?)$ { location ~* \.(?:js|mjs|css|png|jpg|jpeg|gif|ico|svg|woff2?)$ {
-29
View File
@@ -1,29 +0,0 @@
# Changelog for upcoming version: vX.X
Introduction
## New features
-
## Improvements
-
## Fixed bugs
-
---
## New version numbers
**Backend:** vX.X
**Frontend:** vX.X
**Admin panel:** vX.X
---
-[Theis](https://portfolio-theis.de)
+19 -27
View File
@@ -1,43 +1,42 @@
services: services:
usr-frontend: usr-frontend:
container_name: borrow-system_usr-frontend container_name: borrow-system_usr-frontend
networks:
proxynet:
ipv4_address: 172.20.0.6
build: ./frontend build: ./frontend
restart: unless-stopped environment:
VITE_BACKEND_URL: ${BACKEND_URL}
restart: always
admin-frontend: admin-frontend:
container_name: borrow-system_admin-frontend container_name: borrow-system_admin-frontend
networks:
proxynet:
ipv4_address: 172.20.0.35
build: ./admin build: ./admin
restart: unless-stopped environment:
VITE_BACKEND_URL: ${BACKEND_URL}
restart: always
backend_v2: backend:
container_name: borrow-system_backend container_name: borrow-system_backend
networks:
proxynet:
ipv4_address: 172.20.0.5
build: ./backend build: ./backend
environment: environment:
NODE_ENV: production NODE_ENV: production
DB_HOST: mysql_v2 DB_HOST: borrow-system_mysql
DB_USER: root DB_USER: root
DB_PASSWORD: ${DB_PASSWORD_V2} DB_PASSWORD: ${DB_PASSWORD}
DB_NAME: borrow_system_new DB_NAME: borrow_system_new
MAIL_HOST: ${MAIL_HOST}
MAIL_PORT: ${MAIL_PORT}
MAIL_USER: ${MAIL_USER}
MAIL_PASSWORD: ${MAIL_PASSWORD}
MAIL_SENDEES_CONTACT: ${MAIL_SENDEES_CONTACT}
MAIL_SENDEES: ${MAIL_SENDEES}
NAAS_URL: ${NAAS_URL}
depends_on: depends_on:
- mysql_v2 - mysql_v2
restart: unless-stopped restart: always
mysql: mysql:
container_name: borrow-system_mysql container_name: borrow-system_mysql
networks:
proxynet:
ipv4_address: 172.20.0.12
image: mysql:8.0 image: mysql:8.0
restart: unless-stopped restart: always
environment: environment:
MYSQL_ROOT_PASSWORD: ${DB_PASSWORD_V2} MYSQL_ROOT_PASSWORD: ${DB_PASSWORD_V2}
MYSQL_DATABASE: borrow_system_new MYSQL_DATABASE: borrow_system_new
@@ -48,9 +47,6 @@ services:
no-as-a-service: no-as-a-service:
container_name: borrow-system_naas container_name: borrow-system_naas
networks:
proxynet:
ipv4_address: 172.20.0.36
build: build:
context: ./no-as-a-service context: ./no-as-a-service
dockerfile: Dockerfile dockerfile: Dockerfile
@@ -58,8 +54,4 @@ services:
volumes: volumes:
mysql-data: mysql-data:
mysql-v2-data: mysql-v2-data:
networks:
proxynet:
external: true
+1 -1
View File
@@ -14,7 +14,7 @@ server {
} }
location /backend/ { location /backend/ {
proxy_pass http://borrow_system-backend_v2:8004/; proxy_pass http://borrow-system_backend:8004/;
} }
location ~* \.(?:js|mjs|css|png|jpg|jpeg|gif|ico|svg|woff2?)$ { location ~* \.(?:js|mjs|css|png|jpg|jpeg|gif|ico|svg|woff2?)$ {
+2 -6
View File
@@ -11,8 +11,7 @@
"workspaces": [ "workspaces": [
"backend", "backend",
"frontend", "frontend",
"admin", "admin"
"shared"
], ],
"devDependencies": { "devDependencies": {
"concurrently": "^10.0.6", "concurrently": "^10.0.6",
@@ -481,10 +480,6 @@
"node": ">=6.9.0" "node": ">=6.9.0"
} }
}, },
"node_modules/@borrow-system/shared": {
"resolved": "shared",
"link": true
},
"node_modules/@chakra-ui/react": { "node_modules/@chakra-ui/react": {
"version": "3.37.0", "version": "3.37.0",
"resolved": "https://registry.npmjs.org/@chakra-ui/react/-/react-3.37.0.tgz", "resolved": "https://registry.npmjs.org/@chakra-ui/react/-/react-3.37.0.tgz",
@@ -7484,6 +7479,7 @@
"shared": { "shared": {
"name": "@borrow-system/shared", "name": "@borrow-system/shared",
"version": "1.0.0", "version": "1.0.0",
"extraneous": true,
"license": "ISC" "license": "ISC"
} }
} }
+1 -2
View File
@@ -5,8 +5,7 @@
"workspaces": [ "workspaces": [
"backend", "backend",
"frontend", "frontend",
"admin", "admin"
"shared"
], ],
"description": "", "description": "",
"main": "index.js", "main": "index.js",
-14
View File
@@ -1,14 +0,0 @@
{
"name": "@borrow-system/shared",
"private": "true",
"version": "1.0.0",
"type": "module",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC"
}