https://github.com/afcms/hexagone_cloud_computing
https://github.com/afcms/hexagone_cloud_computing
kvm libvirt opentofu studies
Last synced: 13 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/afcms/hexagone_cloud_computing
- Owner: AFCMS
- Created: 2026-06-15T07:48:58.000Z (19 days ago)
- Default Branch: master
- Last Pushed: 2026-06-19T17:41:29.000Z (14 days ago)
- Last Synced: 2026-06-19T18:25:55.715Z (14 days ago)
- Topics: kvm, libvirt, opentofu, studies
- Language: HCL
- Homepage:
- Size: 143 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Hexagone - Cloud Computing
Automated OpenTofu/libvirt deployment of a containerized Forgejo application.
[ASSIGNMENT REPORT](./RAPPORT.md)
## Architecture
The lab creates three Ubuntu VMs on a libvirt NAT network. Each service runs in a Docker container deployed by cloud-init.
| VM | IP | Role | Container |
| ---------- | ---------------- | --------------- | ---------- |
| `cc-proxy` | `192.168.101.10` | Reverse proxy | Traefik |
| `cc-app` | `192.168.101.20` | Web application | Forgejo |
| `cc-db` | `192.168.101.30` | Database | PostgreSQL |
Forgejo is exposed through Traefik at:
```text
http://forgejo.cc.local/
```
## Local DNS
Add this line to `/etc/hosts` on the host machine:
```text
192.168.101.10 forgejo.cc.local
```
Without editing `/etc/hosts`, you can test through the proxy IP with an explicit Host header:
```shell
curl -H 'Host: forgejo.cc.local' http://192.168.101.10/
```
## Deployment
Apply the infrastructure:
```shell
tofu apply
```
Destroy the infrastructure:
```shell
tofu destroy
```
## Local libvirt notes
This project defaults to Fedora's modular libvirt socket:
```text
qemu:///system?socket=/var/run/libvirt/virtqemud-sock
```
If your host uses the legacy socket, override it:
```shell
TF_VAR_libvirt_uri='qemu:///system' tofu apply
```
## Tests
After `tofu apply`, wait a few minutes for cloud-init to install Docker and pull the container images.
With `/etc/hosts` configured:
```shell
curl -fsS -I http://forgejo.cc.local/
```
Without `/etc/hosts` configured:
```shell
curl -fsS -H 'Host: forgejo.cc.local' http://192.168.101.10/
```
Expected result:
- Traefik routes HTTP requests to the Forgejo container.
- Forgejo can connect to PostgreSQL.
- The Forgejo initial setup page is available in the browser.
Open `http://forgejo.cc.local/` and create the initial Forgejo administrator account through the setup page.