This service is made for uploading scanned documents directly into ifirma.pl user account. It is not supported by ifirma.pl in any way. It does not use the ifirma.pl API, it performs its tasks using the Chrome browser and the Selenium library. It was created as a useful example of a microservice running in a docker-compose environment.
Using Python 3.11
There are two different python requirements:
- test requirements - Used for unit tests and code analize
- requirements - used for service
Docker compose contains some additional services providing functionalities for production use.
Simple ftp server. This is useful for network printers with scanner functionality. Scanned document is uploaded to this servers shared directory for processing by ifirma_docs service.
Default FTP credentials (can be changed in docker-compose.yaml)
- user: user
- pass: 123
Used to provide remote browser driver for selenium.
This service is watching shared directory for new files (eg. uploaded via ftp). When file apears in shared directory, it is uploaded to ifirma user account as new document and deleted from shared directory.
make prepare-developCommand will prepare virtual python environment (venv) and install test requirements. Will also run FTP and Chrome docker containers (useful in development)
Preparation will create ./env.develop configured ready to run local development environment. Adjust env variables to your need especially:
IFIRMA__LOGINIFIRMA__PASSWORD
make analyzemake unit.vscode included providing ready to run VSCode launch debug target.
To create defualt (STAGE=test) .env file run:
make env_fileCommand will create .env.test file in env.
To create different stage env file just use env variables:
make env_file STAGE=prodCommand will create .env.prod file in env.
Note
Edit .env file before run
To run fully contenerized environment (default STAGE=test) run:
make runIt is possible to run different stage, just add custom env variable:
make run STAGE=prodIf you didn't run make env_file STAGE=prod before,
.env.prod file will be created with default values
and environment will try to run, so it is better to run make env_file first.
To stop specific stage environment (eg. prod):
make stop STAGE=prod