plaintextpackets / netprobe_lite

Simple internet performance tester written in Python
625 stars 126 forks source link

Use absolute paths in `docker-compose.yml` #48

Open Xian55 opened 4 months ago

Xian55 commented 4 months ago

Hello, good day!

Your Docker Compose file uses relative paths (e.g., ./config/...), which can be problematic when deploying through Portainer because the context directory might not be what you expect. Portainer might not have access to the same filesystem structure as your local development environment. Here are some steps and adjustments you can make to ensure it works properly:

General Adjustments

  1. Use Absolute Paths: When deploying with Portainer, it's better to use absolute paths for volumes to ensure the paths are correctly resolved.

  2. Verify Paths: Ensure all paths referenced in your docker-compose.yml actually exist on your host machine and are accessible.

  3. Permissions: Ensure the user running Portainer has the necessary permissions to access the files and directories specified.

One step to the right direction would be is to specify these /absolute/path/to/

version: '3'
name: netprobe

networks:
  netprobe-net:

services:
  redis:
    restart: always
    container_name: netprobe-redis
    image: "redis:latest"
    volumes:
      - /absolute/path/to/config/redis/redis.conf:/etc/redis/redis.conf
    networks:
      - netprobe-net
    dns:
      - 8.8.8.8
      - 8.8.4.4      

  netprobe:
    restart: always
    container_name: netprobe-probe
    image: "plaintextpackets/netprobe:latest"
    pull_policy: always
    volumes:
      - /absolute/path/to/netprobe_lite:/netprobe_lite
    environment:
      MODULE: "NETPROBE"
    networks:
      - netprobe-net
    dns:
      - 8.8.8.8
      - 8.8.4.4      

  speedtest:
    restart: always
    container_name: netprobe-speedtest
    image: "plaintextpackets/netprobe:latest"
    pull_policy: always
    volumes:
      - /absolute/path/to/netprobe_lite:/netprobe_lite
    environment:
      MODULE: "SPEEDTEST"
    networks:
      - netprobe-net
    dns:
      - 8.8.8.8
      - 8.8.4.4      

  presentation:
    restart: always
    container_name: netprobe-presentation
    image: "plaintextpackets/netprobe:latest"
    pull_policy: always
    volumes:
      - /absolute/path/to/netprobe_lite:/netprobe_lite
    environment:
      MODULE: "PRESENTATION"
    networks:
      - netprobe-net
    dns:
      - 8.8.8.8
      - 8.8.4.4      

  prometheus:
    restart: always
    container_name: netprobe-prometheus
    image: "prom/prometheus"
    volumes:
      - /absolute/path/to/config/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
      - prometheus_data:/prometheus  # Persistent local storage for Prometheus data
    command:
      - '--config.file=/etc/prometheus/prometheus.yml'
      - '--storage.tsdb.path=/prometheus'
    networks:
      - netprobe-net
    dns:
      - 8.8.8.8
      - 8.8.4.4      

  grafana:
    restart: always
    image: grafana/grafana-enterprise
    container_name: netprobe-grafana
    volumes:
      - /absolute/path/to/config/grafana/datasources/automatic.yml:/etc/grafana/provisioning/datasources/automatic.yml
      - /absolute/path/to/config/grafana/dashboards/main.yml:/etc/grafana/provisioning/dashboards/main.yml
      - /absolute/path/to/config/grafana/dashboards/netprobe.json:/var/lib/grafana/dashboards/netprobe.json
      - grafana_data:/var/lib/grafana
    ports:
      - '3001:3000'
    networks:
      - netprobe-net
    dns:
      - 8.8.8.8
      - 8.8.4.4      

volumes:
  prometheus_data:
  grafana_data:

Applying these changes should help resolve #29

If any of the config files are containing some path on your machine please also make it clear if it required to be specified.

example:

Xian55 commented 4 months ago

I've opened a PR #49 how i managed to add support for Portrainer. Gooday!