this post was submitted on 03 Jul 2023
193 points (96.6% liked)

Selfhosted

40042 readers
940 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules:

  1. Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it's not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don't duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 1 year ago
MODERATORS
 

Hi all, new to Lemmy but this seems to be the best community for this that is decently active. Apologies if not!

I got into home servers in my first house a couple years ago, but our stay in that house was unexpectedly brief and everything got put back into boxes. It's time to setup at the new place, and I have many improvements in mind from the first implementation - so while I wait for server parts to arrive, I decided to update the diagram for planning.

In no order, here's a list of lessons I learned from V1:

  • The blade form factor doesn't work for me. I enjoyed getting one and learning about them, but my use cases are small (&quiet) enough that a tower and a small network rack works better.
  • In the quest for automatic home lighting, I shouldn't have gone all-in on smart bulbs rather than switches. There get to be too many in the house, and when a couple start inevitably failing, expensive bulbs and misplaced warranty info are a gigantic pain. So now the bulbs are just for special things like ceiling fans and floor lamps.
  • I need to put more attention on storage. That's what gets used the most, by multiple users, so I will use TrueNAS Scale as my host instead of ESXi. I was not enough of a power user for that to be important to me. The rest of it is mostly for play and doesn't need to be perfect.
  • My media streaming needs are very simple, so I think I may like Jellyfin better than Plex.
  • I need to be 'a little' more lax about security. I don't think my server is realistically likely to be heavily attacked, and when I tried to go all out on best practices, more often than not I just broke things and upset my family users. My server will not have an outside access except via VPN, and my IOT devices will not speak unless spoken to - I think that will be enough.

In particular, I tried so hard last time to have a tagged management VLAN in UniFi and always just broke connectivity between something that required a hard reset. I'm planning to skip that this time but if someone has a pointer to a good setup guide, I could try that again.

Thanks for reading/looking, all comments or suggestions are welcome! I also still need to find more applications I can selfhost so I will be keeping an eye on the community for ideas.

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 4 points 1 year ago* (last edited 1 year ago) (4 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] 2 points 1 year ago (3 children)

Thank you, and good suggestion! I installed grafana once last time and failed to get anything useful as I didn't invest enough time. Notifications sound great so I may look into the same combo you mentioned and see if I can wrangle it this time. Did you follow any particular guide when you started out with that? Otherwise I'll just dive into the google

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

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

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

Not a problem, thanks!! I'm sure this will be a big help

[–] [email protected] 2 points 1 year ago

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.

load more comments (1 replies)
load more comments (1 replies)