dotnet 8: https://dotnet.microsoft.com/en-us/download/dotnet/8.0
docker: https://www.docker.com/
trusted certs: See dev-cert command
This project uses a Makefile to run commands. Any command can be run with
make {COMMAND}
.
make start
Runs several commands to bring up the stack, client, api and db.
make stop
Stop the services and remove containers.
make cleanup
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.
make restore
Goes through the NuGet dependencies and downloads any missing dependencies or updates out of date dependencies.
make build
Build the solution, creating dll files in the bin/debug folder along with the executable.
make run-client
Runs the client application.
make run-server
Runs the server application.
make docker-build-dev
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.
make docker-build-release
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.
make docker-run
Runs the build image and creates a container. Runs on port 8080
make docker-stop
Tears down the container.
make migrate migration_name={MIGRATION_NAME}
Creates a migration and updates the database. Accepts a "migration_name" parameter
make roll-back-migration previous_migration={PREVIOUS_MIGRATION}
Rollback migrations to a specific named migration. Accepts a "previous" parameter
make format
Runs dotnet format which targets the solution and formats code.
make dev-cert
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
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
The ports exposed on each service is both port 80 and 443. Below is a mapping of the ports.
- 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
- 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