Skip to content

Code for Fife Voluntary Action database and API project

Notifications You must be signed in to change notification settings

Scottish-Tech-Army/FVA

 
 

Repository files navigation

FVA

Prerequisites

dotnet 8: https://dotnet.microsoft.com/en-us/download/dotnet/8.0

docker: https://www.docker.com/

trusted certs: See dev-cert command

Commands

This project uses a Makefile to run commands. Any command can be run with make {COMMAND}.

Commands

start

make start

Description

Runs several commands to bring up the stack, client, api and db.

stop

make stop

Description

Stop the services and remove containers.

cleanup

make cleanup

Description

Cleans the output of the solution from the previous build.

Whilst not required everytime the project is built, it can help in resolving dotnet specific problems when assemblies may not work correctly.

restore

make restore

Description

Goes through the NuGet dependencies and downloads any missing dependencies or updates out of date dependencies.

build

make build

Description

Build the solution, creating dll files in the bin/debug folder along with the executable.

run-client

make run-client

Description

Runs the client application.

run-server

make run-server

Description

Runs the server application.

docker-build-dev

make docker-build-dev

Description

Build the image based on mcr.microsoft.com/dotnet/aspnet:8.0. This is build with the arg ENV set to Debug to indicate to the dotnet cli to build the assembly in debug.

docker-build-release

make docker-build-release

Description

Build the image based on mcr.microsoft.com/dotnet/aspnet:8.0. This is build with the arg ENV set to Release to indicate to the dotnet cli to build the assembly in Release.

docker-run

make docker-run

Description

Runs the build image and creates a container. Runs on port 8080

docker-stop

make docker-stop

Description

Tears down the container.

migrate

make migrate migration_name={MIGRATION_NAME}

Description

Creates a migration and updates the database. Accepts a "migration_name" parameter

roll-back-migration

make roll-back-migration previous_migration={PREVIOUS_MIGRATION}

Description

Rollback migrations to a specific named migration. Accepts a "previous" parameter

format

make format

Description

Runs dotnet format which targets the solution and formats code.

dev-cert

make dev-cert

Description

Generates a self-signed development certificate that gets copied to the container to allow for https use. This command is configured to be run on MacOS.

MUST BE RUN TO DEVELOP LOCALLY

Port Mapping and docker setup

The project is split into 3 services Server and Client. There are 2 top level docker files Dockerfile-Server and Dockerfile-Client.

Note: The third service is the database which does not have a dockerfile. Instead, it is build in the docker-compose see here for more.

Each take an argument to define whether the container built is debug or release. See docker-build-dev and docker-build-release.

When the containers are built they are accessible by the names assigned to them in the docker-compose. When built successfully it should look something like this

Container Preview

The ports exposed on each service is both port 80 and 443. Below is a mapping of the ports.

Server

  • Port 8080 on host machine is mapped to 80 in container for http
  • Port 8081 on host machine is mapped to 443 in container for https

Client

  • Port 5000 on host machine is mapped to 80 in container for http
  • Port 5001 on host machine is mapped to 443 in container for https

About

Code for Fife Voluntary Action database and API project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 78.6%
  • HTML 9.9%
  • CSS 9.7%
  • Makefile 1.8%