Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@

# Node
node_modules

# Misc
.DS_Store
75 changes: 18 additions & 57 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,65 +1,26 @@
# Homelab
My homelab setup with Dell PowerEdge R730 running Proxmox and K0s
# MengLinMaker's homelab
My homelab setup with Dell PowerEdge R730 running Proxmox, Talos and K0s, provisioned with kubernetes.

## Fan control
To silence the fans, install `ipmitool`
## Quick start
1. Install dependencies
```bash
apt install ipmitool -y
```

Enable manual fan control
```bash
ipmitool raw 0x30 0x30 0x01 0x00
```

Disable manual fan control
```bash
ipmitool raw 0x30 0x30 0x01 0x01
```

Turn fan to 10% - 0xA is 10
```bash
ipmitool raw 0x30 0x30 0x02 0xff 0xA
```

Turn fan to 20% - 0x19 is 20
```bash
ipmitool raw 0x30 0x30 0x02 0xff 0x19
```
brew install terraform tfsec siderolabs/tap/talosctl

Monitor some relevant metrics
```bash
ipmitool sdr elist full
pnpm i
```

## Tailscale VPN
Setup tailscale to access network externally

### Proxmox access
1. [Install tailscale client on access devices](https://tailscale.com/download)
2. [Install tailscale on target device](https://tailscale.com/kb/1031/install-linux)
2. Provide env variables:
- `terraform login`
- Create `terraform/terraform.tfvars` according the `terraform/variables.tf`
3. Deploy
```bash
curl -fsSL https://tailscale.com/install.sh | sh
pnpm dep
```
3. Access target device by enabling tailscale VPN and access via assigned IPv4 or IPv6

### LXC access
Instructions taken from https://dustri.org/b/running-tailscale-inside-of-a-proxmox-container.html
## Layout
Folder structure:
- `docs` - helpful commands
- `kubernetes` - all the kubernetes related configs
- `terraform` - config for deploying infra on proxmox

1. Add some lxc config in proxmox specifying correct ID - 100 in this example
```bash
echo 'lxc.cgroup.devices.allow: c 10:200 rwm' >> /etc/pve/lxc/100.conf
echo 'lxc.mount.entry: /dev/net/tun dev/net/tun none bind,create=file' >> /etc/pve/lxc/100.conf
```
2. Enter lxc container
```bash
pct enter 100
```
3. Install and configure tailscale
```bash
curl -fsSL https://tailscale.com/install.sh | sh
echo 'net.ipv4.ip_forward = 1' | tee -a /etc/sysctl.conf
echo 'net.ipv6.conf.all.forwarding = 1' | tee -a /etc/sysctl.conf
sysctl -p /etc/sysctl.conf
reboot
```
## Attribution:
- Terraform setup inspired by [this blog](https://olav.ninja/talos-cluster-on-proxmox-with-terraform)
36 changes: 36 additions & 0 deletions docs/fan.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Fan control
The fans of the r730 is quite loud. So here are some commands to lower fan speeds.

## Install
To silence the fans, install `ipmitool`
```bash
apt install ipmitool -y
```

## Enable control
Enable manual fan control
```bash
ipmitool raw 0x30 0x30 0x01 0x00
```

Disable manual fan control
```bash
ipmitool raw 0x30 0x30 0x01 0x01
```

## Change speed
Turn fan to 10% - 0xA is 10
```bash
ipmitool raw 0x30 0x30 0x02 0xff 0xA
```

Turn fan to 20% - 0x19 is 20
```bash
ipmitool raw 0x30 0x30 0x02 0xff 0x19
```

## Monitor
Monitor some relevant metrics
```bash
ipmitool sdr elist full
```
32 changes: 32 additions & 0 deletions docs/tailscale.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@

# Tailscale VPN
Access the homelab on a different network, using tailscale.

## Proxmox access
1. [Install tailscale client on access devices](https://tailscale.com/download)
2. [Install tailscale on target device](https://tailscale.com/kb/1031/install-linux)
```bash
curl -fsSL https://tailscale.com/install.sh | sh
```
3. Access target device by enabling tailscale VPN and access via assigned IPv4 or IPv6

## LXC access
Instructions taken from https://dustri.org/b/running-tailscale-inside-of-a-proxmox-container.html

1. Add some lxc config in proxmox specifying correct ID - 100 in this example
```bash
echo 'lxc.cgroup.devices.allow: c 10:200 rwm' >> /etc/pve/lxc/100.conf
echo 'lxc.mount.entry: /dev/net/tun dev/net/tun none bind,create=file' >> /etc/pve/lxc/100.conf
```
2. Enter lxc container
```bash
pct enter 100
```
3. Install and configure tailscale
```bash
curl -fsSL https://tailscale.com/install.sh | sh
echo 'net.ipv4.ip_forward = 1' | tee -a /etc/sysctl.conf
echo 'net.ipv6.conf.all.forwarding = 1' | tee -a /etc/sysctl.conf
sysctl -p /etc/sysctl.conf
reboot
```
1 change: 1 addition & 0 deletions kubernetes/guestbook-go/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
guestbook_bin
30 changes: 30 additions & 0 deletions kubernetes/guestbook-go/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Copyright 2016 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

FROM golang:1.10.0
RUN go get github.com/codegangsta/negroni \
github.com/gorilla/mux \
github.com/xyproto/simpleredis/v2
WORKDIR /app
ADD ./main.go .
RUN CGO_ENABLED=0 GOOS=linux go build -o main .

FROM scratch
WORKDIR /app
COPY --from=0 /app/main .
COPY ./public/index.html public/index.html
COPY ./public/script.js public/script.js
COPY ./public/style.css public/style.css
CMD ["/app/main"]
EXPOSE 3000
36 changes: 36 additions & 0 deletions kubernetes/guestbook-go/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Copyright 2016 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Build the guestbook-go example

# Usage:
# [VERSION=v3] [REGISTRY="staging-k8s.gcr.io"] make build
VERSION?=v3
REGISTRY?=staging-k8s.gcr.io

release: clean build push clean

# builds a docker image that builds the app and packages it into a minimal docker image
build:
docker buildx build --load -t ${REGISTRY}/guestbook:${VERSION} .

# push the image to an registry
push:
docker buildx build --push -t ${REGISTRY}/guestbook:${VERSION} .

# remove previous images and containers
clean:
docker rm -f ${REGISTRY}/guestbook:${VERSION} 2> /dev/null || true

.PHONY: release clean build push
Loading