- start a local smtp server, in a terminal, type docker run -p 1080:80 -p 1025:25 maildev/maildev
- start the web services server, see https://github.com/nicolas-sarramagna/example_reporting_web_services
- from the source code,
- in a terminal, type export PYTHONPATH=.;python example_reporting_main/main.py
See the file config.cfg for the configuration of the smtp server (smtp gmail for example) to send the mail in a real mailblox.
or
- with docker, type docker-compose up
See the folder docker_config_dev for the configuration files (config.cfg and logging.cfg)
The main function consumes the endpoints of the api server, creates the html message and sends the email.
So, by default, the email is visible on the maildev webmail on http://localhost:1080
Complete and export the variables var_email_sender, var_email_receiver, var_secure_mode_login, var_secure_mode_pwd.
Type in a terminal
export var_email_sender= ; export var_email_receiver= ; export var_secure_mode_login= ; export var_secure_mode_pwd= ;
and type
type docker-compose -f prod_env.yml
See the folder docker_config_prod for the configuration files (config.cfg and logging.cfg)
CircleCI does not support the Docker volumes natively (see this link for ex).
Here, i use a workaround to call the the prod folder in the main function (-> example_reporting_main/main.py + base_logger.py) with an optional enviromnent variable (declared in the file prod_env_circleci.yml).
The circleci config file config.yml contains the job named send-report (with the command docker-compose -f prod_env_circleci.yml up) and the workflow named daily with the definition of the trigger : at 9:00 AM every day.