Add site build

This commit is contained in:
Tyler Perkins 2024-11-15 20:59:06 -05:00
parent 967cb6d719
commit cf825d03f3
Signed by: tyler
GPG Key ID: 03B27509E17EFDC8
16 changed files with 189 additions and 28 deletions

7
.ci/Dockerfile Normal file
View File

@ -0,0 +1,7 @@
FROM nginx:latest
COPY nginx.conf /etc/nginx/nginx.conf
COPY ./static /var/www/static
RUN nginx -t

25
.ci/nginx.conf Normal file
View File

@ -0,0 +1,25 @@
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
server {
listen 80;
#server_name localhost;
root /var/www/static;
index index.html;
location / {
try_files $uri $uri/ =404;
}
}
}

0
.ci/static/.gitkeep Normal file
View File

3
.gitignore vendored
View File

@ -3,3 +3,6 @@
*~ *~
private.pem private.pem
venv/ venv/
./.ci/static/
!./.ci/static/.gitkeep

View File

@ -0,0 +1,64 @@
- name: Bootstrap docker
hosts: k3s_masters
become: yes
vars_files:
# Secrets
- ../secrets/gluttonycluster-credentials.yaml
tasks:
- name: Update the apt package index
apt:
update_cache: yes
tags: docker
- name: Install packages to allow apt to use a repository over HTTPS
apt:
name:
- ca-certificates
- curl
- gnupg
- lsb-release
state: present
tags: docker
- name: Download Docker's GPG key
ansible.builtin.get_url:
url: https://download.docker.com/linux/ubuntu/gpg
dest: /usr/share/keyrings/docker-archive-keyring.gpg
mode: '0644'
tags: docker
- name: Set up the stable Docker repository
ansible.builtin.lineinfile:
path: /etc/apt/sources.list.d/docker.list
line: "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu {{ ansible_distribution_release }} stable"
create: yes
tags: docker
- name: Update the apt package index after adding Docker repository
apt:
update_cache: yes
tags: docker
- name: Install Docker Engine
apt:
name:
- docker-ce
- docker-ce-cli
- containerd.io
state: latest
tags: docker
- name: Ensure Docker is started and enabled
service:
name: docker
state: started
enabled: yes
tags: docker
- name: Add user to docker group (optional)
ansible.builtin.user:
name: "{{ ansible_user }}"
groups: docker
append: yes
tags: docker

54
ansible/run-playbook.sh Executable file
View File

