You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/knowledge-base/environment-variables.md
+23-9Lines changed: 23 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,7 @@ description: "A guide how to use environment variables in Coolify."
4
4
---
5
5
6
6
# Environment Variables
7
+
7
8
You can define environment variables for your resources, and they will be available in your application.
8
9
9
10
> Preview Deployments could have different environment variables, so you can test your application as a staging environment for example.
@@ -25,15 +26,19 @@ You can set shared variables on their respective pages.
25
26
Then you can use these variables anywhere. For example: You defined `NODE_ENV` to `production`.
26
27
27
28
### Team Based
29
+
28
30
You can set them on the `Team` page and use it with <codev-pre>{{team.NODE_ENV}}</code>. Do not replace "team" with your actual team name.
29
31
30
32
### Project Based
33
+
31
34
You can set them on the `Projects` page, under the gear icon and use it with <codev-pre>{{project.NODE_ENV}}</code>. Do not replace "project" with your actual project name.
32
35
33
36
### Environment Based
37
+
34
38
You can set them on the `Environments` page (select a `Project`), under the gear icon and use it with <codev-pre>{{environment.NODE_ENV}}</code> Do not replace "environment" with your actual environment name.
35
39
36
40
#### Using Shared Variables in Compose File
41
+
37
42
If you want to use the environment variables in your compose file, you can do so by using the following syntax:
38
43
39
44
```bash
@@ -49,41 +54,50 @@ NODE_ENV={{team.NODE_ENV}}
49
54
50
55
## Predefined Variables
51
56
52
-
Coolify predefines some variables for you, so you can use them in your application. All you need to do is to add an environment variable like this to your application.
57
+
Coolify predefines some variables for you, so you can use them in your application or service. All you need to do is to add an environment variable like this to your application or service.
53
58
54
59
```bash
55
60
# For example, you can use this variable in your application
56
61
MY_VARIABLE=$SOURCE_COMMIT
57
62
# You will have the commit hash of the source code in your application as an environment variable in MY_VARIABLE
58
63
```
59
64
60
-
### `COOLIFY_FQDN`
65
+
### Application Variables
66
+
67
+
#### `COOLIFY_FQDN`
61
68
62
69
Fully qualified domain name(s) of the application.
63
70
64
-
### `COOLIFY_URL`
71
+
####`COOLIFY_URL`
65
72
66
73
URL(s) of the application.
67
74
68
-
### `COOLIFY_BRANCH`
75
+
####`COOLIFY_BRANCH`
69
76
70
77
Branch name of the source code.
71
78
72
-
### `COOLIFY_RESOURCE_UUID`
79
+
####`COOLIFY_RESOURCE_UUID`
73
80
74
81
Unique resource identifier generated by Coolify.
75
82
76
-
### `COOLIFY_CONTAINER_NAME`
83
+
####`COOLIFY_CONTAINER_NAME`
77
84
78
85
Name of the container generated by Coolify.
79
86
80
-
### `SOURCE_COMMIT`
87
+
####`SOURCE_COMMIT`
81
88
82
89
Commit hash of the source code.
83
90
84
-
### `PORT`
91
+
####`PORT`
85
92
86
93
If not set: it is set to the `Port Exposes`'s first port.
87
94
88
-
### `HOST`
95
+
#### `HOST`
96
+
89
97
If not set: it is set to `0.0.0.0`
98
+
99
+
### Service Stack Variables
100
+
101
+
#### `SERVICE_NAME_<SERVICE>`
102
+
103
+
The service name of a given service in the stack. For example, if you have a service named `web`, you can access it with `SERVICE_NAME_WEB`. Useful for preview deployments where service names will vary.
description: Learn how to manage health checks in Coolify for your applications and services.
4
+
keywords: ["Healthchecks", "Not Found", "No available server", "404", "503"]
3
5
---
4
6
5
7
# Health checks
6
-
Health checks are important, but not mandatory for your application. It is a way to check if your application is started properly. Coolify provides a way to configure health checks for your application.
7
8
8
-
## How it works
9
+
Health checks are a way to ensure that your applications and services are running correctly. They allow Coolify to monitor the health of your resources and ensure that traffic is only routed to healthy instances. This for example important for [Rolling Updates](/knowledge-base/rolling-updates) to work correctly.
9
10
10
-
If you set a health check, Coolify (and integrated proxy) will check the health of your application by sending a request to the health check endpoint.
11
+
## Traefik
11
12
12
-
The integrated proxy only forwards the request to your application if the health check is successful. If the health check fails, the proxy will return a 502 Bad Gateway error.
13
+
When using Traefik as the reverse proxy, health checks are an integral part of how it routes traffic to your resources.
13
14
14
-
##What if I do not set a health check?
15
+
### Enabled
15
16
16
-
You get a warning next to your application's status. It is not mandatory, but it is recommended to set a health check.
17
-
The integrated proxy will forward the request to your application without checking the health.
17
+
If your resource has health checks _enabled_, Traefik will only route traffic to it if the health check passes. If the health check fails, Traefik will not route traffic to the resource.
18
18
19
-
::: warning Caution!
20
-
Health checks run inside your container, so you need to have either `curl` or `wget` installed on your container. You can use an docker image that already includes `curl/wget` or add it to your Dockerfile yourself.
19
+
**It will cause the resource to return a `404 Not Found` or `No available server` error.**
21
20
22
-
Without one of these packages, health checks will always fail and mark your container as unhealthy, which will cause the deployment to fail due to the failing health check.
23
-
:::
21
+
### Disabled
22
+
23
+
If your resource has health checks _disabled_, Traefik will route traffic to it regardless of the health check status.
24
+
25
+
## Configure Health checks
26
+
27
+
### Applications
28
+
29
+
There are two ways to configure health checks for your applications:
1.**Using the UI**: You can set up health checks directly in the Coolify UI when creating or editing an application. You can specify the path to check, the expected response code, and the interval for checking. It will be required that the container has either `curl` or `wget` installed to perform the health checks.
24
34
35
+
2.**Using the Dockerfile**: You can also define health checks in your Dockerfile using the [HEALTHCHECK](https://docs.docker.com/reference/dockerfile/#healthcheck) instruction. This allows you to specify how the health check should be performed, including the command to run and the expected response.
36
+
37
+
If there are healthchecks both in the UI and in the Dockerfile defined and enabled, the Dockerfile will take precedence.
38
+
39
+
### Service Stacks
40
+
41
+
Services or Applications that use the [Docker Compose Build Pack](/builds/packs/docker-compose) require their health checks to be defined in the `Dockerfile` of each service, or in their `docker-compose.y[a]ml` file using the [healthcheck](https://docs.docker.com/reference/compose-file/services/#healthcheck) attribute.
42
+
43
+
::: tip When to use health checks?
44
+
It is recommended to enable health checks for all your resources. This way, you can ensure that only healthy resources are receiving traffic.
45
+
46
+
But if you cannot set up health checks for some reason, you can disable them.
47
+
48
+
Just be aware that if the resource is unhealthy, it will still receive traffic.
Copy file name to clipboardExpand all lines: docs/knowledge-base/proxy/traefik/overview.md
+27-26Lines changed: 27 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,50 +3,51 @@ title: "Traefik Overview"
3
3
---
4
4
5
5
# Traefik Proxy
6
-
[Traefik ↗](https://traefik.io/) is a modern, open-source reverse proxy and load balancer designed to handle incoming requests and route them to the appropriate services. It’s widely used in the container ecosystem, making it a perfect fit for projects running on Coolify.
7
6
8
-
By default, Coolify uses Traefik as its proxy, enabling easy management of routing, SSL certificates, and more, without requiring deep technical expertise.
7
+
[Traefik ↗](https://traefik.io/) is a modern, open-source reverse proxy and load balancer designed to handle incoming requests and route them to the appropriate services. It’s widely used in the container ecosystem, making it a perfect fit for projects running on Coolify.
9
8
9
+
By default, Coolify uses Traefik as its proxy, enabling easy management of routing, SSL certificates, and more, without requiring deep technical expertise.
10
10
11
-
## Why Use Traefik?
12
-
- Dynamically manages routing between your apps and the internet.
13
-
- Integrates seamlessly with container orchestrators like Docker or Kubernetes.
14
-
- Simplifies SSL/TLS certificate management, including support for [Let's Encrypt ↗](https://letsencrypt.org/).
15
-
- Offers advanced features like load balancing and middleware for fine-grained control.
16
-
- Comes with a built-in dashboard for monitoring routes and configurations.
11
+
## Why Use Traefik?
17
12
13
+
- Dynamically manages routing between your apps and the internet.
14
+
- Integrates seamlessly with container orchestrators like Docker or Kubernetes.
15
+
- Simplifies SSL/TLS certificate management, including support for [Let's Encrypt ↗](https://letsencrypt.org/).
16
+
- Offers advanced features like load balancing and middleware for fine-grained control.
17
+
- Comes with a built-in dashboard for monitoring routes and configurations.
18
18
19
-
## When Not to Use Traefik?
20
-
- If you need complete control over every aspect of your reverse proxy.
21
-
- If you prefer using another reverse proxy solution like [NGINX ↗](https://nginx.org/en/).
22
-
- If you have highly customized or complex routing rules that Traefik might not fully support.
19
+
## When Not to Use Traefik?
23
20
21
+
- If you need complete control over every aspect of your reverse proxy.
22
+
- If you prefer using another reverse proxy solution like [NGINX ↗](https://nginx.org/en/).
23
+
- If you have highly customized or complex routing rules that Traefik might not fully support.
24
24
25
-
## Ways to Use Traefik with Coolify
26
-
Coolify automatically configures Traefik as your proxy. However, you can customize and extend Traefik's functionality based on your needs.
25
+
## Ways to Use Traefik with Coolify
27
26
28
-
Below are some of the key features and ways you can use Traefik with Coolify:
27
+
Coolify automatically configures Traefik as your proxy. However, you can customize and extend Traefik's functionality based on your needs.
29
28
30
-
1.[Basic Authentication](/knowledge-base/proxy/traefik/basic-auth) -> Add username and password protection to your applications.
29
+
Below are some of the key features and ways you can use Traefik with Coolify:
31
30
32
-
2.[Custom SSL Certificates](/knowledge-base/proxy/traefik/custom-ssl-certs) -> Use your own SSL certificates instead of automatically generated ones.
31
+
1.[Basic Authentication](/knowledge-base/proxy/traefik/basic-auth) -> Add username and password protection to your applications.
33
32
34
-
3.[Dashboard](/knowledge-base/proxy/traefik/dashboard) -> Enable Traefik’s built-in dashboard for real-time monitoring and insights.
33
+
2.[Custom SSL Certificates](/knowledge-base/proxy/traefik/custom-ssl-certs) -> Use your own SSL certificates instead of automatically generated ones.
35
34
36
-
4.[Dynamic Configuration](/knowledge-base/proxy/traefik/dynamic-config) -> Manage dynamic configuration changes like routing rules or middlewares.
35
+
3.[Dashboard](/knowledge-base/proxy/traefik/dashboard) -> Enable Traefik’s built-in dashboard for real-time monitoring and insights.
37
36
38
-
5.[Health Checks](/knowledge-base/proxy/traefik/healthchecks) -> Configure health checks to ensure your applications are running smoothly.
37
+
4.[Dynamic Configuration](/knowledge-base/proxy/traefik/dynamic-config) -> Manage dynamic configuration changes like routing rules or middlewares.
39
38
40
-
6.[Load Balancing](/knowledge-base/proxy/traefik/load-balancing) -> Distribute traffic across multiple app instances for better performance.
39
+
5.[Health Checks](/knowledge-base/health-checks) -> Configure health checks to ensure your applications are running smoothly.
41
40
42
-
7.[Redirects](/knowledge-base/proxy/traefik/redirects) -> Set up HTTP-to-HTTPS redirection or create specific URL redirects.
41
+
6.[Load Balancing](/knowledge-base/proxy/traefik/load-balancing) -> Distribute traffic across multiple app instances for better performance.
43
42
44
-
8.[Wildcard Certificates](/knowledge-base/proxy/traefik/wildcard-certs) -> Secure multiple subdomains with a single SSL certificate.
43
+
7.[Redirects](/knowledge-base/proxy/traefik/redirects) -> Set up HTTP-to-HTTPS redirection or create specific URL redirects.
44
+
45
+
8.[Wildcard Certificates](/knowledge-base/proxy/traefik/wildcard-certs) -> Secure multiple subdomains with a single SSL certificate.
45
46
46
47
---
47
48
48
49
::: danger CAUTION!
49
-
**Do not make changes to Traefik's configuration unless you are sure of what you are doing. Incorrect settings can make your entire application inaccessible..**
50
+
**Do not make changes to Traefik's configuration unless you are sure of what you are doing. Incorrect settings can make your entire application inaccessible..**
50
51
51
-
**We highly recommend testing any changes in a development environment before applying them to production.**
52
-
:::
52
+
**We highly recommend testing any changes in a development environment before applying them to production.**
If your deployed application **maybe** works when you access it via your server’s IP address and port but shows a **Bad Gateway** error on your domain, the issue is most often due to misconfigured port settings, incorrect host mapping, or your app listening only on localhost.
7
8
8
9
## What’s an Application and What's a Service?
10
+
9
11
-**Application:** An Application is deployed by you using a Git repository or any deployment option **except** the one-click service.
10
12
11
13
-**Service:** A Service is an app deployed using a Compose file or the one-click service on Coolify. These deployments may have different network settings and UI sections (for example, you might not see the Network section in your UI).
12
14
13
-
14
15
## Symptoms
15
-
- The application **maybe** accessible via the server IP with a port number but not via the domain.
16
-
- You might also run into a **No Available Server** error.
17
16
17
+
- The application **maybe** accessible via the server IP with a port number but not via the domain.
18
18
19
19
## Diagnosis
20
-
-**Port Configuration:**
21
-
-**Applications:** Make sure the port your app is listening on is correctly entered in the **Port Exposes** field on the Coolify dashboard.
20
+
21
+
-**Port Configuration:**
22
+
23
+
-**Applications:** Make sure the port your app is listening on is correctly entered in the **Port Exposes** field on the Coolify dashboard.
22
24
-**Services:** Check that your Compose or one-click service configuration has the appropriate network configuration.
23
25
24
-
-**Host Mapping:**
26
+
-**Host Mapping:**
27
+
25
28
-**Applications:** Verify that the application’s port is not incorrectly mapped to the host system.
26
29
-**Services:** Confirm that any port mapping in your Compose file or service configuration aligns with the proxy routing requirements.
27
30
@@ -31,28 +34,27 @@ If your deployed application **maybe** works when you access it via your server
31
34
32
35
-**Container Status:** Check the status of the container where your app or service is running. Is it unhealthy? Stuck at Starting? A failing health check might be the reason.
33
36
34
-
35
37
## Solution
36
-
-**Update Port Settings:** Enter the correct port number in the **Port Exposes** field on the Coolify dashboard and restart your app.
37
-
38
+
39
+
-**Update Port Settings:** Enter the correct port number in the **Port Exposes** field on the Coolify dashboard and restart your app.
-**Remove Host Port Mapping:** If the port is mapped to the host system, remove the mapping so the proxy can route traffic correctly, then restart your app.
41
-
43
+
-**Remove Host Port Mapping:** If the port is mapped to the host system, remove the mapping so the proxy can route traffic correctly, then restart your app.
-**Restart Container / Check Logs:** Restart the container or check its logs to diagnose the issue. Often, a failing health check might be the problem, and removing the health check could fix it.
If these steps don’t solve the issue, consider reaching out for further assistance by joining our [Discord community ↗](https://coolify.io/discord) and sharing your app logs, coolify proxy logs, configuration screenshots, and details of the troubleshooting steps you’ve already tried.
59
+
60
+
If these steps don’t solve the issue, consider reaching out for further assistance by joining our [Discord community ↗](https://coolify.io/discord) and sharing your app logs, coolify proxy logs, configuration screenshots, and details of the troubleshooting steps you’ve already tried.
0 commit comments