Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,4 @@ nodejs/generators/app/templates/reports

# Claude Code local settings
.claude/settings.local.json
.worktrees
19 changes: 0 additions & 19 deletions docusaurus/dotnet/3-prerequisites/1-github.mdx

This file was deleted.

4 changes: 0 additions & 4 deletions docusaurus/dotnet/3-prerequisites/_category_.json

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,11 @@ The Intility Api template provides a robust foundation for building RESTful API
>
<TabItem value="cli">

Create a new API project with a solution file. For the best experience, use the `--argo-project`, `--openshift-namespace`, `--github-repo-url`, `--client-id`, `--tenant-id` and `--swagger-client-id` parameters. This will ensure that the dotnet project is connected with your newly created OpenShift namespace, ArgoCD Project and uses your App Registrations for authentication and authorization.
Create a new API project with a solution file. The template works without any flags — placeholder tokens are left in the scaffolded output for you to fill in afterwards.

```shell
# Create project with solution
dotnet new iwebapi -o MyApiService \
-ap "AppServices" \
-on "aa-appservices-dev" \
-gru "https://github.com/Intility/MyApiService.git" \
-cid "<CLIENT_ID you saved earlier>" \
-tid "<TENANT_ID from appreg, or common if multitenant>"
-swid "<SWAGGER_CLIENT_ID you saved earlier>"
# Create project — no flags required
dotnet new iwebapi -o MyApiService

# Navigate to project directory
cd MyApiService
Expand All @@ -51,6 +45,29 @@ cd MyApiService
dotnet run --project MyApiService/MyApiService.csproj
```

The scaffolded project contains `__SCREAMING_SNAKE_CASE__` placeholder tokens throughout. Find and replace each one with your actual values:

| Placeholder | Where | What to replace with |
| --- | --- | --- |
| `__CLIENT_ID__` | `appsettings.json` | Azure AD application (client) ID |
| `__TENANT_ID__` | `appsettings.json` | Azure AD directory (tenant) ID |
| `__SWAGGER_CLIENT_ID__` | `appsettings.json` | Azure AD client ID for Swagger UI |
| `__ARGO_PROJECT__` | `argo/**` | Argo project name (e.g. `AppServices`) |
| `__OPENSHIFT_NAMESPACE__` | `argo/**` | OpenShift namespace (e.g. `aa-appservices-dev`) |
| `__GITHUB_REPO_URL__` | `argo/**` | GitHub repository URL |

If you have all values ready at scaffold time, you can supply them as flags to skip the find-and-replace step:

```shell
dotnet new iwebapi -o MyApiService \
-ap "AppServices" \
-on "aa-appservices-dev" \
-gru "https://github.com/Intility/MyApiService.git" \
-cid "<YOUR_CLIENT_ID>" \
-tid "<YOUR_TENANT_ID>" \
-swid "<YOUR_SWAGGER_CLIENT_ID>"
```

**Advanced options:**

If you only want to create a project (without a solution), use the `--projectOnly` argument.
Expand Down Expand Up @@ -85,8 +102,8 @@ dotnet new iwebapi --help

5. Configure template-specific options.

:::info
For the best experience, fill the `Argo Project`, `OpenShift Namespace` and `GitHub Repoository Url` parameters. Argo Project is found in ArgoCD, OpenShift Namespace is found in the OpenShift cluster and GitHub Repoository Url is found in GitHub.
:::tip
All parameters are optional. Leave them blank to use placeholder tokens in the scaffolded output, or fill them in to skip the find-and-replace step.
:::

![Visual Studio Configure Template-Specific Options](/img/vs-configure-api.png)
Expand All @@ -109,14 +126,11 @@ The Intility Worker template helps you build background processing services with
>
<TabItem value="cli">

Create a new Worker Service project with a solution file. For the best experience, use the `--argo-project`, `--openshift-namespace` and `--github-repo-url` parameters.
Create a new Worker Service project with a solution file. The template works without any flags — placeholder tokens are left in the scaffolded output for you to fill in afterwards.

```shell
# Create project with solution
dotnet new iworker -o MyWorkerService \
-ap "AppServices" \
-on "aa-appservices-dev" \
-gru "https://github.com/Intility/MyWorkerService.git"
# Create project — no flags required
dotnet new iworker -o MyWorkerService

# Navigate to project directory
cd MyWorkerService
Expand All @@ -125,6 +139,23 @@ cd MyWorkerService
dotnet run --project MyWorkerService/MyWorkerService.csproj
```

The scaffolded project contains `__SCREAMING_SNAKE_CASE__` placeholder tokens throughout. Find and replace each one with your actual values:

| Placeholder | Where | What to replace with |
| --- | --- | --- |
| `__ARGO_PROJECT__` | `argo/**` | Argo project name (e.g. `AppServices`) |
| `__OPENSHIFT_NAMESPACE__` | `argo/**` | OpenShift namespace (e.g. `aa-appservices-dev`) |
| `__GITHUB_REPO_URL__` | `argo/**` | GitHub repository URL |

If you have all values ready at scaffold time, you can supply them as flags to skip the find-and-replace step:

```shell
dotnet new iworker -o MyWorkerService \
-ap "AppServices" \
-on "aa-appservices-dev" \
-gru "https://github.com/Intility/MyWorkerService.git"
```

**Advanced options:**

:::info
Expand Down Expand Up @@ -165,8 +196,8 @@ dotnet new iworker --help

5. Configure template-specific options.

:::info
For the best experience, fill the `Argo Project`, `OpenShift Namespace` and `GitHub Repoository Url` parameters. Argo Project is found in ArgoCD, OpenShift Namespace is found in the OpenShift cluster and GitHub Repoository Url is found in GitHub.
:::tip
All parameters are optional. Leave them blank to use placeholder tokens in the scaffolded output, or fill them in to skip the find-and-replace step.
:::

