This is a FastAPI-based server for uploading and validating neural network files used by Stockfish chess engine. The server accepts files, validates their content, and stores them g-zip compressed on the server.
.
├── .editorconfig
├── .github
│ └── workflows
│ ├── lint.yaml
│ └── server.yaml
├── .gitignore
├── .python-version
├── LICENSE
├── README.md
├── pyproject.toml
├── scripts
│ ├── aws_nets_backup.py
│ ├── nets_hashes_check.py
│ └── update_server.sh
├── server
│ ├── __init__.py
│ └── main.py
├── tests
│ └── test_server.py
└── uv.lock
- Upload neural network files
- Validate file content using SHA-256 hash
- Save g-zipped network files
- Handle various error scenarios with appropriate HTTP status codes
- Python 3.13 or higher
- FastAPI
- Gunicorn + Uvicorn (for running the server)
- uv (for project management)
-
Clone the repository:
git clone https://github.com/ppigazzini/net-server.git cd net-server
-
Sync the project with production dependencies:
uv sync --group prod
Use this systemd unit file to run the server with a nginx proxy server:
[Unit]
Description=fastapi server for chess engine networks
After=network.target
[Service]
Type=simple
ExecStart=/home/<username>/net-server/.venv/bin/gunicorn main:app --timeout 120 --workers 4 --worker-class uvicorn.workers.UvicornWorker
Restart=on-failure
RestartSec=3
User=<username>
WorkingDirectory=/home/<username>/net-server/server
[Install]
WantedBy=multi-user.target