Skip to content

Commit

Permalink
docs(deployment): consul implementation (#317)
Browse files Browse the repository at this point in the history
  • Loading branch information
bwendlandt-intel authored Jul 31, 2023
1 parent 6b6c583 commit 470c591
Show file tree
Hide file tree
Showing 7 changed files with 141 additions and 5 deletions.
114 changes: 114 additions & 0 deletions docs/Deployment/centralizedConfiguration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@

!!! warning "Centralized Configuration (Consul) is a Preview Feature"
The Consul implementation feature is a Preview Feature and is subject to change. This means it has not been fully validated and cannot be guaranteed to work. There are still potential bugs and tweaks needed for a production-level feature standard. Interested in this feature and helping us test it? Reach out via GitHub.

Consul is a service networking solution and service mesh providing a wide variety of features to handle key networking or service management use cases. Read more about Consul [in their documentation](https://developer.hashicorp.com/consul).

Consul Use Cases:

- mTLS Encryption between Services
- Dynamic Load Balancing
- Observability (Health and Metrics)
- **Centralized Configuration of Services**

## Consul and Open AMT

As part of Open AMT, we are currently focused on the last bullet point. We've introduced Hashicorp Consul as an optional deployable service to centralize and ease configuration of the MPS and RPS services. In the future, we may expand and incorporate other capabilities offered by Consul.

MPS/RPS Startup Flows:

- If Consul exists on startup and empty, copy local configs into Consul.
- If Consul exists on startup and not empty, copy Consul configs down locally.
- If Consul does not exist on startup, load local configs into MPS/RPS.

The two configuration files are stored as K/V pairs within Consul under:

- /MPS/config
- /RPS/config

### Consul Configuration

By default, Consul is deployed as part of the local Docker deployment in the `docker-compose.yml` file. This is the default configuration. Currently, we do not provide a Kubernetes deployment example.

The Consul configurations are stored in a local volume. When cleaning up containers, make sure to delete existing volumes.

``` yaml
consul:
restart: always
image: hashicorp/consul
networks:
- openamtnetwork
ports:
- 8500:8500
volumes:
- type: volume
source: consul-config
target: /consul/config
volume: {}
- type: volume
source: consul-data
target: /consul/data
volume: {}
command: "agent -server -ui -node=OACT-1 -bootstrap-expect=1 -client=0.0.0.0"
```
## Enable Consul
1. Follow the [Get Started Guide Setup page](../GetStarted/setup.md). Return here after the **Set Kong JSON Web Token (JWT)** section.
2. In the `.env`, enable Consul and Save.

``` yaml
# CONSUL
CONSUL_ENABLED=true #update from false to true
CONSUL_HOST=consul
CONSUL_PORT=8500
```

3. Pull the images.

=== "Linux"
```
sudo docker-compose pull
```

=== "Windows"
```
docker-compose pull
```

4. Start the containers.

=== "Linux"
```
sudo docker-compose up -d
```

=== "Windows"
```
docker-compose up -d
```

5. To view the Consul UI, visit `http://localhost:8500`.

6. Click **Key/Value** from the left-hand menu.

<figure class="figure-image">
<img src="..\..\assets\images\Consul_KV_Overview.png" alt="Figure 1: Consul K/V Overview Page">
<figcaption>Figure 1: Consul K/V Overview Page</figcaption>
</figure>

7. Choose either the `/MPS` or `/RPS` directory, then `/config`.

<figure class="figure-image">
<img src="..\..\assets\images\Consul_KV_MPS.png" alt="Figure 2: Consul K/V MPS Configuration">
<figcaption>Figure 2: Consul K/V MPS Configuration</figcaption>
</figure>

8. From here, users can make edits to the config files and save.

Today, the current preview implementation does not update the MPS or RPS services realtime. They must be restarted manually to apply the new configurations.

[Follow along with any new updates and features using Consul in our Feature Backlog.](https://github.com/orgs/open-amt-cloud-toolkit/projects/5)

<br>
26 changes: 23 additions & 3 deletions docs/Deployment/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Regardless of the deployment scenario (i.e., a VM, Kubernetes, Docker Swarm, a n
- [MS SQL Server](https://www.microsoft.com/en-us/sql-server/sql-server-2019)
- [MariaDB](https://mariadb.org/)

For more information about replacing the default toolkit database, see the [database guide](./database.md).
For more information about replacing the default toolkit database, see the [Database Replacement guide](./database.md).

## Secrets Management

Expand All @@ -43,7 +43,7 @@ Additionally, if a secret provider is not necessary for your deployment, conside
- [Azure Key Vault](https://docs.microsoft.com/en-us/azure/key-vault/)
- [AWS Key Management Service (KMS)](https://aws.amazon.com/kms/)

For more information about replacing the default secret provider, see the [secrets guide](./secrets.md).
For more information about replacing the default secret provider, see the [Secrets Management guide](./secrets.md).

## API Gateway

Expand All @@ -60,4 +60,24 @@ The toolkit uses Kong as its open source API gateway. Kong provides an entry poi
- [Azure API Gateway](https://docs.microsoft.com/en-us/azure/architecture/microservices/design/gateway)
- [Amazon API Gateway](https://docs.microsoft.com/en-us/azure/architecture/microservices/design/gateway)
- [Google Cloud Endpoints](https://cloud.google.com/endpoints)
- [Tyk](https://tyk.io/)
- [Tyk](https://tyk.io/)

## Centralized Configuration

!!! warning "Centralized Configuration (Consul) is a Preview Feature"
The Consul implementation feature is a Preview Feature and is subject to change. This means it has not been fully validated and cannot be guaranteed to work. There are still potential bugs and tweaks needed for a production-level feature standard. Interested in this feature and helping us test it? Reach out via GitHub.

The toolkit utilizes Consul to implement centralized configuration of the MPS and RPS services. This is an optional, opt-in service that is deployed, but not enabled by default.

### Default Component

<img src="./../../assets/images/logos/consul.png" alt="kong" style="width:50px;"/>

- [Hashicorp Consul](https://www.consul.io/)

### Example Replacements

- [etcd](https://etcd.io/)
- [Apache Zookeeper](https://zookeeper.apache.org/)

By default, Consul is deployed, but not utilized. For more information about enabling Consul, see the [Service Mesh guide](./centralizedConfiguration.md).
5 changes: 3 additions & 2 deletions docs/GetStarted/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,11 @@ Set the shared secret used in Kong for JWT authentication.
eclipse-mosquitto Up 2 minutes open-amt-cloud-toolkit_mosquitto_1
vault Up 2 minutes open-amt-cloud-toolkit_vault_1
intel/oact-mpsrouter:latest Up 2 minutes (healthy) open-amt-cloud-toolkit_mpsrouter_1
postgres:14 Up 2 minutes (healthy) open-amt-cloud-toolkit_db_1
postgres:15 Up 2 minutes (healthy) open-amt-cloud-toolkit_db_1
intel/oact-webui:latest Up 2 minutes open-amt-cloud-toolkit_webui_1
kong:2.3 Up 2 minutes (healthy) open-amt-cloud-toolkit_kong_1
kong:3.1 Up 2 minutes (healthy) open-amt-cloud-toolkit_kong_1
intel/oact-mps:latest Up 2 minutes (healthy) open-amt-cloud-toolkit_mps_1
hashicorp/consul Up 2 minutes open-amt-cloud-toolkit_consul_1
```
!!! warning "Warning - Container Issues"
Expand Down
Binary file added docs/assets/images/Consul_KV_MPS.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/images/Consul_KV_Overview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/images/logos/consul.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ nav:
- Troubleshooting: Reference/troubleshooting.md
- Deployment:
- Overview: Deployment/overview.md
- Centralized Configuration: Deployment/centralizedConfiguration.md
- Database Replacement: Deployment/database.md
- Secrets Management: Deployment/secrets.md
- Upgrade Toolkit Version: Deployment/upgradeVersion.md
Expand Down

0 comments on commit 470c591

Please sign in to comment.