![Visual Studio Configure Template-Specific Options](/img/vs-configure-worker.png)
Expand Down Expand Up @@ -205,7 +236,6 @@ The following parameters are specific to the `iwebapi` template:
| `-cid, --client-id` | Azure AD application (client) ID |
| `-tid, --tenant-id` | Azure AD directory (tenant) ID |
| `-swid, --swagger-client-id` | Azure AD client ID for Swagger UI authentication |
| `-s, --scope` | Default OAuth scope (defaults to "user_impersonation") |

</details>

Expand All @@ -219,18 +249,3 @@ The following parameters are specific to the `iworker` template:
| `-c, --cronJob` | Creates a Kubernetes CronJob instead of a continuous Deployment |

</details>

## Pushing your application

Creating a dotnet project from a template does not automatically create a git repository for you,
so we have to make one ourselves.
Follow the "Push an existing folder" example,
which should look something like this:

```bash
git init
git remote add origin git@github.com:intility/intility-app.git
git add .
git commit -m "feat: add intility-app base"
git push -u origin main
```
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"label": "Set up",
"position": 4
"position": 3
}
34 changes: 34 additions & 0 deletions docusaurus/dotnet/4-configuration/1-github.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
title: GitHub
sidebar_position: 1
---

Go to [New Project in GitHub](https://github.com/new).

Select a fitting name, it should be as globally unique and descriptive for your project as possible.
![New Project in GitHub photo](/img/github-new.png)

:::warning
For this setup, ensure that all optional initialization settings—including README file, license, and .gitignore—are left unselected.
:::

![Empty initialization](/img/initializerepo.png)

:::tip Replace the placeholder
Replace `__GITHUB_REPO_URL__` in your `argo/**` files with this URL.
:::

## Pushing your application

Creating a dotnet project from a template does not automatically create a git repository for you,
so we have to make one ourselves.
Follow the "Push an existing folder" example,
which should look something like this:

```bash
git init
git remote add origin git@github.com:intility/intility-app.git
git add .
git commit -m "feat: add intility-app base"
git push -u origin main
```
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Hit the register button, and you will be taken to an overview of your newly crea

![Finding Client ID](/img/azure-clientid-dotnet.png)
:::tip Copy the `Application (Client) ID` GUID
Copy the `Application (Client) ID` GUID, and save it for later. We will use this ID when we create our project.
Copy the `Application (Client) ID` GUID and replace `__CLIENT_ID__` in `appsettings.json` with this value.
:::

### Add an application scope
Expand Down Expand Up @@ -60,7 +60,7 @@ Hit the register button, and you will be taken to an overview of your newly crea

![Finding Client ID](/img/azure-clientid-swagger.png)
:::tip Copy the `Application (Client) ID` GUID
Copy the `Application (Client) ID` GUID, and save it for later. This ID will also be used when we create our project.
Copy the `Application (Client) ID` GUID and replace `__SWAGGER_CLIENT_ID__` in `appsettings.json` with this value.
:::

### Adding reply URLs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ Go to [our OpenShift instance](https://console-openshift-console.apps.openshift.
Create a project, the name should be `aa-__APP_NAME__-dev`, e.g. `aa-intility-app-dev`.
Add a fitting display name and description if you feel like it.

:::tip Copy your newly created name
Copy your newly created name, and save it for later. We will use this name when we create our project.
:::tip Replace the placeholder
Replace `__OPENSHIFT_NAMESPACE__` in your `argo/**` files with this name.
:::

## ArgoCD
Expand All @@ -20,8 +20,8 @@ Navigate to [ArgoCD](https://argo.apps.int.intility.no/) and log in using Single

### Add OpenShift Destination to Argo Project

:::tip Copy your ArgoCD project name
The project name in ArgoCD is usually your department name, copy this for later.
:::tip Replace the placeholder
The project name in ArgoCD is usually your department name. Replace `__ARGO_PROJECT__` in your `argo/**` files with this name.
:::

Go to **Settings → Projects → Your Project**, and configure the following destinations:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Sentry
sidebar_position: 2
sidebar_position: 4
---

The project comes included with error reporting to Sentry, and a pipeline job to upload sourcemaps and create releases.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Deploy
sidebar_position: 3
sidebar_position: 5
---

### Create ArgoCD Bootstrap Application
Expand Down
4 changes: 4 additions & 0 deletions docusaurus/dotnet/4-configuration/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"label": "Configuration",
"position": 4
}
6 changes: 1 addition & 5 deletions dotnet/iwebapi/.template.config/dotnetcli.host.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@
"longName": "tenant-id",
"shortName": "tid"
},
"DefaultScope": {
"longName": "scope",
"shortName": "s"
},
"SwaggerClientId": {
"longName": "swagger-client-id",
"shortName": "swid"
Expand Down Expand Up @@ -46,7 +42,7 @@
}
},
"usageExamples": [
"--client-id \"11111111-1111-1111-11111111111111111\" --tenant-id \"9b5ff18e-53c0-45a2-8bc2-9c0c8f60b2c6\"",
"--client-id \"__CLIENT_ID__\" --tenant-id \"__TENANT_ID__\"",
"--projectOnly --no-restore"
]
}
9 changes: 0 additions & 9 deletions dotnet/iwebapi/.template.config/ide.host.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,6 @@
"group": "Authentication",
"precedence": 240
},
{
"id": "DefaultScope",
"name": {
"text": "Default Scope"
},
"isVisible": true,
"group": "Authentication",
"precedence": 250
},
{
"id": "SwaggerClientId",
"name": {
Expand Down
Loading
Loading