diff --git a/backend/Makefile b/backend/Makefile new file mode 100644 index 00000000..5c47deae --- /dev/null +++ b/backend/Makefile @@ -0,0 +1,11 @@ +#---- COMMANDS ----# + +start: ##@Docker (start) + docker compose up --build + +fresh: ##@Docker (start) with fresh fixtures + docker compose --profile fresh down + docker compose --profile fresh up --build + +clean: ##@Docker (stop) Stops and removes all containers and volumes + docker compose --profile fresh down -v \ No newline at end of file diff --git a/backend/README.md b/backend/README.md index ff015c2f..98920601 100644 --- a/backend/README.md +++ b/backend/README.md @@ -7,12 +7,29 @@ - [cors for Express.js](https://github.com/expressjs/cors) - middleware - [nodemon](https://github.com/remy/nodemon) - development dependency -## Developement - -Install and run the backend using `docker compose up` -If you change the fixtures afterwards you have to run `docker compose up --build` to reload the new fixtures to the image. +## Development ### Environment variables Make a copy of `.env.example` and name it `.env` When using docker you don't need to do any modifications for developing locally. + +### Start the backend and a database + +(Requires docker installed and the environment variables from the step above) + +Start the backend and a local database: +`make start` + +Start the backend and a local database with clean dummy data: +`make fresh` + +Stop and remove backend and local database: +`make clean` + +--- + +#### Commands if not using makefile: + +Install and run the backend using `docker compose up --build` +If you want to populate your local database with dummy data from the fixtures use `docker compose --profile fresh up --build` instead. diff --git a/backend/docker-compose.yml b/backend/docker-compose.yml index 2d4dcb7d..4cd116b3 100644 --- a/backend/docker-compose.yml +++ b/backend/docker-compose.yml @@ -10,6 +10,7 @@ services: # Auto imports fixtures, will auto exit when done import-fixtures: + profiles: ['fresh'] env_file: - .env build: diff --git a/backend/fixtures/production/committees.json b/backend/fixtures/production/committees.json index 468e6186..594d351d 100644 --- a/backend/fixtures/production/committees.json +++ b/backend/fixtures/production/committees.json @@ -83,5 +83,12 @@ "deputy_board_member" ], "accepts_admissions": false + }, + { + "_id": 103, + "name": "Materialutvalget", + "slug": "materialutvalget", + "access_roles": ["deputy_leader"], + "accepts_admissions": false } ]