Skip to content

Commit 7f1f091

Browse files
authored
Merge pull request #879 from layer5io/copilot/update-deployment-instructions
docs(cloud): add comprehensive INIT_CONFIG YAML configuration documentation for self-hosted deployments
2 parents 154b62b + b76bdfa commit 7f1f091

File tree

2 files changed

+180
-1
lines changed

2 files changed

+180
-1
lines changed

content/en/cloud/self-hosted/deployment/_index.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,54 @@ weight: 2
88

99
## High-level List of Deployment Tasks
1010

11+
## High-level List of Deployment Tasks
12+
13+
### INIT_CONFIG
14+
15+
The `INIT_CONFIG` environment variable allows you to configure the initial setup of your self-hosted Layer5 Cloud provider. This variable accepts a JSON string that defines the provider initialization configuration.
16+
17+
#### Purpose
18+
19+
`INIT_CONFIG` enables you to:
20+
- Pre-configure provider settings during deployment
21+
- Automate initial setup for consistent deployments
22+
- Define custom provider configurations without manual intervention
23+
24+
#### Usage
25+
26+
Set the `INIT_CONFIG` environment variable with a JSON configuration string:
27+
28+
```bash
29+
export INIT_CONFIG='{"provider": {"name": "my-provider", "settings": {...}}}'
30+
```
31+
32+
For Docker deployments:
33+
34+
```bash
35+
# example
36+
docker run -e INIT_CONFIG='{"provider": {"name": "my-provider"}}' layer5/meshery-cloud
37+
```
38+
39+
For Kubernetes deployments, add to your deployment manifest:
40+
41+
```yaml
42+
env:
43+
- name: INIT_CONFIG
44+
value: '{"provider": {"name": "my-provider", "settings": {...}}}'
45+
```
46+
47+
{{< alert type="info" title="Note" >}}
48+
The INIT_CONFIG variable is only processed during the initial startup. Subsequent restarts will not reprocess this configuration.
49+
{{< /alert >}}
50+
51+
#### Configuration Schema
52+
53+
The `INIT_CONFIG` JSON structure supports the following fields:
54+
55+
- `provider.name`: The name of your provider instance
56+
- `provider.settings`: Custom provider settings specific to your deployment
57+
58+
1159
<ol>
1260
<li>Review the prequisites for installing Layer5 Cloud on Kubernetes. (<a href="#prerequisites">docs</a>)</li>
1361
</li>

content/en/cloud/self-hosted/planning/_index.md

