diff --git a/apps/docs/content/features/env-variables.mdx b/apps/docs/content/features/env-variables.mdx index 5cfddf92..f1387047 100644 --- a/apps/docs/content/features/env-variables.mdx +++ b/apps/docs/content/features/env-variables.mdx @@ -63,26 +63,57 @@ It is always necessary to redeploy your application when updating or creating en ## Setting secret variables -Use secret variables to store passwords, tokens and other sensitive information that shouldn't be part of your repository and listed in zerops.yml. +There are several ways to set secret variables to your project/services using Zerops GUI: + +### With Import Dialog + +When importing services/project using yaml config via Zerops dashboard, you can assign secret variables to your services in your yaml using the `envSecrets` parameter: + +```yaml +services: + - hostname: app + type: nodejs@latest + envSecrets: + SECRET_KEY: <@generateRandomString(<32>)> + S3_ACCESS_KEY_ID: 'P8cX1vVVb' + S3_ACCESS_SECRET: 'ogFthuiLYki8XoL73opSCQ' +``` + +### From Project > Services > Secrets + +You can assign secret variables to your services from the **Project > Service > Environment variables** page. +Use secret variables to store tokens and other sensitive information that shouldn't be public and assigned in `zerops.yml`.
+
-You can set env variables when you [create](/java/how-to/create) a new Java service or you can set them later. +### Individual editing + +To configure individual variables, go to the service detail and choose **Environment variables** in the left menu. Click the **Add secret variable** button and set variable key and value. + +You can edit or delete variables by clicking on the menu on the right side of each row. -To configure env variables for an existing service, go to the service detail and choose **Environment variables** in the left menu. Scroll to the **Secret variables** section and click on the **Add secret variable** button and set variable key and value. +### Bulk editing -You can edit or delete env variables that you've created by clicking on the menu on the right side of each row. +Click "Edit multiple secret variables in .env format" to open an editor where you can manage multiple variables at once using standard .env file format: + +```env +# Add or update variables +DB_USER=admin +API_KEY=abc123 +DEBUG_MODE=true + +# Delete variables by removing their lines +``` -The changes you've made in the list of env variables need to be committed. Click on the **Commit x changes** button and Zerops will update the env variables in all containers of your project's services. +Zerops will automatically update the env variables in all containers of your project's services. :::caution -You need to **restart** the runtime service after you commit the changes in env variables. The Java process running in the container receives the list env variables only when it starts. Update of the env variables while the Java process is running does not affect your application. +You need to **restart** the runtime service after updating env variables. The Java process running in the container receives the list env variables only when it starts. Update of the env variables while the Java process is running does not affect your application. ::: ## Set basic build env variables in zerops.yml diff --git a/apps/docs/content/nodejs/how-to/env-variables.mdx b/apps/docs/content/nodejs/how-to/env-variables.mdx index d62ac85a..aea66869 100644 --- a/apps/docs/content/nodejs/how-to/env-variables.mdx +++ b/apps/docs/content/nodejs/how-to/env-variables.mdx @@ -48,6 +48,11 @@ You can [reference](/nodejs/how-to/env-variables#reference-a-local-variable-in-a Use secret variables to store passwords, tokens and other sensitive information that shouldn't be part of your repository and listed in zerops.yml. +You can manage secret variables in two ways: + +1. **Individual editing**: Add or edit variables one by one +2. **Bulk editing**: Manage multiple variables at once using .env format +
-You can set env variables when you [create](/nodejs/how-to/create) a new Node.js service or you can set them later. +### Individual editing -To configure env variables for an existing service, go to the service detail and choose **Environment variables** in the left menu. Scroll to the **Secret variables** section and click on the **Add secret variable** button and set variable key and value. +To configure individual variables, go to the service detail and choose **Environment variables** in the left menu. Click the **Add secret variable** button and set variable key and value. -You can edit or delete env variables that you've created by clicking on the menu on the right side of each row. +You can edit or delete variables by clicking on the menu on the right side of each row. -The changes you've made in the list of env variables need to be committed. Click on the **Commit x changes** button and Zerops will update the env variables in all containers of your project's services. +### Bulk editing -:::caution -You need to **restart** the runtime service after you commit the changes in env variables. The Node.js process running in the container receives the list env variables only when it starts. Update of the env variables while the Node.js process is running does not affect your application. -::: +Click "Edit multiple secret variables in .env format" to open an editor where you can manage multiple variables at once using standard .env file format: + +```env +# Add or update variables +DB_USER=admin +API_KEY=abc123 +DEBUG_MODE=true + +# Delete variables by removing their lines +``` ## Set basic build env variables in zerops.yml @@ -195,3 +207,24 @@ You can use runtime env variables in the build environment using the `RUNTIME_` If you create a secret env variable and a basic runtime env variable with the same key, Zerops saves the basic runtime env variable from your zerops.yml and ignores the secret env variable. If you create a basic build env variable and a runtime env variable with the same key, Zerops saves both because the build and runtime environments have separate sets of env variables. + +## Setting secret variables + +You can set secret variables in two ways: + +### With Import Dialog + +When importing a Node.js service using YAML configuration, you can define secret variables using the `envSecrets` map: + +```yaml +services: + - hostname: app + type: nodejs@latest + envSecrets: + S3_ACCESS_KEY_ID: 'P8cX1vVVb' + S3_ACCESS_SECRET: 'ogFthuiLYki8XoL73opSCQ' +``` + +### In Zerops GUI + +Use secret variables to store passwords, tokens and other sensitive information that shouldn't be part of your repository and listed in zerops.yml. diff --git a/apps/docs/content/python/how-to/env-variables.mdx b/apps/docs/content/python/how-to/env-variables.mdx index 4fba2d41..26f22ce5 100644 --- a/apps/docs/content/python/how-to/env-variables.mdx +++ b/apps/docs/content/python/how-to/env-variables.mdx @@ -49,6 +49,11 @@ You can [reference](/python/how-to/env-variables#reference-a-local-variable-in-a Use secret variables to store passwords, tokens and other sensitive information that shouldn't be part of your repository and listed in zerops.yml. +You can manage secret variables in two ways: + +1. **Individual editing**: Add or edit variables one by one +2. **Bulk editing**: Manage multiple variables at once using .env format +
-You can set env variables when you [create](/python/how-to/create) a new Python service or you can set them later. +### Individual editing + +To configure individual variables, go to the service detail and choose **Environment variables** in the left menu. Click the **Add secret variable** button and set variable key and value. + +You can edit or delete variables by clicking on the menu on the right side of each row. + +### Bulk editing + +Click "Edit multiple secret variables in .env format" to open an editor where you can manage multiple variables at once using standard .env file format: -To configure env variables for an existing service, go to the service detail and choose **Environment variables** in the left menu. Scroll to the **Secret variables** section and click on the **Add secret variable** button and set variable key and value. +```env +# Add or update variables +DB_USER=admin +API_KEY=abc123 +DEBUG_MODE=true You can edit or delete env variables that you've created by clicking on the menu on the right side of each row. -The changes you've made in the list of env variables need to be committed. Click on the **Commit x changes** button and Zerops will update the env variables in all containers of your project's services. +Zerops will automatically update the env variables in all containers of your project's services. :::caution -You need to **restart** the runtime service after you commit the changes in env variables. The Python process running in the container receives the list env variables only when it starts. Update of the env variables while the Python process is running does not affect your application. +You need to **restart** the runtime service after updating env variables. The Python process running in the container receives the list env variables only when it starts. Update of the env variables while the Python process is running does not affect your application. ::: ## Set basic build env variables in zerops.yml diff --git a/apps/docs/static/img/gui/env-editing.png b/apps/docs/static/img/gui/env-editing.png new file mode 100644 index 00000000..3df09990 Binary files /dev/null and b/apps/docs/static/img/gui/env-editing.png differ diff --git a/apps/docs/static/img/gui/secrets.webp b/apps/docs/static/img/gui/secrets.webp new file mode 100644 index 00000000..094eb795 Binary files /dev/null and b/apps/docs/static/img/gui/secrets.webp differ