docker build test

This commit is contained in:
Julian Krauser 2024-11-27 17:06:41 +01:00
parent f58032e1e5
commit 8b7bbf8edd
3 changed files with 83 additions and 27 deletions

View file

@ -17,7 +17,6 @@ WORKDIR /app
COPY --from=build /app/dist /app/dist COPY --from=build /app/dist /app/dist
COPY --from=build /app/node_modules /app/node_modules COPY --from=build /app/node_modules /app/node_modules
COPY --from=build /app/package.json /app/package.json COPY --from=build /app/package.json /app/package.json
COPY --from=build /app/.env /app/.env
EXPOSE 5000 EXPOSE 5000

View file

@ -1,30 +1,87 @@
# member-administration-server # 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. ## Einleitung
Login is possible via Username and TOTP.
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 ## Installation
### Requirements ### Docker Compose Setup
1. MySql Database Um den Container hochzufahren, erstellen Sie eine `docker-compose.yml` Datei mit folgendem Inhalt:
2. Access to the internet for sending Mails
### Configuration ```yaml
version: "3"
1. Copy the .env.example file to .env and fill in the required information services:
2. Create a new Database in MySql named as in the .env file ff-member-administration-server:
3. Install all packages via `npm install` image: docker.registry.jk-effects.cloud/ehrenamt/member-administration/server:latest
4. Start the application to create the database schema 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=<dbuserpasswd>
- JWT_SECRET=<tobemodified>
- JWT_EXPIRATION=<number[m|d] - bsp.:15m>
- REFRESH_EXPIRATION=<number[m|d] - bsp.:1d>
- MAIL_USERNAME=<mailadress|username>
- MAIL_PASSWORD=<password>
- MAIL_HOST=<url>
- MAIL_PORT=<port>
- MAIL_SECURE=<boolean>
- CLUB_NAME=<tobemodified>
volumes:
- <volume|local path>:/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=<dbuserpasswd>
- MYSQL_ROOT_PASSWORD=<dbrootpasswd>
volumes:
- <volume|local path>:/var/lib/mysql
networks:
- ff_internal
1. Install the database-system-package you like (e.g. mysql, mariadb, postgresql, sqlite3) networks:
2. Configure type inside src/data-source.ts to run the database-system you like. ff_internal:
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 Führen Sie dann den folgenden Befehl im Verzeichnis der compose-Datei aus, um den Container zu starten:
- 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) ```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.

View file

@ -25,13 +25,13 @@ export default (app: Express) => {
app.use(cors()); app.use(cors());
app.options("*", cors()); app.options("*", cors());
app.use("/public", publicAvailable); app.use("/api/public", publicAvailable);
app.use("/setup", allowSetup, setup); app.use("/api/setup", allowSetup, setup);
app.use("/reset", reset); app.use("/api/reset", reset);
app.use("/invite", invite); app.use("/api/invite", invite);
app.use("/auth", auth); app.use("/api/auth", auth);
app.use(authenticate); app.use(authenticate);
app.use("/admin", admin); app.use("/api/admin", admin);
app.use("/user", user); app.use("/api/user", user);
app.use(errorHandler); app.use(errorHandler);
}; };