ui_poc/README.md

86 lines
1.7 KiB
Markdown
Raw Normal View History

2024-09-06 02:07:07 +00:00
<h1> Dashboard UI </h1>
<h2>Table of Contents</h2>
- [Introduction](#introduction)
- [Deploy Locally](#deploy-locally)
- [Deploy on TFGrid](#deploy-on-tfgrid)
- [DNS Name](#dns-name)
- [Troubleshooting](#troubleshooting)
- [Notes](#notes)
---
2024-09-06 00:50:11 +00:00
## Introduction
This is a proof-of-concept of a basic Dashboard UI in Python using FastApi and HTMX.
## Deploy Locally
```
# Clone the repository
git clone https://git.ourworld.tf/tfgrid/ui_poc
# Go to backend
cd ui_poc/backend
# Set Python environment
python3 -m venv venv
source venv/bin/activate
# Install requirements
python3 -m pip install -r requirements.txt
# Deploy the local website at port 8000
uvicorn main:app --reload
```
2024-09-06 02:07:07 +00:00
## Deploy on TFGrid
You can deploy the website on the TFGrid. Follow those steps before after following the local steps.
- Deploy Full VM Ubuntu 24.04 with IPv4 address and connect into it via SSH
- Prepare the environment
```
apt update && apt install -y git nano curl git python3 python-is-python3 python3-venv python3-pip
```
- Install Caddy
```
apt install -y debian-keyring debian-archive-keyring
apt install -y apt-transport-https
echo "deb [trusted=yes] https://releases.caddyserver.com/deb/ $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/caddy.list
apt update
apt install caddy
```
- Enable and start caddy
```
systemctl enable caddy
systemctl start caddy
```
- Create caddyfile at
```
nano /etc/caddy/Caddyfile
```
- Caddy content:
```
2024-09-06 02:10:02 +00:00
example.com {
2024-09-06 02:07:07 +00:00
reverse_proxy 127.0.0.1:8000
}
```
## DNS Name
Set a DNS A record of your domain URL pointing to the IPv4 address.
## Troubleshooting
- Check the status
```
systemctl status caddy
```
- Check the caddy log
```
journalctl -u caddy
```
## Notes
2024-09-06 01:02:05 +00:00
The .gitignore file is set with `venv` as the Python virtual environment.