Jonsk

joined 1 year ago
[–] [email protected] 2 points 1 year ago* (last edited 1 year ago)

Sorry for the late reply. I followed a great tutorial on youtube by Techno Tim, it explains everything pretty well. It's a bit long, but thorough.

I used this docker-compose file as a base because it connects loki automatically, but you have to add the volumes manually and its not too hard to connect it manually. You can just use the one that Techno Tim uses in the video if you want less complexity in you're compose files.

My docker compose file for reference:

version: "3"
services:
  loki:
    container_name: 'loki'
    image: grafana/loki:2.8.0
    ports:
      - "20110:3100"
    command: -config.file=/etc/loki/loki-config.yaml
    volumes: 
      - ./loki:/etc/loki
    networks:
      - loki

  promtail:
    image: grafana/promtail:2.8.0
    volumes:
      - /var/log:/var/log
      - ./promtail:/etc/promtail
    command: -config.file=/etc/promtail/promtail-config.yaml
    networks:
      - loki

  grafana:
    container_name: 'grafana'
    image: grafana/grafana-oss:latest
    environment:
      GF_PATHS_PROVISIONING: /etc/grafana/provisioning

      GF_AUTH_ANONYMOUS_ENABLED: false
      GF_LOG_MODE: "console file"
      GF_SERVER_ROOT_URL: "https://grafana.shshere.uk"
    entrypoint:
      - sh
      - -euc
      - |
        mkdir -p /etc/grafana/provisioning/datasources
        cat <<EOF > /etc/grafana/provisioning/datasources/ds.yaml
        apiVersion: 1
        datasources:
        - name: Loki
          type: loki
          access: proxy 
          orgId: 1
          url: http://loki:3100
          basicAuth: false
          isDefault: true
          version: 1
          editable: false
        EOF
        /run.sh
    volumes:
      - ./grafana/data:/var/lib/grafana
      - ./grafana/logs:/var/log/grafana
    ports:
      - "20100:3000"
    networks:
      - loki

networks:
  loki:
    name: loki
  frontend:
    external: true

Sorry if the formatting looks bad, since I'm on mobile. I use frontend as a network that includes containers that connect to nginx proxy manager. Edit: Better wording

[–] [email protected] 3 points 1 year ago* (last edited 1 year ago) (2 children)

You don't have a logging stack? You should set one up, it helps greatly to see your servers long term snd short term status at a glance, especially if you hook it up with grafana to visualize. You can even use grafana with Home Assistant, and do some pretty crazy things with notifications, but i must say, it is a rabbit hole, especially grafana, and quite a large one at that.

I'm currently using grafana with loki and looking to set up notifications with ntfy but if you have the resources you could set up some other logging stacks like elk, or greylog but they're a bit resource hungry and you dont seem to have too many services set up to warrant a larger stack.

Anyway you have a really nice setup, good job!

Edit: typo

[–] [email protected] 4 points 1 year ago (1 children)

Really? Because in my private instance, the communities have a lot more users than just 1.