ApfelNetzwerk/docs/SETUP.md
2024-10-14 23:24:55 +02:00

57 lines
1.5 KiB
Markdown

# How to setup the Project
## Table of Contents
1. [Prerequisites](#prerequisites)
2. [Setup](#setup)
3. [Applying Migrations](#applying-migrations)
---
# Prerequisites
Docker installed on the system.
For the frontend it might be necessary to install pnpm and its requirements
For a production environment you may change the database user/password in the `.env` file and the corresponding `dev-compose.yml` or build your own!
# Setup
To execute the database and backend run the following command in the root directory of the project
```bash
docker compose -f dev-compose.yml up -d
```
or if you only want to execute 1 or n containers the syntax is the following
```bash
docker compose -f dev-compose.yml up -d postgres backend frontend
```
this starts all the containers however you can just remove them as you like. If you want to stop all docker containers run
```bash
docker compose -f dev-compose.yml down
```
# Applying Migrations
If migrations haven't been applied yet you can apply them with the following commands:
*Note: Plase ensure the database and backend is running*
remove old docker image if you have updated the backend
```bash
docker image remove apfelnetzwerk-backend
```
1. check which dockers are running (both the database and backend should run otherwise start them as stated above)
```bash
docker ps
```
2. attach a shell to the running backend docker container
```bash
docker exec -it <id/name> /bin/bash
```
3. apply migrations
```bash
#(go into the crates folder)
cd crates
#run migrations
sea-orm-cli migrate fresh
```