|
1 | 1 | # Setting up an Environment
|
2 | 2 |
|
3 |
| -Follow these Steps to create/setup an Environment on Lowcoder :  |
4 |
| - |
5 |
| -1. **Central PostgreSQL DB :** For the Enterprise Edition, there is this main requirement of having a Central PostgreSQL Database which will be same for all the Environments, you will configure. Each Environment will have a separate MongoDB, but there will be a shared PostgreSQL DB for all the Envs. |
6 |
| -2. **Add Environment :** Click on the "Add Environment" button and fill up the details in the Form \ |
7 |
| - .png>) |
8 |
| -3. **Form Details :** Add Environment Name, Choose Environment type like Test or Production, Enter API Service URL and the API Key. This API key is of the Lowcoder Instance that you need to setup. More details about the Lowcoder API Key is here : [lowcoder-open-rest-api.md](../../../../lowcoder-extension/lowcoder-open-rest-api.md "mention") . If it is a Master Env, then turn the Toggle ON in the Pop up . Click on "Create Environment" button.\ |
9 |
| -  (5).png>) |
10 |
| -4. **Clone the Lowcoder Repositary :** Now, to setup the Lowcoder instance, you need to clone from Lowcoder Repositary. The details can be found here : [self-hosting](../../../self-hosting/ "mention") |
11 |
| -5. **Add EE docker-compose.yaml file :**  |
12 |
| -6. **Add changes in docker-compose.yaml file :**  |
13 |
| - 1. Name the Environment and Container name\ |
14 |
| - .png>) |
15 |
| - 2. Setup Sub-domain : \ |
16 |
| - You should setup a sub-domains for different Environments, and access your Envs from those sub-domains. |
17 |
| -7. **Changes to envUtils.ts file :** \ |
18 |
| - This file is located in **lowcoder/client/packages/lowcoder/src/util/envUtils.ts.** Add highlighted code in the mentioned place OR simply run this command :  |
19 |
| - |
20 |
| - ```bash |
21 |
| - LOWCODER_API_SERVICE_URL=your_ip_address REACT_APP_EDITION="enterprise" yarn workspace lowcoder start |
22 |
| - ``` |
| 3 | +Lowcoder Enterprise Edition supports multiple **Environments** (or **Instances**) like **Development**, **Staging**, or **Production** to support structured deployment workflows. Each environment runs as an independent Lowcoder instance but connects to a **central PostgreSQL database** for coordination and control. |
| 4 | + |
| 5 | +There are **two ways** to register environments in Lowcoder Enterprise. Via the UI, or better, **automatically via plugin bootstrapping**. |
| 6 | + |
| 7 | +### Prerequisites for All Environments |
| 8 | + |
| 9 | +Before setting up an environment (via either method), ensure the following: |
| 10 | + |
| 11 | +1. **A Central PostgreSQL Database** |
| 12 | + * Required and **shared** across all environments (Dev, Staging, Prod) |
| 13 | + * Used to register metadata, deployment relations, and staging logic |
| 14 | +2. **Enterprise Plugin and License** |
| 15 | + * You must have the `.jar` plugin file and `.lic` license file installed |
| 16 | + |
| 17 | +### Option 1: Automatic Registration (Recommended) |
| 18 | + |
| 19 | +The simplest and most robust way to create an environment is via **auto-registration at startup**. |
| 20 | + |
| 21 | +#### Steps: |
| 22 | + |
| 23 | +1. **Prepare the Central PostgreSQL** |
| 24 | + * Ensure it is accessible to all Lowcoder environments |
| 25 | + * Pre-create a database such as `lowcoder_enterprise` with the correct user and password |
| 26 | +2. **Install Plugin & License** |
| 27 | + * Place the plugin `.jar` file at:\ |
| 28 | + `/lowcoder-stacks/plugins` |
| 29 | + * Place the license file at:\ |
| 30 | + `/lowcoder-stacks/licenses` |
| 31 | +3. **Add Enterprise ENV Variables** to your `docker-compose` or environment file for each Instance |
| 32 | + |
| 33 | +```env |
| 34 | +LOWCODER_PLUGINS_DIR=/lowcoder-stacks/plugins |
| 35 | +PLUGIN_ENTERPRISE_ENV_TYPE=DEV |
| 36 | +PLUGIN_ENTERPRISE_DATABASE_URL=postgresql://localhost:5432/lowcoder_enterprise |
| 37 | +PLUGIN_ENTERPRISE_DATABASE_USER=lowcoder |
| 38 | +PLUGIN_ENTERPRISE_DATABASE_PASSWORD=yourSecurePassword |
| 39 | +PLUGIN_ENTERPRISE_LICENSE_LOCATION=/lowcoder-stacks/licenses |
| 40 | +PLUGIN_ENTERPRISE_REDIS_URL=redis://localhost:6379 |
| 41 | +PLUGIN_ENTERPRISE_MAXMIND_ACCOUNT_ID=124 |
| 42 | +PLUGIN_ENTERPRISE_MAXMIND_LICENSE=yourMaxMindAPIKey |
| 43 | +``` |
| 44 | + |
| 45 | +4. **Restart the Target Environment** |
| 46 | + * When the Lowcoder instance starts, the Enterprise Plugin detects the config and **automatically registers the environment** into the central PostgreSQL instance |
| 47 | + |
| 48 | +### Option 2: Manual Setup via UI |
| 49 | + |
| 50 | +#### Steps: |
| 51 | + |
| 52 | +1. **Log in to the Source (Master) Environment (typically your DEV environment)** |
| 53 | + * Use an Admin account |
| 54 | + * Navigate to the **Environments page** |
| 55 | +2. **Click “Add Environment”**\ |
| 56 | + Fill out the form with: |
| 57 | + * **Environment Name** |
| 58 | + * **Stage Type** (e.g., Dev, Test, Production) |
| 59 | + * **API Service URL** (the URL of the instance to connect) |
| 60 | + * **API Key** (created manually on the target Lowcoder instance) |
| 61 | +3. **Set Environment Role** |
| 62 | + * Toggle ON if the new environment is to act as a **Master** (optional) |
| 63 | +4. **Click "Create Environment"** |
| 64 | + |
| 65 | + * The environment will now be registered and ready for staging and deployment operations. |
23 | 66 |
|
24 | 67 | \
|
25 |
| -  (6).png>)\ |
| 68 | + |
| 69 | + |
| 70 | + <figure><img src="../../../../.gitbook/assets/frame_generic_light (26).png" alt=""><figcaption></figcaption></figure> |
| 71 | + |
| 72 | +*** |
| 73 | + |
| 74 | +#### 📌 Notes for API Key (Manual Setup) |
| 75 | + |
| 76 | +To generate an API key for an instance: |
| 77 | + |
| 78 | +1. Log in to the target instance |
| 79 | +2. Use an Admin account |
| 80 | +3. Navigate to Your **User** **Profile → API Keys** |
| 81 | +4. Generate and copy the API key to use in the manual setup form\ |
| 82 | + |
| 83 | + |
0 commit comments