Tip
To report bugs, please create an issue.
An analysis tool for powering data centers with solar, wind and gas.
For commercial usage requests, you can fill out this form here.
You can check out the site at gigawatt-datacenter.com OR run it locally with.
pip install uv
uv venv
then
uv pip install -r requirements.txt
then
cd app
python app.py
Inspired by a blog from Austin Vernon.
To manage the Gradio app as a systemd service, follow these steps:
-
Create a new user for running the app:
sudo adduser gigawatt-datacenter
-
Change ownership of the project directory:
sudo chown -R gigawatt-datacenter:gigawatt-datacenter /var/www/gigawatt-datacenter
-
Create a systemd service file:
sudo nano /etc/systemd/system/gigawatt-datacenter.service
-
Add the following content to the file:
[Unit] Description=Gigawatt Data Center Gradio App After=network.target [Service] User=gigawatt-datacenter WorkingDirectory=/var/www/gigawatt-datacenter ExecStart=/var/www/gigawatt-datacenter/.venv/bin/python /var/www/gigawatt-datacenter/app/app.py Restart=always RestartSec=10 [Install] WantedBy=multi-user.target
-
Save and close the file (in nano: Ctrl + X, then Y, then Enter).
-
Reload the systemd daemon:
sudo systemctl daemon-reload
-
Enable the service to start on boot:
sudo systemctl enable gigawatt-datacenter.service
-
Start the service:
sudo systemctl start gigawatt-datacenter.service
Use these commands to manage the Eire Data Gradio app service:
-
Check the status of the service:
sudo systemctl status gigawatt-datacenter.service
-
Start the service:
sudo systemctl start gigawatt-datacenter.service
-
Stop the service:
sudo systemctl stop gigawatt-datacenter.service
-
Restart the service:
sudo systemctl restart gigawatt-datacenter.service
-
View service logs:
sudo journalctl -u gigawatt-datacenter.service
To update the application with the latest code:
-
SSH into the server:
ssh user@your_server_ip
-
Navigate to the project directory:
cd /var/www/gigawatt-datacenter
-
Pull the latest changes from Git:
git pull origin main
-
Install any new dependencies:
source dataEnv/bin/activate pip install -r requirements.txt
-
Restart the service to apply changes:
sudo systemctl restart gigawatt-datacenter.service
To check the application logs for errors:
-
View the systemd service logs:
sudo journalctl -u gigawatt-datacenter.service
-
Check Nginx error logs:
sudo tail -f /var/log/nginx/error.log
-
Check Nginx access logs:
sudo tail -f /var/log/nginx/access.log
-
To check which process is using port 7860:
sudo lsof -i :7860
-
To restart Nginx:
sudo systemctl restart nginx
-
Install Nginx if not already installed:
sudo apt update sudo apt install nginx
-
Create a new Nginx server block configuration:
sudo nano /etc/nginx/sites-available/gigawatt-datacenter
-
Add the following content to the file:
server { listen 80; server_name gigawattdatacenter.com www.gigawattdatacenter.com; location / { proxy_pass http://localhost:7860; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; } }
-
Create a symbolic link to enable the site:
sudo ln -s /etc/nginx/sites-available/gigawatt-datacenter /etc/nginx/sites-enabled/
-
Test Nginx configuration:
sudo nginx -t
-
If the test is successful, restart Nginx:
sudo systemctl restart nginx
To review your Nginx settings for gigawattdatacenter.com:
-
View the Nginx configuration file:
sudo cat /etc/nginx/sites-available/gigawatt-datacenter
-
Check if the symbolic link exists:
ls -l /etc/nginx/sites-enabled/gigawatt-datacenter
-
Verify Nginx is listening on port 80:
sudo netstat -tlnp | grep nginx
-
Check Nginx error logs for any issues:
sudo tail -f /var/log/nginx/error.log
Remember to always check the logs after restarting the server to ensure everything is running correctly.