Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I encountered a Grafana error when deploying the documentation using the current official demo #1716

Closed
Oldmooo opened this issue Sep 9, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@Oldmooo
Copy link

Oldmooo commented Sep 9, 2024

Bug Report

On my side, I followed the official website documentation address : https://opentelemetry.io/docs/demo/docker-deployment/
When everything is containerized and healthy, the following error occurs when I access the address in the document (http://localhost:8080/grafana/) :

"if you're seeing this grafana has failed to load its application files 1. this could be caused by your reverse proxy settings. 2. if you host grafana under subpath make sure your grafana.ini root_url setting includes subpath. if not using a reverse proxy make sure to set serve_from_sub_path to true."

Note: I'm not using a reverse proxy, but rather I'm accessing the operation via Public IP:port/grafana/, with a collective access address of http://public:8080/grafana/

Symptom

The problem is that Grafana Web, which OpenTelemetry integrates with, opens correctly.

Reproduce

Additional Context

Here's exactly how I deployed it:

Server Configuration 8c16GB 1Mbps
root@OpenTelemetry:~# uname -a
Linux OpenTelemetry 5.4.0-189-generic #209-Ubuntu SMP Fri Jun 7 14:05:13 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
# install docker
#!/bin/bash
apt install -y curl ca-certificates
install -m 0755 -d /etc/apt/keyrings

while read line; do 
    echo "$line" | grep -q export && eval $line || eval export $line
done </etc/os-release

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null

if [ "$(cat /proc/sys/net/ipv4/ip_forward)" != "1" ]; then
    sed -i '/net.ipv4.ip_forward/d' /etc/sysctl.conf
    echo "net.ipv4.ip_forward=1" >>/etc/sysctl.conf
    sysctl -p
fi

apt update
apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
# install opentelemetry-demo
mkdir -p opentelemetry && cd opentelemetry
git clone https://github.com/open-telemetry/opentelemetry-demo.git
cd opentelemetry-demo/
docker compose up --force-recreate --remove-orphans --detach

Grafana url access exception occurs after the deployment is completed, the specific error is reported as follows: : if you're seeing this grafana has failed to load its application files

I tried to add : environment to the Grafana configuration inside ,But it still gives the same error as above

/opentelemetry/opentelemetry-demo# vim docker-compose.yml
Environment:
   -GF SERVER SERVE FROM SUB PATH=true#。.。
   -GF_SERVER_RO0T_URL=%(protocol)s://%(domain)s:%(http_port)s/grafana

It seems that the variables I configured above didn't successfully take effect after a container restart. I decided to write them dead! This successfully solved my problem and the grafana web opens properly!

root@OpenTelemetry:~/opentelemetry/opentelemetry-demo# vim docker-compose.yml
  # Grafana
  grafana:
    image: ${GRAFANA_IMAGE}
    container_name: grafana
    deploy:
      resources:
        limits:
          memory: 100M
    restart: unless-stopped
    environment:
      - "GF_INSTALL_PLUGINS=grafana-opensearch-datasource"
      - "GF_SERVER_SERVE_FROM_SUB_PATH=true"                            #increase
      - "GF_SERVER_ROOT_URL=http://public IP address:8080/grafana/" #increase

    volumes:
      - ./src/grafana/grafana.ini:/etc/grafana/grafana.ini
      - ./src/grafana/provisioning/:/etc/grafana/provisioning/
    ports:
      - "${GRAFANA_SERVICE_PORT}"
    logging: *logging
    
root@OpenTelemetry:~/opentelemetry/opentelemetry-demo# vim  src/grafana/grafana.ini
root_url = http://public IP address:8080/grafana/
serve_from_sub_path = true

docker compose down && docker compose down up -d
@Oldmooo Oldmooo added the bug Something isn't working label Sep 9, 2024
@puckpuck
Copy link
Contributor

Grafana is exposed through the frontend-proxy service and not directly. Please follow the docs to start the demo, which asks to use make a start instead of docker compose. When doing this you will get a URL to load the Grafana UI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants