/Development

All local development tools for working on goSolve services.

GNU Affero General Public License v3.0AGPL-3.0

Intro

This repository includes all tools and documentation to set you up to develop on goSolve's services.

Back-end

Requirements

Make sure you have these tools installed:

First time setup

Install development certificates

To be able to run our services over https, we need to install a development certificate.
Execute following commands in this directory (for Windows, use powershell):

# If it's the firt install of mkcert, run
mkcert -install

# Generate local development certificate
mkdir -p $HOME/.dev/gosolve/certs
mkcert -cert-file $HOME/.dev/gosolve/certs/local-cert.pem -key-file $HOME/.dev/gosolve/certs/local-key.pem "localhost" "host.docker.internal"

# Copy root certificate
cp "$(mkcert -CAROOT)/*" $HOME/.dev/gosolve/certs

Add goSolve nuget package source

We have our own nuget packages hosted on GitHub which the projects require.

First you will need to create a GitHub personal access token for your account.

To add our nuget source, run the following commands in a terminal in your goSolve projects directory (this will have effect on all projects in your projects directory):

# Create basic nuget.config file
dotnet new nugetconfig

# Add goSolve source
nuget sources add -Name "gosolve-org" -Source "https://nuget.pkg.github.com/gosolve-org/index.json" -username "YOUR-GITHUB-USERNAME" -password "YOUR-GITHUB-TOKEN" -ConfigFile ./nuget.config

First time API setup

We need to copy the generated root certificate into our project. Execute the next commands in the project directory:

cp $HOME/.dev/gosolve/certs/* ./certs/

Running an API

First run the docker-compose.yml file in this repository.
This sets up shared dependencies such as Traefik, a database and a redis.

docker-compose up

The next step is running the project (or multiple projects at the same time):

Method Description
Visual Studio (easiest) Run the docker-compose project in Visual Studio. (This also enables debugging features.)
Terminal Run docker-compose up in a terminal in the project directory.

⚠️ On errors: Try removing your /obj and /bin folders.

Traefik routing (port 5001 (https) | port 5000 (http))

We use Traefik as the reverse proxy for our local development. This means we can spin up as many services as we want without any port conflicts.
This causes some URL differences between Azure hosted services and local services:
Azure: https://my-api.gosolve.org/api/v1/books
Local: https://localhost:5001/my-api/api/v1/books

License

License: AGPL v3
goSolve is open-source. We use the GNU AGPLv3 licensing strategy.