From 8b7bbf8edd2d1d67757018e04140152ba90711f8 Mon Sep 17 00:00:00 2001 From: Julian Krauser Date: Wed, 27 Nov 2024 17:06:41 +0100 Subject: [PATCH] docker build test --- Dockerfile | 1 - README.md | 95 ++++++++++++++++++++++++++++++++++++--------- src/routes/index.ts | 14 +++---- 3 files changed, 83 insertions(+), 27 deletions(-) diff --git a/Dockerfile b/Dockerfile index 250b814..8d60e07 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,7 +17,6 @@ WORKDIR /app COPY --from=build /app/dist /app/dist COPY --from=build /app/node_modules /app/node_modules COPY --from=build /app/package.json /app/package.json -COPY --from=build /app/.env /app/.env EXPOSE 5000 diff --git a/README.md b/README.md index 08b682c..dc68a7b 100644 --- a/README.md +++ b/README.md @@ -1,30 +1,87 @@ # member-administration-server -Memberadministration +Mitgliederverwaltung für Feuerwehren und Vereine (Backend). -Authentications is realized via JWT-Tokens. The server is able to send Mails to the members. -Login is possible via Username and TOTP. +## Einleitung + +Dieses Projekt, `member-administration-server`, ist das Backend zur Verwaltung von Mitgliederdaten. Die zugehörige Webapp ist im Repository [member-administration-ui](https://forgejo.jk-effects.cloud/Ehrenamt/member-administration-ui) zu finden. + +Eine Demo zusammen mit der `member-administration-ui` finden Sie unter [ff-admin-demo.jk-effects.cloud](ff-admin-demo.jk-effects.cloud). ## Installation -### Requirements +### Docker Compose Setup -1. MySql Database -2. Access to the internet for sending Mails +Um den Container hochzufahren, erstellen Sie eine `docker-compose.yml` Datei mit folgendem Inhalt: -### Configuration +```yaml +version: "3" -1. Copy the .env.example file to .env and fill in the required information -2. Create a new Database in MySql named as in the .env file -3. Install all packages via `npm install` -4. Start the application to create the database schema +services: + ff-member-administration-server: + image: docker.registry.jk-effects.cloud/ehrenamt/member-administration/server:latest + container_name: ff_member_administration_server + restart: unless-stopped + environment: + - DB_TYPE = mysql + - DB_HOST=ffm-db + - DB_NAME=administration + - DB_USERNAME=administration_backend + - DB_PASSWORD= + - JWT_SECRET= + - JWT_EXPIRATION= + - REFRESH_EXPIRATION= + - MAIL_USERNAME= + - MAIL_PASSWORD= + - MAIL_HOST= + - MAIL_PORT= + - MAIL_SECURE= + - CLUB_NAME= + volumes: + - :/app/export + networks: + - ff_internal + depends_on: + - ff-db -## Testing + ff-db: + image: mariadb:11.2 + container_name: ff_db + restart: unless-stopped + environment: + - MYSQL_DATABASE=ffadmin + - MYSQL_USER=administration_backend + - MYSQL_PASSWORD= + - MYSQL_ROOT_PASSWORD= + volumes: + - :/var/lib/mysql + networks: + - ff_internal -1. Install the database-system-package you like (e.g. mysql, mariadb, postgresql, sqlite3) -2. Configure type inside src/data-source.ts to run the database-system you like. -3. Set migrationsRun to false and synchronize to true for rapid prototyping -4. Building the schema via CLI: - - Run `npm run update-database` to build the schema using the migrations without starting the application - - Run `npm run synchronize-database` to build the schema without using migrations without starting the application -5. Run `npm run dev` to run inside dev-environment (runs migrations if migrationsRun is set to true) +networks: + ff_internal: +``` + +Führen Sie dann den folgenden Befehl im Verzeichnis der compose-Datei aus, um den Container zu starten: + +```sh +docker-compose up -d +``` + +### Manuelle Installation + +Klonen Sie dieses Repository und installieren Sie die Abhängigkeiten: + +```sh +git clone https://forgejo.jk-effects.cloud/Ehrenamt/member-administration-server.git +cd member-administration-server +npm install +npm run build +npm run start +``` + +## Fragen und Wünsche + +Bei Fragen, Anregungen oder Wünschen können Sie sich gerne melden.\ +Wir freuen uns über Ihr Feedback und helfen Ihnen gerne weiter.\ +Schreiben Sie dafür eine Mail an julian.krauser@jk-effects.com. diff --git a/src/routes/index.ts b/src/routes/index.ts index eee3e7d..72cb526 100644 --- a/src/routes/index.ts +++ b/src/routes/index.ts @@ -25,13 +25,13 @@ export default (app: Express) => { app.use(cors()); app.options("*", cors()); - app.use("/public", publicAvailable); - app.use("/setup", allowSetup, setup); - app.use("/reset", reset); - app.use("/invite", invite); - app.use("/auth", auth); + app.use("/api/public", publicAvailable); + app.use("/api/setup", allowSetup, setup); + app.use("/api/reset", reset); + app.use("/api/invite", invite); + app.use("/api/auth", auth); app.use(authenticate); - app.use("/admin", admin); - app.use("/user", user); + app.use("/api/admin", admin); + app.use("/api/user", user); app.use(errorHandler); };