Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jacksgt/homelab
IaC repository for Jack's homelab - mirror of https://git.cubieserver.de/cubieserver/homelab
https://github.com/jacksgt/homelab
ansible flux helm homelab infrastructure-as-code kubernetes self-hosted
Last synced: about 11 hours ago
JSON representation
IaC repository for Jack's homelab - mirror of https://git.cubieserver.de/cubieserver/homelab
- Host: GitHub
- URL: https://github.com/jacksgt/homelab
- Owner: jacksgt
- Created: 2023-03-04T11:40:35.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2024-03-28T06:58:04.000Z (8 months ago)
- Last Synced: 2024-03-28T07:42:38.749Z (8 months ago)
- Topics: ansible, flux, helm, homelab, infrastructure-as-code, kubernetes, self-hosted
- Language: Smarty
- Homepage: https://git.cubieserver.de/cubieserver/homelab
- Size: 113 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Cubieserver - Jack's Homelab
Welcome to the Infrastructure as Code repository serving as the source of truth for Jack's Homelab - "Cubieserver".
> Note: the canonical repository is . The [Github mirror](https://github.com/jacksgt/homelab) is intended for disaster recovery purposes (to avoid the chicken-and-egg problem when bootstrapping the infrastructure).
The installation, setup and configuration of all software involved is handled by two components:
* **Ansible**: used for provisioning physical machines until they can join the Kubernetes cluster
* *this is currently still in development*
* **Flux**: deploys all services on top of Kubernetes (with local Kustomize manifests and external Helm charts)
* *find more details in the [flux directory](./flux/README.md)*An overview of the currently running services can be found on the [Cubieserver homepage](https://www.cubieserver.de).
## Tips & Tricks
### Traefik
To access traefik dashboard at , run:
```sh
ns=traefik; kubectl -n "$ns" port-forward $(kubectl -n "$ns" get pods --selector "app.kubernetes.io/name=traefik" --output=name) 9000:9000
```### PostgreSQL Size
Get size of Postgres databases:
```
psql -h -U\l+
```Get size of Postgres tables:
```
\c\d+
```## Truncate all tables in MySQL
Truncates all tables of database `DB_NAME`:
```
SELECT Concat('TRUNCATE TABLE ',table_schema,'.',TABLE_NAME, ';')
FROM INFORMATION_SCHEMA.TABLES WHERE table_schema IN ('DB_NAME');
```Might need to set `SET FOREIGN_KEY_CHECKS=0;` before running (revert to original behavior with `SET FOREIGN_KEY_CHECKS=1;`)
Source: https://stackoverflow.com/a/17738975
## Import MySQL dump
```
mysql -h HOSTNAME -u USER -p -D DB_NAME -C < dump.sql
```optionally use `-f` to continue despite SQL errors
## Run the database cronjob now
```sh
kubectl -n mariadb create job --from=cronjob/mariadb-backup "mariadb-backup-$(date +"%Y%m%d-%H%M%S")"
kubectl -n mariadb get jobs -w
```## XMPP DNS records
https://prosody.im/doc/dns
record name | TTL | class | type | priority | weight | port | target
_xmpp-client._tcp.example.com | 3600 | IN | SRV | 0 | 5 | 5222 | xmpp.example.com
_xmpp-server._tcp.example.com | 3600 | IN | SRV | 0 | 5 | 5269 | xmpp.example.com## Analyze and optimize MySQL tables
```sh
# To check all tables in all databases:
$ mysqlcheck -h HOST -u root -p --all-databases -c# To analyze all tables in all databases:
$ mysqlcheck -h HOST -u root -p --all-databases -a# To repair all tables in all databases:
$ mysqlcheck -h HOST -u root -p --all-databases -r# To optimize all tables in all databases:
$ mysqlcheck -h HOST -u root -p --all-databases -o# Do the same for a single table
$ mysqlcheck -h HOST -u root -p $DB $TABLE -c/-a/-r/-o
```https://wiki.archlinux.org/title/MariaDB#Checking,_optimizing_and_repairing_databases
## Show size of tables in MySQL database
```mysql
SELECT
TABLE_NAME AS `Table`,
ROUND((DATA_LENGTH + INDEX_LENGTH) / 1024 / 1024) AS `Size (MB)`
FROM
information_schema.TABLES
WHERE
TABLE_SCHEMA = "$DATABASE"
ORDER BY
(DATA_LENGTH + INDEX_LENGTH)
DESC;
```https://chartio.com/resources/tutorials/how-to-get-the-size-of-a-table-in-mysql/
## PVC Debug Pod
```sh
NAMESPACE=xxx
PVC_NAME=xxxkubectl create -f - < "${output}" <