Skip to content

ppigazzini/net-server

Repository files navigation

CI serverCI lint

Net Server

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.

Project structure

.
├── .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

Features

  • 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

Requirements

  • Python 3.13 or higher
  • FastAPI
  • Gunicorn + Uvicorn (for running the server)
  • uv (for project management)

Installation

  1. Clone the repository:

    git clone https://github.com/ppigazzini/net-server.git
    cd net-server
  2. Sync the project with production dependencies:

    uv sync --group prod

Running the Server

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published