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

1.5 KiB

How to setup the Project

Table of Contents

  1. Prerequisites
  2. Setup
  3. 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

docker compose -f dev-compose.yml up -d

or if you only want to execute 1 or n containers the syntax is the following

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

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

docker image remove apfelnetzwerk-backend
  1. check which dockers are running (both the database and backend should run otherwise start them as stated above)
docker ps
  1. attach a shell to the running backend docker container
docker exec -it <id/name> /bin/bash
  1. apply migrations
#(go into the crates folder)
cd crates
#run migrations
sea-orm-cli migrate fresh