ui_poc/README.md
2024-09-05 22:07:07 -04:00

1.7 KiB

Dashboard UI

Table of Contents


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

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:
ui.threefold.pro {
	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

The .gitignore file is set with venv as the Python virtual environment.