|
1 | 1 | --- |
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 |
3 | 134 | description: "Understand deployment prerequisites and prepare your environment for a secure and scalable Layer5 Cloud deployment." |
4 | 135 | categories: [Self-Hosted] |
5 | 136 | #tags: [helm] |
|
0 commit comments