# Reverse Proxy Server

{% hint style="info" %}
Traefik is a modern HTTP reverse proxy and load balancer that simplifies deploying microservices. It automatically discovers the right configuration for your services based on the infrastructure it runs on, whether it's Docker, Kubernetes, Marathon, Consul, Etcd, Rancher, or others.&#x20;

Traefik makes routing your services easy with its user-friendly dashboard, enabling real-time updates without restarting. Its native support for Let's Encrypt allows for automatic SSL/TLS certificate generation and renewal, enhancing security.&#x20;
{% endhint %}

<figure><img src="/files/3Ypfk9bqarmDhd7TT5W7" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
Where traditionally edge routers (or reverse proxies) need a configuration file that contains every possible route to your services, Traefik gets them from the services themselves.

Deploying your services, you attach information that tells Traefik the characteristics of the requests the services can handle.

It means that when a service is deployed, Traefik detects it immediately and updates the routing rules in real time. Similarly, when a service is removed from the infrastructure, the corresponding route is deleted accordingly.

You no longer need to create and synchronize configuration files cluttered with IP addresses or other rules.
{% endhint %}

For futher information:

{% embed url="<https://doc.traefik.io/traefik/>" %}

{% tabs %}
{% tab title="Dashboard" %}
{% hint style="info" %}
By default the Traefik dashboard is disabled. &#x20;

The configuration settings are located in: docker-compose.in.yml

The IP address for the&#x20;
{% endhint %}

1. To enable the dashboard, navigate to:&#x20;

```bash
cd
cd /opt/pentaho/pdc-docker-deployment/vendor
sudo nano docker-compose.in.yml
```

2. Uncomment the dashboard port. &#x20;

```
# The Web UI (enabled by --api.insecure=true) 
- "8181:8080"
```

3. Restart the PDC services.

```bash
cd
cd /opt/pentaho/pdc-docker-deployment
./pdc.sh stop
```

```bash
cd
cd /opt/pentaho/pdc-docker-deployment
./pdc.sh up
```

4. Ensure the required services are up and running.&#x20;
5. Log into Portainer and make a note of the IP address: port for the Traefik container.

<figure><img src="/files/NZSKyRui22XjAyYNzJmu" alt=""><figcaption><p>Traefik IP:Port</p></figcaption></figure>

6. Enter: \[IP address: Port] in your browser.

<figure><img src="/files/m1TvZRVB1mJiDRrrAYFQ" alt=""><figcaption><p>Traefik Dashboard</p></figcaption></figure>
{% endtab %}

{% tab title="Labels & Rules" %}
{% hint style="info" %}
Traefik simplifies the routing of requests to services by dynamically obtaining routing rules directly from the services themselves, rather than relying on a static configuration file.&#x20;

When a service is deployed or removed, Traefik automatically detects the change and updates its routing rules in real-time to reflect the current state of the infrastructure, ensuring seamless access to your services without the need to manage complex configuration files.

Traefik allows you to route traffic using labels. This solution allows for all your apps to run without explicit exposing ports, you just let Traefik know what port it should forward requests to and where it should send those requests to - a particular app (Rule).
{% endhint %}

1. Navigate to: /opt/pentaho/pdc-docker-deployment/vendor
2. Double-click on: docker-compose.in.yml to open the text file

{% hint style="info" %}
Notice there's a whole bunch of labels & rules that are redirecting requests.

Below is an extract for the fe: (front-end).
{% endhint %}

```bash
  fe:
    labels:
      - "traefik.enable=true"
      - "traefik.docker.network=${COMPOSE_PROJECT_NAME}_default"
      - "traefik.http.services.${COMPOSE_PROJECT_NAME}_fe.loadbalancer.server.port=3000"
      - "traefik.http.routers.fe.rule=PathPrefix(`/`)"
      - "traefik.http.routers.fe.entrypoints=web"
      - "traefik.http.routers.fes.rule=PathPrefix(`/`)"
      - "traefik.http.routers.fes.tls=true"
      - "traefik.http.routers.fes.entrypoints=web-secure"
      - "traefik.port=3000"
```

{% hint style="info" %}
Brief overview:

• App / Service is called: fe (front-end)

• Any HTTP / HTTPS request  will be routed to this fe app loadbalancer on port:3000
{% endhint %}

4. In the Traefik dashboard, select HTTP option in top menu.

<figure><img src="/files/TTkLSwHDXqGF4otueL0S" alt=""><figcaption><p>Routing requests to fe app</p></figcaption></figure>

<figure><img src="/files/qthhbT7Wg0SsvIPPh70H" alt=""><figcaption><p>HTTP routing to pdc_fe service</p></figcaption></figure>

4. Lots of info can also be found in Portainer.

<figure><img src="/files/8wHkUmHOKWIuVKezD3Hr" alt=""><figcaption><p>fe container</p></figcaption></figure>
{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://academy.pentaho.com/pentaho-data-catalog-en/setup/components/reverse-proxy-server.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
