From d4941359b949b24071ccca61f8bb2820014fcbdd Mon Sep 17 00:00:00 2001 From: Petra Vankova Date: Wed, 11 Jun 2025 10:30:56 +0200 Subject: [PATCH] reusable 3 --- .../docs/content/bun/how-to/env-variables.mdx | 178 +-- .../content/deno/how-to/env-variables.mdx | 178 +-- .../content/dotnet/how-to/env-variables.mdx | 197 +-- .../content/elixir/how-to/env-variables.mdx | 178 +-- .../content/gleam/how-to/env-variables.mdx | 178 +-- apps/docs/content/go/how-to/env-variables.mdx | 196 +-- .../content/java/how-to/env-variables.mdx | 196 +-- .../content/nodejs/how-to/env-variables.mdx | 197 +-- .../docs/content/php/how-to/env-variables.mdx | 194 +-- .../content/python/how-to/env-variables.mdx | 196 +-- .../content/rust/how-to/env-variables.mdx | 195 +-- .../src/components/content/env-variables.mdx | 210 +++ apps/docs/src/components/content/var.js | 7 + apps/docs/static/llms-full.txt | 1388 ++--------------- apps/docs/static/llms-small.txt | 1388 ++--------------- 15 files changed, 496 insertions(+), 4580 deletions(-) create mode 100644 apps/docs/src/components/content/env-variables.mdx diff --git a/apps/docs/content/bun/how-to/env-variables.mdx b/apps/docs/content/bun/how-to/env-variables.mdx index 6784cc55..9f671f44 100644 --- a/apps/docs/content/bun/how-to/env-variables.mdx +++ b/apps/docs/content/bun/how-to/env-variables.mdx @@ -3,176 +3,12 @@ title: How to set and use environment variables in Bun service description: Learn how you can setup and use environment variables in a Bun service on Zerops. --- -Environment variables help you run your application in different environments. They allow you to isolate all specific environment aspects from your application code and keep your app encapsulated. You can create several projects in Zerops that represent different environments (development, stage, production) or even each developer can have a project with its own environment. +import { SetVar } from '/src/components/content/var'; +import EnvVariablesContent from '/src/components/content/env-variables.mdx'; -In Zerops you do not have to create a `.env` file manually. Zerops handles the environment variables for you. + + + + -## Types of env variables in Zerops - -There are 3 different sets of env variables in Zerops: - -| environment | type | defined in | -| ----------- | ------ | --------------------------------------------------------------------------------- | -| build | basic | [zerops.yaml](bun/how-to/build-pipeline#envvariables) | -| runtime | basic | [zerops.yaml](bun/how-to/build-pipeline#envvariables-1) | -| runtime | secret | [Zerops GUI](bun/how-to/env-variables#set-secret-env-variables-in-zerops-gui) | - -Use the [secret env variables](bun/how-to/create#set-secret-environment-variables) for all sensitive data you don't want to store in your application code. Secret env variables are also useful if you need for testing where you need to change the value of some env variables frequently. Secret variables are managed in Zerops GUI and you don't have to redeploy your application. - -The basic build and runtime env variables are listed in your [zerops.yaml](/zerops-yaml/specification) and deployed together with your application code. When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your zerops.yaml and redeploy your application to Zerops. - -You can [reference](bun/how-to/env-variables#reference-a-local-variable-in-another-variable-value) another variable of the same service or even a variable of [another service](bun/how-to/env-variables#reference-a-variable-of-another-project-service) within the same project. - -## Set secret env variables 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.yaml. - -

- image -

- -You can set env variables when you [create](bun/how-to/create) a new Bun service or you can set them later. - -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. - -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 will be automatically applied to all containers of your project's services. - -:::caution -You need to **restart** the runtime service after you update environment variables. The Bun process running in the container receives the list env variables only when it starts. Update of the env variables while the Bun process is running does not affect your application. -::: - -## Set basic build env variables in zerops.yaml - -To set basic env variables for the build environment, add the `envVariables` attribute to the build section in your `zerops.yaml` - -```yaml -zerops: - # define hostname of your service - - setup: app - # ==== how to build your application ==== - build: - … - - # OPTIONAL. Defines the env variables for the build environment: - envVariables: - NODE_ENV: production - DB_NAME: db - DB_HOST: db - DB_USER: db - DB_PASS: ${db_password} -``` - -When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your `zerops.yaml` and redeploy your application to Zerops. - -## Set basic runtime env variables in zerops.yaml - -To set basic env variables for the runtime environment, add the `envVariables` attribute to the runtime section in your `zerops.yaml`. - -```yaml -zerops: - # define hostname of your service - - setup: app - # ==== how to build your application ==== - run: - … - - # OPTIONAL. Defines the env variables for the runtime environment: - envVariables: - NODE_ENV: production - DB_NAME: db - DB_HOST: db - DB_USER: db - DB_PASS: ${db_password} -``` - -When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your `zerops.yaml` and redeploy your application to Zerops. - -## Env variable restrictions - -**key** - -- must satisfy the following regular expression: `[a-zA-Z_]+[a-zA-Z0-9_]*` -- all variable keys in the same service must be unique regardless of case -- keys are case sensitive - -**value** - -- must contain only ASCII characters -- the _End of Line_ character is forbidden - -These restrictions apply to all [types of env variables](bun/how-to/env-variables#types-of-env-variables-in-zerops). - -## Referencing other env variables - -You can reference another variable of the same service using `${key}` in your variable value. You can even reference a variable from a different service using `${hostname_key}`. The referenced variable doesn't need to exist when you are entering your variable. - -### Reference a local variable in another variable value - -| Variable key | Variable value | Computed variable value | -| ------------ | ------------------- | ----------------------- | -| id | 12345 | 12345 | -| hostname | app | app | -| name | `${id}-${hostname}` | 12345-app | - -### Reference a variable of another project service - -Let's say your project contains two PostgreSQL services `dbtest` and `dbprod`. Both services have a `connectionString` variable. Then you can create a `dbConnectionString` env variable in your Bun runtime and set `${dbtest_connectionString}` as the variable value. Zerops will fill in the value of the `connectionString` variable of the `dbtest` service. - -When you change the `dbConnectionString` value to `${dbprod_connectionString}`, Zerops will fill in the value of the `connectionString` variable of the `dbprod` service. - -:::caution -When you change the value of the `connectionString` variable in the service `dbtest` you need to **restart** the Bun service. The Bun process running in the container receives the list env variables only when it starts. Update of the env variables while the Bun process is running does not affect your application. -::: - -## Generated env variables - -Zerops creates several helper variables when a Bun service is created, e.g. `hostname`, `PATH`. Some helper variables are read-only (`hostname`), others are editable (`PATH`). Generated variables cannot be deleted. - -Generated env variables are listed on the **Environment variables** page. Scroll to the **Generated variables** section. - -{/* TODO screenshot of the generated env variables of the respective runtime*/} - -

- image -

- -## How to read env variables from your Bun app - -Zerops passes all environment variables from all project services when your Bun app is deployed and started. - -To access the local environment variable i.e. the variable set to this Bun service in your app, use: - -```sh -process.env.YOUR_VARIABLE_KEY_HERE -``` - -## How to read env variables of another service - -All services of the same project can reference environment variables from other services. To use an environment variable from one service in another service in the same project, you must prefix the environment variable key with the service hostname and underscore. - -#### Examples: - -To access the `connectionString` env variable of the `mariadb1` service, use `mariadb1_connectionString` as the env variable key. -To access the `password` env variable of the `mariadb2` service, use `mariadb2_password` as the env variable key. - -## How to read runtime env variables in the build environment - -You can use runtime env variables in the build environment using the `RUNTIME_` prefix. For example if you have a runtime variable with the `connectionString` key, use the `RUNTIME_connectionString` to read the variable in the build environment. This rule applies both for basic and secret runtime variables. - -## Basic and secret env variable with the same key - -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.yaml 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. + \ No newline at end of file diff --git a/apps/docs/content/deno/how-to/env-variables.mdx b/apps/docs/content/deno/how-to/env-variables.mdx index dac86320..31f9841f 100644 --- a/apps/docs/content/deno/how-to/env-variables.mdx +++ b/apps/docs/content/deno/how-to/env-variables.mdx @@ -3,176 +3,12 @@ title: How to set and use environment variables in Deno service description: Learn how you can setup and use environment variables in a deno service on Zerops. --- -Environment variables help you run your application in different environments. They allow you to isolate all specific environment aspects from your application code and keep your app encapsulated. You can create several projects in Zerops that represent different environments (development, stage, production) or even each developer can have a project with its own environment. +import { SetVar } from '/src/components/content/var'; +import EnvVariablesContent from '/src/components/content/env-variables.mdx'; -In Zerops you do not have to create a `.env` file manually. Zerops handles the environment variables for you. + + + + -## Types of env variables in Zerops - -There are 3 different sets of env variables in Zerops: - -| environment | type | defined in | -| ----------- | ------ | --------------------------------------------------------------------------------- | -| build | basic | [zerops.yaml](/deno/how-to/build-pipeline#envvariables) | -| runtime | basic | [zerops.yaml](/deno/how-to/build-pipeline#envvariables-1) | -| runtime | secret | [Zerops GUI](#set-secret-env-variables-in-zerops-gui) | - -Use the [secret env variables](/deno/how-to/create#set-secret-environment-variables) for all sensitive data you don't want to store in your application code. Secret env variables are also useful if you need for testing where you need to change the value of some env variables frequently. Secret variables are managed in Zerops GUI and you don't have to redeploy your application. - -The basic build and runtime env variables are listed in your [zerops.yaml](/zerops-yaml/specification) and deployed together with your application code. When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your zerops.yaml and redeploy your application to Zerops. - -You can [reference](/deno/how-to/env-variables#reference-a-local-variable-in-another-variable-value) another variable of the same service or even a variable of [another service](/deno/how-to/env-variables#reference-a-variable-of-another-project-service) within the same project. - -## Set secret env variables 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.yaml. - -

- image -

- -You can set env variables when you [create](/deno/how-to/create) a new Deno service or you can set them later. - -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. - -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 to environment variables will be automatically applied to all containers of your project's services. - -:::caution -You need to **restart** the runtime service after you update environment variables. The Deno process running in the container receives the list env variables only when it starts. Update of the env variables while the Deno process is running does not affect your application. -::: - -## Set basic build env variables in zerops.yaml - -To set basic env variables for the build environment, add the `envVariables` attribute to the build section in your `zerops.yaml` - -```yaml -zerops: - # define hostname of your service - - setup: app - # ==== how to build your application ==== - build: - … - - # OPTIONAL. Defines the env variables for the build environment: - envVariables: - NODE_ENV: production - DB_NAME: db - DB_HOST: db - DB_USER: db - DB_PASS: ${db_password} -``` - -When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your `zerops.yaml` and redeploy your application to Zerops. - -## Set basic runtime env variables in zerops.yaml - -To set basic env variables for the runtime environment, add the `envVariables` attribute to the runtime section in your `zerops.yaml`. - -```yaml -zerops: - # define hostname of your service - - setup: app - # ==== how to build your application ==== - run: - … - - # OPTIONAL. Defines the env variables for the runtime environment: - envVariables: - NODE_ENV: production - DB_NAME: db - DB_HOST: db - DB_USER: db - DB_PASS: ${db_password} -``` - -When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your `zerops.yaml` and redeploy your application to Zerops. - -## Env variable restrictions - -**key** - -- must satisfy the following regular expression: `[a-zA-Z_]+[a-zA-Z0-9_]*` -- all variable keys in the same service must be unique regardless of case -- keys are case sensitive - -**value** - -- must contain only ASCII characters -- the _End of Line_ character is forbidden - -These restrictions apply to all [types of env variables](/deno/how-to/env-variables#types-of-env-variables-in-zerops). - -## Referencing other env variables - -You can reference another variable of the same service using `${key}` in your variable value. You can even reference a variable from a different service using `${hostname_key}`. The referenced variable doesn't need to exist when you are entering your variable. - -### Reference a local variable in another variable value - -| Variable key | Variable value | Computed variable value | -| ------------ | ------------------- | ----------------------- | -| id | 12345 | 12345 | -| hostname | app | app | -| name | `${id}-${hostname}` | 12345-app | - -### Reference a variable of another project service - -Let's say your project contains two PostgreSQL services `dbtest` and `dbprod`. Both services have a `connectionString` variable. Then you can create a `dbConnectionString` env variable in your Deno runtime and set `${dbtest_connectionString}` as the variable value. Zerops will fill in the value of the `connectionString` variable of the `dbtest` service. - -When you change the `dbConnectionString` value to `${dbprod_connectionString}`, Zerops will fill in the value of the `connectionString` variable of the `dbprod` service. - -:::caution -When you change the value of the `connectionString` variable in the service `dbtest` you need to **restart** the Deno service. The Deno process running in the container receives the list env variables only when it starts. Update of the env variables while the Deno process is running does not affect your application. -::: - -## Generated env variables - -Zerops creates several helper variables when a Deno service is created, e.g. `hostname`, `PATH`. Some helper variables are read-only (`hostname`), others are editable (`PATH`). Generated variables cannot be deleted. - -Generated env variables are listed on the **Environment variables** page. Scroll to the **Generated variables** section. - -{/* TODO screenshot of the generated env variables of the respective runtime*/} - -

- image -