Lines changed: 132 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,136 @@
11
---
2-
title: Planning Layer5 Cloud Deployment
2+
title: Planning
3+
description: Plan your self-hosted Layer5 Cloud deployment
4+
weight: 2
5+
---
6+
7+
## Provider Configuration Planning
8+
9+
When planning your self-hosted Layer5 Cloud deployment, consider how you will initialize and configure your provider instance. The `INIT_CONFIG` environment variable enables you to automate provider configuration during deployment.
10+
11+
### Configuration Strategy
12+
13+
Before deploying, plan your configuration approach:
14+
15+
1. **Provider Identity**: Define your provider name and identification
16+
2. **Initial Settings**: Determine which settings need to be configured at startup
17+
3. **Configuration Management**: Decide how configuration will be managed (environment variables, secrets, config files)
18+
4. **Update Strategy**: Plan for configuration updates and changes over time
19+
20+
### Provider Admin Organization Initialization
21+
22+
The Provider Admin organization is a special organization identified by the hardcoded UUID `11111111-1111-1111-1111-111111111111`. It represents the root administrative organization for the cloud platform.
23+
24+
#### Configuration Format
25+
26+
The `INIT_CONFIG` environment variable accepts a YAML configuration with the following structure:
27+
28+
```yaml
29+
organization:
30+
name: "Layer5"
31+
description: "The uber organization for all things Layer5."
32+
country: "United States"
33+
region: "North America"
34+
35+
user:
36+
first_name: "Admin"
37+
last_name: "User"
38+
email: "admin@layer5.io"
39+
username: "admin@layer5.io" # Optional, defaults to email if not provided
40+
password: "change-me-on-first-login" # Required
41+
```
42+
43+
#### Setting the Environment Variable
44+
45+
To enable Provider Admin organization initialization, set the `INIT_CONFIG` environment variable with the entire YAML configuration as its value:
46+
47+
```bash
48+
INIT_CONFIG='organization:
49+
name: "Layer5"
50+
description: "The uber organization for all things Layer5."
51+
country: "United States"
52+
region: "North America"
53+
54+
user:
55+
first_name: "Admin"
56+
last_name: "User"
57+
email: "admin@layer5.io"
58+
username: "admin@layer5.io"
59+
password: "change-me-on-first-login"'
60+
```
61+
62+
#### Required and Optional Fields
63+
64+
**Organization:**
65+
- `name`: Name of the provider organization (required)
66+
- `description`: Description of the organization (optional)
67+
- `country`: Country where the organization is located (optional)
68+
- `region`: Region where the organization is located (optional)
69+
70+
**User:**
71+
- `first_name`: First name of the provider admin user (required)
72+
- `last_name`: Last name of the provider admin user (required)
73+
- `email`: Email address of the provider admin user (required)
74+
- `username`: Username for the provider admin user (optional, defaults to email)
75+
- `password`: Password for the provider admin user (required)
76+
77+
#### Initialization Process
78+
79+
When the server starts and `INIT_CONFIG` is set:
80+
81+
1. The YAML configuration is parsed and validated
82+
2. The system checks if the provider organization already exists (by UUID `11111111-1111-1111-1111-111111111111`)
83+
3. If the organization exists, initialization is skipped
84+
4. If the organization does not exist:
85+
- Kratos identity is created with password credentials for authentication
86+
- Provider admin user is created
87+
- Admin and MeshMap roles are assigned to the user
88+
- Provider organization is created with the hardcoded UUID
89+
- User is added to the provider organization with organization admin role
90+
91+
#### Idempotency
92+
93+
The initialization process is idempotent:
94+
- Running the server multiple times with the same configuration will not create duplicate organizations
95+
- If the provider organization already exists, the initialization is skipped
96+
- No errors are thrown if the organization already exists
97+
98+
#### Error Handling
99+
100+
If initialization fails:
101+
- Errors are logged using MeshKit logger
102+
- The server continues to start (non-fatal error)
103+
- All database operations are wrapped in a transaction for atomicity
104+
- If any step fails, all changes are rolled back
105+
106+
### Deployment Options
107+
108+
You can set the `INIT_CONFIG` environment variable using several methods:
109+
110+
**Option A (Helm with inline values)**: Include `initConfig` in the Helm `values.yaml` file with the YAML configuration as a multiline string
111+
112+
**Option B (Helm with --set-file flag)**: Use `--set-file` to load configuration from a separate file:
113+
```bash
114+
helm install meshery-cloud ./install/kubernetes/helm/layer5-cloud \
115+
--set-file env.initConfig=./config/provider-init.yaml.example
116+
```
117+
118+
**Option C (Direct environment variable)**: Set the `INIT_CONFIG` environment variable with the YAML content as a string
119+
120+
### Using INIT_CONFIG for Automated Setup
121+
122+
The `INIT_CONFIG` environment variable allows you to pre-configure your provider during deployment, eliminating manual setup steps. This is particularly valuable for:
123+
124+
- **Reproducible Deployments**: Ensure consistent configuration across environments
125+
- **CI/CD Integration**: Automate deployments with predefined configurations
126+
- **Infrastructure as Code**: Manage provider configuration alongside your infrastructure
127+
128+
For detailed configuration options, see the configuration schema below.
129+
130+
{{< alert type="warning" title="Important" >}}
131+
Plan your INIT_CONFIG carefully as it is only processed during initial startup. Changes require redeployment or manual configuration updates.
132+
{{< /alert >}}
133+
Layer5 Cloud Deployment
3134
description: "Understand deployment prerequisites and prepare your environment for a secure and scalable Layer5 Cloud deployment."
4135
categories: [Self-Hosted]
5136
#tags: [helm]

0 commit comments

Comments
 (0)