Skip to content

Command Center#

pipeline status coverage report Latest Release

graph LR
  A[Start] --> B{Error?};
  B -->|Yes| C[Hmm...];
  C --> D[Exception Log];
  D --> B;
  B ---->|No| E[Nice!];

Getting started#

Requirements#

  • Node.js + NPM (https://docs.npmjs.com/downloading-and-installing-node-js-and-npm)
  • Docker (https://docs.docker.com/get-docker/)

Read these first:#


Deploying Command Center#

The services are platform independent and can be deployed on Linux or Windows and as containerized versions.
When PR/MR are merged in to main the CI CD pipeline can publish and deploy:
- The client app as a Azure static website.
- Push container images to the Azure Container Registry (ACR).

Manual Deployment#

This will also be automated using CI/CD but it's good to know how to do the steps manually.
- IIS hosted mainly self hosted (Exite)
- Local IIS Setup

Start front-end#

Open Visual Studio from the folder: CommandCenter/ClientApps/command-center

Start storybook with the command: npm run storybook

If storybook doesn't open properly and you get the following error: Error: error:0308010C:digital envelope routines::unsupported...

Run the one of the following commands and try to start storybook again.

If you use macOS or Linux, run the following command:

export NODE_OPTIONS=--openssl-legacy-provider
If you use the Windows command prompt, run the following command and restart the command prompt to allow the change to take effect:
setx NODE_OPTIONS "--openssl-legacy-provider"
If you use Windows PowerShell, run the following command:
$env:NODE_OPTIONS='--openssl-legacy-provider'

To see what command are available with npm run just execute this command in you favorite terminal of command-line shell npm run. Or if you prefer to use a GUI, then in VS Code there is a panel for that 😋
npm scripts - panel

Add connection string#

  1. Right click on the project name in Visual Studio and select 'Manage User Secrets'.
  2. Add the default connection string with the values for your environment.
    "ConnectionStrings": {
            "DefaultConnection": "Server=host.docker.internal;Database=CommandCenter;Trusted_Connection=True;User Id=docker;Password=docker"
    }
    

Docker and Host connectivity

More on ConnectionStrings and environment variables with Docker Configuration

User Secrets#

Use the Right-mouse-button and click on the project, CommandCenter and scroll down to "Manage User Secrets"

This will open the appsettings.json in a special location in your user profile on disk.
Here you can add all the configuration properties required for security, like passwords and secrets, that must not be committed to source control (Git).

secrets.json
{
  "AzureAd": {
    "TenantId": "f3408dcc-bd00-4d82-9c78-12aec626ea4e",
    "ClientId": "....",
    "ClientSecret": "..."
  }
}

When staring and running projects separate this will just work, for use with Docker there are some additional considerations.
Every .Net application will have an volume mapping in the docker-compose.override.yml pointing to the secrets.json.

docker-compose.override.yml
services:
  my-app:
    volumes:
      - ${APPDATA}/Microsoft/UserSecrets:/root/.microsoft/usersecrets:ro
      - ${APPDATA}/ASP.NET/Https:/root/.aspnet/https:ro

Security detail#

Application configuration is a difficult thing to do, in the most basic sense all attributes in the base configuration should be seen as template values.
There are some considerations for creating a base profile, mostly for security reasons, and because these everything committed is shared between clones of the repo.

List of knowledge for including and excluding:
- Exclude Any secret must never be included. (passwords, secret strings, etc.)
- Exclude All that is considered a default variable and is mentioned in documentation.
- Optional GUID/ UUID's can be included, aren't considered secret be doesn't mean they have to be broadcasted to the world.
- Optional URL's, URI's, tags and labels are allowed as long they don't contain sensitive variables.
- Include Anything mandatory may be added with empty or descriptive strings.
- Exclude Environment variables may be added as template, but also never contain sensitive data. about Environment Variables

Info

When overriding applications settings is required or custom settings are needed for local development, we must use the user-secrets feature in dotnet and Visual Studio. Read more on managing user secrets <- there.

Docker#

Running all services and have them communicate just as a normal server backend, we can build these services just as a production environment. They can communicate on there on network and resolve host-names by a internal DNS. To do this we build and run the container images using Docker Compose.

Read about Dockerize Command Center.