• 0 Posts
  • 4 Comments
Joined 1 year ago
cake
Cake day: July 1st, 2023

help-circle
  • Oh and one last thing (i promise) is that if you are using or will use ARM for loki, you have to build the docker driver for loki from source.

    A quick tutorial is here for anyone that needs it: Install go with sudo apt install go Then clone the github repo with git clone https://github.com/grafana/loki.git Then cd into it with cd loki Once you’re inside the directory, do GOOS=linux/windows/whatever GOARCH=arm-version(eg. armv7,arm64) go build ./clients/cmd/docker-driver and wait for it to finish. The resulting file should (if i remember correclty) be called either loki or docker-driver. It’s reccomended to do this on another machine then import it into your arm machine.


  • 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 your 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" #optional, used if you want a log file
     #     GF_SERVER_ROOT_URL: "(Full url here eg. https://grafana.example.com") #optional, used for redirects
        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 #log file
        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.

    If you have ARM then you might have problems, more info in the comment below

    Edit: Better wording Edit2:typo, edited refrence for clarity and added arm warning


  • 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


  • I have an old laptop that i’m selfhosting a few services on. Right now i’m hosting:

    • nginx proxy manager as a reverse proxy (all requests go through the reverse proxy and it redirects to the app based on the domain name)
    • mealie and tandoor(for recipe management, dont know which one to choose yet)
    • immich (for photo backup and management, kind of like Google photos)
    • media stack with jellyfin, bazarr, sonarr, radarr, prowlarr jellyseerr, sabnzbd, and qbittorrent (jellyfin for streaming movies and shows, qbittorrent and sabnzbd for downloading movies and shows from either torrent or usenet sites (basically torrents but better), sonarr and radarr for telling them what to download, prowlarr for telling sonarr and radarr where to download from, and jellyseer is an interface where users select movies to download)
    • gluetun (only use it sometimes, it’s a VPN client that I use with qbittorrent)
    • archiveteam warrior for helping out archiving reddit, they have some other cool archival projects too.
    • And finally, Lemmy.

    I host most of my important things on the cloud because of my situation meaning that my laptop is not too reliable. If you are curious:

    • actual (a pretty cool budget management app)
    • nginx proxy manager
    • gotify (sends and receives messages)
    • ntfy (same but a bit simpler and more configurable)
    • headscale (selfhosted control server for tailscale)
    • metrics stack with grafana, prometheus and node exporter (node exporter scrapes my cloud server for data like CPU usage and other stuff every, I think, minute and then sends it to prometheus and grafana scrapes Prometheus for the metrics then visualises it if I request it to)
    • authentik single sign on (single sign on means you log into authentik and then you can log into every other app through authentik, it’s a bit complicated to setup but it’s very nice when you do)

    And that’s about it.

    Trust me, I had to go through A LOT of tutorials to get to even this point, so it may be daunting at first, but you’ll get there. Eventually.

    If you’d ask me what the hardest to set up was it was probably the media stack, probably because it was my first project 😅 and a close second would probably be authentik, it requires learning the different authentication types that you need, then actually setting it up on your server.

    If you decide to selfhost something through docker and are new to doing stuff through the command line then i would recommend portainer, because it has a nice GUI and is maybe a bit better understandable to people who don’t understand all the commands In docker. Even if you are, it’s still nice for monitoring IMO. Incase you don’t know what docker is, you should check it out. I’m not gonna go into it here, but it’s pretty cool.

    You should consider joining !selfhosted@lemmy.world (I realize that beehaw defederated but I feel like I should still bring It up) and !selfhost@lemmy.ml

    Anyway sorry for the long post, I’ll shut up now.