Branch | Status |
---|---|
develop | |
master |
- Summary of the project
- How to run locally
- Versioning
- Endpoints
- Deploying the project and continuous integration
Height and profile services for http://api3.geo.admin.ch
The Make targets assume you have bash, curl, python3.9, pipenv, docker installed.
First, you'll need to clone the repo
git clone git@github.com:geoadmin/service-alti.git
Then, you can run the setup target to ensure you have everything needed to develop, test and serve locally
make setup
That's it, you're ready to work.
In order to have a consistent code style the code should be formatted using yapf
. Also to avoid syntax errors and non
pythonic idioms code, the project uses the pylint
linter. Both formatting and linter can be manually run using the
following command:
make format-lint
Formatting and linting should be at best integrated inside the IDE, for this look at Integrate yapf and pylint into IDE
Testing if what you developed work is made simple. You have four targets at your disposal. test, serve, gunicornserve, dockerrun
make test
This command run the integration and unit tests.
make serve
This will serve the application through Flask without any wsgi in front.
make gunicornserve
This will serve the application with the Gunicorn layer in front of the application
make dockerrun
This will serve the application with the wsgi server, inside a container. To stop serving through containers,
make shutdown
Is the command you're looking for.
This service uses SemVer as versioning scheme. The versioning is automatically handled by .github/workflows/main.yml
file.
See also Git Flow - Versioning for more information on the versioning guidelines.
this is a simple route meant to test if the server is up.
http://api3.geo.admin.ch/services/sdiservices.html#height
http://api3.geo.admin.ch/services/sdiservices.html#profile
When creating a PR, it should run a codebuild job to test, build and push automatically your PR as a tagged container.
This service is to be deployed to the Kubernetes cluster once it is merged.
TO DO: give instructions to deploy to kubernetes.
The service is configured by Environment Variable:
Env | Default | Description |
---|---|---|
HTTP_PORT | '5000' |
HTTP port of the service |
LOGGING_CFG | 'logging-cfg-local.yml' |
Logging configuration file |
LOGS_DIR | './logs' |
Directory for logging output files |
DTM_BASE_PATH | '/var/local/profile/' |
Raster and COMB files location |
PRELOAD_RASTER_FILES | False |
Preload raster files at startup. If not set they will be loaded during first request |
ALTI_WORKERS | 0 |
Number of workers. 0 or negative value means that the number of worker are computed from the number of cpu |
DFT_CACHE_HEADER | public, max-age=86400 |
Default cache settings for successful GET, HEAD and OPTIONS requests |
GUNICORN_WORKER_TMP_DIR | None |
This should be set to an tmpfs file system for better performance. See https://docs.gunicorn.org/en/stable/settings.html#worker-tmp-dir. |