3 KiB
ilo pali lili
Backend for orchestrating deployment of censorship circumvention resources.
Local Development
Setup just
MacOS:
brew install just
Debian/Ubuntu:
apt install just
Others: link
Setup poetry
pip install poetry
Other ways: link
Setup Postgres (16.3)
just up
Copy the environment file and install dependencies
cp .env.example .envpoetry install
Run the uvicorn server
With default settings:
just run
With extra configs (e.g. logging file)
just run --log-config logging.ini
Linters
Format the code with ruff --fix and ruff format
just lint
Migrations
- Create an automatic migration from changes in
src/database.py
just mm *migration_name*
- Run migrations
just migrate
- Downgrade migrations
just downgrade downgrade -1 # or -2 or base or hash of the migration
Deployment
Deployment is done with Docker and Gunicorn. The Dockerfile is optimized for small size and fast builds with a non-root user. The gunicorn configuration is set to use the number of workers based on the number of CPU cores.
Example of running the app with docker compose:
docker compose -f docker-compose.prod.yml up -d --build
Conventions
This project uses the FastAPI best practices documented by GitHub user zhanymkanov and was originally created from their template.
Copyright
Copyright © 2025 SR2 Communications Limited.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
