Lawal Idris
12/30/2024, 5:05 PMMarvin
12/30/2024, 5:05 PMbash
   prefect cloud loginprefect cloud loginLawal Idris
12/30/2024, 5:08 PMMarvin
12/30/2024, 5:08 PM<http://127.0.0.1:4200/api>bash
prefect server startbash
prefect config set PREFECT_API_URL="<http://127.0.0.1:4200/api>"bash
prefect config viewLawal Idris
12/30/2024, 5:22 PMLawal Idris
12/30/2024, 5:33 PMMarvin
12/30/2024, 5:34 PMbash
PREFECT_SERVER_API_HOST="0.0.0.0" prefect server startbash
   # For UFW (Ubuntu's default firewall)
   sudo ufw allow 4200
   
   # For iptables
   sudo iptables -A INPUT -p tcp --dport 4200 -j ACCEPTbash
   prefect config set PREFECT_API_URL="<http://YOUR_VPS_IP:4200/api>"nginx
server {
    listen 443 ssl;
    server_name <http://your.domain.com|your.domain.com>;
    ssl_certificate /path/to/cert.pem;
    ssl_certificate_key /path/to/key.pem;
    location / {
        proxy_pass <http://localhost:4200;>
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
    }
}bash
prefect config set PREFECT_API_URL="<https://your.domain.com/api>"Lawal Idris
12/30/2024, 5:45 PMMarvin
12/30/2024, 5:45 PMbash
PREFECT_SERVER_API_HOST="0.0.0.0" prefect server startbash
prefect config set PREFECT_API_URL="<http://YOUR_VPS_ACTUAL_IP:4200/api>"bash
curl <http://ifconfig.me|ifconfig.me>
# or
ip addr showbash
ping YOUR_VPS_ACTUAL_IPbash
telnet YOUR_VPS_ACTUAL_IP 4200Lawal Idris
12/30/2024, 7:21 PMMarvin
12/30/2024, 7:21 PMbash
prefect config view<>bash
prefect config set PREFECT_API_URL="<http://123.456.789.10:4200/api>"bash
netstat -tulpn | grep 4200bash
sudo ufw status
# or
sudo iptables -Lbash
curl <http://YOUR_VPS_IP:4200/api/health>bash
telnet YOUR_VPS_IP 4200prefect config viewLawal Idris
12/30/2024, 7:40 PMMarvin
12/30/2024, 7:40 PMpython
from prefect.client.orchestration import get_client
async def test_connection():
    client = await get_client()
    try:
        health = await client.api_healthcheck()
        print(f"Connection successful! Health check: {health}")
    except Exception as e:
        print(f"Connection failed with error: {e}")
if __name__ == "__main__":
    import asyncio
    asyncio.run(test_connection())test_prefect.pybash
python test_prefect.py~/.prefect/prefect.logLawal Idris
12/30/2024, 7:42 PMMarvin
12/30/2024, 7:43 PMpython
from prefect.client.orchestration import PrefectClient
import asyncio
async def test_connection():
    client = PrefectClient()
    try:
        health = await client.api_healthcheck()
        print(f"Connection successful! Health check: {health}")
    except Exception as e:
        print(f"Connection failed with error: {e}")
if __name__ == "__main__":
    asyncio.run(test_connection())bash
prefect server health-checkecho $PREFECT_API_URLLawal Idris
12/30/2024, 7:59 PMMarvin
12/30/2024, 7:59 PMpython
import httpx
import asyncio
async def test_server():
    # Your VPS IP and port
    url = "<http://YOUR_VPS_IP:4200/api/health>"
    
    try:
        async with httpx.AsyncClient() as client:
            response = await client.get(url)
            print(f"Status Code: {response.status_code}")
            print(f"Response: {response.text}")
    except Exception as e:
        print(f"Error: {e}")
if __name__ == "__main__":
    asyncio.run(test_server())bash
# Check if the process is running
ps aux | grep prefect
# Check which ports are being listened to
sudo lsof -i :4200
# Check the server logs
tail -f ~/.prefect/prefect.logbash
# Show all Prefect-related environment variables
env | grep PREFECT
# Show current Prefect configuration
prefect config viewps aux | grep prefectprefect config view