- Usage scenarios:
- Service team users: upload update binary files and publish update manifests
- Desktop applications: check update manifest, download the update if necessary
- Load expectations:
- Desktop applications are running on tens to hundreds workplaces
- Every application checks for an update once per 10 minutes
- A new version gets published on a bi-weekly or a monthly basis
- User management:
- Not required
- Application key + whitelists is enough for the service team
37 man-hours
-
# install uv uv sync uv tool run pre-commit install - In IDE, do not forget to select the environment from
.venv
- Copy .env.example to .env
- Set the following variables:
- app_api_key
- app_crm_url_base - CRM or mock URL not including '/1/validate-token'
python -m app
docker compose up -d --build
- Run
docker compose upto launch a local PostgreSQL instance - Make sure the database
autotestexists (create if necessary) - Run
pytestand make sure all tests are passing
ruff checkmypy app
- OpenAPI specification: /openapi.json
- Swagger UI: /docs
- ReDoc: /redoc
docker build --tag app-update-service-test --target test .docker run --rm app-update-service-test ruff checkdocker run --rm app-update-service-test mypy appdocker run --rm app-update-service-test pytest tests/unit
docker build --tag app-update-service .
- Obtain PosgreSQL connection parameters: host, port, user, password, DB name
- Arrange file storage for update files with access for uid=1000 gid=1000
sudo chown 1000:1000 /path/to/file_storage
- Arrange file storage for log files with access for uid=1000 gid=1000
sudo chown 1000:1000 /path/to/log_storage
- Prepare environment variables:
- app_host - bind application socket to this host
- app_port - bind application socket to this port
- postgres_host
- postgres_port
- postgres_user
- postgres_password
- postgres_db - DB name
- app_api_key - key for accessing API service endpoints (normally one would just generate a new secure key)
- app_crm_url_base - base URL of CRM (not including /1/validate-token)
- logger_file_max_size - rotate log file on this size, bytes, default 0 (rotation is off)
- logger_file_backup_count - keep this number of old log files during rotation, default 0 (rotation is off)
- Run database mirgations passing environment variables:
docker run --env-file .env --rm app-update-service bash -c "alembic upgrade head"
- Run the application passing environment variables and mounting the two file storages to container's
/persistent/file_storageand/persistent/log_storage:docker run -d --env-file .env -p 8080:8080 -v /path/to/file_storage:/persistent/file_storage -v /path/to/log_storage:/persistent/log_storage app-update-service
- For a docker compose example, see docker-compose-deploy-example.yml