- -## How to read env variables from your Deno app - -Zerops passes all environment variables from all project services when your Deno app is deployed and started. - -To access the local environment variable i.e. the variable set to this Deno service in your app, use: - -```sh -process.env.YOUR_VARIABLE_KEY_HERE -``` - -## How to read env variables of another service - -All services of the same project can reference environment variables from other services. To use an environment variable from one service in another service in the same project, you must prefix the environment variable key with the service hostname and underscore. - -#### Examples: - -To access the `connectionString` env variable of the `mariadb1` service, use `mariadb1_connectionString` as the env variable key. -To access the `password` env variable of the `mariadb2` service, use `mariadb2_password` as the env variable key. - -## How to read runtime env variables in the build environment - -You can use runtime env variables in the build environment using the `RUNTIME_` prefix. For example if you have a runtime variable with the `connectionString` key, use the `RUNTIME_connectionString` to read the variable in the build environment. This rule applies both for basic and secret runtime variables. - -## Basic and secret env variable with the same key - -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.yaml 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. + \ No newline at end of file diff --git a/apps/docs/content/dotnet/how-to/env-variables.mdx b/apps/docs/content/dotnet/how-to/env-variables.mdx index 1febed0e..34ac1554 100644 --- a/apps/docs/content/dotnet/how-to/env-variables.mdx +++ b/apps/docs/content/dotnet/how-to/env-variables.mdx @@ -3,195 +3,12 @@ title: How to set and use environment variables in .NET service description: Learn how you can setup and use environment variables in a dotnet service on Zerops. --- -import Image from '/src/components/Image'; +import { SetVar } from '/src/components/content/var'; +import EnvVariablesContent from '/src/components/content/env-variables.mdx'; -Environment variables help you run your application in different environments. They allow you to isolate all specific environment aspects from your application code and keep your app encapsulated. You can create several projects in Zerops that represent different environments (development, stage, production) or even each developer can have a project with its own environment. + + + + -In Zerops you do not have to create a `.env` file manually. Zerops handles the environment variables for you. - -## Types of env variables in Zerops - -There are 3 different sets of env variables in Zerops: - - - - - - - - - - - - - - - - - - - - - - - - - - -
TypeEnvironmentDefined in
basicbuildzerops.yaml
basicruntimezerops.yaml
secretruntimeZerops GUI
- -Use the [secret env variables](/dotnet/how-to/create#set-secret-environment-variables) for all sensitive data you don't want to store in your application code. Secret env variables are also useful if you need for testing where you need to change the value of some env variables frequently. Secret variables are managed in Zerops GUI and you don't have to redeploy your application. - -The basic build and runtime env variables are listed in your [zerops.yaml](/zerops-yaml/specification) and deployed together with your application code. When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your zerops.yaml and redeploy your application to Zerops. - -You can [reference](/dotnet/how-to/env-variables#reference-a-local-variable-in-another-variable-value) another variable of the same service or even a variable of [another service](/dotnet/how-to/env-variables#reference-a-variable-of-another-project-service) within the same project. - -## Set secret env variables 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.yaml. - -

- Secrete ENVs -

- -You can set env variables when you [create](/dotnet/how-to/create) a new .NET service or you can set them later. - -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. - -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 to environment variables will be automatically applied to all containers of your project's services. - -:::caution -You need to **restart** the runtime service after you update environment variables. The .NET process running in the container receives the list env variables only when it starts. Update of the env variables while the .NET process is running does not affect your application. -::: - -## Set basic build env variables in zerops.yaml - -To set basic env variables for the build environment, add the `envVariables` attribute to the build section in your `zerops.yaml` - -```yaml -zerops: - # define hostname of your service - - setup: app - # ==== how to build your application ==== - build: - … - - # OPTIONAL. Defines the env variables for the build environment: - envVariables: - DB_NAME: db - DB_HOST: db - DB_USER: db - DB_PASS: ${db_password} -``` - -When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your `zerops.yaml` and redeploy your application to Zerops. - -## Set basic runtime env variables in zerops.yaml - -To set basic env variables for the runtime environment, add the `envVariables` attribute to the runtime section in your `zerops.yaml`. - -```yaml -zerops: - # define hostname of your service - - setup: app - # ==== how to build your application ==== - run: - … - - # OPTIONAL. Defines the env variables for the runtime environment: - envVariables: - DB_NAME: db - DB_HOST: db - DB_USER: db - DB_PASS: ${db_password} -``` - -When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your `zerops.yaml` and redeploy your application to Zerops. - -## Env variable restrictions - -**key** - -- must satisfy the following regular expression: `[a-zA-Z_]+[a-zA-Z0-9_]*` -- all variable keys in the same service must be unique regardless of case -- keys are case sensitive - -**value** - -- must contain only ASCII characters -- the _End of Line_ character is forbidden - -These restrictions apply to all [types of env variables](/dotnet/how-to/env-variables#types-of-env-variables-in-zerops). - -## Referencing other env variables - -You can reference another variable of the same service using `${key}` in your variable value. You can even reference a variable from a different service using `${hostname_key}`. The referenced variable doesn't need to exist when you are entering your variable. - -### Reference a local variable in another variable value - -| Variable key | Variable value | Computed variable value | -| ------------ | ------------------- | ----------------------- | -| id | 12345 | 12345 | -| hostname | app | app | -| name | `${id}-${hostname}` | 12345-app | - -### Reference a variable of another project service - -Let's say your project contains two PostgreSQL services `dbtest` and `dbprod`. Both services have a `connectionString` variable. Then you can create a `dbConnectionString` env variable in your .NET runtime and set `${dbtest_connectionString}` as the variable value. Zerops will fill in the value of the `connectionString` variable of the `dbtest` service. - -When you change the `dbConnectionString` value to `${dbprod_connectionString}`, Zerops will fill in the value of the `connectionString` variable of the `dbprod` service. - -:::caution -When you change the value of the `connectionString` variable in the service `dbtest` you need to **restart** the .NET service. The .NET process running in the container receives the list env variables only when it starts. Update of the env variables while the .NET process is running does not affect your application. -::: - -## Generated env variables - -Zerops creates several helper variables when a .NET service is created, e.g. `hostname`, `PATH`. Some helper variables are read-only (`hostname`), others are editable (`PATH`). Generated variables cannot be deleted. - -Generated env variables are listed on the **Environment variables** page. Scroll to the **Generated variables** section. - -

- Node.js Generated Variables -

- -## How to read env variables from your .NET app - -Zerops passes all environment variables from all project services when your .NET app is deployed and started. - -To access the local environment variable i.e. the variable set to this .NET service in your app, use: - -```sh -Environment.GetEnvironmentVariable("YOUR_VARIABLE_KEY_HERE"); -``` - -## How to read env variables of another service - -All services of the same project can reference environment variables from other services. To use an environment variable from one service in another service in the same project, you must prefix the environment variable key with the service hostname and underscore. - -#### Examples: - -To access the `connectionString` env variable of the `mariadb1` service, use `mariadb1_connectionString` as the env variable key. -To access the `password` env variable of the `mariadb2` service, use `mariadb2_password` as the env variable key. - -## How to read runtime env variables in the build environment - -You can use runtime env variables in the build environment using the `RUNTIME_` prefix. For example if you have a runtime variable with the `connectionString` key, use the `RUNTIME_connectionString` to read the variable in the build environment. This rule applies both for basic and secret runtime variables. - -## Basic and secret env variable with the same key - -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.yaml 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. + \ No newline at end of file diff --git a/apps/docs/content/elixir/how-to/env-variables.mdx b/apps/docs/content/elixir/how-to/env-variables.mdx index 35e570a0..29c7f442 100644 --- a/apps/docs/content/elixir/how-to/env-variables.mdx +++ b/apps/docs/content/elixir/how-to/env-variables.mdx @@ -3,176 +3,12 @@ title: How to set and use environment variables in Elixir service description: Learn how you can setup and use environment variables in a elixir service on Zerops. --- -Environment variables help you run your application in different environments. They allow you to isolate all specific environment aspects from your application code and keep your app encapsulated. You can create several projects in Zerops that represent different environments (development, stage, production) or even each developer can have a project with its own environment. +import { SetVar } from '/src/components/content/var'; +import EnvVariablesContent from '/src/components/content/env-variables.mdx'; -In Zerops you do not have to create a `.env` file manually. Zerops handles the environment variables for you. + + + + -## Types of env variables in Zerops - -There are 3 different sets of env variables in Zerops: - -| environment | type | defined in | -| ----------- | ------ | --------------------------------------------------------------------------------- | -| build | basic | [zerops.yaml](/elixir/how-to/build-pipeline#envvariables) | -| runtime | basic | [zerops.yaml](/elixir/how-to/build-pipeline#envvariables-1) | -| runtime | secret | [Zerops GUI](#set-secret-env-variables-in-zerops-gui) | - -Use the [secret env variables](/elixir/how-to/create#set-secret-environment-variables) for all sensitive data you don't want to store in your application code. Secret env variables are also useful if you need for testing where you need to change the value of some env variables frequently. Secret variables are managed in Zerops GUI and you don't have to redeploy your application. - -The basic build and runtime env variables are listed in your [zerops.yaml](/zerops-yaml/specification) and deployed together with your application code. When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your zerops.yaml and redeploy your application to Zerops. - -You can [reference](/elixir/how-to/env-variables#reference-a-local-variable-in-another-variable-value) another variable of the same service or even a variable of [another service](/elixir/how-to/env-variables#reference-a-variable-of-another-project-service) within the same project. - -## Set secret env variables 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.yaml. - -

- image -

- -You can set env variables when you [create](/elixir/how-to/create) a new Elixir service or you can set them later. - -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. - -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 to environment variables will be automatically applied to all containers of your project's services. - -:::caution -You need to **restart** the runtime service after you update environment variables. The Elixir process running in the container receives the list env variables only when it starts. Update of the env variables while the Elixir process is running does not affect your application. -::: - -## Set basic build env variables in zerops.yaml - -To set basic env variables for the build environment, add the `envVariables` attribute to the build section in your `zerops.yaml` - -```yaml -zerops: - # define hostname of your service - - setup: app - # ==== how to build your application ==== - build: - … - - # OPTIONAL. Defines the env variables for the build environment: - envVariables: - NODE_ENV: production - DB_NAME: db - DB_HOST: db - DB_USER: db - DB_PASS: ${db_password} -``` - -When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your `zerops.yaml` and redeploy your application to Zerops. - -## Set basic runtime env variables in zerops.yaml - -To set basic env variables for the runtime environment, add the `envVariables` attribute to the runtime section in your `zerops.yaml`. - -```yaml -zerops: - # define hostname of your service - - setup: app - # ==== how to build your application ==== - run: - … - - # OPTIONAL. Defines the env variables for the runtime environment: - envVariables: - NODE_ENV: production - DB_NAME: db - DB_HOST: db - DB_USER: db - DB_PASS: ${db_password} -``` - -When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your `zerops.yaml` and redeploy your application to Zerops. - -## Env variable restrictions - -**key** - -- must satisfy the following regular expression: `[a-zA-Z_]+[a-zA-Z0-9_]*` -- all variable keys in the same service must be unique regardless of case -- keys are case sensitive - -**value** - -- must contain only ASCII characters -- the _End of Line_ character is forbidden - -These restrictions apply to all [types of env variables](/elixir/how-to/env-variables#types-of-env-variables-in-zerops). - -## Referencing other env variables - -You can reference another variable of the same service using `${key}` in your variable value. You can even reference a variable from a different service using `${hostname_key}`. The referenced variable doesn't need to exist when you are entering your variable. - -### Reference a local variable in another variable value - -| Variable key | Variable value | Computed variable value | -| ------------ | ------------------- | ----------------------- | -| id | 12345 | 12345 | -| hostname | app | app | -| name | `${id}-${hostname}` | 12345-app | - -### Reference a variable of another project service - -Let's say your project contains two PostgreSQL services `dbtest` and `dbprod`. Both services have a `connectionString` variable. Then you can create a `dbConnectionString` env variable in your Elixir runtime and set `${dbtest_connectionString}` as the variable value. Zerops will fill in the value of the `connectionString` variable of the `dbtest` service. - -When you change the `dbConnectionString` value to `${dbprod_connectionString}`, Zerops will fill in the value of the `connectionString` variable of the `dbprod` service. - -:::caution -When you change the value of the `connectionString` variable in the service `dbtest` you need to **restart** the Elixir service. The Elixir process running in the container receives the list env variables only when it starts. Update of the env variables while the Elixir process is running does not affect your application. -::: - -## Generated env variables - -Zerops creates several helper variables when a Elixir service is created, e.g. `hostname`, `PATH`. Some helper variables are read-only (`hostname`), others are editable (`PATH`). Generated variables cannot be deleted. - -Generated env variables are listed on the **Environment variables** page. Scroll to the **Generated variables** section. - -{/* TODO screenshot of the generated env variables of the respective runtime*/} - -

- image -

- -## How to read env variables from your Elixir app - -Zerops passes all environment variables from all project services when your Elixir app is deployed and started. - -To access the local environment variable i.e. the variable set to this Elixir service in your app, use: - -```sh -process.env.YOUR_VARIABLE_KEY_HERE -``` - -## How to read env variables of another service - -All services of the same project can reference environment variables from other services. To use an environment variable from one service in another service in the same project, you must prefix the environment variable key with the service hostname and underscore. - -#### Examples: - -To access the `connectionString` env variable of the `mariadb1` service, use `mariadb1_connectionString` as the env variable key. -To access the `password` env variable of the `mariadb2` service, use `mariadb2_password` as the env variable key. - -## How to read runtime env variables in the build environment - -You can use runtime env variables in the build environment using the `RUNTIME_` prefix. For example if you have a runtime variable with the `connectionString` key, use the `RUNTIME_connectionString` to read the variable in the build environment. This rule applies both for basic and secret runtime variables. - -## Basic and secret env variable with the same key - -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.yaml 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. + \ No newline at end of file diff --git a/apps/docs/content/gleam/how-to/env-variables.mdx b/apps/docs/content/gleam/how-to/env-variables.mdx index 016cd942..833ea8d8 100644 --- a/apps/docs/content/gleam/how-to/env-variables.mdx +++ b/apps/docs/content/gleam/how-to/env-variables.mdx @@ -3,176 +3,12 @@ title: How to set and use environment variables in Gleam service description: Learn how you can setup and use environment variables in a gleam service on Zerops. --- -Environment variables help you run your application in different environments. They allow you to isolate all specific environment aspects from your application code and keep your app encapsulated. You can create several projects in Zerops that represent different environments (development, stage, production) or even each developer can have a project with its own environment. +import { SetVar } from '/src/components/content/var'; +import EnvVariablesContent from '/src/components/content/env-variables.mdx'; -In Zerops you do not have to create a `.env` file manually. Zerops handles the environment variables for you. + + + + -## Types of env variables in Zerops - -There are 3 different sets of env variables in Zerops: - -| environment | type | defined in | -| ----------- | ------ | --------------------------------------------------------------------------------- | -| build | basic | [zerops.yaml](/gleam/how-to/build-pipeline#envvariables) | -| runtime | basic | [zerops.yaml](/gleam/how-to/build-pipeline#envvariables-1) | -| runtime | secret | [Zerops GUI](#set-secret-env-variables-in-zerops-gui) | - -Use the [secret env variables](/gleam/how-to/create#set-secret-environment-variables) for all sensitive data you don't want to store in your application code. Secret env variables are also useful if you need for testing where you need to change the value of some env variables frequently. Secret variables are managed in Zerops GUI and you don't have to redeploy your application. - -The basic build and runtime env variables are listed in your [zerops.yaml](/zerops-yaml/specification) and deployed together with your application code. When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your zerops.yaml and redeploy your application to Zerops. - -You can [reference](/gleam/how-to/env-variables#reference-a-local-variable-in-another-variable-value) another variable of the same service or even a variable of [another service](/gleam/how-to/env-variables#reference-a-variable-of-another-project-service) within the same project. - -## Set secret env variables 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.yaml. - -

- image -

- -You can set env variables when you [create](/gleam/how-to/create) a new Gleam service or you can set them later. - -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. - -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 to environment variables will be automatically applied to all containers of your project's services. - -:::caution -You need to **restart** the runtime service after you update environment variables. The Gleam process running in the container receives the list env variables only when it starts. Update of the env variables while the Gleam process is running does not affect your application. -::: - -## Set basic build env variables in zerops.yaml - -To set basic env variables for the build environment, add the `envVariables` attribute to the build section in your `zerops.yaml` - -```yaml -zerops: - # define hostname of your service - - setup: app - # ==== how to build your application ==== - build: - … - - # OPTIONAL. Defines the env variables for the build environment: - envVariables: - NODE_ENV: production - DB_NAME: db - DB_HOST: db - DB_USER: db - DB_PASS: ${db_password} -``` - -When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your `zerops.yaml` and redeploy your application to Zerops. - -## Set basic runtime env variables in zerops.yaml - -To set basic env variables for the runtime environment, add the `envVariables` attribute to the runtime section in your `zerops.yaml`. - -```yaml -zerops: - # define hostname of your service - - setup: app - # ==== how to build your application ==== - run: - … - - # OPTIONAL. Defines the env variables for the runtime environment: - envVariables: - NODE_ENV: production - DB_NAME: db - DB_HOST: db - DB_USER: db - DB_PASS: ${db_password} -``` - -When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your `zerops.yaml` and redeploy your application to Zerops. - -## Env variable restrictions - -**key** - -- must satisfy the following regular expression: `[a-zA-Z_]+[a-zA-Z0-9_]*` -- all variable keys in the same service must be unique regardless of case -- keys are case sensitive - -**value** - -- must contain only ASCII characters -- the _End of Line_ character is forbidden - -These restrictions apply to all [types of env variables](/gleam/how-to/env-variables#types-of-env-variables-in-zerops). - -## Referencing other env variables - -You can reference another variable of the same service using `${key}` in your variable value. You can even reference a variable from a different service using `${hostname_key}`. The referenced variable doesn't need to exist when you are entering your variable. - -### Reference a local variable in another variable value - -| Variable key | Variable value | Computed variable value | -| ------------ | ------------------- | ----------------------- | -| id | 12345 | 12345 | -| hostname | app | app | -| name | `${id}-${hostname}` | 12345-app | - -### Reference a variable of another project service - -Let's say your project contains two PostgreSQL services `dbtest` and `dbprod`. Both services have a `connectionString` variable. Then you can create a `dbConnectionString` env variable in your Gleam runtime and set `${dbtest_connectionString}` as the variable value. Zerops will fill in the value of the `connectionString` variable of the `dbtest` service. - -When you change the `dbConnectionString` value to `${dbprod_connectionString}`, Zerops will fill in the value of the `connectionString` variable of the `dbprod` service. - -:::caution -When you change the value of the `connectionString` variable in the service `dbtest` you need to **restart** the Gleam service. The Gleam process running in the container receives the list env variables only when it starts. Update of the env variables while the Gleam process is running does not affect your application. -::: - -## Generated env variables - -Zerops creates several helper variables when a Gleam service is created, e.g. `hostname`, `PATH`. Some helper variables are read-only (`hostname`), others are editable (`PATH`). Generated variables cannot be deleted. - -Generated env variables are listed on the **Environment variables** page. Scroll to the **Generated variables** section. - -{/* TODO screenshot of the generated env variables of the respective runtime*/} - -

- image -

- -## How to read env variables from your Gleam app - -Zerops passes all environment variables from all project services when your Gleam app is deployed and started. - -To access the local environment variable i.e. the variable set to this Gleam service in your app, use: - -```sh -process.env.YOUR_VARIABLE_KEY_HERE -``` - -## How to read env variables of another service - -All services of the same project can reference environment variables from other services. To use an environment variable from one service in another service in the same project, you must prefix the environment variable key with the service hostname and underscore. - -#### Examples: - -To access the `connectionString` env variable of the `mariadb1` service, use `mariadb1_connectionString` as the env variable key. -To access the `password` env variable of the `mariadb2` service, use `mariadb2_password` as the env variable key. - -## How to read runtime env variables in the build environment - -You can use runtime env variables in the build environment using the `RUNTIME_` prefix. For example if you have a runtime variable with the `connectionString` key, use the `RUNTIME_connectionString` to read the variable in the build environment. This rule applies both for basic and secret runtime variables. - -## Basic and secret env variable with the same key - -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.yaml 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. + \ No newline at end of file diff --git a/apps/docs/content/go/how-to/env-variables.mdx b/apps/docs/content/go/how-to/env-variables.mdx index f1a43633..36b41f75 100644 --- a/apps/docs/content/go/how-to/env-variables.mdx +++ b/apps/docs/content/go/how-to/env-variables.mdx @@ -3,194 +3,12 @@ title: How to set and use environment variables in Go service description: Learn how you can setup and use environment variables in a go service on Zerops. --- -Environment variables help you run your application in different environments. They allow you to isolate all specific environment aspects from your application code and keep your app encapsulated. You can create several projects in Zerops that represent different environments (development, stage, production) or even each developer can have a project with its own environment. +import { SetVar } from '/src/components/content/var'; +import EnvVariablesContent from '/src/components/content/env-variables.mdx'; -In Zerops you do not have to create a `.env` file manually. Zerops handles the environment variables for you. + + + + -## Types of env variables in Zerops - -There are 3 different sets of env variables in Zerops: - - - - - - - - - - - - - - - - - - - - - - - - - - -
TypeEnvironmentDefined in
basicbuildzerops.yaml
basicruntimezerops.yaml
secretruntimeZerops GUI
- - -Use the [secret env variables](/go/how-to/create#set-secret-environment-variables) for all sensitive data you don't want to store in your application code. Secret env variables are also useful if you need for testing where you need to change the value of some env variables frequently. Secret variables are managed in Zerops GUI and you don't have to redeploy your application. - -The basic build and runtime env variables are listed in your [zerops.yaml](/zerops-yaml/specification) and deployed together with your application code. When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your zerops.yaml and redeploy your application to Zerops. - -You can [reference](/go/how-to/env-variables#reference-a-local-variable-in-another-variable-value) another variable of the same service or even a variable of [another service](/go/how-to/env-variables#reference-a-variable-of-another-project-service) within the same project. - -## Set secret env variables 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.yaml. - -

- image -

- -You can set env variables when you [create](/go/how-to/create) a new Go service or you can set them later. - -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. - -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 to environment variables will be automatically applied to all containers of your project's services. - -:::caution -You need to **restart** the runtime service after you update environment variables. The Go process running in the container receives the list env variables only when it starts. Update of the env variables while the Go process is running does not affect your application. -::: - -## Set basic build env variables in zerops.yaml - -To set basic env variables for the build environment, add the `envVariables` attribute to the build section in your `zerops.yaml` - -```yaml -zerops: - # define hostname of your service - - setup: app - # ==== how to build your application ==== - build: - … - - # OPTIONAL. Defines the env variables for the build environment: - envVariables: - DB_NAME: db - DB_HOST: db - DB_USER: db - DB_PASS: ${db_password} -``` - -When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your `zerops.yaml` and redeploy your application to Zerops. - -## Set basic runtime env variables in zerops.yaml - -To set basic env variables for the runtime environment, add the `envVariables` attribute to the runtime section in your `zerops.yaml`. - -```yaml -zerops: - # define hostname of your service - - setup: app - # ==== how to build your application ==== - run: - … - - # OPTIONAL. Defines the env variables for the runtime environment: - envVariables: - DB_NAME: db - DB_HOST: db - DB_USER: db - DB_PASS: ${db_password} -``` - -When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your `zerops.yaml` and redeploy your application to Zerops. - -## Env variable restrictions - -**key** - -- must satisfy the following regular expression: `[a-zA-Z_]+[a-zA-Z0-9_]*` -- all variable keys in the same service must be unique regardless of case -- keys are case sensitive - -**value** - -- must contain only ASCII characters -- the _End of Line_ character is forbidden - -These restrictions apply to all [types of env variables](/go/how-to/env-variables#types-of-env-variables-in-zerops). - -## Referencing other env variables - -You can reference another variable of the same service using `${key}` in your variable value. You can even reference a variable from a different service using `${hostname_key}`. The referenced variable doesn't need to exist when you are entering your variable. - -### Reference a local variable in another variable value - -| Variable key | Variable value | Computed variable value | -| ------------ | ------------------- | ----------------------- | -| id | 12345 | 12345 | -| hostname | app | app | -| name | `${id}-${hostname}` | 12345-app | - -### Reference a variable of another project service - -Let's say your project contains two PostgreSQL services `dbtest` and `dbprod`. Both services have a `connectionString` variable. Then you can create a `dbConnectionString` env variable in your Go runtime and set `${dbtest_connectionString}` as the variable value. Zerops will fill in the value of the `connectionString` variable of the `dbtest` service. - -When you change the `dbConnectionString` value to `${dbprod_connectionString}`, Zerops will fill in the value of the `connectionString` variable of the `dbprod` service. - -:::caution -When you change the value of the `connectionString` variable in the service `dbtest` you need to **restart** the Go service. The Go process running in the container receives the list env variables only when it starts. Update of the env variables while the Go process is running does not affect your application. -::: - -## Generated env variables - -Zerops creates several helper variables when a Go service is created, e.g. `hostname`, `PATH`. Some helper variables are read-only (`hostname`), others are editable (`PATH`). Generated variables cannot be deleted. - -Generated env variables are listed on the **Environment variables** page. Scroll to the **Generated variables** section. - -

- image -

- -## How to read env variables from your Go app - -Zerops passes all environment variables from all project services when your Go app is deployed and started. - -To access the local environment variable i.e. the variable set to this Go service in your app, use: - -```sh -os.Getenv("YOUR_VARIABLE_KEY_HERE") -``` - -## How to read env variables of another service - -All services of the same project can reference environment variables from other services. To use an environment variable from one service in another service in the same project, you must prefix the environment variable key with the service hostname and underscore. - -#### Examples: - -To access the `connectionString` env variable of the `mariadb1` service, use `mariadb1_connectionString` as the env variable key. -To access the `password` env variable of the `mariadb2` service, use `mariadb2_password` as the env variable key. - -## How to read runtime env variables in the build environment - -You can use runtime env variables in the build environment using the `RUNTIME_` prefix. For example if you have a runtime variable with the `connectionString` key, use the `RUNTIME_connectionString` to read the variable in the build environment. This rule applies both for basic and secret runtime variables. - -## Basic and secret env variable with the same key - -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.yaml 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. + \ No newline at end of file diff --git a/apps/docs/content/java/how-to/env-variables.mdx b/apps/docs/content/java/how-to/env-variables.mdx index 988d7712..6e6fde29 100644 --- a/apps/docs/content/java/how-to/env-variables.mdx +++ b/apps/docs/content/java/how-to/env-variables.mdx @@ -3,194 +3,12 @@ title: How to set and use environment variables in Java service description: Learn how you can setup and use environment variables in a java service on Zerops. --- -Environment variables help you run your application in different environments. They allow you to isolate all specific environment aspects from your application code and keep your app encapsulated. You can create several projects in Zerops that represent different environments (development, stage, production) or even each developer can have a project with its own environment. +import { SetVar } from '/src/components/content/var'; +import EnvVariablesContent from '/src/components/content/env-variables.mdx'; -In Zerops you do not have to create a `.env` file manually. Zerops handles the environment variables for you. + + + + -## Types of env variables in Zerops - -There are 3 different sets of env variables in Zerops: - - - - - - - - - - - - - - - - - - - - - - - - - - -
TypeEnvironmentDefined in
basicbuildzerops.yaml
basicruntimezerops.yaml
secretruntimeZerops GUI
- - -Use the [secret env variables](/java/how-to/create#set-secret-environment-variables) for all sensitive data you don't want to store in your application code. Secret env variables are also useful if you need for testing where you need to change the value of some env variables frequently. Secret variables are managed in Zerops GUI and you don't have to redeploy your application. - -The basic build and runtime env variables are listed in your [zerops.yaml](/zerops-yaml/specification) and deployed together with your application code. When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your zerops.yaml and redeploy your application to Zerops. - -You can [reference](/java/how-to/env-variables#reference-a-local-variable-in-another-variable-value) another variable of the same service or even a variable of [another service](/java/how-to/env-variables#reference-a-variable-of-another-project-service) within the same project. - -## Set secret env variables 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.yaml. - -

- image -

- -You can set env variables when you [create](/java/how-to/create) a new Java service or you can set them later. - -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. - -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 to environment variables will be automatically applied to all containers of your project's services. - -:::caution -You need to **restart** the runtime service after you update environment 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.yaml - -To set basic env variables for the build environment, add the `envVariables` attribute to the build section in your `zerops.yaml` - -```yaml -zerops: - # define hostname of your service - - setup: app - # ==== how to build your application ==== - build: - … - - # OPTIONAL. Defines the env variables for the build environment: - envVariables: - DB_NAME: db - DB_HOST: db - DB_USER: db - DB_PASS: ${db_password} -``` - -When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your `zerops.yaml` and redeploy your application to Zerops. - -## Set basic runtime env variables in zerops.yaml - -To set basic env variables for the runtime environment, add the `envVariables` attribute to the runtime section in your `zerops.yaml`. - -```yaml -zerops: - # define hostname of your service - - setup: app - # ==== how to build your application ==== - run: - … - - # OPTIONAL. Defines the env variables for the runtime environment: - envVariables: - DB_NAME: db - DB_HOST: db - DB_USER: db - DB_PASS: ${db_password} -``` - -When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your `zerops.yaml` and redeploy your application to Zerops. - -## Env variable restrictions - -**key** - -- must satisfy the following regular expression: `[a-zA-Z_]+[a-zA-Z0-9_]*` -- all variable keys in the same service must be unique regardless of case -- keys are case sensitive - -**value** - -- must contain only ASCII characters -- the _End of Line_ character is forbidden - -These restrictions apply to all [types of env variables](/java/how-to/env-variables#types-of-env-variables-in-zerops). - -## Referencing other env variables - -You can reference another variable of the same service using `${key}` in your variable value. You can even reference a variable from a different service using `${hostname_key}`. The referenced variable doesn't need to exist when you are entering your variable. - -### Reference a local variable in another variable value - -| Variable key | Variable value | Computed variable value | -| ------------ | ------------------- | ----------------------- | -| id | 12345 | 12345 | -| hostname | app | app | -| name | `${id}-${hostname}` | 12345-app | - -### Reference a variable of another project service - -Let's say your project contains two PostgreSQL services `dbtest` and `dbprod`. Both services have a `connectionString` variable. Then you can create a `dbConnectionString` env variable in your Java runtime and set `${dbtest_connectionString}` as the variable value. Zerops will fill in the value of the `connectionString` variable of the `dbtest` service. - -When you change the `dbConnectionString` value to `${dbprod_connectionString}`, Zerops will fill in the value of the `connectionString` variable of the `dbprod` service. - -:::caution -When you change the value of the `connectionString` variable in the service `dbtest` you need to **restart** the Java service. 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. -::: - -## Generated env variables - -Zerops creates several helper variables when a Java service is created, e.g. `hostname`, `PATH`. Some helper variables are read-only (`hostname`), others are editable (`PATH`). Generated variables cannot be deleted. - -Generated env variables are listed on the **Environment variables** page. Scroll to the **Generated variables** section. - -

- image -

- -## How to read env variables from your Java app - -Zerops passes all environment variables from all project services when your Java app is deployed and started. - -To access the local environment variable i.e. the variable set to this Java service in your app, use: - -```sh -os.Getenv("YOUR_VARIABLE_KEY_HERE") -``` - -## How to read env variables of another service - -All services of the same project can reference environment variables from other services. To use an environment variable from one service in another service in the same project, you must prefix the environment variable key with the service hostname and underscore. - -#### Examples: - -To access the `connectionString` env variable of the `mariadb1` service, use `mariadb1_connectionString` as the env variable key. -To access the `password` env variable of the `mariadb2` service, use `mariadb2_password` as the env variable key. - -## How to read runtime env variables in the build environment - -You can use runtime env variables in the build environment using the `RUNTIME_` prefix. For example if you have a runtime variable with the `connectionString` key, use the `RUNTIME_connectionString` to read the variable in the build environment. This rule applies both for basic and secret runtime variables. - -## Basic and secret env variable with the same key - -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.yaml 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. + \ No newline at end of file diff --git a/apps/docs/content/nodejs/how-to/env-variables.mdx b/apps/docs/content/nodejs/how-to/env-variables.mdx index 093c98d1..f55913b2 100644 --- a/apps/docs/content/nodejs/how-to/env-variables.mdx +++ b/apps/docs/content/nodejs/how-to/env-variables.mdx @@ -3,195 +3,12 @@ title: How to set and use environment variables in Node.js service description: Learn how you can setup and use environment variables in a nodejs service on Zerops. --- -Environment variables help you run your application in different environments. They allow you to isolate all specific environment aspects from your application code and keep your app encapsulated. You can create several projects in Zerops that represent different environments (development, stage, production) or even each developer can have a project with its own environment. +import { SetVar } from '/src/components/content/var'; +import EnvVariablesContent from '/src/components/content/env-variables.mdx'; -In Zerops you do not have to create a `.env` file manually. Zerops handles the environment variables for you. + + + + -## Types of env variables in Zerops - -There are 3 different sets of env variables in Zerops: - - - - - - - - - - - - - - - - - - - - - - - - - - -
TypeEnvironmentDefined in
basicbuildzerops.yaml
basicruntimezerops.yaml
secretruntimeZerops GUI
- -Use the [secret env variables](/nodejs/how-to/create#set-secret-environment-variables) for all sensitive data you don't want to store in your application code. Secret env variables are also useful if you need for testing where you need to change the value of some env variables frequently. Secret variables are managed in Zerops GUI and you don't have to redeploy your application. - -The basic build and runtime env variables are listed in your [zerops.yaml](/zerops-yaml/specification) and deployed together with your application code. When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your zerops.yaml and redeploy your application to Zerops. - -You can [reference](/nodejs/how-to/env-variables#reference-a-local-variable-in-another-variable-value) another variable of the same service or even a variable of [another service](/nodejs/how-to/env-variables#reference-a-variable-of-another-project-service) within the same project. - -## Set secret env variables 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.yaml. - -

- image -

- -You can set env variables when you [create](/nodejs/how-to/create) a new Node.js service or you can set them later. - -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. - -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 to environment variables will be automatically applied to all containers of your project's services. - -:::caution -You need to **restart** the runtime service after you update environment 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. -::: - -## Set basic build env variables in zerops.yaml - -To set basic env variables for the build environment, add the `envVariables` attribute to the build section in your `zerops.yaml` - -```yaml -zerops: - # define hostname of your service - - setup: app - # ==== how to build your application ==== - build: - … - - # OPTIONAL. Defines the env variables for the build environment: - envVariables: - NODE_ENV: production - DB_NAME: db - DB_HOST: db - DB_USER: db - DB_PASS: ${db_password} -``` - -When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your `zerops.yaml` and redeploy your application to Zerops. - -## Set basic runtime env variables in zerops.yaml - -To set basic env variables for the runtime environment, add the `envVariables` attribute to the runtime section in your `zerops.yaml`. - -```yaml -zerops: - # define hostname of your service - - setup: app - # ==== how to build your application ==== - run: - … - - # OPTIONAL. Defines the env variables for the runtime environment: - envVariables: - NODE_ENV: production - DB_NAME: db - DB_HOST: db - DB_USER: db - DB_PASS: ${db_password} -``` - -When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your `zerops.yaml` and redeploy your application to Zerops. - -## Env variable restrictions - -**key** - -- must satisfy the following regular expression: `[a-zA-Z_]+[a-zA-Z0-9_]*` -- all variable keys in the same service must be unique regardless of case -- keys are case sensitive - -**value** - -- must contain only ASCII characters -- the _End of Line_ character is forbidden - -These restrictions apply to all [types of env variables](/nodejs/how-to/env-variables#types-of-env-variables-in-zerops). - -## Referencing other env variables - -You can reference another variable of the same service using `${key}` in your variable value. You can even reference a variable from a different service using `${hostname_key}`. The referenced variable doesn't need to exist when you are entering your variable. - -### Reference a local variable in another variable value - -| Variable key | Variable value | Computed variable value | -| ------------ | ------------------- | ----------------------- | -| id | 12345 | 12345 | -| hostname | app | app | -| name | `${id}-${hostname}` | 12345-app | - -### Reference a variable of another project service - -Let's say your project contains two PostgreSQL services `dbtest` and `dbprod`. Both services have a `connectionString` variable. Then you can create a `dbConnectionString` env variable in your Node.js runtime and set `${dbtest_connectionString}` as the variable value. Zerops will fill in the value of the `connectionString` variable of the `dbtest` service. - -When you change the `dbConnectionString` value to `${dbprod_connectionString}`, Zerops will fill in the value of the `connectionString` variable of the `dbprod` service. - -:::caution -When you change the value of the `connectionString` variable in the service `dbtest` you need to **restart** the Node.js service. 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. -::: - -## Generated env variables - -Zerops creates several helper variables when a Node.js service is created, e.g. `hostname`, `PATH`. Some helper variables are read-only (`hostname`), others are editable (`PATH`). Generated variables cannot be deleted. - -Generated env variables are listed on the **Environment variables** page. Scroll to the **Generated variables** section. - -

- image -

- -## How to read env variables from your Node.js app - -Zerops passes all environment variables from all project services when your Node.js app is deployed and started. - -To access the local environment variable i.e. the variable set to this Node.js service in your app, use: - -```sh -process.env.YOUR_VARIABLE_KEY_HERE -``` - -## How to read env variables of another service - -All services of the same project can reference environment variables from other services. To use an environment variable from one service in another service in the same project, you must prefix the environment variable key with the service hostname and underscore. - -#### Examples: - -To access the `connectionString` env variable of the `mariadb1` service, use `mariadb1_connectionString` as the env variable key. -To access the `password` env variable of the `mariadb2` service, use `mariadb2_password` as the env variable key. - -## How to read runtime env variables in the build environment - -You can use runtime env variables in the build environment using the `RUNTIME_` prefix. For example if you have a runtime variable with the `connectionString` key, use the `RUNTIME_connectionString` to read the variable in the build environment. This rule applies both for basic and secret runtime variables. - -## Basic and secret env variable with the same key - -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.yaml 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. + \ No newline at end of file diff --git a/apps/docs/content/php/how-to/env-variables.mdx b/apps/docs/content/php/how-to/env-variables.mdx index 5b56f308..6bbde836 100644 --- a/apps/docs/content/php/how-to/env-variables.mdx +++ b/apps/docs/content/php/how-to/env-variables.mdx @@ -3,192 +3,12 @@ title: How to set and use environment variables in PHP service description: Learn how you can setup and use environment variables in a php service on Zerops. --- -Environment variables help you run your application in different environments. They allow you to isolate all specific environment aspects from your application code and keep your app encapsulated. You can create several projects in Zerops that represent different environments (development, stage, production) or even each developer can have a project with its own environment. +import { SetVar } from '/src/components/content/var'; +import EnvVariablesContent from '/src/components/content/env-variables.mdx'; -In Zerops you do not have to create a `.env` file manually. Zerops handles the environment variables for you. + + + + -## Types of env variables in Zerops - -There are 3 different sets of env variables in Zerops: - - - - - - - - - - - - - - - - - - - - - - - - - - -
TypeEnvironmentDefined in
basicbuildzerops.yaml
basicruntimezerops.yaml
secretruntimeZerops GUI
- - -Use the [secret env variables](/php/how-to/create#set-secret-environment-variables) for all sensitive data you don't want to store in your application code. Secret env variables are also useful if you need for testing where you need to change the value of some env variables frequently. Secret variables are managed in Zerops GUI and you don't have to redeploy your application. - -The basic build and runtime env variables are listed in your [zerops.yaml](/zerops-yaml/specification) and deployed together with your application code. When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your zerops.yaml and redeploy your application to Zerops. - -You can [reference](/php/how-to/env-variables#reference-a-local-variable-in-another-variable-value) another variable of the same service or even a variable of [another service](/php/how-to/env-variables#reference-a-variable-of-another-project-service) within the same project. - -## Set secret env variables 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.yaml. - -

- image -

- -You can set env variables when you [create](/php/how-to/create) a new PHP service or you can set them later. - -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. - -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 to environment variables will be automatically applied to all containers of your project's services. - -:::caution -You need to **restart** the runtime service after you update environment variables. The PHP process running in the container receives the list env variables only when it starts. Update of the env variables while the PHP process is running does not affect your application. -::: - -## Set basic build env variables in zerops.yaml - -To set basic env variables for the build environment, add the `envVariables` attribute to the build section in your `zerops.yaml` - -```yaml -zerops: - # define hostname of your service - - setup: app - # ==== how to build your application ==== - build: - … - - # OPTIONAL. Defines the env variables for the build environment: - envVariables: - DB_NAME: db - DB_HOST: db - DB_USER: db - DB_PASS: ${db_password} -``` - -When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your `zerops.yaml` and redeploy your application to Zerops. - -## Set basic runtime env variables in zerops.yaml - -To set basic env variables for the runtime environment, add the `envVariables` attribute to the runtime section in your `zerops.yaml`. - -```yaml -zerops: - # define hostname of your service - - setup: app - # ==== how to build your application ==== - run: - … - - # OPTIONAL. Defines the env variables for the runtime environment: - envVariables: - DB_NAME: db - DB_HOST: db - DB_USER: db - DB_PASS: ${db_password} -``` - -When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your `zerops.yaml` and redeploy your application to Zerops. - -## Env variable restrictions - -**key** - -- must satisfy the following regular expression: `[a-zA-Z_]+[a-zA-Z0-9_]*` -- all variable keys in the same service must be unique regardless of case -- keys are case sensitive - -**value** - -- must contain only ASCII characters -- the _End of Line_ character is forbidden - -These restrictions apply to all [types of env variables](/php/how-to/env-variables#types-of-env-variables-in-zerops). - -## Referencing other env variables - -You can reference another variable of the same service using `${key}` in your variable value. You can even reference a variable from a different service using `${hostname_key}`. The referenced variable doesn't need to exist when you are entering your variable. - -### Reference a local variable in another variable value - -| Variable key | Variable value | Computed variable value | -| ------------ | ------------------- | ----------------------- | -| id | 12345 | 12345 | -| hostname | app | app | -| name | `${id}-${hostname}` | 12345-app | - -### Reference a variable of another project service - -Let's say your project contains two PostgreSQL services `dbtest` and `dbprod`. Both services have a `connectionString` variable. Then you can create a `dbConnectionString` env variable in your PHP runtime and set `${dbtest_connectionString}` as the variable value. Zerops will fill in the value of the `connectionString` variable of the `dbtest` service. - -When you change the `dbConnectionString` value to `${dbprod_connectionString}`, Zerops will fill in the value of the `connectionString` variable of the `dbprod` service. - -:::caution -When you change the value of the `connectionString` variable in the service `dbtest` you need to **restart** the PHP service. The PHP process running in the container receives the list env variables only when it starts. Update of the env variables while the PHP process is running does not affect your application. -::: - -## Generated env variables - -Zerops creates several helper variables when a PHP service is created, e.g. `hostname`, `PATH`. Some helper variables are read-only (`hostname`), others are editable (`PATH`). Generated variables cannot be deleted. - -Generated env variables are listed on the **Environment variables** page. Scroll to the **Generated variables** section. - -

- image -

- -## How to read env variables from your PHP app - -To access the local environment variable i.e. the variable set to this PHP service in your app, use: - -```sh -getenv('YOUR_VARIABLE_KEY_HERE'); -``` - -## How to read env variables of another service - -All services of the same project can reference environment variables from other services. To use an environment variable from one service in another service in the same project, you must prefix the environment variable key with the service hostname and underscore. - -#### Examples: - -To access the `connectionString` env variable of the `mariadb1` service, use `mariadb1_connectionString` as the env variable key. -To access the `password` env variable of the `mariadb2` service, use `mariadb2_password` as the env variable key. - -## How to read runtime env variables in the build environment - -You can use runtime env variables in the build environment using the `RUNTIME_` prefix. For example if you have a runtime variable with the `connectionString` key, use the `RUNTIME_connectionString` to read the variable in the build environment. This rule applies both for basic and secret runtime variables. - -## Basic and secret env variable with the same key - -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.yaml 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. + \ No newline at end of file diff --git a/apps/docs/content/python/how-to/env-variables.mdx b/apps/docs/content/python/how-to/env-variables.mdx index 0345b09d..3e6d1bfb 100644 --- a/apps/docs/content/python/how-to/env-variables.mdx +++ b/apps/docs/content/python/how-to/env-variables.mdx @@ -3,194 +3,12 @@ title: How to set and use environment variables in Python service description: Learn how you can setup and use environment variables in a python service on Zerops. --- -Environment variables help you run your application in different environments. They allow you to isolate all specific environment aspects from your application code and keep your app encapsulated. You can create several projects in Zerops that represent different environments (development, stage, production) or even each developer can have a project with its own environment. +import { SetVar } from '/src/components/content/var'; +import EnvVariablesContent from '/src/components/content/env-variables.mdx'; -In Zerops you do not have to create a `.env` file manually. Zerops handles the environment variables for you. + + + + -## Types of env variables in Zerops - -There are 3 different sets of env variables in Zerops: - - - - - - - - - - - - - - - - - - - - - - - - - - -
TypeEnvironmentDefined in
basicbuildzerops.yaml
basicruntimezerops.yaml
secretruntimeZerops GUI
- - -Use the [secret env variables](/python/how-to/create#set-secret-environment-variables) for all sensitive data you don't want to store in your application code. Secret env variables are also useful if you need for testing where you need to change the value of some env variables frequently. Secret variables are managed in Zerops GUI and you don't have to redeploy your application. - -The basic build and runtime env variables are listed in your [zerops.yaml](/zerops-yaml/specification) and deployed together with your application code. When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your zerops.yaml and redeploy your application to Zerops. - -You can [reference](/python/how-to/env-variables#reference-a-local-variable-in-another-variable-value) another variable of the same service or even a variable of [another service](/python/how-to/env-variables#reference-a-variable-of-another-project-service) within the same project. - -## Set secret env variables 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.yaml. - -

- image -

- -You can set env variables when you [create](/python/how-to/create) a new Python service or you can set them later. - -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. - -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 to environment variables will be automatically applied to all containers of your project's services. - -:::caution -You need to **restart** the runtime service after you update environment 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.yaml - -To set basic env variables for the build environment, add the `envVariables` attribute to the build section in your `zerops.yaml` - -```yaml -zerops: - # define hostname of your service - - setup: app - # ==== how to build your application ==== - build: - … - - # OPTIONAL. Defines the env variables for the build environment: - envVariables: - DB_NAME: db - DB_HOST: db - DB_USER: db - DB_PASS: ${db_password} -``` - -When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your `zerops.yaml` and redeploy your application to Zerops. - -## Set basic runtime env variables in zerops.yaml - -To set basic env variables for the runtime environment, add the `envVariables` attribute to the runtime section in your `zerops.yaml`. - -```yaml -zerops: - # define hostname of your service - - setup: app - # ==== how to build your application ==== - run: - … - - # OPTIONAL. Defines the env variables for the runtime environment: - envVariables: - DB_NAME: db - DB_HOST: db - DB_USER: db - DB_PASS: ${db_password} -``` - -When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your `zerops.yaml` and redeploy your application to Zerops. - -## Env variable restrictions - -**key** - -- must satisfy the following regular expression: `[a-zA-Z_]+[a-zA-Z0-9_]*` -- all variable keys in the same service must be unique regardless of case -- keys are case sensitive - -**value** - -- must contain only ASCII characters -- the _End of Line_ character is forbidden - -## Referencing other env variables - -These restrictions apply to all [types of env variables](/python/how-to/env-variables#types-of-env-variables-in-zerops). - -You can reference another variable of the same service using `${key}` in your variable value. You can even reference a variable from a different service using `${hostname_key}`. The referenced variable doesn't need to exist when you are entering your variable. - -### Reference a local variable in another variable value - -| Variable key | Variable value | Computed variable value | -| ------------ | ------------------- | ----------------------- | -| id | 12345 | 12345 | -| hostname | app | app | -| name | `${id}-${hostname}` | 12345-app | - -### Reference a variable of another project service - -Let's say your project contains two PostgreSQL services `dbtest` and `dbprod`. Both services have a `connectionString` variable. Then you can create a `dbConnectionString` env variable in your Python runtime and set `${dbtest_connectionString}` as the variable value. Zerops will fill in the value of the `connectionString` variable of the `dbtest` service. - -When you change the `dbConnectionString` value to `${dbprod_connectionString}`, Zerops will fill in the value of the `connectionString` variable of the `dbprod` service. - -:::caution -When you change the value of the `connectionString` variable in the service `dbtest` you need to **restart** the Python service. 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. -::: - -## Generated env variables - -Zerops creates several helper variables when a Python service is created, e.g. `hostname`, `PATH`. Some helper variables are read-only (`hostname`), others are editable (`PATH`). Generated variables cannot be deleted. - -Generated env variables are listed on the **Environment variables** page. Scroll to the **Generated variables** section. - -

- image -

- -## How to read env variables from your Python app - -Zerops passes all environment variables from all project services when your Python app is deployed and started. - -To access the local environment variable i.e. the variable set to this Python service in your app, use: - -```sh -os.environ['YOUR_VARIABLE_KEY_HERE'] -``` - -## How to read env variables of another service - -All services of the same project can reference environment variables from other services. To use an environment variable from one service in another service in the same project, you must prefix the environment variable key with the service hostname and underscore. - -#### Examples: - -To access the `connectionString` env variable of the `mariadb1` service, use `mariadb1_connectionString` as the env variable key. -To access the `password` env variable of the `mariadb2` service, use `mariadb2_password` as the env variable key. - -## How to read runtime env variables in the build environment - -You can use runtime env variables in the build environment using the `RUNTIME_` prefix. For example if you have a runtime variable with the `connectionString` key, use the `RUNTIME_connectionString` to read the variable in the build environment. This rule applies both for basic and secret runtime variables. - -## Basic and secret env variable with the same key - -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.yaml 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. + \ No newline at end of file diff --git a/apps/docs/content/rust/how-to/env-variables.mdx b/apps/docs/content/rust/how-to/env-variables.mdx index 15392851..92f8c86a 100644 --- a/apps/docs/content/rust/how-to/env-variables.mdx +++ b/apps/docs/content/rust/how-to/env-variables.mdx @@ -3,193 +3,12 @@ title: How to set and use environment variables in Rust service description: Learn how you can setup and use environment variables in a rust service on Zerops. --- -Environment variables help you run your application in different environments. They allow you to isolate all specific environment aspects from your application code and keep your app encapsulated. You can create several projects in Zerops that represent different environments (development, stage, production) or even each developer can have a project with its own environment. +import { SetVar } from '/src/components/content/var'; +import EnvVariablesContent from '/src/components/content/env-variables.mdx'; -In Zerops you do not have to create a `.env` file manually. Zerops handles the environment variables for you. + + + + -## Types of env variables in Zerops - -There are 3 different sets of env variables in Zerops: - - - - - - - - - - - - - - - - - - - - - - - - - - -
TypeEnvironmentDefined in
basicbuildzerops.yaml
basicruntimezerops.yaml
secretruntimeZerops GUI
- -Use the [secret env variables](/rust/how-to/create#set-secret-environment-variables) for all sensitive data you don't want to store in your application code. Secret env variables are also useful if you need for testing where you need to change the value of some env variables frequently. Secret variables are managed in Zerops GUI and you don't have to redeploy your application. - -The basic build and runtime env variables are listed in your [zerops.yaml](/zerops-yaml/specification) and deployed together with your application code. When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your zerops.yaml and redeploy your application to Zerops. - -You can [reference](/rust/how-to/env-variables#reference-a-local-variable-in-another-variable-value) another variable of the same service or even a variable of [another service](/rust/how-to/env-variables#reference-a-variable-of-another-project-service) within the same project. - -## Set secret env variables 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.yaml. - -

- image -

- -You can set env variables when you [create](/rust/how-to/create) a new Rust service or you can set them later. - -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. - -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 to environment variables will be automatically applied to all containers of your project's services. - -:::caution -You need to **restart** the runtime service after you update environment variables. The Rust process running in the container receives the list env variables only when it starts. Update of the env variables while the Rust process is running does not affect your application. -::: - -## Set basic build env variables in zerops.yaml - -To set basic env variables for the build environment, add the `envVariables` attribute to the build section in your `zerops.yaml` - -```yaml -zerops: - # define hostname of your service - - setup: app - # ==== how to build your application ==== - build: - … - - # OPTIONAL. Defines the env variables for the build environment: - envVariables: - DB_NAME: db - DB_HOST: db - DB_USER: db - DB_PASS: ${db_password} -``` - -When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your `zerops.yaml` and redeploy your application to Zerops. - -## Set basic runtime env variables in zerops.yaml - -To set basic env variables for the runtime environment, add the `envVariables` attribute to the runtime section in your `zerops.yaml`. - -```yaml -zerops: - # define hostname of your service - - setup: app - # ==== how to build your application ==== - run: - … - - # OPTIONAL. Defines the env variables for the runtime environment: - envVariables: - DB_NAME: db - DB_HOST: db - DB_USER: db - DB_PASS: ${db_password} -``` - -When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your `zerops.yaml` and redeploy your application to Zerops. - -## Env variable restrictions - -**key** - -- must satisfy the following regular expression: `[a-zA-Z_]+[a-zA-Z0-9_]*` -- all variable keys in the same service must be unique regardless of case -- keys are case sensitive - -**value** - -- must contain only ASCII characters -- the _End of Line_ character is forbidden - -These restrictions apply to all [types of env variables](/rust/how-to/env-variables#types-of-env-variables-in-zerops). - -## Referencing other env variables - -You can reference another variable of the same service using `${key}` in your variable value. You can even reference a variable from a different service using `${hostname_key}`. The referenced variable doesn't need to exist when you are entering your variable. - -### Reference a local variable in another variable value - -| Variable key | Variable value | Computed variable value | -| ------------ | ------------------- | ----------------------- | -| id | 12345 | 12345 | -| hostname | app | app | -| name | `${id}-${hostname}` | 12345-app | - -### Reference a variable of another project service - -Let's say your project contains two PostgreSQL services `dbtest` and `dbprod`. Both services have a `connectionString` variable. Then you can create a `dbConnectionString` env variable in your Rust runtime and set `${dbtest_connectionString}` as the variable value. Zerops will fill in the value of the `connectionString` variable of the `dbtest` service. - -When you change the `dbConnectionString` value to `${dbprod_connectionString}`, Zerops will fill in the value of the `connectionString` variable of the `dbprod` service. - -:::caution -When you change the value of the `connectionString` variable in the service `dbtest` you need to **restart** the Rust service. The Rust process running in the container receives the list env variables only when it starts. Update of the env variables while the Rust process is running does not affect your application. -::: - -## Generated env variables - -Zerops creates several helper variables when a Rust service is created, e.g. `hostname`, `PATH`. Some helper variables are read-only (`hostname`), others are editable (`PATH`). Generated variables cannot be deleted. - -Generated env variables are listed on the **Environment variables** page. Scroll to the **Generated variables** section. - -

- image -

- -## How to read env variables from your Rust app - -Zerops passes all environment variables from all project services when your Rust app is deployed and started. - -To access the local environment variable i.e. the variable set to this Rust service in your app, use: - -```sh -env::var("YOUR_VARIABLE_KEY_HERE") -``` - -## How to read env variables of another service - -All services of the same project can reference environment variables from other services. To use an environment variable from one service in another service in the same project, you must prefix the environment variable key with the service hostname and underscore. - -#### Examples: - -To access the `connectionString` env variable of the `mariadb1` service, use `mariadb1_connectionString` as the env variable key. -To access the `password` env variable of the `mariadb2` service, use `mariadb2_password` as the env variable key. - -## How to read runtime env variables in the build environment - -You can use runtime env variables in the build environment using the `RUNTIME_` prefix. For example if you have a runtime variable with the `connectionString` key, use the `RUNTIME_connectionString` to read the variable in the build environment. This rule applies both for basic and secret runtime variables. - -## Basic and secret env variable with the same key - -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.yaml 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. + \ No newline at end of file diff --git a/apps/docs/src/components/content/env-variables.mdx b/apps/docs/src/components/content/env-variables.mdx new file mode 100644 index 00000000..aaa6ca94 --- /dev/null +++ b/apps/docs/src/components/content/env-variables.mdx @@ -0,0 +1,210 @@ +import { SetVar, Var, VarLink, VarCodeBlock } from '/src/components/content/var'; + +Environment variables help you run your application in different environments. They allow you to isolate all specific environment aspects from your application code and keep your app encapsulated. You can create several projects in Zerops that represent different environments (development, stage, production) or even each developer can have a project with its own environment. + +In Zerops you do not have to create a `.env` file manually. Zerops handles the environment variables for you. + +## Types of env variables in Zerops + +There are 3 different sets of env variables in Zerops: + + + + + + + + + + + + + + + + + + + + + + + + + + +
TypeEnvironmentDefined in
basicbuildzerops.yaml
basicruntimezerops.yaml
secretruntimeZerops GUI
+ +Use the secret env variables for all sensitive data you don't want to store in your application code. Secret env variables are also useful if you need for testing where you need to change the value of some env variables frequently. Secret variables are managed in Zerops GUI and you don't have to redeploy your application. + +The basic build and runtime env variables are listed in your [zerops.yaml](/zerops-yaml/specification) and deployed together with your application code. When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your zerops.yaml and redeploy your application to Zerops. + +You can reference another variable of the same service or even a variable of another service within the same project. + +## Set secret env variables 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.yaml. + +

+ image +

+ +You can set env variables when you create a new service or you can set them later. + +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. + +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 to environment variables will be automatically applied to all containers of your project's services. + +:::caution +You need to **restart** the runtime service after you update environment variables. The process running in the container receives the list env variables only when it starts. Update of the env variables while the process is running does not affect your application. +::: + +## Set basic build env variables in zerops.yaml + +To set basic env variables for the build environment, add the `envVariables` attribute to the build section in your `zerops.yaml` + +```yaml +zerops: + # define hostname of your service + - setup: app + # ==== how to build your application ==== + build: + … + + # OPTIONAL. Defines the env variables for the build environment: + envVariables: + DB_NAME: db + DB_HOST: db + DB_USER: db + DB_PASS: ${db_password} +``` + +When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your `zerops.yaml` and redeploy your application to Zerops. + +## Set basic runtime env variables in zerops.yaml + +To set basic env variables for the runtime environment, add the `envVariables` attribute to the runtime section in your `zerops.yaml`. + +```yaml +zerops: + # define hostname of your service + - setup: app + # ==== how to build your application ==== + run: + … + + # OPTIONAL. Defines the env variables for the runtime environment: + envVariables: + DB_NAME: db + DB_HOST: db + DB_USER: db + DB_PASS: ${db_password} +``` + +When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your `zerops.yaml` and redeploy your application to Zerops. + +## Env variable restrictions + +**key** + +- must satisfy the following regular expression: `[a-zA-Z_]+[a-zA-Z0-9_]*` +- all variable keys in the same service must be unique regardless of case +- keys are case sensitive + +**value** + +- must contain only ASCII characters +- the _End of Line_ character is forbidden + +These restrictions apply to all types of env variables. + +## Referencing other env variables + +You can reference another variable of the same service using `${key}` in your variable value. You can even reference a variable from a different service using `${hostname_key}`. The referenced variable doesn't need to exist when you are entering your variable. + +### Reference a local variable in another variable value + + + + + + + + + + + + + + + + + + + + + + + + + + +
Variable keyVariable valueComputed variable value
id1234512345
hostnameappapp
name`${id}-${hostname}`12345-app
+### Reference a variable of another project service + +Let's say your project contains two PostgreSQL services `dbtest` and `dbprod`. Both services have a `connectionString` variable. Then you can create a `dbConnectionString` env variable in your runtime and set `${dbtest_connectionString}` as the variable value. Zerops will fill in the value of the `connectionString` variable of the `dbtest` service. + +When you change the `dbConnectionString` value to `${dbprod_connectionString}`, Zerops will fill in the value of the `connectionString` variable of the `dbprod` service. + +:::caution +When you change the value of the `connectionString` variable in the service `dbtest` you need to **restart** the service. The process running in the container receives the list env variables only when it starts. Update of the env variables while the process is running does not affect your application. +::: + +## Generated env variables + +Zerops creates several helper variables when a service is created, e.g. `hostname`, `PATH`. Some helper variables are read-only (`hostname`), others are editable (`PATH`). Generated variables cannot be deleted. + +Generated env variables are listed on the **Environment variables** page. Scroll to the **Generated variables** section. + +

+ image +

+ +## How to read env variables from your app + +Zerops passes all environment variables from all project services when your app is deployed and started. + +To access the local environment variable i.e. the variable set to this service in your app, use: + + + +## How to read env variables of another service + +All services of the same project can reference environment variables from other services. To use an environment variable from one service in another service in the same project, you must prefix the environment variable key with the service hostname and underscore. + +#### Examples: + +To access the `connectionString` env variable of the `mariadb1` service, use `mariadb1_connectionString` as the env variable key. +To access the `password` env variable of the `mariadb2` service, use `mariadb2_password` as the env variable key. + +## How to read runtime env variables in the build environment + +You can use runtime env variables in the build environment using the `RUNTIME_` prefix. For example if you have a runtime variable with the `connectionString` key, use the `RUNTIME_connectionString` to read the variable in the build environment. This rule applies both for basic and secret runtime variables. + +## Basic and secret env variable with the same key + +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.yaml 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. diff --git a/apps/docs/src/components/content/var.js b/apps/docs/src/components/content/var.js index 4a1c029b..c996694b 100644 --- a/apps/docs/src/components/content/var.js +++ b/apps/docs/src/components/content/var.js @@ -1,4 +1,5 @@ import React from 'react'; +import CodeBlock from '@theme/CodeBlock'; const variables = {}; @@ -17,4 +18,10 @@ export const VarLink = ({ name, path, children }) => { return {children}; }; +export const VarCodeBlock = ({ codeVar, languageVar }) => { + const code = variables[codeVar] || ''; + const language = variables[languageVar] || 'javascript'; + return {code}; +}; + export default Var; \ No newline at end of file diff --git a/apps/docs/static/llms-full.txt b/apps/docs/static/llms-full.txt index 52687517..3d260b11 100644 --- a/apps/docs/static/llms-full.txt +++ b/apps/docs/static/llms-full.txt @@ -1089,109 +1089,7 @@ When the custom runtime cache is used, Zerops doesn't create a prepare runtime c # Bun > How To > Env Variables -Environment variables help you run your application in different environments. They allow you to isolate all specific environment aspects from your application code and keep your app encapsulated. You can create several projects in Zerops that represent different environments (development, stage, production) or even each developer can have a project with its own environment. -In Zerops you do not have to create a `.env` file manually. Zerops handles the environment variables for you. -## Types of env variables in Zerops -There are 3 different sets of env variables in Zerops: -| environment | type | defined in | -| ----------- | ------ | --------------------------------------------------------------------------------- | -| build | basic | [zerops.yaml](bun/how-to/build-pipeline#envvariables) | -| runtime | basic | [zerops.yaml](bun/how-to/build-pipeline#envvariables-1) | -| runtime | secret | [Zerops GUI](bun/how-to/env-variables#set-secret-env-variables-in-zerops-gui) | -| runtime | secret | [Zerops GUI](bun/how-to/env-variables#set-secret-env-variables-in-zerops-gui) | -Use the [secret env variables](bun/how-to/create#set-secret-environment-variables) for all sensitive data you don't want to store in your application code. Secret env variables are also useful if you need for testing where you need to change the value of some env variables frequently. Secret variables are managed in Zerops GUI and you don't have to redeploy your application. -The basic build and runtime env variables are listed in your [zerops.yaml](/zerops-yaml/specification) and deployed together with your application code. When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your zerops.yaml and redeploy your application to Zerops. -You can [reference](bun/how-to/env-variables#reference-a-local-variable-in-another-variable-value) another variable of the same service or even a variable of [another service](bun/how-to/env-variables#reference-a-variable-of-another-project-service) within the same project. -## Set secret env variables 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.yaml. - -You can set env variables when you [create](bun/how-to/create) a new Bun service or you can set them later. -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. -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 will be automatically applied to all containers of your project's services. -:::caution -You need to **restart** the runtime service after you update environment variables. The Bun process running in the container receives the list env variables only when it starts. Update of the env variables while the Bun process is running does not affect your application. -::: -## Set basic build env variables in zerops.yaml -To set basic env variables for the build environment, add the `envVariables` attribute to the build section in your `zerops.yaml` -```yaml -zerops: - # define hostname of your service - - setup: app - # ==== how to build your application ==== - build: - … - # OPTIONAL. Defines the env variables for the build environment: - envVariables: - NODE_ENV: production - DB_NAME: db - DB_HOST: db - DB_USER: db - DB_PASS: ${db_password} -``` -When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your `zerops.yaml` and redeploy your application to Zerops. -## Set basic runtime env variables in zerops.yaml -To set basic env variables for the runtime environment, add the `envVariables` attribute to the runtime section in your `zerops.yaml`. -```yaml -zerops: - # define hostname of your service - - setup: app - # ==== how to build your application ==== - run: - … - # OPTIONAL. Defines the env variables for the runtime environment: - envVariables: - NODE_ENV: production - DB_NAME: db - DB_HOST: db - DB_USER: db - DB_PASS: ${db_password} -``` -When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your `zerops.yaml` and redeploy your application to Zerops. -## Env variable restrictions -**key** -- must satisfy the following regular expression: `[a-zA-Z_]+[a-zA-Z0-9_]*` -- all variable keys in the same service must be unique regardless of case -- keys are case sensitive -**value** -- must contain only ASCII characters -- the _End of Line_ character is forbidden -These restrictions apply to all [types of env variables](bun/how-to/env-variables#types-of-env-variables-in-zerops). -## Referencing other env variables -You can reference another variable of the same service using `${key}` in your variable value. You can even reference a variable from a different service using `${hostname_key}`. The referenced variable doesn't need to exist when you are entering your variable. -### Reference a local variable in another variable value -| Variable key | Variable value | Computed variable value | -| ------------ | ------------------- | ----------------------- | -| id | 12345 | 12345 | -| hostname | app | app | -| name | `${id}-${hostname}` | 12345-app | -| name | `${id}-${hostname}` | 12345-app | -### Reference a variable of another project service -Let's say your project contains two PostgreSQL services `dbtest` and `dbprod`. Both services have a `connectionString` variable. Then you can create a `dbConnectionString` env variable in your Bun runtime and set `${dbtest_connectionString}` as the variable value. Zerops will fill in the value of the `connectionString` variable of the `dbtest` service. -When you change the `dbConnectionString` value to `${dbprod_connectionString}`, Zerops will fill in the value of the `connectionString` variable of the `dbprod` service. -:::caution -When you change the value of the `connectionString` variable in the service `dbtest` you need to **restart** the Bun service. The Bun process running in the container receives the list env variables only when it starts. Update of the env variables while the Bun process is running does not affect your application. -::: -## Generated env variables -Zerops creates several helper variables when a Bun service is created, e.g. `hostname`, `PATH`. Some helper variables are read-only (`hostname`), others are editable (`PATH`). Generated variables cannot be deleted. -Generated env variables are listed on the **Environment variables** page. Scroll to the **Generated variables** section. - -## How to read env variables from your Bun app -Zerops passes all environment variables from all project services when your Bun app is deployed and started. -To access the local environment variable i.e. the variable set to this Bun service in your app, use: -```sh -process.env.YOUR_VARIABLE_KEY_HERE -``` -## How to read env variables of another service -All services of the same project can reference environment variables from other services. To use an environment variable from one service in another service in the same project, you must prefix the environment variable key with the service hostname and underscore. -#### Examples: -To access the `connectionString` env variable of the `mariadb1` service, use `mariadb1_connectionString` as the env variable key. -To access the `password` env variable of the `mariadb2` service, use `mariadb2_password` as the env variable key. -## How to read runtime env variables in the build environment -You can use runtime env variables in the build environment using the `RUNTIME_` prefix. For example if you have a runtime variable with the `connectionString` key, use the `RUNTIME_connectionString` to read the variable in the build environment. This rule applies both for basic and secret runtime variables. -## Basic and secret env variable with the same key -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.yaml 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. + ---------------------------------------- @@ -2930,109 +2828,7 @@ When the custom runtime cache is used, Zerops doesn't create a prepare runtime c # Deno > How To > Env Variables -Environment variables help you run your application in different environments. They allow you to isolate all specific environment aspects from your application code and keep your app encapsulated. You can create several projects in Zerops that represent different environments (development, stage, production) or even each developer can have a project with its own environment. -In Zerops you do not have to create a `.env` file manually. Zerops handles the environment variables for you. -## Types of env variables in Zerops -There are 3 different sets of env variables in Zerops: -| environment | type | defined in | -| ----------- | ------ | --------------------------------------------------------------------------------- | -| build | basic | [zerops.yaml](/deno/how-to/build-pipeline#envvariables) | -| runtime | basic | [zerops.yaml](/deno/how-to/build-pipeline#envvariables-1) | -| runtime | secret | [Zerops GUI](#set-secret-env-variables-in-zerops-gui) | -| runtime | secret | [Zerops GUI](#set-secret-env-variables-in-zerops-gui) | -Use the [secret env variables](/deno/how-to/create#set-secret-environment-variables) for all sensitive data you don't want to store in your application code. Secret env variables are also useful if you need for testing where you need to change the value of some env variables frequently. Secret variables are managed in Zerops GUI and you don't have to redeploy your application. -The basic build and runtime env variables are listed in your [zerops.yaml](/zerops-yaml/specification) and deployed together with your application code. When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your zerops.yaml and redeploy your application to Zerops. -You can [reference](/deno/how-to/env-variables#reference-a-local-variable-in-another-variable-value) another variable of the same service or even a variable of [another service](/deno/how-to/env-variables#reference-a-variable-of-another-project-service) within the same project. -## Set secret env variables 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.yaml. - -You can set env variables when you [create](/deno/how-to/create) a new Deno service or you can set them later. -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. -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 to environment variables will be automatically applied to all containers of your project's services. -:::caution -You need to **restart** the runtime service after you update environment variables. The Deno process running in the container receives the list env variables only when it starts. Update of the env variables while the Deno process is running does not affect your application. -::: -## Set basic build env variables in zerops.yaml -To set basic env variables for the build environment, add the `envVariables` attribute to the build section in your `zerops.yaml` -```yaml -zerops: - # define hostname of your service - - setup: app - # ==== how to build your application ==== - build: - … - # OPTIONAL. Defines the env variables for the build environment: - envVariables: - NODE_ENV: production - DB_NAME: db - DB_HOST: db - DB_USER: db - DB_PASS: ${db_password} -``` -When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your `zerops.yaml` and redeploy your application to Zerops. -## Set basic runtime env variables in zerops.yaml -To set basic env variables for the runtime environment, add the `envVariables` attribute to the runtime section in your `zerops.yaml`. -```yaml -zerops: - # define hostname of your service - - setup: app - # ==== how to build your application ==== - run: - … - # OPTIONAL. Defines the env variables for the runtime environment: - envVariables: - NODE_ENV: production - DB_NAME: db - DB_HOST: db - DB_USER: db - DB_PASS: ${db_password} -``` -When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your `zerops.yaml` and redeploy your application to Zerops. -## Env variable restrictions -**key** -- must satisfy the following regular expression: `[a-zA-Z_]+[a-zA-Z0-9_]*` -- all variable keys in the same service must be unique regardless of case -- keys are case sensitive -**value** -- must contain only ASCII characters -- the _End of Line_ character is forbidden -These restrictions apply to all [types of env variables](/deno/how-to/env-variables#types-of-env-variables-in-zerops). -## Referencing other env variables -You can reference another variable of the same service using `${key}` in your variable value. You can even reference a variable from a different service using `${hostname_key}`. The referenced variable doesn't need to exist when you are entering your variable. -### Reference a local variable in another variable value -| Variable key | Variable value | Computed variable value | -| ------------ | ------------------- | ----------------------- | -| id | 12345 | 12345 | -| hostname | app | app | -| name | `${id}-${hostname}` | 12345-app | -| name | `${id}-${hostname}` | 12345-app | -### Reference a variable of another project service -Let's say your project contains two PostgreSQL services `dbtest` and `dbprod`. Both services have a `connectionString` variable. Then you can create a `dbConnectionString` env variable in your Deno runtime and set `${dbtest_connectionString}` as the variable value. Zerops will fill in the value of the `connectionString` variable of the `dbtest` service. -When you change the `dbConnectionString` value to `${dbprod_connectionString}`, Zerops will fill in the value of the `connectionString` variable of the `dbprod` service. -:::caution -When you change the value of the `connectionString` variable in the service `dbtest` you need to **restart** the Deno service. The Deno process running in the container receives the list env variables only when it starts. Update of the env variables while the Deno process is running does not affect your application. -::: -## Generated env variables -Zerops creates several helper variables when a Deno service is created, e.g. `hostname`, `PATH`. Some helper variables are read-only (`hostname`), others are editable (`PATH`). Generated variables cannot be deleted. -Generated env variables are listed on the **Environment variables** page. Scroll to the **Generated variables** section. - -## How to read env variables from your Deno app -Zerops passes all environment variables from all project services when your Deno app is deployed and started. -To access the local environment variable i.e. the variable set to this Deno service in your app, use: -```sh -process.env.YOUR_VARIABLE_KEY_HERE -``` -## How to read env variables of another service -All services of the same project can reference environment variables from other services. To use an environment variable from one service in another service in the same project, you must prefix the environment variable key with the service hostname and underscore. -#### Examples: -To access the `connectionString` env variable of the `mariadb1` service, use `mariadb1_connectionString` as the env variable key. -To access the `password` env variable of the `mariadb2` service, use `mariadb2_password` as the env variable key. -## How to read runtime env variables in the build environment -You can use runtime env variables in the build environment using the `RUNTIME_` prefix. For example if you have a runtime variable with the `connectionString` key, use the `RUNTIME_connectionString` to read the variable in the build environment. This rule applies both for basic and secret runtime variables. -## Basic and secret env variable with the same key -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.yaml 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. + ---------------------------------------- @@ -4672,149 +4468,38 @@ When the custom runtime cache is used, Zerops doesn't create a prepare runtime c # Dotnet > How To > Env Variables -Environment variables help you run your application in different environments. They allow you to isolate all specific environment aspects from your application code and keep your app encapsulated. You can create several projects in Zerops that represent different environments (development, stage, production) or even each developer can have a project with its own environment. -In Zerops you do not have to create a `.env` file manually. Zerops handles the environment variables for you. -## Types of env variables in Zerops -There are 3 different sets of env variables in Zerops: + + +---------------------------------------- + +# Dotnet > How To > Filebrowser + +## Zerops GUI +In Zerops GUI, go to the service detail page and choose **Service containers & resources overview** and scroll down to the list of containers. - Type - Environment - Defined in - - basic - build - zerops.yaml - - basic - runtime - zerops.yaml - - secret - runtime - Zerops GUI - -Use the [secret env variables](/dotnet/how-to/create#set-secret-environment-variables) for all sensitive data you don't want to store in your application code. Secret env variables are also useful if you need for testing where you need to change the value of some env variables frequently. Secret variables are managed in Zerops GUI and you don't have to redeploy your application. -The basic build and runtime env variables are listed in your [zerops.yaml](/zerops-yaml/specification) and deployed together with your application code. When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your zerops.yaml and redeploy your application to Zerops. -You can [reference](/dotnet/how-to/env-variables#reference-a-local-variable-in-another-variable-value) another variable of the same service or even a variable of [another service](/dotnet/how-to/env-variables#reference-a-variable-of-another-project-service) within the same project. -## Set secret env variables 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.yaml. +Then click on the file browser icon and the file browser opens: -You can set env variables when you [create](/dotnet/how-to/create) a new .NET service or you can set them later. -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. -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 to environment variables will be automatically applied to all containers of your project's services. -:::caution -You need to **restart** the runtime service after you update environment variables. The .NET process running in the container receives the list env variables only when it starts. Update of the env variables while the .NET process is running does not affect your application. -::: -## Set basic build env variables in zerops.yaml -To set basic env variables for the build environment, add the `envVariables` attribute to the build section in your `zerops.yaml` -```yaml -zerops: - # define hostname of your service - - setup: app - # ==== how to build your application ==== - build: - … - # OPTIONAL. Defines the env variables for the build environment: - envVariables: - DB_NAME: db - DB_HOST: db - DB_USER: db - DB_PASS: ${db_password} -``` -When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your `zerops.yaml` and redeploy your application to Zerops. -## Set basic runtime env variables in zerops.yaml -To set basic env variables for the runtime environment, add the `envVariables` attribute to the runtime section in your `zerops.yaml`. -```yaml -zerops: - # define hostname of your service - - setup: app - # ==== how to build your application ==== - run: - … - # OPTIONAL. Defines the env variables for the runtime environment: - envVariables: - DB_NAME: db - DB_HOST: db - DB_USER: db - DB_PASS: ${db_password} -``` -When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your `zerops.yaml` and redeploy your application to Zerops. -## Env variable restrictions -**key** -- must satisfy the following regular expression: `[a-zA-Z_]+[a-zA-Z0-9_]*` -- all variable keys in the same service must be unique regardless of case -- keys are case sensitive -**value** -- must contain only ASCII characters -- the _End of Line_ character is forbidden -These restrictions apply to all [types of env variables](/dotnet/how-to/env-variables#types-of-env-variables-in-zerops). -## Referencing other env variables -You can reference another variable of the same service using `${key}` in your variable value. You can even reference a variable from a different service using `${hostname_key}`. The referenced variable doesn't need to exist when you are entering your variable. -### Reference a local variable in another variable value -| Variable key | Variable value | Computed variable value | -| ------------ | ------------------- | ----------------------- | -| id | 12345 | 12345 | -| hostname | app | app | -| name | `${id}-${hostname}` | 12345-app | -| name | `${id}-${hostname}` | 12345-app | -### Reference a variable of another project service -Let's say your project contains two PostgreSQL services `dbtest` and `dbprod`. Both services have a `connectionString` variable. Then you can create a `dbConnectionString` env variable in your .NET runtime and set `${dbtest_connectionString}` as the variable value. Zerops will fill in the value of the `connectionString` variable of the `dbtest` service. -When you change the `dbConnectionString` value to `${dbprod_connectionString}`, Zerops will fill in the value of the `connectionString` variable of the `dbprod` service. -:::caution -When you change the value of the `connectionString` variable in the service `dbtest` you need to **restart** the .NET service. The .NET process running in the container receives the list env variables only when it starts. Update of the env variables while the .NET process is running does not affect your application. -::: -## Generated env variables -Zerops creates several helper variables when a .NET service is created, e.g. `hostname`, `PATH`. Some helper variables are read-only (`hostname`), others are editable (`PATH`). Generated variables cannot be deleted. -Generated env variables are listed on the **Environment variables** page. Scroll to the **Generated variables** section. - -## How to read env variables from your .NET app -Zerops passes all environment variables from all project services when your .NET app is deployed and started. -To access the local environment variable i.e. the variable set to this .NET service in your app, use: -```sh -Environment.GetEnvironmentVariable("YOUR_VARIABLE_KEY_HERE"); -``` -## How to read env variables of another service -All services of the same project can reference environment variables from other services. To use an environment variable from one service in another service in the same project, you must prefix the environment variable key with the service hostname and underscore. -#### Examples: -To access the `connectionString` env variable of the `mariadb1` service, use `mariadb1_connectionString` as the env variable key. -To access the `password` env variable of the `mariadb2` service, use `mariadb2_password` as the env variable key. -## How to read runtime env variables in the build environment -You can use runtime env variables in the build environment using the `RUNTIME_` prefix. For example if you have a runtime variable with the `connectionString` key, use the `RUNTIME_connectionString` to read the variable in the build environment. This rule applies both for basic and secret runtime variables. -## Basic and secret env variable with the same key -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.yaml 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. - ----------------------------------------- - -# Dotnet > How To > Filebrowser - -## Zerops GUI -In Zerops GUI, go to the service detail page and choose **Service containers & resources overview** and scroll down to the list of containers. - -Then click on the file browser icon and the file browser opens: - -If your service is in the [HA mode], you can switch between containers in the top left corner. -## zCLI & SSH -You can connect to the container via SSH with the Zerops CLI and browse its files. -How to [connect to your service via SSH](/references/ssh). - ----------------------------------------- - -# Dotnet > How To > Logs - -Zerops provides 3 different logs: -- [build log](#build-log) -- [prepare runtime log](#prepare-runtime-log) -- [runtime log](#runtime-log) -## How to access logs -### Build log -#### Zerops GUI -To access a build log in Zerops GUI, go to the service detail and choose **Service dashboard & runtime containers** in the left menu. Then open the pipeline detail of an application version and click on **Build log**. The build log button is available only if the [build pipeline](/dotnet/how-to/trigger-pipeline) was triggered for the selected deploy. -#### zCLI -To access a build log in Zerops CLI use -```sh -zcli service log --showBuildLogs +If your service is in the [HA mode], you can switch between containers in the top left corner. +## zCLI & SSH +You can connect to the container via SSH with the Zerops CLI and browse its files. +How to [connect to your service via SSH](/references/ssh). + +---------------------------------------- + +# Dotnet > How To > Logs + +Zerops provides 3 different logs: +- [build log](#build-log) +- [prepare runtime log](#prepare-runtime-log) +- [runtime log](#runtime-log) +## How to access logs +### Build log +#### Zerops GUI +To access a build log in Zerops GUI, go to the service detail and choose **Service dashboard & runtime containers** in the left menu. Then open the pipeline detail of an application version and click on **Build log**. The build log button is available only if the [build pipeline](/dotnet/how-to/trigger-pipeline) was triggered for the selected deploy. +#### zCLI +To access a build log in Zerops CLI use +```sh +zcli service log --showBuildLogs ``` Read more about the [zcli service log](/references/cli/access-logs) command. ### Prepare runtime log @@ -6229,109 +5914,7 @@ When the custom runtime cache is used, Zerops doesn't create a prepare runtime c # Elixir > How To > Env Variables -Environment variables help you run your application in different environments. They allow you to isolate all specific environment aspects from your application code and keep your app encapsulated. You can create several projects in Zerops that represent different environments (development, stage, production) or even each developer can have a project with its own environment. -In Zerops you do not have to create a `.env` file manually. Zerops handles the environment variables for you. -## Types of env variables in Zerops -There are 3 different sets of env variables in Zerops: -| environment | type | defined in | -| ----------- | ------ | --------------------------------------------------------------------------------- | -| build | basic | [zerops.yaml](/elixir/how-to/build-pipeline#envvariables) | -| runtime | basic | [zerops.yaml](/elixir/how-to/build-pipeline#envvariables-1) | -| runtime | secret | [Zerops GUI](#set-secret-env-variables-in-zerops-gui) | -| runtime | secret | [Zerops GUI](#set-secret-env-variables-in-zerops-gui) | -Use the [secret env variables](/elixir/how-to/create#set-secret-environment-variables) for all sensitive data you don't want to store in your application code. Secret env variables are also useful if you need for testing where you need to change the value of some env variables frequently. Secret variables are managed in Zerops GUI and you don't have to redeploy your application. -The basic build and runtime env variables are listed in your [zerops.yaml](/zerops-yaml/specification) and deployed together with your application code. When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your zerops.yaml and redeploy your application to Zerops. -You can [reference](/elixir/how-to/env-variables#reference-a-local-variable-in-another-variable-value) another variable of the same service or even a variable of [another service](/elixir/how-to/env-variables#reference-a-variable-of-another-project-service) within the same project. -## Set secret env variables 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.yaml. - -You can set env variables when you [create](/elixir/how-to/create) a new Elixir service or you can set them later. -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. -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 to environment variables will be automatically applied to all containers of your project's services. -:::caution -You need to **restart** the runtime service after you update environment variables. The Elixir process running in the container receives the list env variables only when it starts. Update of the env variables while the Elixir process is running does not affect your application. -::: -## Set basic build env variables in zerops.yaml -To set basic env variables for the build environment, add the `envVariables` attribute to the build section in your `zerops.yaml` -```yaml -zerops: - # define hostname of your service - - setup: app - # ==== how to build your application ==== - build: - … - # OPTIONAL. Defines the env variables for the build environment: - envVariables: - NODE_ENV: production - DB_NAME: db - DB_HOST: db - DB_USER: db - DB_PASS: ${db_password} -``` -When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your `zerops.yaml` and redeploy your application to Zerops. -## Set basic runtime env variables in zerops.yaml -To set basic env variables for the runtime environment, add the `envVariables` attribute to the runtime section in your `zerops.yaml`. -```yaml -zerops: - # define hostname of your service - - setup: app - # ==== how to build your application ==== - run: - … - # OPTIONAL. Defines the env variables for the runtime environment: - envVariables: - NODE_ENV: production - DB_NAME: db - DB_HOST: db - DB_USER: db - DB_PASS: ${db_password} -``` -When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your `zerops.yaml` and redeploy your application to Zerops. -## Env variable restrictions -**key** -- must satisfy the following regular expression: `[a-zA-Z_]+[a-zA-Z0-9_]*` -- all variable keys in the same service must be unique regardless of case -- keys are case sensitive -**value** -- must contain only ASCII characters -- the _End of Line_ character is forbidden -These restrictions apply to all [types of env variables](/elixir/how-to/env-variables#types-of-env-variables-in-zerops). -## Referencing other env variables -You can reference another variable of the same service using `${key}` in your variable value. You can even reference a variable from a different service using `${hostname_key}`. The referenced variable doesn't need to exist when you are entering your variable. -### Reference a local variable in another variable value -| Variable key | Variable value | Computed variable value | -| ------------ | ------------------- | ----------------------- | -| id | 12345 | 12345 | -| hostname | app | app | -| name | `${id}-${hostname}` | 12345-app | -| name | `${id}-${hostname}` | 12345-app | -### Reference a variable of another project service -Let's say your project contains two PostgreSQL services `dbtest` and `dbprod`. Both services have a `connectionString` variable. Then you can create a `dbConnectionString` env variable in your Elixir runtime and set `${dbtest_connectionString}` as the variable value. Zerops will fill in the value of the `connectionString` variable of the `dbtest` service. -When you change the `dbConnectionString` value to `${dbprod_connectionString}`, Zerops will fill in the value of the `connectionString` variable of the `dbprod` service. -:::caution -When you change the value of the `connectionString` variable in the service `dbtest` you need to **restart** the Elixir service. The Elixir process running in the container receives the list env variables only when it starts. Update of the env variables while the Elixir process is running does not affect your application. -::: -## Generated env variables -Zerops creates several helper variables when a Elixir service is created, e.g. `hostname`, `PATH`. Some helper variables are read-only (`hostname`), others are editable (`PATH`). Generated variables cannot be deleted. -Generated env variables are listed on the **Environment variables** page. Scroll to the **Generated variables** section. - -## How to read env variables from your Elixir app -Zerops passes all environment variables from all project services when your Elixir app is deployed and started. -To access the local environment variable i.e. the variable set to this Elixir service in your app, use: -```sh -process.env.YOUR_VARIABLE_KEY_HERE -``` -## How to read env variables of another service -All services of the same project can reference environment variables from other services. To use an environment variable from one service in another service in the same project, you must prefix the environment variable key with the service hostname and underscore. -#### Examples: -To access the `connectionString` env variable of the `mariadb1` service, use `mariadb1_connectionString` as the env variable key. -To access the `password` env variable of the `mariadb2` service, use `mariadb2_password` as the env variable key. -## How to read runtime env variables in the build environment -You can use runtime env variables in the build environment using the `RUNTIME_` prefix. For example if you have a runtime variable with the `connectionString` key, use the `RUNTIME_connectionString` to read the variable in the build environment. This rule applies both for basic and secret runtime variables. -## Basic and secret env variable with the same key -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.yaml 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. + ---------------------------------------- @@ -11524,109 +11107,7 @@ When the custom runtime cache is used, Zerops doesn't create a prepare runtime c # Gleam > How To > Env Variables -Environment variables help you run your application in different environments. They allow you to isolate all specific environment aspects from your application code and keep your app encapsulated. You can create several projects in Zerops that represent different environments (development, stage, production) or even each developer can have a project with its own environment. -In Zerops you do not have to create a `.env` file manually. Zerops handles the environment variables for you. -## Types of env variables in Zerops -There are 3 different sets of env variables in Zerops: -| environment | type | defined in | -| ----------- | ------ | --------------------------------------------------------------------------------- | -| build | basic | [zerops.yaml](/gleam/how-to/build-pipeline#envvariables) | -| runtime | basic | [zerops.yaml](/gleam/how-to/build-pipeline#envvariables-1) | -| runtime | secret | [Zerops GUI](#set-secret-env-variables-in-zerops-gui) | -| runtime | secret | [Zerops GUI](#set-secret-env-variables-in-zerops-gui) | -Use the [secret env variables](/gleam/how-to/create#set-secret-environment-variables) for all sensitive data you don't want to store in your application code. Secret env variables are also useful if you need for testing where you need to change the value of some env variables frequently. Secret variables are managed in Zerops GUI and you don't have to redeploy your application. -The basic build and runtime env variables are listed in your [zerops.yaml](/zerops-yaml/specification) and deployed together with your application code. When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your zerops.yaml and redeploy your application to Zerops. -You can [reference](/gleam/how-to/env-variables#reference-a-local-variable-in-another-variable-value) another variable of the same service or even a variable of [another service](/gleam/how-to/env-variables#reference-a-variable-of-another-project-service) within the same project. -## Set secret env variables 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.yaml. - -You can set env variables when you [create](/gleam/how-to/create) a new Gleam service or you can set them later. -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. -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 to environment variables will be automatically applied to all containers of your project's services. -:::caution -You need to **restart** the runtime service after you update environment variables. The Gleam process running in the container receives the list env variables only when it starts. Update of the env variables while the Gleam process is running does not affect your application. -::: -## Set basic build env variables in zerops.yaml -To set basic env variables for the build environment, add the `envVariables` attribute to the build section in your `zerops.yaml` -```yaml -zerops: - # define hostname of your service - - setup: app - # ==== how to build your application ==== - build: - … - # OPTIONAL. Defines the env variables for the build environment: - envVariables: - NODE_ENV: production - DB_NAME: db - DB_HOST: db - DB_USER: db - DB_PASS: ${db_password} -``` -When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your `zerops.yaml` and redeploy your application to Zerops. -## Set basic runtime env variables in zerops.yaml -To set basic env variables for the runtime environment, add the `envVariables` attribute to the runtime section in your `zerops.yaml`. -```yaml -zerops: - # define hostname of your service - - setup: app - # ==== how to build your application ==== - run: - … - # OPTIONAL. Defines the env variables for the runtime environment: - envVariables: - NODE_ENV: production - DB_NAME: db - DB_HOST: db - DB_USER: db - DB_PASS: ${db_password} -``` -When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your `zerops.yaml` and redeploy your application to Zerops. -## Env variable restrictions -**key** -- must satisfy the following regular expression: `[a-zA-Z_]+[a-zA-Z0-9_]*` -- all variable keys in the same service must be unique regardless of case -- keys are case sensitive -**value** -- must contain only ASCII characters -- the _End of Line_ character is forbidden -These restrictions apply to all [types of env variables](/gleam/how-to/env-variables#types-of-env-variables-in-zerops). -## Referencing other env variables -You can reference another variable of the same service using `${key}` in your variable value. You can even reference a variable from a different service using `${hostname_key}`. The referenced variable doesn't need to exist when you are entering your variable. -### Reference a local variable in another variable value -| Variable key | Variable value | Computed variable value | -| ------------ | ------------------- | ----------------------- | -| id | 12345 | 12345 | -| hostname | app | app | -| name | `${id}-${hostname}` | 12345-app | -| name | `${id}-${hostname}` | 12345-app | -### Reference a variable of another project service -Let's say your project contains two PostgreSQL services `dbtest` and `dbprod`. Both services have a `connectionString` variable. Then you can create a `dbConnectionString` env variable in your Gleam runtime and set `${dbtest_connectionString}` as the variable value. Zerops will fill in the value of the `connectionString` variable of the `dbtest` service. -When you change the `dbConnectionString` value to `${dbprod_connectionString}`, Zerops will fill in the value of the `connectionString` variable of the `dbprod` service. -:::caution -When you change the value of the `connectionString` variable in the service `dbtest` you need to **restart** the Gleam service. The Gleam process running in the container receives the list env variables only when it starts. Update of the env variables while the Gleam process is running does not affect your application. -::: -## Generated env variables -Zerops creates several helper variables when a Gleam service is created, e.g. `hostname`, `PATH`. Some helper variables are read-only (`hostname`), others are editable (`PATH`). Generated variables cannot be deleted. -Generated env variables are listed on the **Environment variables** page. Scroll to the **Generated variables** section. - -## How to read env variables from your Gleam app -Zerops passes all environment variables from all project services when your Gleam app is deployed and started. -To access the local environment variable i.e. the variable set to this Gleam service in your app, use: -```sh -process.env.YOUR_VARIABLE_KEY_HERE -``` -## How to read env variables of another service -All services of the same project can reference environment variables from other services. To use an environment variable from one service in another service in the same project, you must prefix the environment variable key with the service hostname and underscore. -#### Examples: -To access the `connectionString` env variable of the `mariadb1` service, use `mariadb1_connectionString` as the env variable key. -To access the `password` env variable of the `mariadb2` service, use `mariadb2_password` as the env variable key. -## How to read runtime env variables in the build environment -You can use runtime env variables in the build environment using the `RUNTIME_` prefix. For example if you have a runtime variable with the `connectionString` key, use the `RUNTIME_connectionString` to read the variable in the build environment. This rule applies both for basic and secret runtime variables. -## Basic and secret env variable with the same key -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.yaml 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. + ---------------------------------------- @@ -13035,118 +12516,7 @@ When the custom runtime cache is used, Zerops doesn't create a prepare runtime c # Go > How To > Env Variables -Environment variables help you run your application in different environments. They allow you to isolate all specific environment aspects from your application code and keep your app encapsulated. You can create several projects in Zerops that represent different environments (development, stage, production) or even each developer can have a project with its own environment. -In Zerops you do not have to create a `.env` file manually. Zerops handles the environment variables for you. -## Types of env variables in Zerops -There are 3 different sets of env variables in Zerops: - - Type - Environment - Defined in - - basic - build - zerops.yaml - - basic - runtime - zerops.yaml - - secret - runtime - Zerops GUI - -Use the [secret env variables](/go/how-to/create#set-secret-environment-variables) for all sensitive data you don't want to store in your application code. Secret env variables are also useful if you need for testing where you need to change the value of some env variables frequently. Secret variables are managed in Zerops GUI and you don't have to redeploy your application. -The basic build and runtime env variables are listed in your [zerops.yaml](/zerops-yaml/specification) and deployed together with your application code. When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your zerops.yaml and redeploy your application to Zerops. -You can [reference](/go/how-to/env-variables#reference-a-local-variable-in-another-variable-value) another variable of the same service or even a variable of [another service](/go/how-to/env-variables#reference-a-variable-of-another-project-service) within the same project. -## Set secret env variables 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.yaml. - -You can set env variables when you [create](/go/how-to/create) a new Go service or you can set them later. -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. -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 to environment variables will be automatically applied to all containers of your project's services. -:::caution -You need to **restart** the runtime service after you update environment variables. The Go process running in the container receives the list env variables only when it starts. Update of the env variables while the Go process is running does not affect your application. -::: -## Set basic build env variables in zerops.yaml -To set basic env variables for the build environment, add the `envVariables` attribute to the build section in your `zerops.yaml` -```yaml -zerops: - # define hostname of your service - - setup: app - # ==== how to build your application ==== - build: - … - # OPTIONAL. Defines the env variables for the build environment: - envVariables: - DB_NAME: db - DB_HOST: db - DB_USER: db - DB_PASS: ${db_password} -``` -When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your `zerops.yaml` and redeploy your application to Zerops. -## Set basic runtime env variables in zerops.yaml -To set basic env variables for the runtime environment, add the `envVariables` attribute to the runtime section in your `zerops.yaml`. -```yaml -zerops: - # define hostname of your service - - setup: app - # ==== how to build your application ==== - run: - … - # OPTIONAL. Defines the env variables for the runtime environment: - envVariables: - DB_NAME: db - DB_HOST: db - DB_USER: db - DB_PASS: ${db_password} -``` -When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your `zerops.yaml` and redeploy your application to Zerops. -## Env variable restrictions -**key** -- must satisfy the following regular expression: `[a-zA-Z_]+[a-zA-Z0-9_]*` -- all variable keys in the same service must be unique regardless of case -- keys are case sensitive -**value** -- must contain only ASCII characters -- the _End of Line_ character is forbidden -These restrictions apply to all [types of env variables](/go/how-to/env-variables#types-of-env-variables-in-zerops). -## Referencing other env variables -You can reference another variable of the same service using `${key}` in your variable value. You can even reference a variable from a different service using `${hostname_key}`. The referenced variable doesn't need to exist when you are entering your variable. -### Reference a local variable in another variable value -| Variable key | Variable value | Computed variable value | -| ------------ | ------------------- | ----------------------- | -| id | 12345 | 12345 | -| hostname | app | app | -| name | `${id}-${hostname}` | 12345-app | -| name | `${id}-${hostname}` | 12345-app | -### Reference a variable of another project service -Let's say your project contains two PostgreSQL services `dbtest` and `dbprod`. Both services have a `connectionString` variable. Then you can create a `dbConnectionString` env variable in your Go runtime and set `${dbtest_connectionString}` as the variable value. Zerops will fill in the value of the `connectionString` variable of the `dbtest` service. -When you change the `dbConnectionString` value to `${dbprod_connectionString}`, Zerops will fill in the value of the `connectionString` variable of the `dbprod` service. -:::caution -When you change the value of the `connectionString` variable in the service `dbtest` you need to **restart** the Go service. The Go process running in the container receives the list env variables only when it starts. Update of the env variables while the Go process is running does not affect your application. -::: -## Generated env variables -Zerops creates several helper variables when a Go service is created, e.g. `hostname`, `PATH`. Some helper variables are read-only (`hostname`), others are editable (`PATH`). Generated variables cannot be deleted. -Generated env variables are listed on the **Environment variables** page. Scroll to the **Generated variables** section. - -## How to read env variables from your Go app -Zerops passes all environment variables from all project services when your Go app is deployed and started. -To access the local environment variable i.e. the variable set to this Go service in your app, use: -```sh -os.Getenv("YOUR_VARIABLE_KEY_HERE") -``` -## How to read env variables of another service -All services of the same project can reference environment variables from other services. To use an environment variable from one service in another service in the same project, you must prefix the environment variable key with the service hostname and underscore. -#### Examples: -To access the `connectionString` env variable of the `mariadb1` service, use `mariadb1_connectionString` as the env variable key. -To access the `password` env variable of the `mariadb2` service, use `mariadb2_password` as the env variable key. -## How to read runtime env variables in the build environment -You can use runtime env variables in the build environment using the `RUNTIME_` prefix. For example if you have a runtime variable with the `connectionString` key, use the `RUNTIME_connectionString` to read the variable in the build environment. This rule applies both for basic and secret runtime variables. -## Basic and secret env variable with the same key -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.yaml 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. + ---------------------------------------- @@ -14795,136 +14165,25 @@ Some packages or tools can take a long time to install. Therefore, Zerops caches 1. Content of the build.addToRunPrepare and run.prepareCommands attributes didn't change from the previous deploy 2. The custom runtime cache wasn't invalidated in the Zerops GUI. To invalidate the Zerops runtime cache go to your service detail in Zerops GUI, choose **Service dashboard & runtime containers** from the left menu and click on the **Open pipeline detail** button. Then click on the **Clear runtime prepare cache** button. -When the custom runtime cache is used, Zerops doesn't create a prepare runtime container and executes the deployment of your application directly. - ----------------------------------------- - -# Java > How To > Delete - - - ----------------------------------------- - -# Java > How To > Deploy Process - - - ----------------------------------------- - -# Java > How To > Env Variables - -Environment variables help you run your application in different environments. They allow you to isolate all specific environment aspects from your application code and keep your app encapsulated. You can create several projects in Zerops that represent different environments (development, stage, production) or even each developer can have a project with its own environment. -In Zerops you do not have to create a `.env` file manually. Zerops handles the environment variables for you. -## Types of env variables in Zerops -There are 3 different sets of env variables in Zerops: - - Type - Environment - Defined in - - basic - build - zerops.yaml - - basic - runtime - zerops.yaml - - secret - runtime - Zerops GUI - -Use the [secret env variables](/java/how-to/create#set-secret-environment-variables) for all sensitive data you don't want to store in your application code. Secret env variables are also useful if you need for testing where you need to change the value of some env variables frequently. Secret variables are managed in Zerops GUI and you don't have to redeploy your application. -The basic build and runtime env variables are listed in your [zerops.yaml](/zerops-yaml/specification) and deployed together with your application code. When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your zerops.yaml and redeploy your application to Zerops. -You can [reference](/java/how-to/env-variables#reference-a-local-variable-in-another-variable-value) another variable of the same service or even a variable of [another service](/java/how-to/env-variables#reference-a-variable-of-another-project-service) within the same project. -## Set secret env variables 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.yaml. - -You can set env variables when you [create](/java/how-to/create) a new Java service or you can set them later. -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. -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 to environment variables will be automatically applied to all containers of your project's services. -:::caution -You need to **restart** the runtime service after you update environment 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.yaml -To set basic env variables for the build environment, add the `envVariables` attribute to the build section in your `zerops.yaml` -```yaml -zerops: - # define hostname of your service - - setup: app - # ==== how to build your application ==== - build: - … - # OPTIONAL. Defines the env variables for the build environment: - envVariables: - DB_NAME: db - DB_HOST: db - DB_USER: db - DB_PASS: ${db_password} -``` -When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your `zerops.yaml` and redeploy your application to Zerops. -## Set basic runtime env variables in zerops.yaml -To set basic env variables for the runtime environment, add the `envVariables` attribute to the runtime section in your `zerops.yaml`. -```yaml -zerops: - # define hostname of your service - - setup: app - # ==== how to build your application ==== - run: - … - # OPTIONAL. Defines the env variables for the runtime environment: - envVariables: - DB_NAME: db - DB_HOST: db - DB_USER: db - DB_PASS: ${db_password} -``` -When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your `zerops.yaml` and redeploy your application to Zerops. -## Env variable restrictions -**key** -- must satisfy the following regular expression: `[a-zA-Z_]+[a-zA-Z0-9_]*` -- all variable keys in the same service must be unique regardless of case -- keys are case sensitive -**value** -- must contain only ASCII characters -- the _End of Line_ character is forbidden -These restrictions apply to all [types of env variables](/java/how-to/env-variables#types-of-env-variables-in-zerops). -## Referencing other env variables -You can reference another variable of the same service using `${key}` in your variable value. You can even reference a variable from a different service using `${hostname_key}`. The referenced variable doesn't need to exist when you are entering your variable. -### Reference a local variable in another variable value -| Variable key | Variable value | Computed variable value | -| ------------ | ------------------- | ----------------------- | -| id | 12345 | 12345 | -| hostname | app | app | -| name | `${id}-${hostname}` | 12345-app | -| name | `${id}-${hostname}` | 12345-app | -### Reference a variable of another project service -Let's say your project contains two PostgreSQL services `dbtest` and `dbprod`. Both services have a `connectionString` variable. Then you can create a `dbConnectionString` env variable in your Java runtime and set `${dbtest_connectionString}` as the variable value. Zerops will fill in the value of the `connectionString` variable of the `dbtest` service. -When you change the `dbConnectionString` value to `${dbprod_connectionString}`, Zerops will fill in the value of the `connectionString` variable of the `dbprod` service. -:::caution -When you change the value of the `connectionString` variable in the service `dbtest` you need to **restart** the Java service. 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. -::: -## Generated env variables -Zerops creates several helper variables when a Java service is created, e.g. `hostname`, `PATH`. Some helper variables are read-only (`hostname`), others are editable (`PATH`). Generated variables cannot be deleted. -Generated env variables are listed on the **Environment variables** page. Scroll to the **Generated variables** section. - -## How to read env variables from your Java app -Zerops passes all environment variables from all project services when your Java app is deployed and started. -To access the local environment variable i.e. the variable set to this Java service in your app, use: -```sh -os.Getenv("YOUR_VARIABLE_KEY_HERE") -``` -## How to read env variables of another service -All services of the same project can reference environment variables from other services. To use an environment variable from one service in another service in the same project, you must prefix the environment variable key with the service hostname and underscore. -#### Examples: -To access the `connectionString` env variable of the `mariadb1` service, use `mariadb1_connectionString` as the env variable key. -To access the `password` env variable of the `mariadb2` service, use `mariadb2_password` as the env variable key. -## How to read runtime env variables in the build environment -You can use runtime env variables in the build environment using the `RUNTIME_` prefix. For example if you have a runtime variable with the `connectionString` key, use the `RUNTIME_connectionString` to read the variable in the build environment. This rule applies both for basic and secret runtime variables. -## Basic and secret env variable with the same key -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.yaml 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. +When the custom runtime cache is used, Zerops doesn't create a prepare runtime container and executes the deployment of your application directly. + +---------------------------------------- + +# Java > How To > Delete + + + +---------------------------------------- + +# Java > How To > Deploy Process + + + +---------------------------------------- + +# Java > How To > Env Variables + + ---------------------------------------- @@ -19383,120 +18642,7 @@ When the custom runtime cache is used, Zerops doesn't create a prepare runtime c # Nodejs > How To > Env Variables -Environment variables help you run your application in different environments. They allow you to isolate all specific environment aspects from your application code and keep your app encapsulated. You can create several projects in Zerops that represent different environments (development, stage, production) or even each developer can have a project with its own environment. -In Zerops you do not have to create a `.env` file manually. Zerops handles the environment variables for you. -## Types of env variables in Zerops -There are 3 different sets of env variables in Zerops: - - Type - Environment - Defined in - - basic - build - zerops.yaml - - basic - runtime - zerops.yaml - - secret - runtime - Zerops GUI - -Use the [secret env variables](/nodejs/how-to/create#set-secret-environment-variables) for all sensitive data you don't want to store in your application code. Secret env variables are also useful if you need for testing where you need to change the value of some env variables frequently. Secret variables are managed in Zerops GUI and you don't have to redeploy your application. -The basic build and runtime env variables are listed in your [zerops.yaml](/zerops-yaml/specification) and deployed together with your application code. When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your zerops.yaml and redeploy your application to Zerops. -You can [reference](/nodejs/how-to/env-variables#reference-a-local-variable-in-another-variable-value) another variable of the same service or even a variable of [another service](/nodejs/how-to/env-variables#reference-a-variable-of-another-project-service) within the same project. -## Set secret env variables 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.yaml. - -You can set env variables when you [create](/nodejs/how-to/create) a new Node.js service or you can set them later. -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. -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 to environment variables will be automatically applied to all containers of your project's services. -:::caution -You need to **restart** the runtime service after you update environment 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. -::: -## Set basic build env variables in zerops.yaml -To set basic env variables for the build environment, add the `envVariables` attribute to the build section in your `zerops.yaml` -```yaml -zerops: - # define hostname of your service - - setup: app - # ==== how to build your application ==== - build: - … - # OPTIONAL. Defines the env variables for the build environment: - envVariables: - NODE_ENV: production - DB_NAME: db - DB_HOST: db - DB_USER: db - DB_PASS: ${db_password} -``` -When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your `zerops.yaml` and redeploy your application to Zerops. -## Set basic runtime env variables in zerops.yaml -To set basic env variables for the runtime environment, add the `envVariables` attribute to the runtime section in your `zerops.yaml`. -```yaml -zerops: - # define hostname of your service - - setup: app - # ==== how to build your application ==== - run: - … - # OPTIONAL. Defines the env variables for the runtime environment: - envVariables: - NODE_ENV: production - DB_NAME: db - DB_HOST: db - DB_USER: db - DB_PASS: ${db_password} -``` -When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your `zerops.yaml` and redeploy your application to Zerops. -## Env variable restrictions -**key** -- must satisfy the following regular expression: `[a-zA-Z_]+[a-zA-Z0-9_]*` -- all variable keys in the same service must be unique regardless of case -- keys are case sensitive -**value** -- must contain only ASCII characters -- the _End of Line_ character is forbidden -These restrictions apply to all [types of env variables](/nodejs/how-to/env-variables#types-of-env-variables-in-zerops). -## Referencing other env variables -You can reference another variable of the same service using `${key}` in your variable value. You can even reference a variable from a different service using `${hostname_key}`. The referenced variable doesn't need to exist when you are entering your variable. -### Reference a local variable in another variable value -| Variable key | Variable value | Computed variable value | -| ------------ | ------------------- | ----------------------- | -| id | 12345 | 12345 | -| hostname | app | app | -| name | `${id}-${hostname}` | 12345-app | -| name | `${id}-${hostname}` | 12345-app | -### Reference a variable of another project service -Let's say your project contains two PostgreSQL services `dbtest` and `dbprod`. Both services have a `connectionString` variable. Then you can create a `dbConnectionString` env variable in your Node.js runtime and set `${dbtest_connectionString}` as the variable value. Zerops will fill in the value of the `connectionString` variable of the `dbtest` service. -When you change the `dbConnectionString` value to `${dbprod_connectionString}`, Zerops will fill in the value of the `connectionString` variable of the `dbprod` service. -:::caution -When you change the value of the `connectionString` variable in the service `dbtest` you need to **restart** the Node.js service. 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. -::: -## Generated env variables -Zerops creates several helper variables when a Node.js service is created, e.g. `hostname`, `PATH`. Some helper variables are read-only (`hostname`), others are editable (`PATH`). Generated variables cannot be deleted. -Generated env variables are listed on the **Environment variables** page. Scroll to the **Generated variables** section. - -## How to read env variables from your Node.js app -Zerops passes all environment variables from all project services when your Node.js app is deployed and started. -To access the local environment variable i.e. the variable set to this Node.js service in your app, use: -```sh -process.env.YOUR_VARIABLE_KEY_HERE -``` -## How to read env variables of another service -All services of the same project can reference environment variables from other services. To use an environment variable from one service in another service in the same project, you must prefix the environment variable key with the service hostname and underscore. -#### Examples: -To access the `connectionString` env variable of the `mariadb1` service, use `mariadb1_connectionString` as the env variable key. -To access the `password` env variable of the `mariadb2` service, use `mariadb2_password` as the env variable key. -## How to read runtime env variables in the build environment -You can use runtime env variables in the build environment using the `RUNTIME_` prefix. For example if you have a runtime variable with the `connectionString` key, use the `RUNTIME_connectionString` to read the variable in the build environment. This rule applies both for basic and secret runtime variables. -## Basic and secret env variable with the same key -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.yaml 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. + ---------------------------------------- @@ -21494,161 +20640,51 @@ Example: - **`{{.Environment.ENV_NAME}}`** is replaced by the [env variable](/php/how-to/env-variables) value. The env variable must be either defined in [run.envVariables]() in `zerops.yaml` or set as a [secret](/php/how-to/env-variables#set-secret-env-variables-in-zerops-gui) or [generated](/php/how-to/env-variables#generated-env-variables) env variable in Zerops GUI. :::caution Use the **.tmpl** file extension to make Zerops interpret the file as a template. Zerops will replace the supported variables listed above. -::: -3. Check that your Apache configuration is consistent with Zerops requirements: -- Do not use IP addresses in the `` directive -- If you use other ports than `:80` in the `` directive, add them to the `run.ports` in your `zerops.yaml` as well. - Do not use the port **:443**. All the incoming `https://` traffic is terminated on the Zerops internal balancer where the SSL certificate is installed and the request is forwarded to your PHP+Apache service as a **http://** on the port **:80**. -4. Add the `siteConfigPath` to the run section of your `zerops.yaml`. -```yaml -zerops: - # define hostname of your service - - setup: app - # ==== how to build your application ==== - build: - # REQUIRED. Set the base technology for the build environment: - base: php-apache@latest - # REQUIRED. Select which files / folders to deploy after - # the build has successfully finished - deployFiles: - - vendor - - public - # ==== how to run your application ==== - run: - documentRoot: public - # OPTIONAL. Sets the custom Nginx or Apache configuration. The file must be deployed in the runtime container. Enter the path to the file relative to the /var/www folder - siteConfigPath: site_config.tmpl -``` -5. Ensure that the `build.deployFiles` contains the folder with the `siteConfigPath` or add the path to the Apache config file to the `deployFiles` list. Zerops will deploy the file to the runtime container(s). -6. [Trigger](/php/how-to/trigger-pipeline) the build & deploy pipeline. - ----------------------------------------- - -# Php > How To > Delete - - - ----------------------------------------- - -# Php > How To > Deploy Process - - - ----------------------------------------- - -# Php > How To > Env Variables - -Environment variables help you run your application in different environments. They allow you to isolate all specific environment aspects from your application code and keep your app encapsulated. You can create several projects in Zerops that represent different environments (development, stage, production) or even each developer can have a project with its own environment. -In Zerops you do not have to create a `.env` file manually. Zerops handles the environment variables for you. -## Types of env variables in Zerops -There are 3 different sets of env variables in Zerops: - - Type - Environment - Defined in - - basic - build - zerops.yaml - - basic - runtime - zerops.yaml - - secret - runtime - Zerops GUI - -Use the [secret env variables](/php/how-to/create#set-secret-environment-variables) for all sensitive data you don't want to store in your application code. Secret env variables are also useful if you need for testing where you need to change the value of some env variables frequently. Secret variables are managed in Zerops GUI and you don't have to redeploy your application. -The basic build and runtime env variables are listed in your [zerops.yaml](/zerops-yaml/specification) and deployed together with your application code. When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your zerops.yaml and redeploy your application to Zerops. -You can [reference](/php/how-to/env-variables#reference-a-local-variable-in-another-variable-value) another variable of the same service or even a variable of [another service](/php/how-to/env-variables#reference-a-variable-of-another-project-service) within the same project. -## Set secret env variables 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.yaml. - -You can set env variables when you [create](/php/how-to/create) a new PHP service or you can set them later. -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. -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 to environment variables will be automatically applied to all containers of your project's services. -:::caution -You need to **restart** the runtime service after you update environment variables. The PHP process running in the container receives the list env variables only when it starts. Update of the env variables while the PHP process is running does not affect your application. -::: -## Set basic build env variables in zerops.yaml -To set basic env variables for the build environment, add the `envVariables` attribute to the build section in your `zerops.yaml` -```yaml -zerops: - # define hostname of your service - - setup: app - # ==== how to build your application ==== - build: - … - # OPTIONAL. Defines the env variables for the build environment: - envVariables: - DB_NAME: db - DB_HOST: db - DB_USER: db - DB_PASS: ${db_password} -``` -When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your `zerops.yaml` and redeploy your application to Zerops. -## Set basic runtime env variables in zerops.yaml -To set basic env variables for the runtime environment, add the `envVariables` attribute to the runtime section in your `zerops.yaml`. -```yaml -zerops: - # define hostname of your service - - setup: app - # ==== how to build your application ==== - run: - … - # OPTIONAL. Defines the env variables for the runtime environment: - envVariables: - DB_NAME: db - DB_HOST: db - DB_USER: db - DB_PASS: ${db_password} -``` -When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your `zerops.yaml` and redeploy your application to Zerops. -## Env variable restrictions -**key** -- must satisfy the following regular expression: `[a-zA-Z_]+[a-zA-Z0-9_]*` -- all variable keys in the same service must be unique regardless of case -- keys are case sensitive -**value** -- must contain only ASCII characters -- the _End of Line_ character is forbidden -These restrictions apply to all [types of env variables](/php/how-to/env-variables#types-of-env-variables-in-zerops). -## Referencing other env variables -You can reference another variable of the same service using `${key}` in your variable value. You can even reference a variable from a different service using `${hostname_key}`. The referenced variable doesn't need to exist when you are entering your variable. -### Reference a local variable in another variable value -| Variable key | Variable value | Computed variable value | -| ------------ | ------------------- | ----------------------- | -| id | 12345 | 12345 | -| hostname | app | app | -| name | `${id}-${hostname}` | 12345-app | -| name | `${id}-${hostname}` | 12345-app | -### Reference a variable of another project service -Let's say your project contains two PostgreSQL services `dbtest` and `dbprod`. Both services have a `connectionString` variable. Then you can create a `dbConnectionString` env variable in your PHP runtime and set `${dbtest_connectionString}` as the variable value. Zerops will fill in the value of the `connectionString` variable of the `dbtest` service. -When you change the `dbConnectionString` value to `${dbprod_connectionString}`, Zerops will fill in the value of the `connectionString` variable of the `dbprod` service. -:::caution -When you change the value of the `connectionString` variable in the service `dbtest` you need to **restart** the PHP service. The PHP process running in the container receives the list env variables only when it starts. Update of the env variables while the PHP process is running does not affect your application. -::: -## Generated env variables -Zerops creates several helper variables when a PHP service is created, e.g. `hostname`, `PATH`. Some helper variables are read-only (`hostname`), others are editable (`PATH`). Generated variables cannot be deleted. -Generated env variables are listed on the **Environment variables** page. Scroll to the **Generated variables** section. - -## How to read env variables from your PHP app -To access the local environment variable i.e. the variable set to this PHP service in your app, use: -```sh -getenv('YOUR_VARIABLE_KEY_HERE'); +::: +3. Check that your Apache configuration is consistent with Zerops requirements: +- Do not use IP addresses in the `` directive +- If you use other ports than `:80` in the `` directive, add them to the `run.ports` in your `zerops.yaml` as well. + Do not use the port **:443**. All the incoming `https://` traffic is terminated on the Zerops internal balancer where the SSL certificate is installed and the request is forwarded to your PHP+Apache service as a **http://** on the port **:80**. +4. Add the `siteConfigPath` to the run section of your `zerops.yaml`. +```yaml +zerops: + # define hostname of your service + - setup: app + # ==== how to build your application ==== + build: + # REQUIRED. Set the base technology for the build environment: + base: php-apache@latest + # REQUIRED. Select which files / folders to deploy after + # the build has successfully finished + deployFiles: + - vendor + - public + # ==== how to run your application ==== + run: + documentRoot: public + # OPTIONAL. Sets the custom Nginx or Apache configuration. The file must be deployed in the runtime container. Enter the path to the file relative to the /var/www folder + siteConfigPath: site_config.tmpl ``` -## How to read env variables of another service -All services of the same project can reference environment variables from other services. To use an environment variable from one service in another service in the same project, you must prefix the environment variable key with the service hostname and underscore. -#### Examples: -To access the `connectionString` env variable of the `mariadb1` service, use `mariadb1_connectionString` as the env variable key. -To access the `password` env variable of the `mariadb2` service, use `mariadb2_password` as the env variable key. -## How to read runtime env variables in the build environment -You can use runtime env variables in the build environment using the `RUNTIME_` prefix. For example if you have a runtime variable with the `connectionString` key, use the `RUNTIME_connectionString` to read the variable in the build environment. This rule applies both for basic and secret runtime variables. -## Basic and secret env variable with the same key -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.yaml 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. +5. Ensure that the `build.deployFiles` contains the folder with the `siteConfigPath` or add the path to the Apache config file to the `deployFiles` list. Zerops will deploy the file to the runtime container(s). +6. [Trigger](/php/how-to/trigger-pipeline) the build & deploy pipeline. + +---------------------------------------- + +# Php > How To > Delete + + + +---------------------------------------- + +# Php > How To > Deploy Process + + + +---------------------------------------- + +# Php > How To > Env Variables + + ---------------------------------------- @@ -23709,118 +22745,7 @@ When the custom runtime cache is used, Zerops doesn't create a prepare runtime c # Python > How To > Env Variables -Environment variables help you run your application in different environments. They allow you to isolate all specific environment aspects from your application code and keep your app encapsulated. You can create several projects in Zerops that represent different environments (development, stage, production) or even each developer can have a project with its own environment. -In Zerops you do not have to create a `.env` file manually. Zerops handles the environment variables for you. -## Types of env variables in Zerops -There are 3 different sets of env variables in Zerops: - - Type - Environment - Defined in - - basic - build - zerops.yaml - - basic - runtime - zerops.yaml - - secret - runtime - Zerops GUI - -Use the [secret env variables](/python/how-to/create#set-secret-environment-variables) for all sensitive data you don't want to store in your application code. Secret env variables are also useful if you need for testing where you need to change the value of some env variables frequently. Secret variables are managed in Zerops GUI and you don't have to redeploy your application. -The basic build and runtime env variables are listed in your [zerops.yaml](/zerops-yaml/specification) and deployed together with your application code. When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your zerops.yaml and redeploy your application to Zerops. -You can [reference](/python/how-to/env-variables#reference-a-local-variable-in-another-variable-value) another variable of the same service or even a variable of [another service](/python/how-to/env-variables#reference-a-variable-of-another-project-service) within the same project. -## Set secret env variables 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.yaml. - -You can set env variables when you [create](/python/how-to/create) a new Python service or you can set them later. -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. -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 to environment variables will be automatically applied to all containers of your project's services. -:::caution -You need to **restart** the runtime service after you update environment 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.yaml -To set basic env variables for the build environment, add the `envVariables` attribute to the build section in your `zerops.yaml` -```yaml -zerops: - # define hostname of your service - - setup: app - # ==== how to build your application ==== - build: - … - # OPTIONAL. Defines the env variables for the build environment: - envVariables: - DB_NAME: db - DB_HOST: db - DB_USER: db - DB_PASS: ${db_password} -``` -When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your `zerops.yaml` and redeploy your application to Zerops. -## Set basic runtime env variables in zerops.yaml -To set basic env variables for the runtime environment, add the `envVariables` attribute to the runtime section in your `zerops.yaml`. -```yaml -zerops: - # define hostname of your service - - setup: app - # ==== how to build your application ==== - run: - … - # OPTIONAL. Defines the env variables for the runtime environment: - envVariables: - DB_NAME: db - DB_HOST: db - DB_USER: db - DB_PASS: ${db_password} -``` -When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your `zerops.yaml` and redeploy your application to Zerops. -## Env variable restrictions -**key** -- must satisfy the following regular expression: `[a-zA-Z_]+[a-zA-Z0-9_]*` -- all variable keys in the same service must be unique regardless of case -- keys are case sensitive -**value** -- must contain only ASCII characters -- the _End of Line_ character is forbidden -## Referencing other env variables -These restrictions apply to all [types of env variables](/python/how-to/env-variables#types-of-env-variables-in-zerops). -You can reference another variable of the same service using `${key}` in your variable value. You can even reference a variable from a different service using `${hostname_key}`. The referenced variable doesn't need to exist when you are entering your variable. -### Reference a local variable in another variable value -| Variable key | Variable value | Computed variable value | -| ------------ | ------------------- | ----------------------- | -| id | 12345 | 12345 | -| hostname | app | app | -| name | `${id}-${hostname}` | 12345-app | -| name | `${id}-${hostname}` | 12345-app | -### Reference a variable of another project service -Let's say your project contains two PostgreSQL services `dbtest` and `dbprod`. Both services have a `connectionString` variable. Then you can create a `dbConnectionString` env variable in your Python runtime and set `${dbtest_connectionString}` as the variable value. Zerops will fill in the value of the `connectionString` variable of the `dbtest` service. -When you change the `dbConnectionString` value to `${dbprod_connectionString}`, Zerops will fill in the value of the `connectionString` variable of the `dbprod` service. -:::caution -When you change the value of the `connectionString` variable in the service `dbtest` you need to **restart** the Python service. 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. -::: -## Generated env variables -Zerops creates several helper variables when a Python service is created, e.g. `hostname`, `PATH`. Some helper variables are read-only (`hostname`), others are editable (`PATH`). Generated variables cannot be deleted. -Generated env variables are listed on the **Environment variables** page. Scroll to the **Generated variables** section. - -## How to read env variables from your Python app -Zerops passes all environment variables from all project services when your Python app is deployed and started. -To access the local environment variable i.e. the variable set to this Python service in your app, use: -```sh -os.environ['YOUR_VARIABLE_KEY_HERE'] -``` -## How to read env variables of another service -All services of the same project can reference environment variables from other services. To use an environment variable from one service in another service in the same project, you must prefix the environment variable key with the service hostname and underscore. -#### Examples: -To access the `connectionString` env variable of the `mariadb1` service, use `mariadb1_connectionString` as the env variable key. -To access the `password` env variable of the `mariadb2` service, use `mariadb2_password` as the env variable key. -## How to read runtime env variables in the build environment -You can use runtime env variables in the build environment using the `RUNTIME_` prefix. For example if you have a runtime variable with the `connectionString` key, use the `RUNTIME_connectionString` to read the variable in the build environment. This rule applies both for basic and secret runtime variables. -## Basic and secret env variable with the same key -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.yaml 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. + ---------------------------------------- @@ -28747,118 +27672,7 @@ When the custom runtime cache is used, Zerops doesn't create a prepare runtime c # Rust > How To > Env Variables -Environment variables help you run your application in different environments. They allow you to isolate all specific environment aspects from your application code and keep your app encapsulated. You can create several projects in Zerops that represent different environments (development, stage, production) or even each developer can have a project with its own environment. -In Zerops you do not have to create a `.env` file manually. Zerops handles the environment variables for you. -## Types of env variables in Zerops -There are 3 different sets of env variables in Zerops: - - Type - Environment - Defined in - - basic - build - zerops.yaml - - basic - runtime - zerops.yaml - - secret - runtime - Zerops GUI - -Use the [secret env variables](/rust/how-to/create#set-secret-environment-variables) for all sensitive data you don't want to store in your application code. Secret env variables are also useful if you need for testing where you need to change the value of some env variables frequently. Secret variables are managed in Zerops GUI and you don't have to redeploy your application. -The basic build and runtime env variables are listed in your [zerops.yaml](/zerops-yaml/specification) and deployed together with your application code. When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your zerops.yaml and redeploy your application to Zerops. -You can [reference](/rust/how-to/env-variables#reference-a-local-variable-in-another-variable-value) another variable of the same service or even a variable of [another service](/rust/how-to/env-variables#reference-a-variable-of-another-project-service) within the same project. -## Set secret env variables 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.yaml. - -You can set env variables when you [create](/rust/how-to/create) a new Rust service or you can set them later. -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. -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 to environment variables will be automatically applied to all containers of your project's services. -:::caution -You need to **restart** the runtime service after you update environment variables. The Rust process running in the container receives the list env variables only when it starts. Update of the env variables while the Rust process is running does not affect your application. -::: -## Set basic build env variables in zerops.yaml -To set basic env variables for the build environment, add the `envVariables` attribute to the build section in your `zerops.yaml` -```yaml -zerops: - # define hostname of your service - - setup: app - # ==== how to build your application ==== - build: - … - # OPTIONAL. Defines the env variables for the build environment: - envVariables: - DB_NAME: db - DB_HOST: db - DB_USER: db - DB_PASS: ${db_password} -``` -When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your `zerops.yaml` and redeploy your application to Zerops. -## Set basic runtime env variables in zerops.yaml -To set basic env variables for the runtime environment, add the `envVariables` attribute to the runtime section in your `zerops.yaml`. -```yaml -zerops: - # define hostname of your service - - setup: app - # ==== how to build your application ==== - run: - … - # OPTIONAL. Defines the env variables for the runtime environment: - envVariables: - DB_NAME: db - DB_HOST: db - DB_USER: db - DB_PASS: ${db_password} -``` -When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your `zerops.yaml` and redeploy your application to Zerops. -## Env variable restrictions -**key** -- must satisfy the following regular expression: `[a-zA-Z_]+[a-zA-Z0-9_]*` -- all variable keys in the same service must be unique regardless of case -- keys are case sensitive -**value** -- must contain only ASCII characters -- the _End of Line_ character is forbidden -These restrictions apply to all [types of env variables](/rust/how-to/env-variables#types-of-env-variables-in-zerops). -## Referencing other env variables -You can reference another variable of the same service using `${key}` in your variable value. You can even reference a variable from a different service using `${hostname_key}`. The referenced variable doesn't need to exist when you are entering your variable. -### Reference a local variable in another variable value -| Variable key | Variable value | Computed variable value | -| ------------ | ------------------- | ----------------------- | -| id | 12345 | 12345 | -| hostname | app | app | -| name | `${id}-${hostname}` | 12345-app | -| name | `${id}-${hostname}` | 12345-app | -### Reference a variable of another project service -Let's say your project contains two PostgreSQL services `dbtest` and `dbprod`. Both services have a `connectionString` variable. Then you can create a `dbConnectionString` env variable in your Rust runtime and set `${dbtest_connectionString}` as the variable value. Zerops will fill in the value of the `connectionString` variable of the `dbtest` service. -When you change the `dbConnectionString` value to `${dbprod_connectionString}`, Zerops will fill in the value of the `connectionString` variable of the `dbprod` service. -:::caution -When you change the value of the `connectionString` variable in the service `dbtest` you need to **restart** the Rust service. The Rust process running in the container receives the list env variables only when it starts. Update of the env variables while the Rust process is running does not affect your application. -::: -## Generated env variables -Zerops creates several helper variables when a Rust service is created, e.g. `hostname`, `PATH`. Some helper variables are read-only (`hostname`), others are editable (`PATH`). Generated variables cannot be deleted. -Generated env variables are listed on the **Environment variables** page. Scroll to the **Generated variables** section. - -## How to read env variables from your Rust app -Zerops passes all environment variables from all project services when your Rust app is deployed and started. -To access the local environment variable i.e. the variable set to this Rust service in your app, use: -```sh -env::var("YOUR_VARIABLE_KEY_HERE") -``` -## How to read env variables of another service -All services of the same project can reference environment variables from other services. To use an environment variable from one service in another service in the same project, you must prefix the environment variable key with the service hostname and underscore. -#### Examples: -To access the `connectionString` env variable of the `mariadb1` service, use `mariadb1_connectionString` as the env variable key. -To access the `password` env variable of the `mariadb2` service, use `mariadb2_password` as the env variable key. -## How to read runtime env variables in the build environment -You can use runtime env variables in the build environment using the `RUNTIME_` prefix. For example if you have a runtime variable with the `connectionString` key, use the `RUNTIME_connectionString` to read the variable in the build environment. This rule applies both for basic and secret runtime variables. -## Basic and secret env variable with the same key -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.yaml 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. + ---------------------------------------- diff --git a/apps/docs/static/llms-small.txt b/apps/docs/static/llms-small.txt index a237958b..6ed4f091 100644 --- a/apps/docs/static/llms-small.txt +++ b/apps/docs/static/llms-small.txt @@ -1089,109 +1089,7 @@ When the custom runtime cache is used, Zerops doesn't create a prepare runtime c # Bun > How To > Env Variables -Environment variables help you run your application in different environments. They allow you to isolate all specific environment aspects from your application code and keep your app encapsulated. You can create several projects in Zerops that represent different environments (development, stage, production) or even each developer can have a project with its own environment. -In Zerops you do not have to create a `.env` file manually. Zerops handles the environment variables for you. -## Types of env variables in Zerops -There are 3 different sets of env variables in Zerops: -| environment | type | defined in | -| ----------- | ------ | --------------------------------------------------------------------------------- | -| build | basic | [zerops.yaml](bun/how-to/build-pipeline#envvariables) | -| runtime | basic | [zerops.yaml](bun/how-to/build-pipeline#envvariables-1) | -| runtime | secret | [Zerops GUI](bun/how-to/env-variables#set-secret-env-variables-in-zerops-gui) | -| runtime | secret | [Zerops GUI](bun/how-to/env-variables#set-secret-env-variables-in-zerops-gui) | -Use the [secret env variables](bun/how-to/create#set-secret-environment-variables) for all sensitive data you don't want to store in your application code. Secret env variables are also useful if you need for testing where you need to change the value of some env variables frequently. Secret variables are managed in Zerops GUI and you don't have to redeploy your application. -The basic build and runtime env variables are listed in your [zerops.yaml](/zerops-yaml/specification) and deployed together with your application code. When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your zerops.yaml and redeploy your application to Zerops. -You can [reference](bun/how-to/env-variables#reference-a-local-variable-in-another-variable-value) another variable of the same service or even a variable of [another service](bun/how-to/env-variables#reference-a-variable-of-another-project-service) within the same project. -## Set secret env variables 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.yaml. - -You can set env variables when you [create](bun/how-to/create) a new Bun service or you can set them later. -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. -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 will be automatically applied to all containers of your project's services. -:::caution -You need to **restart** the runtime service after you update environment variables. The Bun process running in the container receives the list env variables only when it starts. Update of the env variables while the Bun process is running does not affect your application. -::: -## Set basic build env variables in zerops.yaml -To set basic env variables for the build environment, add the `envVariables` attribute to the build section in your `zerops.yaml` -```yaml -zerops: - # define hostname of your service - - setup: app - # ==== how to build your application ==== - build: - … - # OPTIONAL. Defines the env variables for the build environment: - envVariables: - NODE_ENV: production - DB_NAME: db - DB_HOST: db - DB_USER: db - DB_PASS: ${db_password} -``` -When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your `zerops.yaml` and redeploy your application to Zerops. -## Set basic runtime env variables in zerops.yaml -To set basic env variables for the runtime environment, add the `envVariables` attribute to the runtime section in your `zerops.yaml`. -```yaml -zerops: - # define hostname of your service - - setup: app - # ==== how to build your application ==== - run: - … - # OPTIONAL. Defines the env variables for the runtime environment: - envVariables: - NODE_ENV: production - DB_NAME: db - DB_HOST: db - DB_USER: db - DB_PASS: ${db_password} -``` -When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your `zerops.yaml` and redeploy your application to Zerops. -## Env variable restrictions -**key** -- must satisfy the following regular expression: `[a-zA-Z_]+[a-zA-Z0-9_]*` -- all variable keys in the same service must be unique regardless of case -- keys are case sensitive -**value** -- must contain only ASCII characters -- the _End of Line_ character is forbidden -These restrictions apply to all [types of env variables](bun/how-to/env-variables#types-of-env-variables-in-zerops). -## Referencing other env variables -You can reference another variable of the same service using `${key}` in your variable value. You can even reference a variable from a different service using `${hostname_key}`. The referenced variable doesn't need to exist when you are entering your variable. -### Reference a local variable in another variable value -| Variable key | Variable value | Computed variable value | -| ------------ | ------------------- | ----------------------- | -| id | 12345 | 12345 | -| hostname | app | app | -| name | `${id}-${hostname}` | 12345-app | -| name | `${id}-${hostname}` | 12345-app | -### Reference a variable of another project service -Let's say your project contains two PostgreSQL services `dbtest` and `dbprod`. Both services have a `connectionString` variable. Then you can create a `dbConnectionString` env variable in your Bun runtime and set `${dbtest_connectionString}` as the variable value. Zerops will fill in the value of the `connectionString` variable of the `dbtest` service. -When you change the `dbConnectionString` value to `${dbprod_connectionString}`, Zerops will fill in the value of the `connectionString` variable of the `dbprod` service. -:::caution -When you change the value of the `connectionString` variable in the service `dbtest` you need to **restart** the Bun service. The Bun process running in the container receives the list env variables only when it starts. Update of the env variables while the Bun process is running does not affect your application. -::: -## Generated env variables -Zerops creates several helper variables when a Bun service is created, e.g. `hostname`, `PATH`. Some helper variables are read-only (`hostname`), others are editable (`PATH`). Generated variables cannot be deleted. -Generated env variables are listed on the **Environment variables** page. Scroll to the **Generated variables** section. - -## How to read env variables from your Bun app -Zerops passes all environment variables from all project services when your Bun app is deployed and started. -To access the local environment variable i.e. the variable set to this Bun service in your app, use: -```sh -process.env.YOUR_VARIABLE_KEY_HERE -``` -## How to read env variables of another service -All services of the same project can reference environment variables from other services. To use an environment variable from one service in another service in the same project, you must prefix the environment variable key with the service hostname and underscore. -#### Examples: -To access the `connectionString` env variable of the `mariadb1` service, use `mariadb1_connectionString` as the env variable key. -To access the `password` env variable of the `mariadb2` service, use `mariadb2_password` as the env variable key. -## How to read runtime env variables in the build environment -You can use runtime env variables in the build environment using the `RUNTIME_` prefix. For example if you have a runtime variable with the `connectionString` key, use the `RUNTIME_connectionString` to read the variable in the build environment. This rule applies both for basic and secret runtime variables. -## Basic and secret env variable with the same key -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.yaml 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. + ---------------------------------------- @@ -2738,109 +2636,7 @@ When the custom runtime cache is used, Zerops doesn't create a prepare runtime c # Deno > How To > Env Variables -Environment variables help you run your application in different environments. They allow you to isolate all specific environment aspects from your application code and keep your app encapsulated. You can create several projects in Zerops that represent different environments (development, stage, production) or even each developer can have a project with its own environment. -In Zerops you do not have to create a `.env` file manually. Zerops handles the environment variables for you. -## Types of env variables in Zerops -There are 3 different sets of env variables in Zerops: -| environment | type | defined in | -| ----------- | ------ | --------------------------------------------------------------------------------- | -| build | basic | [zerops.yaml](/deno/how-to/build-pipeline#envvariables) | -| runtime | basic | [zerops.yaml](/deno/how-to/build-pipeline#envvariables-1) | -| runtime | secret | [Zerops GUI](#set-secret-env-variables-in-zerops-gui) | -| runtime | secret | [Zerops GUI](#set-secret-env-variables-in-zerops-gui) | -Use the [secret env variables](/deno/how-to/create#set-secret-environment-variables) for all sensitive data you don't want to store in your application code. Secret env variables are also useful if you need for testing where you need to change the value of some env variables frequently. Secret variables are managed in Zerops GUI and you don't have to redeploy your application. -The basic build and runtime env variables are listed in your [zerops.yaml](/zerops-yaml/specification) and deployed together with your application code. When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your zerops.yaml and redeploy your application to Zerops. -You can [reference](/deno/how-to/env-variables#reference-a-local-variable-in-another-variable-value) another variable of the same service or even a variable of [another service](/deno/how-to/env-variables#reference-a-variable-of-another-project-service) within the same project. -## Set secret env variables 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.yaml. - -You can set env variables when you [create](/deno/how-to/create) a new Deno service or you can set them later. -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. -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 to environment variables will be automatically applied to all containers of your project's services. -:::caution -You need to **restart** the runtime service after you update environment variables. The Deno process running in the container receives the list env variables only when it starts. Update of the env variables while the Deno process is running does not affect your application. -::: -## Set basic build env variables in zerops.yaml -To set basic env variables for the build environment, add the `envVariables` attribute to the build section in your `zerops.yaml` -```yaml -zerops: - # define hostname of your service - - setup: app - # ==== how to build your application ==== - build: - … - # OPTIONAL. Defines the env variables for the build environment: - envVariables: - NODE_ENV: production - DB_NAME: db - DB_HOST: db - DB_USER: db - DB_PASS: ${db_password} -``` -When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your `zerops.yaml` and redeploy your application to Zerops. -## Set basic runtime env variables in zerops.yaml -To set basic env variables for the runtime environment, add the `envVariables` attribute to the runtime section in your `zerops.yaml`. -```yaml -zerops: - # define hostname of your service - - setup: app - # ==== how to build your application ==== - run: - … - # OPTIONAL. Defines the env variables for the runtime environment: - envVariables: - NODE_ENV: production - DB_NAME: db - DB_HOST: db - DB_USER: db - DB_PASS: ${db_password} -``` -When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your `zerops.yaml` and redeploy your application to Zerops. -## Env variable restrictions -**key** -- must satisfy the following regular expression: `[a-zA-Z_]+[a-zA-Z0-9_]*` -- all variable keys in the same service must be unique regardless of case -- keys are case sensitive -**value** -- must contain only ASCII characters -- the _End of Line_ character is forbidden -These restrictions apply to all [types of env variables](/deno/how-to/env-variables#types-of-env-variables-in-zerops). -## Referencing other env variables -You can reference another variable of the same service using `${key}` in your variable value. You can even reference a variable from a different service using `${hostname_key}`. The referenced variable doesn't need to exist when you are entering your variable. -### Reference a local variable in another variable value -| Variable key | Variable value | Computed variable value | -| ------------ | ------------------- | ----------------------- | -| id | 12345 | 12345 | -| hostname | app | app | -| name | `${id}-${hostname}` | 12345-app | -| name | `${id}-${hostname}` | 12345-app | -### Reference a variable of another project service -Let's say your project contains two PostgreSQL services `dbtest` and `dbprod`. Both services have a `connectionString` variable. Then you can create a `dbConnectionString` env variable in your Deno runtime and set `${dbtest_connectionString}` as the variable value. Zerops will fill in the value of the `connectionString` variable of the `dbtest` service. -When you change the `dbConnectionString` value to `${dbprod_connectionString}`, Zerops will fill in the value of the `connectionString` variable of the `dbprod` service. -:::caution -When you change the value of the `connectionString` variable in the service `dbtest` you need to **restart** the Deno service. The Deno process running in the container receives the list env variables only when it starts. Update of the env variables while the Deno process is running does not affect your application. -::: -## Generated env variables -Zerops creates several helper variables when a Deno service is created, e.g. `hostname`, `PATH`. Some helper variables are read-only (`hostname`), others are editable (`PATH`). Generated variables cannot be deleted. -Generated env variables are listed on the **Environment variables** page. Scroll to the **Generated variables** section. - -## How to read env variables from your Deno app -Zerops passes all environment variables from all project services when your Deno app is deployed and started. -To access the local environment variable i.e. the variable set to this Deno service in your app, use: -```sh -process.env.YOUR_VARIABLE_KEY_HERE -``` -## How to read env variables of another service -All services of the same project can reference environment variables from other services. To use an environment variable from one service in another service in the same project, you must prefix the environment variable key with the service hostname and underscore. -#### Examples: -To access the `connectionString` env variable of the `mariadb1` service, use `mariadb1_connectionString` as the env variable key. -To access the `password` env variable of the `mariadb2` service, use `mariadb2_password` as the env variable key. -## How to read runtime env variables in the build environment -You can use runtime env variables in the build environment using the `RUNTIME_` prefix. For example if you have a runtime variable with the `connectionString` key, use the `RUNTIME_connectionString` to read the variable in the build environment. This rule applies both for basic and secret runtime variables. -## Basic and secret env variable with the same key -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.yaml 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. + ---------------------------------------- @@ -4480,149 +4276,38 @@ When the custom runtime cache is used, Zerops doesn't create a prepare runtime c # Dotnet > How To > Env Variables -Environment variables help you run your application in different environments. They allow you to isolate all specific environment aspects from your application code and keep your app encapsulated. You can create several projects in Zerops that represent different environments (development, stage, production) or even each developer can have a project with its own environment. -In Zerops you do not have to create a `.env` file manually. Zerops handles the environment variables for you. -## Types of env variables in Zerops -There are 3 different sets of env variables in Zerops: + + +---------------------------------------- + +# Dotnet > How To > Filebrowser + +## Zerops GUI +In Zerops GUI, go to the service detail page and choose **Service containers & resources overview** and scroll down to the list of containers. - Type - Environment - Defined in - - basic - build - zerops.yaml - - basic - runtime - zerops.yaml - - secret - runtime - Zerops GUI - -Use the [secret env variables](/dotnet/how-to/create#set-secret-environment-variables) for all sensitive data you don't want to store in your application code. Secret env variables are also useful if you need for testing where you need to change the value of some env variables frequently. Secret variables are managed in Zerops GUI and you don't have to redeploy your application. -The basic build and runtime env variables are listed in your [zerops.yaml](/zerops-yaml/specification) and deployed together with your application code. When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your zerops.yaml and redeploy your application to Zerops. -You can [reference](/dotnet/how-to/env-variables#reference-a-local-variable-in-another-variable-value) another variable of the same service or even a variable of [another service](/dotnet/how-to/env-variables#reference-a-variable-of-another-project-service) within the same project. -## Set secret env variables 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.yaml. +Then click on the file browser icon and the file browser opens: -You can set env variables when you [create](/dotnet/how-to/create) a new .NET service or you can set them later. -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. -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 to environment variables will be automatically applied to all containers of your project's services. -:::caution -You need to **restart** the runtime service after you update environment variables. The .NET process running in the container receives the list env variables only when it starts. Update of the env variables while the .NET process is running does not affect your application. -::: -## Set basic build env variables in zerops.yaml -To set basic env variables for the build environment, add the `envVariables` attribute to the build section in your `zerops.yaml` -```yaml -zerops: - # define hostname of your service - - setup: app - # ==== how to build your application ==== - build: - … - # OPTIONAL. Defines the env variables for the build environment: - envVariables: - DB_NAME: db - DB_HOST: db - DB_USER: db - DB_PASS: ${db_password} -``` -When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your `zerops.yaml` and redeploy your application to Zerops. -## Set basic runtime env variables in zerops.yaml -To set basic env variables for the runtime environment, add the `envVariables` attribute to the runtime section in your `zerops.yaml`. -```yaml -zerops: - # define hostname of your service - - setup: app - # ==== how to build your application ==== - run: - … - # OPTIONAL. Defines the env variables for the runtime environment: - envVariables: - DB_NAME: db - DB_HOST: db - DB_USER: db - DB_PASS: ${db_password} -``` -When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your `zerops.yaml` and redeploy your application to Zerops. -## Env variable restrictions -**key** -- must satisfy the following regular expression: `[a-zA-Z_]+[a-zA-Z0-9_]*` -- all variable keys in the same service must be unique regardless of case -- keys are case sensitive -**value** -- must contain only ASCII characters -- the _End of Line_ character is forbidden -These restrictions apply to all [types of env variables](/dotnet/how-to/env-variables#types-of-env-variables-in-zerops). -## Referencing other env variables -You can reference another variable of the same service using `${key}` in your variable value. You can even reference a variable from a different service using `${hostname_key}`. The referenced variable doesn't need to exist when you are entering your variable. -### Reference a local variable in another variable value -| Variable key | Variable value | Computed variable value | -| ------------ | ------------------- | ----------------------- | -| id | 12345 | 12345 | -| hostname | app | app | -| name | `${id}-${hostname}` | 12345-app | -| name | `${id}-${hostname}` | 12345-app | -### Reference a variable of another project service -Let's say your project contains two PostgreSQL services `dbtest` and `dbprod`. Both services have a `connectionString` variable. Then you can create a `dbConnectionString` env variable in your .NET runtime and set `${dbtest_connectionString}` as the variable value. Zerops will fill in the value of the `connectionString` variable of the `dbtest` service. -When you change the `dbConnectionString` value to `${dbprod_connectionString}`, Zerops will fill in the value of the `connectionString` variable of the `dbprod` service. -:::caution -When you change the value of the `connectionString` variable in the service `dbtest` you need to **restart** the .NET service. The .NET process running in the container receives the list env variables only when it starts. Update of the env variables while the .NET process is running does not affect your application. -::: -## Generated env variables -Zerops creates several helper variables when a .NET service is created, e.g. `hostname`, `PATH`. Some helper variables are read-only (`hostname`), others are editable (`PATH`). Generated variables cannot be deleted. -Generated env variables are listed on the **Environment variables** page. Scroll to the **Generated variables** section. - -## How to read env variables from your .NET app -Zerops passes all environment variables from all project services when your .NET app is deployed and started. -To access the local environment variable i.e. the variable set to this .NET service in your app, use: -```sh -Environment.GetEnvironmentVariable("YOUR_VARIABLE_KEY_HERE"); -``` -## How to read env variables of another service -All services of the same project can reference environment variables from other services. To use an environment variable from one service in another service in the same project, you must prefix the environment variable key with the service hostname and underscore. -#### Examples: -To access the `connectionString` env variable of the `mariadb1` service, use `mariadb1_connectionString` as the env variable key. -To access the `password` env variable of the `mariadb2` service, use `mariadb2_password` as the env variable key. -## How to read runtime env variables in the build environment -You can use runtime env variables in the build environment using the `RUNTIME_` prefix. For example if you have a runtime variable with the `connectionString` key, use the `RUNTIME_connectionString` to read the variable in the build environment. This rule applies both for basic and secret runtime variables. -## Basic and secret env variable with the same key -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.yaml 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. - ----------------------------------------- - -# Dotnet > How To > Filebrowser - -## Zerops GUI -In Zerops GUI, go to the service detail page and choose **Service containers & resources overview** and scroll down to the list of containers. - -Then click on the file browser icon and the file browser opens: - -If your service is in the [HA mode], you can switch between containers in the top left corner. -## zCLI & SSH -You can connect to the container via SSH with the Zerops CLI and browse its files. -How to [connect to your service via SSH](/references/ssh). - ----------------------------------------- - -# Dotnet > How To > Logs - -Zerops provides 3 different logs: -- [build log](#build-log) -- [prepare runtime log](#prepare-runtime-log) -- [runtime log](#runtime-log) -## How to access logs -### Build log -#### Zerops GUI -To access a build log in Zerops GUI, go to the service detail and choose **Service dashboard & runtime containers** in the left menu. Then open the pipeline detail of an application version and click on **Build log**. The build log button is available only if the [build pipeline](/dotnet/how-to/trigger-pipeline) was triggered for the selected deploy. -#### zCLI -To access a build log in Zerops CLI use -```sh -zcli service log --showBuildLogs +If your service is in the [HA mode], you can switch between containers in the top left corner. +## zCLI & SSH +You can connect to the container via SSH with the Zerops CLI and browse its files. +How to [connect to your service via SSH](/references/ssh). + +---------------------------------------- + +# Dotnet > How To > Logs + +Zerops provides 3 different logs: +- [build log](#build-log) +- [prepare runtime log](#prepare-runtime-log) +- [runtime log](#runtime-log) +## How to access logs +### Build log +#### Zerops GUI +To access a build log in Zerops GUI, go to the service detail and choose **Service dashboard & runtime containers** in the left menu. Then open the pipeline detail of an application version and click on **Build log**. The build log button is available only if the [build pipeline](/dotnet/how-to/trigger-pipeline) was triggered for the selected deploy. +#### zCLI +To access a build log in Zerops CLI use +```sh +zcli service log --showBuildLogs ``` Read more about the [zcli service log](/references/cli/access-logs) command. ### Prepare runtime log @@ -6037,109 +5722,7 @@ When the custom runtime cache is used, Zerops doesn't create a prepare runtime c # Elixir > How To > Env Variables -Environment variables help you run your application in different environments. They allow you to isolate all specific environment aspects from your application code and keep your app encapsulated. You can create several projects in Zerops that represent different environments (development, stage, production) or even each developer can have a project with its own environment. -In Zerops you do not have to create a `.env` file manually. Zerops handles the environment variables for you. -## Types of env variables in Zerops -There are 3 different sets of env variables in Zerops: -| environment | type | defined in | -| ----------- | ------ | --------------------------------------------------------------------------------- | -| build | basic | [zerops.yaml](/elixir/how-to/build-pipeline#envvariables) | -| runtime | basic | [zerops.yaml](/elixir/how-to/build-pipeline#envvariables-1) | -| runtime | secret | [Zerops GUI](#set-secret-env-variables-in-zerops-gui) | -| runtime | secret | [Zerops GUI](#set-secret-env-variables-in-zerops-gui) | -Use the [secret env variables](/elixir/how-to/create#set-secret-environment-variables) for all sensitive data you don't want to store in your application code. Secret env variables are also useful if you need for testing where you need to change the value of some env variables frequently. Secret variables are managed in Zerops GUI and you don't have to redeploy your application. -The basic build and runtime env variables are listed in your [zerops.yaml](/zerops-yaml/specification) and deployed together with your application code. When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your zerops.yaml and redeploy your application to Zerops. -You can [reference](/elixir/how-to/env-variables#reference-a-local-variable-in-another-variable-value) another variable of the same service or even a variable of [another service](/elixir/how-to/env-variables#reference-a-variable-of-another-project-service) within the same project. -## Set secret env variables 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.yaml. - -You can set env variables when you [create](/elixir/how-to/create) a new Elixir service or you can set them later. -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. -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 to environment variables will be automatically applied to all containers of your project's services. -:::caution -You need to **restart** the runtime service after you update environment variables. The Elixir process running in the container receives the list env variables only when it starts. Update of the env variables while the Elixir process is running does not affect your application. -::: -## Set basic build env variables in zerops.yaml -To set basic env variables for the build environment, add the `envVariables` attribute to the build section in your `zerops.yaml` -```yaml -zerops: - # define hostname of your service - - setup: app - # ==== how to build your application ==== - build: - … - # OPTIONAL. Defines the env variables for the build environment: - envVariables: - NODE_ENV: production - DB_NAME: db - DB_HOST: db - DB_USER: db - DB_PASS: ${db_password} -``` -When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your `zerops.yaml` and redeploy your application to Zerops. -## Set basic runtime env variables in zerops.yaml -To set basic env variables for the runtime environment, add the `envVariables` attribute to the runtime section in your `zerops.yaml`. -```yaml -zerops: - # define hostname of your service - - setup: app - # ==== how to build your application ==== - run: - … - # OPTIONAL. Defines the env variables for the runtime environment: - envVariables: - NODE_ENV: production - DB_NAME: db - DB_HOST: db - DB_USER: db - DB_PASS: ${db_password} -``` -When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your `zerops.yaml` and redeploy your application to Zerops. -## Env variable restrictions -**key** -- must satisfy the following regular expression: `[a-zA-Z_]+[a-zA-Z0-9_]*` -- all variable keys in the same service must be unique regardless of case -- keys are case sensitive -**value** -- must contain only ASCII characters -- the _End of Line_ character is forbidden -These restrictions apply to all [types of env variables](/elixir/how-to/env-variables#types-of-env-variables-in-zerops). -## Referencing other env variables -You can reference another variable of the same service using `${key}` in your variable value. You can even reference a variable from a different service using `${hostname_key}`. The referenced variable doesn't need to exist when you are entering your variable. -### Reference a local variable in another variable value -| Variable key | Variable value | Computed variable value | -| ------------ | ------------------- | ----------------------- | -| id | 12345 | 12345 | -| hostname | app | app | -| name | `${id}-${hostname}` | 12345-app | -| name | `${id}-${hostname}` | 12345-app | -### Reference a variable of another project service -Let's say your project contains two PostgreSQL services `dbtest` and `dbprod`. Both services have a `connectionString` variable. Then you can create a `dbConnectionString` env variable in your Elixir runtime and set `${dbtest_connectionString}` as the variable value. Zerops will fill in the value of the `connectionString` variable of the `dbtest` service. -When you change the `dbConnectionString` value to `${dbprod_connectionString}`, Zerops will fill in the value of the `connectionString` variable of the `dbprod` service. -:::caution -When you change the value of the `connectionString` variable in the service `dbtest` you need to **restart** the Elixir service. The Elixir process running in the container receives the list env variables only when it starts. Update of the env variables while the Elixir process is running does not affect your application. -::: -## Generated env variables -Zerops creates several helper variables when a Elixir service is created, e.g. `hostname`, `PATH`. Some helper variables are read-only (`hostname`), others are editable (`PATH`). Generated variables cannot be deleted. -Generated env variables are listed on the **Environment variables** page. Scroll to the **Generated variables** section. - -## How to read env variables from your Elixir app -Zerops passes all environment variables from all project services when your Elixir app is deployed and started. -To access the local environment variable i.e. the variable set to this Elixir service in your app, use: -```sh -process.env.YOUR_VARIABLE_KEY_HERE -``` -## How to read env variables of another service -All services of the same project can reference environment variables from other services. To use an environment variable from one service in another service in the same project, you must prefix the environment variable key with the service hostname and underscore. -#### Examples: -To access the `connectionString` env variable of the `mariadb1` service, use `mariadb1_connectionString` as the env variable key. -To access the `password` env variable of the `mariadb2` service, use `mariadb2_password` as the env variable key. -## How to read runtime env variables in the build environment -You can use runtime env variables in the build environment using the `RUNTIME_` prefix. For example if you have a runtime variable with the `connectionString` key, use the `RUNTIME_connectionString` to read the variable in the build environment. This rule applies both for basic and secret runtime variables. -## Basic and secret env variable with the same key -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.yaml 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. + ---------------------------------------- @@ -11332,109 +10915,7 @@ When the custom runtime cache is used, Zerops doesn't create a prepare runtime c # Gleam > How To > Env Variables -Environment variables help you run your application in different environments. They allow you to isolate all specific environment aspects from your application code and keep your app encapsulated. You can create several projects in Zerops that represent different environments (development, stage, production) or even each developer can have a project with its own environment. -In Zerops you do not have to create a `.env` file manually. Zerops handles the environment variables for you. -## Types of env variables in Zerops -There are 3 different sets of env variables in Zerops: -| environment | type | defined in | -| ----------- | ------ | --------------------------------------------------------------------------------- | -| build | basic | [zerops.yaml](/gleam/how-to/build-pipeline#envvariables) | -| runtime | basic | [zerops.yaml](/gleam/how-to/build-pipeline#envvariables-1) | -| runtime | secret | [Zerops GUI](#set-secret-env-variables-in-zerops-gui) | -| runtime | secret | [Zerops GUI](#set-secret-env-variables-in-zerops-gui) | -Use the [secret env variables](/gleam/how-to/create#set-secret-environment-variables) for all sensitive data you don't want to store in your application code. Secret env variables are also useful if you need for testing where you need to change the value of some env variables frequently. Secret variables are managed in Zerops GUI and you don't have to redeploy your application. -The basic build and runtime env variables are listed in your [zerops.yaml](/zerops-yaml/specification) and deployed together with your application code. When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your zerops.yaml and redeploy your application to Zerops. -You can [reference](/gleam/how-to/env-variables#reference-a-local-variable-in-another-variable-value) another variable of the same service or even a variable of [another service](/gleam/how-to/env-variables#reference-a-variable-of-another-project-service) within the same project. -## Set secret env variables 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.yaml. - -You can set env variables when you [create](/gleam/how-to/create) a new Gleam service or you can set them later. -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. -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 to environment variables will be automatically applied to all containers of your project's services. -:::caution -You need to **restart** the runtime service after you update environment variables. The Gleam process running in the container receives the list env variables only when it starts. Update of the env variables while the Gleam process is running does not affect your application. -::: -## Set basic build env variables in zerops.yaml -To set basic env variables for the build environment, add the `envVariables` attribute to the build section in your `zerops.yaml` -```yaml -zerops: - # define hostname of your service - - setup: app - # ==== how to build your application ==== - build: - … - # OPTIONAL. Defines the env variables for the build environment: - envVariables: - NODE_ENV: production - DB_NAME: db - DB_HOST: db - DB_USER: db - DB_PASS: ${db_password} -``` -When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your `zerops.yaml` and redeploy your application to Zerops. -## Set basic runtime env variables in zerops.yaml -To set basic env variables for the runtime environment, add the `envVariables` attribute to the runtime section in your `zerops.yaml`. -```yaml -zerops: - # define hostname of your service - - setup: app - # ==== how to build your application ==== - run: - … - # OPTIONAL. Defines the env variables for the runtime environment: - envVariables: - NODE_ENV: production - DB_NAME: db - DB_HOST: db - DB_USER: db - DB_PASS: ${db_password} -``` -When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your `zerops.yaml` and redeploy your application to Zerops. -## Env variable restrictions -**key** -- must satisfy the following regular expression: `[a-zA-Z_]+[a-zA-Z0-9_]*` -- all variable keys in the same service must be unique regardless of case -- keys are case sensitive -**value** -- must contain only ASCII characters -- the _End of Line_ character is forbidden -These restrictions apply to all [types of env variables](/gleam/how-to/env-variables#types-of-env-variables-in-zerops). -## Referencing other env variables -You can reference another variable of the same service using `${key}` in your variable value. You can even reference a variable from a different service using `${hostname_key}`. The referenced variable doesn't need to exist when you are entering your variable. -### Reference a local variable in another variable value -| Variable key | Variable value | Computed variable value | -| ------------ | ------------------- | ----------------------- | -| id | 12345 | 12345 | -| hostname | app | app | -| name | `${id}-${hostname}` | 12345-app | -| name | `${id}-${hostname}` | 12345-app | -### Reference a variable of another project service -Let's say your project contains two PostgreSQL services `dbtest` and `dbprod`. Both services have a `connectionString` variable. Then you can create a `dbConnectionString` env variable in your Gleam runtime and set `${dbtest_connectionString}` as the variable value. Zerops will fill in the value of the `connectionString` variable of the `dbtest` service. -When you change the `dbConnectionString` value to `${dbprod_connectionString}`, Zerops will fill in the value of the `connectionString` variable of the `dbprod` service. -:::caution -When you change the value of the `connectionString` variable in the service `dbtest` you need to **restart** the Gleam service. The Gleam process running in the container receives the list env variables only when it starts. Update of the env variables while the Gleam process is running does not affect your application. -::: -## Generated env variables -Zerops creates several helper variables when a Gleam service is created, e.g. `hostname`, `PATH`. Some helper variables are read-only (`hostname`), others are editable (`PATH`). Generated variables cannot be deleted. -Generated env variables are listed on the **Environment variables** page. Scroll to the **Generated variables** section. - -## How to read env variables from your Gleam app -Zerops passes all environment variables from all project services when your Gleam app is deployed and started. -To access the local environment variable i.e. the variable set to this Gleam service in your app, use: -```sh -process.env.YOUR_VARIABLE_KEY_HERE -``` -## How to read env variables of another service -All services of the same project can reference environment variables from other services. To use an environment variable from one service in another service in the same project, you must prefix the environment variable key with the service hostname and underscore. -#### Examples: -To access the `connectionString` env variable of the `mariadb1` service, use `mariadb1_connectionString` as the env variable key. -To access the `password` env variable of the `mariadb2` service, use `mariadb2_password` as the env variable key. -## How to read runtime env variables in the build environment -You can use runtime env variables in the build environment using the `RUNTIME_` prefix. For example if you have a runtime variable with the `connectionString` key, use the `RUNTIME_connectionString` to read the variable in the build environment. This rule applies both for basic and secret runtime variables. -## Basic and secret env variable with the same key -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.yaml 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. + ---------------------------------------- @@ -12843,118 +12324,7 @@ When the custom runtime cache is used, Zerops doesn't create a prepare runtime c # Go > How To > Env Variables -Environment variables help you run your application in different environments. They allow you to isolate all specific environment aspects from your application code and keep your app encapsulated. You can create several projects in Zerops that represent different environments (development, stage, production) or even each developer can have a project with its own environment. -In Zerops you do not have to create a `.env` file manually. Zerops handles the environment variables for you. -## Types of env variables in Zerops -There are 3 different sets of env variables in Zerops: - - Type - Environment - Defined in - - basic - build - zerops.yaml - - basic - runtime - zerops.yaml - - secret - runtime - Zerops GUI - -Use the [secret env variables](/go/how-to/create#set-secret-environment-variables) for all sensitive data you don't want to store in your application code. Secret env variables are also useful if you need for testing where you need to change the value of some env variables frequently. Secret variables are managed in Zerops GUI and you don't have to redeploy your application. -The basic build and runtime env variables are listed in your [zerops.yaml](/zerops-yaml/specification) and deployed together with your application code. When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your zerops.yaml and redeploy your application to Zerops. -You can [reference](/go/how-to/env-variables#reference-a-local-variable-in-another-variable-value) another variable of the same service or even a variable of [another service](/go/how-to/env-variables#reference-a-variable-of-another-project-service) within the same project. -## Set secret env variables 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.yaml. - -You can set env variables when you [create](/go/how-to/create) a new Go service or you can set them later. -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. -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 to environment variables will be automatically applied to all containers of your project's services. -:::caution -You need to **restart** the runtime service after you update environment variables. The Go process running in the container receives the list env variables only when it starts. Update of the env variables while the Go process is running does not affect your application. -::: -## Set basic build env variables in zerops.yaml -To set basic env variables for the build environment, add the `envVariables` attribute to the build section in your `zerops.yaml` -```yaml -zerops: - # define hostname of your service - - setup: app - # ==== how to build your application ==== - build: - … - # OPTIONAL. Defines the env variables for the build environment: - envVariables: - DB_NAME: db - DB_HOST: db - DB_USER: db - DB_PASS: ${db_password} -``` -When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your `zerops.yaml` and redeploy your application to Zerops. -## Set basic runtime env variables in zerops.yaml -To set basic env variables for the runtime environment, add the `envVariables` attribute to the runtime section in your `zerops.yaml`. -```yaml -zerops: - # define hostname of your service - - setup: app - # ==== how to build your application ==== - run: - … - # OPTIONAL. Defines the env variables for the runtime environment: - envVariables: - DB_NAME: db - DB_HOST: db - DB_USER: db - DB_PASS: ${db_password} -``` -When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your `zerops.yaml` and redeploy your application to Zerops. -## Env variable restrictions -**key** -- must satisfy the following regular expression: `[a-zA-Z_]+[a-zA-Z0-9_]*` -- all variable keys in the same service must be unique regardless of case -- keys are case sensitive -**value** -- must contain only ASCII characters -- the _End of Line_ character is forbidden -These restrictions apply to all [types of env variables](/go/how-to/env-variables#types-of-env-variables-in-zerops). -## Referencing other env variables -You can reference another variable of the same service using `${key}` in your variable value. You can even reference a variable from a different service using `${hostname_key}`. The referenced variable doesn't need to exist when you are entering your variable. -### Reference a local variable in another variable value -| Variable key | Variable value | Computed variable value | -| ------------ | ------------------- | ----------------------- | -| id | 12345 | 12345 | -| hostname | app | app | -| name | `${id}-${hostname}` | 12345-app | -| name | `${id}-${hostname}` | 12345-app | -### Reference a variable of another project service -Let's say your project contains two PostgreSQL services `dbtest` and `dbprod`. Both services have a `connectionString` variable. Then you can create a `dbConnectionString` env variable in your Go runtime and set `${dbtest_connectionString}` as the variable value. Zerops will fill in the value of the `connectionString` variable of the `dbtest` service. -When you change the `dbConnectionString` value to `${dbprod_connectionString}`, Zerops will fill in the value of the `connectionString` variable of the `dbprod` service. -:::caution -When you change the value of the `connectionString` variable in the service `dbtest` you need to **restart** the Go service. The Go process running in the container receives the list env variables only when it starts. Update of the env variables while the Go process is running does not affect your application. -::: -## Generated env variables -Zerops creates several helper variables when a Go service is created, e.g. `hostname`, `PATH`. Some helper variables are read-only (`hostname`), others are editable (`PATH`). Generated variables cannot be deleted. -Generated env variables are listed on the **Environment variables** page. Scroll to the **Generated variables** section. - -## How to read env variables from your Go app -Zerops passes all environment variables from all project services when your Go app is deployed and started. -To access the local environment variable i.e. the variable set to this Go service in your app, use: -```sh -os.Getenv("YOUR_VARIABLE_KEY_HERE") -``` -## How to read env variables of another service -All services of the same project can reference environment variables from other services. To use an environment variable from one service in another service in the same project, you must prefix the environment variable key with the service hostname and underscore. -#### Examples: -To access the `connectionString` env variable of the `mariadb1` service, use `mariadb1_connectionString` as the env variable key. -To access the `password` env variable of the `mariadb2` service, use `mariadb2_password` as the env variable key. -## How to read runtime env variables in the build environment -You can use runtime env variables in the build environment using the `RUNTIME_` prefix. For example if you have a runtime variable with the `connectionString` key, use the `RUNTIME_connectionString` to read the variable in the build environment. This rule applies both for basic and secret runtime variables. -## Basic and secret env variable with the same key -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.yaml 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. + ---------------------------------------- @@ -14557,136 +13927,25 @@ Some packages or tools can take a long time to install. Therefore, Zerops caches 1. Content of the build.addToRunPrepare and run.prepareCommands attributes didn't change from the previous deploy 2. The custom runtime cache wasn't invalidated in the Zerops GUI. To invalidate the Zerops runtime cache go to your service detail in Zerops GUI, choose **Service dashboard & runtime containers** from the left menu and click on the **Open pipeline detail** button. Then click on the **Clear runtime prepare cache** button. -When the custom runtime cache is used, Zerops doesn't create a prepare runtime container and executes the deployment of your application directly. - ----------------------------------------- - -# Java > How To > Delete - - - ----------------------------------------- - -# Java > How To > Deploy Process - - - ----------------------------------------- - -# Java > How To > Env Variables - -Environment variables help you run your application in different environments. They allow you to isolate all specific environment aspects from your application code and keep your app encapsulated. You can create several projects in Zerops that represent different environments (development, stage, production) or even each developer can have a project with its own environment. -In Zerops you do not have to create a `.env` file manually. Zerops handles the environment variables for you. -## Types of env variables in Zerops -There are 3 different sets of env variables in Zerops: - - Type - Environment - Defined in - - basic - build - zerops.yaml - - basic - runtime - zerops.yaml - - secret - runtime - Zerops GUI - -Use the [secret env variables](/java/how-to/create#set-secret-environment-variables) for all sensitive data you don't want to store in your application code. Secret env variables are also useful if you need for testing where you need to change the value of some env variables frequently. Secret variables are managed in Zerops GUI and you don't have to redeploy your application. -The basic build and runtime env variables are listed in your [zerops.yaml](/zerops-yaml/specification) and deployed together with your application code. When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your zerops.yaml and redeploy your application to Zerops. -You can [reference](/java/how-to/env-variables#reference-a-local-variable-in-another-variable-value) another variable of the same service or even a variable of [another service](/java/how-to/env-variables#reference-a-variable-of-another-project-service) within the same project. -## Set secret env variables 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.yaml. - -You can set env variables when you [create](/java/how-to/create) a new Java service or you can set them later. -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. -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 to environment variables will be automatically applied to all containers of your project's services. -:::caution -You need to **restart** the runtime service after you update environment 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.yaml -To set basic env variables for the build environment, add the `envVariables` attribute to the build section in your `zerops.yaml` -```yaml -zerops: - # define hostname of your service - - setup: app - # ==== how to build your application ==== - build: - … - # OPTIONAL. Defines the env variables for the build environment: - envVariables: - DB_NAME: db - DB_HOST: db - DB_USER: db - DB_PASS: ${db_password} -``` -When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your `zerops.yaml` and redeploy your application to Zerops. -## Set basic runtime env variables in zerops.yaml -To set basic env variables for the runtime environment, add the `envVariables` attribute to the runtime section in your `zerops.yaml`. -```yaml -zerops: - # define hostname of your service - - setup: app - # ==== how to build your application ==== - run: - … - # OPTIONAL. Defines the env variables for the runtime environment: - envVariables: - DB_NAME: db - DB_HOST: db - DB_USER: db - DB_PASS: ${db_password} -``` -When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your `zerops.yaml` and redeploy your application to Zerops. -## Env variable restrictions -**key** -- must satisfy the following regular expression: `[a-zA-Z_]+[a-zA-Z0-9_]*` -- all variable keys in the same service must be unique regardless of case -- keys are case sensitive -**value** -- must contain only ASCII characters -- the _End of Line_ character is forbidden -These restrictions apply to all [types of env variables](/java/how-to/env-variables#types-of-env-variables-in-zerops). -## Referencing other env variables -You can reference another variable of the same service using `${key}` in your variable value. You can even reference a variable from a different service using `${hostname_key}`. The referenced variable doesn't need to exist when you are entering your variable. -### Reference a local variable in another variable value -| Variable key | Variable value | Computed variable value | -| ------------ | ------------------- | ----------------------- | -| id | 12345 | 12345 | -| hostname | app | app | -| name | `${id}-${hostname}` | 12345-app | -| name | `${id}-${hostname}` | 12345-app | -### Reference a variable of another project service -Let's say your project contains two PostgreSQL services `dbtest` and `dbprod`. Both services have a `connectionString` variable. Then you can create a `dbConnectionString` env variable in your Java runtime and set `${dbtest_connectionString}` as the variable value. Zerops will fill in the value of the `connectionString` variable of the `dbtest` service. -When you change the `dbConnectionString` value to `${dbprod_connectionString}`, Zerops will fill in the value of the `connectionString` variable of the `dbprod` service. -:::caution -When you change the value of the `connectionString` variable in the service `dbtest` you need to **restart** the Java service. 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. -::: -## Generated env variables -Zerops creates several helper variables when a Java service is created, e.g. `hostname`, `PATH`. Some helper variables are read-only (`hostname`), others are editable (`PATH`). Generated variables cannot be deleted. -Generated env variables are listed on the **Environment variables** page. Scroll to the **Generated variables** section. - -## How to read env variables from your Java app -Zerops passes all environment variables from all project services when your Java app is deployed and started. -To access the local environment variable i.e. the variable set to this Java service in your app, use: -```sh -os.Getenv("YOUR_VARIABLE_KEY_HERE") -``` -## How to read env variables of another service -All services of the same project can reference environment variables from other services. To use an environment variable from one service in another service in the same project, you must prefix the environment variable key with the service hostname and underscore. -#### Examples: -To access the `connectionString` env variable of the `mariadb1` service, use `mariadb1_connectionString` as the env variable key. -To access the `password` env variable of the `mariadb2` service, use `mariadb2_password` as the env variable key. -## How to read runtime env variables in the build environment -You can use runtime env variables in the build environment using the `RUNTIME_` prefix. For example if you have a runtime variable with the `connectionString` key, use the `RUNTIME_connectionString` to read the variable in the build environment. This rule applies both for basic and secret runtime variables. -## Basic and secret env variable with the same key -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.yaml 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. +When the custom runtime cache is used, Zerops doesn't create a prepare runtime container and executes the deployment of your application directly. + +---------------------------------------- + +# Java > How To > Delete + + + +---------------------------------------- + +# Java > How To > Deploy Process + + + +---------------------------------------- + +# Java > How To > Env Variables + + ---------------------------------------- @@ -19145,120 +18404,7 @@ When the custom runtime cache is used, Zerops doesn't create a prepare runtime c # Nodejs > How To > Env Variables -Environment variables help you run your application in different environments. They allow you to isolate all specific environment aspects from your application code and keep your app encapsulated. You can create several projects in Zerops that represent different environments (development, stage, production) or even each developer can have a project with its own environment. -In Zerops you do not have to create a `.env` file manually. Zerops handles the environment variables for you. -## Types of env variables in Zerops -There are 3 different sets of env variables in Zerops: - - Type - Environment - Defined in - - basic - build - zerops.yaml - - basic - runtime - zerops.yaml - - secret - runtime - Zerops GUI - -Use the [secret env variables](/nodejs/how-to/create#set-secret-environment-variables) for all sensitive data you don't want to store in your application code. Secret env variables are also useful if you need for testing where you need to change the value of some env variables frequently. Secret variables are managed in Zerops GUI and you don't have to redeploy your application. -The basic build and runtime env variables are listed in your [zerops.yaml](/zerops-yaml/specification) and deployed together with your application code. When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your zerops.yaml and redeploy your application to Zerops. -You can [reference](/nodejs/how-to/env-variables#reference-a-local-variable-in-another-variable-value) another variable of the same service or even a variable of [another service](/nodejs/how-to/env-variables#reference-a-variable-of-another-project-service) within the same project. -## Set secret env variables 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.yaml. - -You can set env variables when you [create](/nodejs/how-to/create) a new Node.js service or you can set them later. -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. -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 to environment variables will be automatically applied to all containers of your project's services. -:::caution -You need to **restart** the runtime service after you update environment 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. -::: -## Set basic build env variables in zerops.yaml -To set basic env variables for the build environment, add the `envVariables` attribute to the build section in your `zerops.yaml` -```yaml -zerops: - # define hostname of your service - - setup: app - # ==== how to build your application ==== - build: - … - # OPTIONAL. Defines the env variables for the build environment: - envVariables: - NODE_ENV: production - DB_NAME: db - DB_HOST: db - DB_USER: db - DB_PASS: ${db_password} -``` -When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your `zerops.yaml` and redeploy your application to Zerops. -## Set basic runtime env variables in zerops.yaml -To set basic env variables for the runtime environment, add the `envVariables` attribute to the runtime section in your `zerops.yaml`. -```yaml -zerops: - # define hostname of your service - - setup: app - # ==== how to build your application ==== - run: - … - # OPTIONAL. Defines the env variables for the runtime environment: - envVariables: - NODE_ENV: production - DB_NAME: db - DB_HOST: db - DB_USER: db - DB_PASS: ${db_password} -``` -When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your `zerops.yaml` and redeploy your application to Zerops. -## Env variable restrictions -**key** -- must satisfy the following regular expression: `[a-zA-Z_]+[a-zA-Z0-9_]*` -- all variable keys in the same service must be unique regardless of case -- keys are case sensitive -**value** -- must contain only ASCII characters -- the _End of Line_ character is forbidden -These restrictions apply to all [types of env variables](/nodejs/how-to/env-variables#types-of-env-variables-in-zerops). -## Referencing other env variables -You can reference another variable of the same service using `${key}` in your variable value. You can even reference a variable from a different service using `${hostname_key}`. The referenced variable doesn't need to exist when you are entering your variable. -### Reference a local variable in another variable value -| Variable key | Variable value | Computed variable value | -| ------------ | ------------------- | ----------------------- | -| id | 12345 | 12345 | -| hostname | app | app | -| name | `${id}-${hostname}` | 12345-app | -| name | `${id}-${hostname}` | 12345-app | -### Reference a variable of another project service -Let's say your project contains two PostgreSQL services `dbtest` and `dbprod`. Both services have a `connectionString` variable. Then you can create a `dbConnectionString` env variable in your Node.js runtime and set `${dbtest_connectionString}` as the variable value. Zerops will fill in the value of the `connectionString` variable of the `dbtest` service. -When you change the `dbConnectionString` value to `${dbprod_connectionString}`, Zerops will fill in the value of the `connectionString` variable of the `dbprod` service. -:::caution -When you change the value of the `connectionString` variable in the service `dbtest` you need to **restart** the Node.js service. 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. -::: -## Generated env variables -Zerops creates several helper variables when a Node.js service is created, e.g. `hostname`, `PATH`. Some helper variables are read-only (`hostname`), others are editable (`PATH`). Generated variables cannot be deleted. -Generated env variables are listed on the **Environment variables** page. Scroll to the **Generated variables** section. - -## How to read env variables from your Node.js app -Zerops passes all environment variables from all project services when your Node.js app is deployed and started. -To access the local environment variable i.e. the variable set to this Node.js service in your app, use: -```sh -process.env.YOUR_VARIABLE_KEY_HERE -``` -## How to read env variables of another service -All services of the same project can reference environment variables from other services. To use an environment variable from one service in another service in the same project, you must prefix the environment variable key with the service hostname and underscore. -#### Examples: -To access the `connectionString` env variable of the `mariadb1` service, use `mariadb1_connectionString` as the env variable key. -To access the `password` env variable of the `mariadb2` service, use `mariadb2_password` as the env variable key. -## How to read runtime env variables in the build environment -You can use runtime env variables in the build environment using the `RUNTIME_` prefix. For example if you have a runtime variable with the `connectionString` key, use the `RUNTIME_connectionString` to read the variable in the build environment. This rule applies both for basic and secret runtime variables. -## Basic and secret env variable with the same key -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.yaml 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. + ---------------------------------------- @@ -21256,161 +20402,51 @@ Example: - **`{{.Environment.ENV_NAME}}`** is replaced by the [env variable](/php/how-to/env-variables) value. The env variable must be either defined in [run.envVariables]() in `zerops.yaml` or set as a [secret](/php/how-to/env-variables#set-secret-env-variables-in-zerops-gui) or [generated](/php/how-to/env-variables#generated-env-variables) env variable in Zerops GUI. :::caution Use the **.tmpl** file extension to make Zerops interpret the file as a template. Zerops will replace the supported variables listed above. -::: -3. Check that your Apache configuration is consistent with Zerops requirements: -- Do not use IP addresses in the `` directive -- If you use other ports than `:80` in the `` directive, add them to the `run.ports` in your `zerops.yaml` as well. - Do not use the port **:443**. All the incoming `https://` traffic is terminated on the Zerops internal balancer where the SSL certificate is installed and the request is forwarded to your PHP+Apache service as a **http://** on the port **:80**. -4. Add the `siteConfigPath` to the run section of your `zerops.yaml`. -```yaml -zerops: - # define hostname of your service - - setup: app - # ==== how to build your application ==== - build: - # REQUIRED. Set the base technology for the build environment: - base: php-apache@latest - # REQUIRED. Select which files / folders to deploy after - # the build has successfully finished - deployFiles: - - vendor - - public - # ==== how to run your application ==== - run: - documentRoot: public - # OPTIONAL. Sets the custom Nginx or Apache configuration. The file must be deployed in the runtime container. Enter the path to the file relative to the /var/www folder - siteConfigPath: site_config.tmpl -``` -5. Ensure that the `build.deployFiles` contains the folder with the `siteConfigPath` or add the path to the Apache config file to the `deployFiles` list. Zerops will deploy the file to the runtime container(s). -6. [Trigger](/php/how-to/trigger-pipeline) the build & deploy pipeline. - ----------------------------------------- - -# Php > How To > Delete - - - ----------------------------------------- - -# Php > How To > Deploy Process - - - ----------------------------------------- - -# Php > How To > Env Variables - -Environment variables help you run your application in different environments. They allow you to isolate all specific environment aspects from your application code and keep your app encapsulated. You can create several projects in Zerops that represent different environments (development, stage, production) or even each developer can have a project with its own environment. -In Zerops you do not have to create a `.env` file manually. Zerops handles the environment variables for you. -## Types of env variables in Zerops -There are 3 different sets of env variables in Zerops: - - Type - Environment - Defined in - - basic - build - zerops.yaml - - basic - runtime - zerops.yaml - - secret - runtime - Zerops GUI - -Use the [secret env variables](/php/how-to/create#set-secret-environment-variables) for all sensitive data you don't want to store in your application code. Secret env variables are also useful if you need for testing where you need to change the value of some env variables frequently. Secret variables are managed in Zerops GUI and you don't have to redeploy your application. -The basic build and runtime env variables are listed in your [zerops.yaml](/zerops-yaml/specification) and deployed together with your application code. When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your zerops.yaml and redeploy your application to Zerops. -You can [reference](/php/how-to/env-variables#reference-a-local-variable-in-another-variable-value) another variable of the same service or even a variable of [another service](/php/how-to/env-variables#reference-a-variable-of-another-project-service) within the same project. -## Set secret env variables 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.yaml. - -You can set env variables when you [create](/php/how-to/create) a new PHP service or you can set them later. -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. -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 to environment variables will be automatically applied to all containers of your project's services. -:::caution -You need to **restart** the runtime service after you update environment variables. The PHP process running in the container receives the list env variables only when it starts. Update of the env variables while the PHP process is running does not affect your application. -::: -## Set basic build env variables in zerops.yaml -To set basic env variables for the build environment, add the `envVariables` attribute to the build section in your `zerops.yaml` -```yaml -zerops: - # define hostname of your service - - setup: app - # ==== how to build your application ==== - build: - … - # OPTIONAL. Defines the env variables for the build environment: - envVariables: - DB_NAME: db - DB_HOST: db - DB_USER: db - DB_PASS: ${db_password} -``` -When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your `zerops.yaml` and redeploy your application to Zerops. -## Set basic runtime env variables in zerops.yaml -To set basic env variables for the runtime environment, add the `envVariables` attribute to the runtime section in your `zerops.yaml`. -```yaml -zerops: - # define hostname of your service - - setup: app - # ==== how to build your application ==== - run: - … - # OPTIONAL. Defines the env variables for the runtime environment: - envVariables: - DB_NAME: db - DB_HOST: db - DB_USER: db - DB_PASS: ${db_password} -``` -When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your `zerops.yaml` and redeploy your application to Zerops. -## Env variable restrictions -**key** -- must satisfy the following regular expression: `[a-zA-Z_]+[a-zA-Z0-9_]*` -- all variable keys in the same service must be unique regardless of case -- keys are case sensitive -**value** -- must contain only ASCII characters -- the _End of Line_ character is forbidden -These restrictions apply to all [types of env variables](/php/how-to/env-variables#types-of-env-variables-in-zerops). -## Referencing other env variables -You can reference another variable of the same service using `${key}` in your variable value. You can even reference a variable from a different service using `${hostname_key}`. The referenced variable doesn't need to exist when you are entering your variable. -### Reference a local variable in another variable value -| Variable key | Variable value | Computed variable value | -| ------------ | ------------------- | ----------------------- | -| id | 12345 | 12345 | -| hostname | app | app | -| name | `${id}-${hostname}` | 12345-app | -| name | `${id}-${hostname}` | 12345-app | -### Reference a variable of another project service -Let's say your project contains two PostgreSQL services `dbtest` and `dbprod`. Both services have a `connectionString` variable. Then you can create a `dbConnectionString` env variable in your PHP runtime and set `${dbtest_connectionString}` as the variable value. Zerops will fill in the value of the `connectionString` variable of the `dbtest` service. -When you change the `dbConnectionString` value to `${dbprod_connectionString}`, Zerops will fill in the value of the `connectionString` variable of the `dbprod` service. -:::caution -When you change the value of the `connectionString` variable in the service `dbtest` you need to **restart** the PHP service. The PHP process running in the container receives the list env variables only when it starts. Update of the env variables while the PHP process is running does not affect your application. -::: -## Generated env variables -Zerops creates several helper variables when a PHP service is created, e.g. `hostname`, `PATH`. Some helper variables are read-only (`hostname`), others are editable (`PATH`). Generated variables cannot be deleted. -Generated env variables are listed on the **Environment variables** page. Scroll to the **Generated variables** section. - -## How to read env variables from your PHP app -To access the local environment variable i.e. the variable set to this PHP service in your app, use: -```sh -getenv('YOUR_VARIABLE_KEY_HERE'); +::: +3. Check that your Apache configuration is consistent with Zerops requirements: +- Do not use IP addresses in the `` directive +- If you use other ports than `:80` in the `` directive, add them to the `run.ports` in your `zerops.yaml` as well. + Do not use the port **:443**. All the incoming `https://` traffic is terminated on the Zerops internal balancer where the SSL certificate is installed and the request is forwarded to your PHP+Apache service as a **http://** on the port **:80**. +4. Add the `siteConfigPath` to the run section of your `zerops.yaml`. +```yaml +zerops: + # define hostname of your service + - setup: app + # ==== how to build your application ==== + build: + # REQUIRED. Set the base technology for the build environment: + base: php-apache@latest + # REQUIRED. Select which files / folders to deploy after + # the build has successfully finished + deployFiles: + - vendor + - public + # ==== how to run your application ==== + run: + documentRoot: public + # OPTIONAL. Sets the custom Nginx or Apache configuration. The file must be deployed in the runtime container. Enter the path to the file relative to the /var/www folder + siteConfigPath: site_config.tmpl ``` -## How to read env variables of another service -All services of the same project can reference environment variables from other services. To use an environment variable from one service in another service in the same project, you must prefix the environment variable key with the service hostname and underscore. -#### Examples: -To access the `connectionString` env variable of the `mariadb1` service, use `mariadb1_connectionString` as the env variable key. -To access the `password` env variable of the `mariadb2` service, use `mariadb2_password` as the env variable key. -## How to read runtime env variables in the build environment -You can use runtime env variables in the build environment using the `RUNTIME_` prefix. For example if you have a runtime variable with the `connectionString` key, use the `RUNTIME_connectionString` to read the variable in the build environment. This rule applies both for basic and secret runtime variables. -## Basic and secret env variable with the same key -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.yaml 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. +5. Ensure that the `build.deployFiles` contains the folder with the `siteConfigPath` or add the path to the Apache config file to the `deployFiles` list. Zerops will deploy the file to the runtime container(s). +6. [Trigger](/php/how-to/trigger-pipeline) the build & deploy pipeline. + +---------------------------------------- + +# Php > How To > Delete + + + +---------------------------------------- + +# Php > How To > Deploy Process + + + +---------------------------------------- + +# Php > How To > Env Variables + + ---------------------------------------- @@ -23471,118 +22507,7 @@ When the custom runtime cache is used, Zerops doesn't create a prepare runtime c # Python > How To > Env Variables -Environment variables help you run your application in different environments. They allow you to isolate all specific environment aspects from your application code and keep your app encapsulated. You can create several projects in Zerops that represent different environments (development, stage, production) or even each developer can have a project with its own environment. -In Zerops you do not have to create a `.env` file manually. Zerops handles the environment variables for you. -## Types of env variables in Zerops -There are 3 different sets of env variables in Zerops: - - Type - Environment - Defined in - - basic - build - zerops.yaml - - basic - runtime - zerops.yaml - - secret - runtime - Zerops GUI - -Use the [secret env variables](/python/how-to/create#set-secret-environment-variables) for all sensitive data you don't want to store in your application code. Secret env variables are also useful if you need for testing where you need to change the value of some env variables frequently. Secret variables are managed in Zerops GUI and you don't have to redeploy your application. -The basic build and runtime env variables are listed in your [zerops.yaml](/zerops-yaml/specification) and deployed together with your application code. When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your zerops.yaml and redeploy your application to Zerops. -You can [reference](/python/how-to/env-variables#reference-a-local-variable-in-another-variable-value) another variable of the same service or even a variable of [another service](/python/how-to/env-variables#reference-a-variable-of-another-project-service) within the same project. -## Set secret env variables 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.yaml. - -You can set env variables when you [create](/python/how-to/create) a new Python service or you can set them later. -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. -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 to environment variables will be automatically applied to all containers of your project's services. -:::caution -You need to **restart** the runtime service after you update environment 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.yaml -To set basic env variables for the build environment, add the `envVariables` attribute to the build section in your `zerops.yaml` -```yaml -zerops: - # define hostname of your service - - setup: app - # ==== how to build your application ==== - build: - … - # OPTIONAL. Defines the env variables for the build environment: - envVariables: - DB_NAME: db - DB_HOST: db - DB_USER: db - DB_PASS: ${db_password} -``` -When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your `zerops.yaml` and redeploy your application to Zerops. -## Set basic runtime env variables in zerops.yaml -To set basic env variables for the runtime environment, add the `envVariables` attribute to the runtime section in your `zerops.yaml`. -```yaml -zerops: - # define hostname of your service - - setup: app - # ==== how to build your application ==== - run: - … - # OPTIONAL. Defines the env variables for the runtime environment: - envVariables: - DB_NAME: db - DB_HOST: db - DB_USER: db - DB_PASS: ${db_password} -``` -When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your `zerops.yaml` and redeploy your application to Zerops. -## Env variable restrictions -**key** -- must satisfy the following regular expression: `[a-zA-Z_]+[a-zA-Z0-9_]*` -- all variable keys in the same service must be unique regardless of case -- keys are case sensitive -**value** -- must contain only ASCII characters -- the _End of Line_ character is forbidden -## Referencing other env variables -These restrictions apply to all [types of env variables](/python/how-to/env-variables#types-of-env-variables-in-zerops). -You can reference another variable of the same service using `${key}` in your variable value. You can even reference a variable from a different service using `${hostname_key}`. The referenced variable doesn't need to exist when you are entering your variable. -### Reference a local variable in another variable value -| Variable key | Variable value | Computed variable value | -| ------------ | ------------------- | ----------------------- | -| id | 12345 | 12345 | -| hostname | app | app | -| name | `${id}-${hostname}` | 12345-app | -| name | `${id}-${hostname}` | 12345-app | -### Reference a variable of another project service -Let's say your project contains two PostgreSQL services `dbtest` and `dbprod`. Both services have a `connectionString` variable. Then you can create a `dbConnectionString` env variable in your Python runtime and set `${dbtest_connectionString}` as the variable value. Zerops will fill in the value of the `connectionString` variable of the `dbtest` service. -When you change the `dbConnectionString` value to `${dbprod_connectionString}`, Zerops will fill in the value of the `connectionString` variable of the `dbprod` service. -:::caution -When you change the value of the `connectionString` variable in the service `dbtest` you need to **restart** the Python service. 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. -::: -## Generated env variables -Zerops creates several helper variables when a Python service is created, e.g. `hostname`, `PATH`. Some helper variables are read-only (`hostname`), others are editable (`PATH`). Generated variables cannot be deleted. -Generated env variables are listed on the **Environment variables** page. Scroll to the **Generated variables** section. - -## How to read env variables from your Python app -Zerops passes all environment variables from all project services when your Python app is deployed and started. -To access the local environment variable i.e. the variable set to this Python service in your app, use: -```sh -os.environ['YOUR_VARIABLE_KEY_HERE'] -``` -## How to read env variables of another service -All services of the same project can reference environment variables from other services. To use an environment variable from one service in another service in the same project, you must prefix the environment variable key with the service hostname and underscore. -#### Examples: -To access the `connectionString` env variable of the `mariadb1` service, use `mariadb1_connectionString` as the env variable key. -To access the `password` env variable of the `mariadb2` service, use `mariadb2_password` as the env variable key. -## How to read runtime env variables in the build environment -You can use runtime env variables in the build environment using the `RUNTIME_` prefix. For example if you have a runtime variable with the `connectionString` key, use the `RUNTIME_connectionString` to read the variable in the build environment. This rule applies both for basic and secret runtime variables. -## Basic and secret env variable with the same key -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.yaml 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. + ---------------------------------------- @@ -25188,118 +24113,7 @@ When the custom runtime cache is used, Zerops doesn't create a prepare runtime c # Rust > How To > Env Variables -Environment variables help you run your application in different environments. They allow you to isolate all specific environment aspects from your application code and keep your app encapsulated. You can create several projects in Zerops that represent different environments (development, stage, production) or even each developer can have a project with its own environment. -In Zerops you do not have to create a `.env` file manually. Zerops handles the environment variables for you. -## Types of env variables in Zerops -There are 3 different sets of env variables in Zerops: - - Type - Environment - Defined in - - basic - build - zerops.yaml - - basic - runtime - zerops.yaml - - secret - runtime - Zerops GUI - -Use the [secret env variables](/rust/how-to/create#set-secret-environment-variables) for all sensitive data you don't want to store in your application code. Secret env variables are also useful if you need for testing where you need to change the value of some env variables frequently. Secret variables are managed in Zerops GUI and you don't have to redeploy your application. -The basic build and runtime env variables are listed in your [zerops.yaml](/zerops-yaml/specification) and deployed together with your application code. When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your zerops.yaml and redeploy your application to Zerops. -You can [reference](/rust/how-to/env-variables#reference-a-local-variable-in-another-variable-value) another variable of the same service or even a variable of [another service](/rust/how-to/env-variables#reference-a-variable-of-another-project-service) within the same project. -## Set secret env variables 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.yaml. - -You can set env variables when you [create](/rust/how-to/create) a new Rust service or you can set them later. -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. -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 to environment variables will be automatically applied to all containers of your project's services. -:::caution -You need to **restart** the runtime service after you update environment variables. The Rust process running in the container receives the list env variables only when it starts. Update of the env variables while the Rust process is running does not affect your application. -::: -## Set basic build env variables in zerops.yaml -To set basic env variables for the build environment, add the `envVariables` attribute to the build section in your `zerops.yaml` -```yaml -zerops: - # define hostname of your service - - setup: app - # ==== how to build your application ==== - build: - … - # OPTIONAL. Defines the env variables for the build environment: - envVariables: - DB_NAME: db - DB_HOST: db - DB_USER: db - DB_PASS: ${db_password} -``` -When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your `zerops.yaml` and redeploy your application to Zerops. -## Set basic runtime env variables in zerops.yaml -To set basic env variables for the runtime environment, add the `envVariables` attribute to the runtime section in your `zerops.yaml`. -```yaml -zerops: - # define hostname of your service - - setup: app - # ==== how to build your application ==== - run: - … - # OPTIONAL. Defines the env variables for the runtime environment: - envVariables: - DB_NAME: db - DB_HOST: db - DB_USER: db - DB_PASS: ${db_password} -``` -When you need to update a value of an existing env variable or change the set of build or runtime env variables, update your `zerops.yaml` and redeploy your application to Zerops. -## Env variable restrictions -**key** -- must satisfy the following regular expression: `[a-zA-Z_]+[a-zA-Z0-9_]*` -- all variable keys in the same service must be unique regardless of case -- keys are case sensitive -**value** -- must contain only ASCII characters -- the _End of Line_ character is forbidden -These restrictions apply to all [types of env variables](/rust/how-to/env-variables#types-of-env-variables-in-zerops). -## Referencing other env variables -You can reference another variable of the same service using `${key}` in your variable value. You can even reference a variable from a different service using `${hostname_key}`. The referenced variable doesn't need to exist when you are entering your variable. -### Reference a local variable in another variable value -| Variable key | Variable value | Computed variable value | -| ------------ | ------------------- | ----------------------- | -| id | 12345 | 12345 | -| hostname | app | app | -| name | `${id}-${hostname}` | 12345-app | -| name | `${id}-${hostname}` | 12345-app | -### Reference a variable of another project service -Let's say your project contains two PostgreSQL services `dbtest` and `dbprod`. Both services have a `connectionString` variable. Then you can create a `dbConnectionString` env variable in your Rust runtime and set `${dbtest_connectionString}` as the variable value. Zerops will fill in the value of the `connectionString` variable of the `dbtest` service. -When you change the `dbConnectionString` value to `${dbprod_connectionString}`, Zerops will fill in the value of the `connectionString` variable of the `dbprod` service. -:::caution -When you change the value of the `connectionString` variable in the service `dbtest` you need to **restart** the Rust service. The Rust process running in the container receives the list env variables only when it starts. Update of the env variables while the Rust process is running does not affect your application. -::: -## Generated env variables -Zerops creates several helper variables when a Rust service is created, e.g. `hostname`, `PATH`. Some helper variables are read-only (`hostname`), others are editable (`PATH`). Generated variables cannot be deleted. -Generated env variables are listed on the **Environment variables** page. Scroll to the **Generated variables** section. - -## How to read env variables from your Rust app -Zerops passes all environment variables from all project services when your Rust app is deployed and started. -To access the local environment variable i.e. the variable set to this Rust service in your app, use: -```sh -env::var("YOUR_VARIABLE_KEY_HERE") -``` -## How to read env variables of another service -All services of the same project can reference environment variables from other services. To use an environment variable from one service in another service in the same project, you must prefix the environment variable key with the service hostname and underscore. -#### Examples: -To access the `connectionString` env variable of the `mariadb1` service, use `mariadb1_connectionString` as the env variable key. -To access the `password` env variable of the `mariadb2` service, use `mariadb2_password` as the env variable key. -## How to read runtime env variables in the build environment -You can use runtime env variables in the build environment using the `RUNTIME_` prefix. For example if you have a runtime variable with the `connectionString` key, use the `RUNTIME_connectionString` to read the variable in the build environment. This rule applies both for basic and secret runtime variables. -## Basic and secret env variable with the same key -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.yaml 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. + ----------------------------------------