This project contains the demo version of a Cheetah.WebApi.
It showcases:
- Produce a message to kafka
- Consume a message from kafka
- Query the opensearch database
With the OAuth2 security model.
Please setup a local certificate:
dotnet dev-certs https -ep "$env:APPDATA/ASP.NET/https/aspnetapp.pfx" -p "password"
dotnet dev-certs https -t # trust
For PoC purpose, we are using a OAuthSimulator
.
It can be accessed at https://localhost:1852/swagger/index.html
Ensure that you have the latest version of Visual Studio and Docker Desktop installed.
You may need to enable virtualization in your BIOS.
NB: We are using Linux containers.
Currently the project uses a nuget package from Trifork's repository Called Cheetah.Shared-{versionNumber}
To source this dependency you will first need to create a Personal Access Token to to a Github-account with access to this repository.
- Navigate to Tools->Options
- Find the NuGet Package Manager -> Package Sources
- Add following source: "https://nuget.pkg.github.com/trifork/index.json"
- click OK
- Restart Visual Studio, if it's open.
- Open NuGet Pack Manager and select the new source. You will now be prompted for a username and password. Enter your account-name into username. And use your PAT as your password
Add the source in your private $HOME/.nuget/NuGet/NuGet.Config
file, e.g.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<config>
<add key="globalPackagesFolder" value="/Users/hhravn/.nuget/cache" />
</config>
<packageSources>
<clear />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
<add key="github" value="https://nuget.pkg.github.com/trifork/index.json" />
</packageSources>
<packageSourceCredentials>
<github>
<add key="Username" value="myuser" />
<add key="ClearTextPassword" value="github-personal-access-token" />
</github>
</packageSourceCredentials>
</configuration>
The project can be run with docker-compose
outside Visual Studio with a few prerequisites.
This can be useful when you are not interested in debugging the service and want to use less computer resources.
Supply NuGet credentials through environment variables:
[System.Environment]::SetEnvironmentVariable('GITHUB_ACTOR', '<github_username>', [System.EnvironmentVariableTarget]::User)
[System.Environment]::SetEnvironmentVariable('GITHUB_TOKEN', '<personal_access_token>', [System.EnvironmentVariableTarget]::User)
Commands:
# Start container using docker-compose.yml
docker-compose up
# OR start container using docker-compose.yml as detached (will run in background)
docker-compose up -d