Skip to content

Commit

Permalink
7568 - Update the Stacks documentation to represent the new .NET Stac…
Browse files Browse the repository at this point in the history
…ks monorepo (#541)
  • Loading branch information
alexanderwjrussell authored Aug 14, 2024
1 parent e525e5a commit dedc999
Show file tree
Hide file tree
Showing 10 changed files with 64 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Build and run locally

=== Windows

Move to the `<PROJECT-NAME>/src/api` folder and run the next commands in **Command Prompt** or **Powershell**
Move to the `<PROJECT-NAME>/simple-api/src/api` folder and run the next commands in **Command Prompt** or **Powershell**

[source, bash]
----
Expand All @@ -36,7 +36,7 @@ dotnet run --project xxENSONOxx.xxSTACKSxx.API/xxENSONOxx.xxSTACKSxx.API.csproj

=== Linux

Move to the `<PROJECT-NAME>/src/api` folder and run the next commands in **terminal**.
Move to the `<PROJECT-NAME>/simple-api/src/api` folder and run the next commands in **terminal**.

[source, bash]
----
Expand All @@ -50,7 +50,7 @@ dotnet run --project xxENSONOxx.xxSTACKSxx.API/xxENSONOxx.xxSTACKSxx.API.csproj
----
Build and run in docker container

From the `<PROJECT-NAME>/src/api` folder, build a Docker image using e.g. the command below:
From the `<PROJECT-NAME>/simple-api/src/api` folder, build a Docker image using e.g. the command below:

.Build docker image
[source, bash]
Expand All @@ -65,7 +65,7 @@ After the creation of the Docker image, the Docker container can be run using th
.Run docker container
[source, bash]
----
docker run -p 5000:80 --mount type=bind,source=/path/to/PROJECT-NAME/src/api/xxENSONOxx.xxSTACKSxx.API/appsettings.json,target=/app/config/appsettings.json
docker run -p 5000:80 --mount type=bind,source=/path/to/PROJECT-NAME/simple-api/src/api/xxENSONOxx.xxSTACKSxx.API/appsettings.json,target=/app/config/appsettings.json
----

Verify that the application has started
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ keywords:

=== Install the package

.NET 3.1 templates have been deprecated. If you want to use the 3.1 templates the latest version is https://www.nuget.org/packages/Amido.Stacks.Templates/3.0.232[3.0.232]

Access Amido.Stacks.Templates package page in Nuget https://www.nuget.org/packages/Amido.Stacks.Templates/[here]. Copy and execute the command displayed in the page (if you want to get the latest version). For example:


Expand Down Expand Up @@ -69,7 +67,7 @@ Template parameter details
- Sets the path to where the project is added
- Omitting the parameter will result in the creation of a new folder
.**-cp|--cloudProvider**
.**--cloudProvider**
- Configures which cloud provider to be used
.**-cicd|--cicdProvider**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ The API generated consists of configuration to be run locally or on a docker con
.Build and run locally on Windows
[%collapsible]
=====
Move to the `<PROJECT-NAME>/src/api` folder and run the next commands in **Command Prompt** or **Powershell**
Move to the `<PROJECT-NAME>/cqrs/src/api` folder and run the next commands in **Command Prompt** or **Powershell**
[source, bash]
----
Expand Down Expand Up @@ -55,7 +55,7 @@ There are two fixes possible so far:
.Build and run locally on Linux
[%collapsible]
=====
Move to the `<PROJECT-NAME>/src/api` folder and run the next commands in **terminal**.
Move to the `<PROJECT-NAME>/cqrs/src/api` folder and run the next commands in **terminal**.
[source, bash]
----
Expand All @@ -81,7 +81,7 @@ dotnet run --project xxENSONOxx.xxSTACKSxx.API/xxENSONOxx.xxSTACKSxx.API.csproj
[%collapsible]
=====
From the `<PROJECT-NAME>/src/api` folder, build a Docker image using e.g. the command below:
From the `<PROJECT-NAME>/cqrs/src/api` folder, build a Docker image using e.g. the command below:
.Build docker image
[source, bash]
Expand All @@ -96,7 +96,7 @@ After the creation of the Docker image, the Docker container can be run using th
.Run docker container
[source, bash]
----
docker run -p 5000:80 --mount type=bind,source=/path/to/PROJECT-NAME/src/api/xxENSONOxx.xxSTACKSxx.API/appsettings.json,target=/app/config/appsettings.json -e COSMOSDB_KEY=your-key -e SERVICEBUS_CONNECTIONSTRING=your-asb-connection-string -e EVENTHUB_CONNECTIONSTRING=your-aeh-connection-string -e STORAGE_CONNECTIONSTRING=your-aeh-storage-connection-string dotnet-api:latest`
docker run -p 5000:80 --mount type=bind,source=/path/to/PROJECT-NAME/cqrs/src/api/xxENSONOxx.xxSTACKSxx.API/appsettings.json,target=/app/config/appsettings.json -e COSMOSDB_KEY=your-key -e SERVICEBUS_CONNECTIONSTRING=your-asb-connection-string -e EVENTHUB_CONNECTIONSTRING=your-aeh-connection-string -e STORAGE_CONNECTIONSTRING=your-aeh-storage-connection-string dotnet-api:latest`
----
NOTE: The **COSMOSDB_KEY** described in the command above has to be passed when running the container. **SERVICEBUS_CONNECTIONSTRING** OR **EVENTHUB_CONNECTIONSTRING** and **STORAGE_CONNECTIONSTRING** are needed based on the configuration and message service you'll be using. Note that the **appsettings.json** value is mounted here for running locally,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ All security sensitive information is passed as a secret in our configuration. W

The project can be set to use Azure **Cosmos DB** or an **InMemory** database to store the example application data. The **InMemory** database works out of the box and no further setup is required aside from creating your project. Depending on your desired setup you'll have to provide some or all of the configuration in the `appsettings.json` file section showed below.

.<PROJECT-NAME>/src/api/xxENSONOxx.xxSTACKSxx.API/appsettings.json
.<PROJECT-NAME>/cqrs/src/api/xxENSONOxx.xxSTACKSxx.API/appsettings.json
[source, json]
----
{
Expand All @@ -46,7 +46,7 @@ The project can be set to use Azure **Cosmos DB** or an **InMemory** database to
.Using the Cosmos DB Emulator to run the database locally
[%collapsible]
=====
Move to the `<PROJECT-NAME>/src/api` folder and run the next commands in **terminal**.
Move to the `<PROJECT-NAME>/cqrs/src/api` folder and run the next commands in **terminal**.
For running on local environments (Windows/Linux/macOS) please follow the https://docs.microsoft.com/en-us/azure/cosmos-db/local-emulator?tabs=ssl-netstd21[instructions provided by Microsoft.]
Expand Down Expand Up @@ -217,7 +217,7 @@ When choosing not to run the CosmosDB locally via the emulator, further configur
Aside from setting the `COSMOSDB_KEY` as an environment variable (described in the previous section), you'll have to set the CosmosDB URI parameter `DatabaseAccountUri` as well.
.<PROJECT-NAME>/src/api/xxENSONOxx.xxSTACKSxx.API/appsettings.json
.<PROJECT-NAME>/cqrs/src/api/xxENSONOxx.xxSTACKSxx.API/appsettings.json
[source, json]
----
{
Expand Down Expand Up @@ -247,7 +247,7 @@ The template and NuGet package assumes you'll use the `AWS CLI` tools and will h

Depending on your desired setup you'll have to provide some or all of the configuration in the `appsettings.json` file section showed below.

.<PROJECT-NAME>/src/api/xxENSONOxx.xxSTACKSxx.API/appsettings.json
.<PROJECT-NAME>/cqrs/src/api/xxENSONOxx.xxSTACKSxx.API/appsettings.json
[source, json]
----
{
Expand All @@ -268,7 +268,7 @@ The project can be set to use AWS **SNS** to publish and consume events. In orde

You will also be required to set the `TOPIC_ARN` as an environment variable (see section **Setting the TOPIC_ARN environment variable**).

.<PROJECT-NAME>/src/api/xxENSONOxx.xxSTACKSxx.API/appsettings.json
.<PROJECT-NAME>/cqrs/src/api/xxENSONOxx.xxSTACKSxx.API/appsettings.json
[source, json]
----
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,32 @@ keywords:
[discrete]
=== Install the package
NOTE: .NET 3.1 templates have been deprecated. If you want to use the 3.1 templates the latest version is https://www.nuget.org/packages/Amido.Stacks.CQRS.Templates/3.0.130[3.0.130]
Access Amido.Stacks.CQRS.Template package page in Nuget https://www.nuget.org/packages/Amido.Stacks.CQRS.Templates/[here]
Access Amido.Stacks.Template package page in Nuget https://www.nuget.org/packages/Amido.Stacks.Templates/[here]
Copy and execute the command displayed in the page (if you want to get the latest version).
For example
.Run the command to install the package
[source, bash]
----
dotnet new install Amido.Stacks.CQRS.Templates
dotnet new install Amido.Stacks.Templates
----
Once installed, you obtain 6 templates that can be used
Once installed, you obtain 7 templates that can be used
[discrete]
=== stacks-webapi
Simple web API which also includes the build infrastructure
Navigate to the folder where you wish to create a new project on.
.Run the command to create the project
[source, bash]
----
dotnet new stacks-webapi -n Company.Project -do YourDomain --cloudProvider CloudProvider
----
The above command will create a folder and a repository called `Company.Project`.
[discrete]
=== stacks-cqrs-app
Expand Down Expand Up @@ -124,7 +137,7 @@ dotnet new stacks-asb-worker -n Company.Project -do Menu
- **-o|--output**
- Sets the path to where the project is added
- Omitting the parameter will result in the creation of a new folder
- **-cp|--cloudProvider**
- **--cloudProvider**
- Configures which cloud provider to be used
====
Expand Down Expand Up @@ -182,7 +195,7 @@ dotnet new stacks-cqrs-app -n Company.Project -do YourDomain -db CosmosDb
- **-o|--output**
- Sets the path to where the project is added
- Omitting the parameter will result in the creation of a new folder
- **-cp|--cloudProvider**
- **--cloudProvider**
- Configures which cloud provider to be used
- **-cicd|--cicdProvider**
- Configures which cicd provider templates to be used
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ values={[
]}>
<TabItem value="windows">

Move to the `<PROJECT-NAME>/src/api` folder and run the next commands in **Command Prompt** or **Powershell**
Move to the `<PROJECT-NAME>/simple-api/src/api` folder and run the next commands in **Command Prompt** or **Powershell**

```bash
dotnet build
Expand All @@ -53,7 +53,7 @@ dotnet run --project xxENSONOxx.xxSTACKSxx.API/xxENSONOxx.xxSTACKSxx.API.csproj

<TabItem value="linux">

Move to the `<PROJECT-NAME>/src/api` folder and run the next commands in **terminal**.
Move to the `<PROJECT-NAME>/simple-api/src/api` folder and run the next commands in **terminal**.

```bash
dotnet build
Expand All @@ -77,7 +77,7 @@ dotnet run --project xxENSONOxx.xxSTACKSxx.API/xxENSONOxx.xxSTACKSxx.API.csproj

<div>

From the `<PROJECT-NAME>/src/api` folder, build a Docker image using e.g. the command below:
From the `<PROJECT-NAME>/simple-api/src/api` folder, build a Docker image using e.g. the command below:

```bash title="Build docker image"
docker build -t dotnet-api .
Expand All @@ -88,7 +88,7 @@ This uses the **Dockerfile** in this folder to generate the Docker image.
After the creation of the Docker image, the Docker container can be run using the command below:

```bash title="Run docker container"
docker run -p 5000:80 --mount type=bind,source=/path/to/PROJECT-NAME/src/api/xxENSONOxx.xxSTACKSxx.API/appsettings.json,target=/app/config/appsettings.json
docker run -p 5000:80 --mount type=bind,source=/path/to/PROJECT-NAME/simple-api/src/api/xxENSONOxx.xxSTACKSxx.API/appsettings.json,target=/app/config/appsettings.json
```

</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ keywords:

### Install the package

:::note
.NET 3.1 templates have been deprecated. If you want to use the 3.1 templates the latest version is [3.0.232](https://www.nuget.org/packages/Amido.Stacks.Templates/3.0.232)
:::

Access Amido.Stacks.Templates package page in Nuget [here](https://www.nuget.org/packages/Amido.Stacks.Templates/). Copy and execute the command displayed in the page (if you want to get the latest version). For example:

```bash title="Run the command to install the package"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ values={[
]}>
<TabItem value="windows">

Move to the `<PROJECT-NAME>/src/api` folder and run the next commands in **Command Prompt** or **Powershell**
Move to the `<PROJECT-NAME>/cqrs/src/api` folder and run the next commands in **Command Prompt** or **Powershell**

```bash
dotnet build
Expand Down Expand Up @@ -72,7 +72,7 @@ There are two fixes possible so far:

<TabItem value="linux">

Move to the `<PROJECT-NAME>/src/api` folder and run the next commands in **terminal**.
Move to the `<PROJECT-NAME>/cqrs/src/api` folder and run the next commands in **terminal**.

```bash
export COSMOSDB_KEY=<COSMOSDB_KEY value here>
Expand Down Expand Up @@ -103,7 +103,7 @@ dotnet run --project xxENSONOxx.xxSTACKSxx.API/xxENSONOxx.xxSTACKSxx.API.csproj

<div>

From the `<PROJECT-NAME>/src/api` folder, build a Docker image using e.g. the command below:
From the `<PROJECT-NAME>/cqrs/src/api` folder, build a Docker image using e.g. the command below:

```bash title="Build docker image"
docker build -t dotnet-api .
Expand All @@ -114,7 +114,7 @@ This uses the **Dockerfile** in this folder to generate the Docker image.
After the creation of the Docker image, the Docker container can be run using the command below:

```bash title="Run docker container"
docker run -p 5000:80 --mount type=bind,source=/path/to/PROJECT-NAME/src/api/xxENSONOxx.xxSTACKSxx.API/appsettings.json,target=/app/config/appsettings.json -e COSMOSDB_KEY=your-key -e SERVICEBUS_CONNECTIONSTRING=your-asb-connection-string -e EVENTHUB_CONNECTIONSTRING=your-aeh-connection-string -e STORAGE_CONNECTIONSTRING=your-aeh-storage-connection-string dotnet-api:latest`
docker run -p 5000:80 --mount type=bind,source=/path/to/PROJECT-NAME/cqrs/src/api/xxENSONOxx.xxSTACKSxx.API/appsettings.json,target=/app/config/appsettings.json -e COSMOSDB_KEY=your-key -e SERVICEBUS_CONNECTIONSTRING=your-asb-connection-string -e EVENTHUB_CONNECTIONSTRING=your-aeh-connection-string -e STORAGE_CONNECTIONSTRING=your-aeh-storage-connection-string dotnet-api:latest`
```

:::note
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ All security sensitive information is passed as a secret in our configuration. W

The project can be set to use Azure **Cosmos DB** or an **InMemory** database to store the example application data. The **InMemory** database works out of the box and no further setup is required aside from creating your project. Depending on your desired setup you'll have to provide some or all of the configuration in the `appsettings.json` file section showed below.

```json title="<PROJECT-NAME>/src/api/xxENSONOxx.xxSTACKSxx.API/appsettings.json"
```json title="<PROJECT-NAME>/cqrs/src/api/xxENSONOxx.xxSTACKSxx.API/appsettings.json"
"CosmosDb": {
"DatabaseAccountUri": "<Add CosmosDB Account URI here>",
"DatabaseName": "Stacks",
Expand Down Expand Up @@ -204,7 +204,7 @@ When choosing not to run the CosmosDB locally via the emulator, further configur

Aside from setting the `COSMOSDB_KEY` as an environment variable (described in the previous section), you'll have to set the CosmosDB URI parameter `DatabaseAccountUri` as well.

```json title="<PROJECT-NAME>/src/api/xxENSONOxx.xxSTACKSxx.API/appsettings.json"
```json title="<PROJECT-NAME>/cqrs/src/api/xxENSONOxx.xxSTACKSxx.API/appsettings.json"
"CosmosDb": {
"DatabaseAccountUri": "<Add CosmosDB Account URI here>",
"DatabaseName": "Stacks",
Expand Down Expand Up @@ -234,7 +234,7 @@ The template and NuGet package assumes you'll use the `AWS CLI` tools and will h

Depending on your desired setup you'll have to provide some or all of the configuration in the `appsettings.json` file section showed below.

```json title="<PROJECT-NAME>/src/api/xxENSONOxx.xxSTACKSxx.API/appsettings.json"
```json title="<PROJECT-NAME>/cqrs/src/api/xxENSONOxx.xxSTACKSxx.API/appsettings.json"
"DynamoDb": {
"TableName": "Menu",
"TablePrefix": ""
Expand All @@ -253,7 +253,7 @@ The project can be set to use AWS **SNS** to publish and consume events. In orde

You will also be required to set the `TOPIC_ARN` as an environment variable (see section **Setting the TOPIC_ARN environment variable**).

```json title="<PROJECT-NAME>/src/api/xxENSONOxx.xxSTACKSxx.API/appsettings.json"
```json title="<PROJECT-NAME>/cqrs/src/api/xxENSONOxx.xxSTACKSxx.API/appsettings.json"
"AwsSnsConfiguration": {
"TopicArn": {
"Identifier": "TOPIC_ARN",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,28 @@ keywords:

### Install the package

:::note
.NET 3.1 templates have been deprecated. If you want to use the 3.1 templates the latest version is [3.0.130](https://www.nuget.org/packages/Amido.Stacks.CQRS.Templates/3.0.130)
:::

Access Amido.Stacks.CQRS.Template package page in Nuget [here](https://www.nuget.org/packages/Amido.Stacks.CQRS.Templates/)
Access Amido.Stacks.CQRS.Template package page in Nuget [here](https://www.nuget.org/packages/Amido.Stacks.Templates/)
Copy and execute the command displayed in the page (if you want to get the latest version).
For example

```bash title="Run the command to install the package"
dotnet new --install Amido.Stacks.CQRS.Templates
dotnet new install Amido.Stacks.CQRS.Templates
```

Once installed, you obtain 6 templates that can be used
Once installed, you obtain 7 templates that can be used

### stacks-webapi

<p>A simple web API which also includes the build infrastructure</p>

Navigate to the folder where you wish to create a new project in.

```bash title="Run the command to create the project"
dotnet new stacks-webapi -n Company.Project -do YourDomain --cloudProvider Azure
```

The above command will create a folder and a repository called `Company.Project` with DevOps build pipelines ready for Azure DevOps.

### stacks-cqrs-app

Expand Down Expand Up @@ -110,7 +119,7 @@ dotnet new stacks-asb-worker -n Company.Project -do Menu
- **-o|--output**
- Sets the path to where the project is added
- Omitting the parameter will result in the creation of a new folder
- **-cp|--cloudProvider**
- **--cloudProvider**
- Configures which cloud provider to be used
:::

Expand All @@ -121,7 +130,7 @@ Once installed you can either, create a new project or add CQRS to an existing p
If you want to remove the templates from your system you'll have to uninstall the Nuget package.

```bash title="To uninstall package execute the following command"
dotnet new --uninstall Amido.Stacks.CQRS.Templates
dotnet new uninstall Amido.Stacks.Templates
```

</details>
Expand Down Expand Up @@ -159,7 +168,7 @@ dotnet new stacks-cqrs-app -n Company.Project -do YourDomain -db CosmosDb
- **-o|--output**
- Sets the path to where the project is added
- Omitting the parameter will result in the creation of a new folder
- **-cp|--cloudProvider**
- **--cloudProvider**
- Configures which cloud provider to be used
- **-cicd|--cicdProvider**
- Configures which cicd provider templates to be used
Expand Down

0 comments on commit dedc999

Please sign in to comment.