@ -0,0 +1,54 @@
#!/bin/bash
PLAYBOOK_DIR="./playbooks"
# Ensure gum is installed
if ! command -v gum &> /dev/null; then
echo "gum could not be found. Please install gum first."
exit 1
fi
# Ensure pass is installed
if ! command -v pass &> /dev/null; then
echo "pass could not be found. Please install pass first."
exit 1
fi
echo "Fetching ansible-vault password"
VAULT_PASS=$(pass show gluttony-cluster/ansible-vault)
if [[ -z "$VAULT_PASS" ]]; then
echo "Failed to retrieve Ansible Vault password from pass."
exit 1
fi
# Create a list of playbooks in the specified directory
PLAYBOOKS=$(ls -1 "$PLAYBOOK_DIR"/*.yaml 2> /dev/null)
if [[ -z "$PLAYBOOKS" ]]; then
echo "No playbooks found in $PLAYBOOK_DIR."
exit 1
fi
# Use gum to select a playbook
SELECTED_PLAYBOOK=$(echo "$PLAYBOOKS" | gum choose)
if [[ -z "$SELECTED_PLAYBOOK" ]]; then
echo "No playbook selected. Exiting."
exit 1
fi
# Confirmation step with gum
echo "You selected: $SELECTED_PLAYBOOK"
if ! gum confirm "Are you sure you want to run this playbook? ($SELECTED_PLAYBOOK)"; then
echo "Operation cancelled. Exiting."
exit 1
fi
# Run the selected playbook with the Ansible Vault password
echo "Running playbook: $SELECTED_PLAYBOOK"
ANSIBLE_VAULT_PASSWORD_FILE=$(mktemp)
echo "$VAULT_PASS" > "$ANSIBLE_VAULT_PASSWORD_FILE"
ansible-playbook -i inventory.yaml "$SELECTED_PLAYBOOK" --vault-password-file "$ANSIBLE_VAULT_PASSWORD_FILE"
# Clean up the temporary password file
rm -f "$ANSIBLE_VAULT_PASSWORD_FILE"

View File

@ -2,8 +2,6 @@
Welcome to the documentation for my k3s cluster, aka my datacenter at home. Welcome to the documentation for my k3s cluster, aka my datacenter at home.
If you are looking for user documentation, navigate to [the user docs](./user/index.md)
## About this project ## About this project
This project is a small datacenter that I run in my house. This project is a small datacenter that I run in my house.

View File

@ -2,5 +2,7 @@
Try and stick to these, so our life is a bit easier. Try and stick to these, so our life is a bit easier.
- Place all components in their own namespace
- Place all system components into a `*-system` namespace - Place all system components into a `*-system` namespace
- Place all "User apps (aka tier 2)" into the default namespace
- Folder per service
- Minimal to no cluster modification (keep everything in version control)

4
docs/user/calendar.md Normal file
View File

@ -0,0 +1,4 @@
# Calendar
> [!NOTE]
>

0
docs/user/contacts.md Normal file
View File

0
docs/user/davx5.md Normal file
View File

View File

@ -1,19 +0,0 @@
# User Documentation
Welcome to the user facing documentation! This documentation is intended for those
utilizing one of my services I host for friends and family.
## FAQ
### How do I register an account?
See [Registering an account](./account.md)
### How do I request media?
See [Requesting Media](./request.md)
### How do I download media?
See [Downloading Media](./download.md)

19
docs/user/radicale.md Normal file
View File

@ -0,0 +1,19 @@
# Radicale
[Radicale](https://radicale.org/v3.html) is a calendar, contact, and TODO list server.
It provides a centeralized place
to store all these things so that they can be backed up and sync across devices.
To get started with radicale, request an account, then login in at [cal.clortox.com](cal.clortox.com).
You can bookmark this page, as anytime you may want to create new calendars, address books, todo lists,
or more, this is where you will have to go.
## Usage
- [Davx5 (Required for use on android devices)](davx5.md)
- [Calendar Setup](calendar.md)
- [Contacts Setup](contacts.md)
- [TODO Setup](todo.md)

0
docs/user/todo.md Normal file
View File

View File

@ -7,20 +7,24 @@ repo_url: https://git.clortox.com/Infrastructure/Gluttony-Cluster
edit_uri: src/branch/main/docs edit_uri: src/branch/main/docs
nav: nav:
- Introduction:
- Overview: index.md
- Cluster Architecture: architecture.md
- Setup Cluster: setup.md
- User Documentation: - User Documentation:
- Overview: user/index.md - Overview: index.md
- Accounts: - Accounts:
- Registering a mail account: user/mailcow.md - Registering a mail account: user/mailcow.md
- Registering an account: user/account.md - Registering an SSO account: user/account.md
- Registering a radicale account: user/radicale.md
- Media: - Media:
- Requesting Media: user/request.md - Requesting Media: user/request.md
- Downloading Media: user/download.md - Downloading Media: user/download.md
- Radicale (Calendars, contacts, etc):
- Android Phone Sync (DAVX5): user/davx5.md
- Making a Calendar: user/calendar.md
- Making a Contact Book: user/contacts.md
- Making a TODO List: user/todo.md
- Technical: - Technical:
- Overview: technical/index.md - Overview: technical/index.md
- Cluster Architecture: architecture.md
- Setup Cluster: technical/setup.md
- Conventions: technical/conventions.md - Conventions: technical/conventions.md
- Tier 0 (Infrastructure): - Tier 0 (Infrastructure):
- MetalLB: technical/metallb.md - MetalLB: technical/metallb.md