Skip to content

Conversation

@pyup-bot
Copy link
Collaborator

This PR updates py-ms from 2.1.0 to 2.2.0.

Changelog

2.2.0

**Features**
- **Create project from scaffold** 90
PyMS has a command line option to create a project template like [Microservices Scaffold](https://github.com/python-microservices/microservices-scaffold).
This command use [cookiecutter](https://github.com/cookiecutter/cookiecutter) to download and install this [template](https://github.com/python-microservices/microservices-template)
**[Warning]** You must run first `pip install cookiecutter==1.7.0`
bash
pyms startproject

this output a lot of options step by step:
bash
project_repo_url [https://github.com/python-microservices/microservices-scaffold]: 
project_name [Python Microservices Boilerplate]: example project
project_folder [example_project]: 
project_short_description [Python Boilerplate contains all the boilerplate you need to create a Python package.]: 
create_model_class [y]: 
microservice_with_swagger_and_connexion [y]: 
microservice_with_traces [y]: 
microservice_with_metrics [y]: 
application_root [/example_project]: 
Select open_source_license:
1 - MIT license
2 - BSD license
3 - ISC license
4 - Apache Software License 2.0
5 - GNU General Public License v3
6 - Not open source
Choose from 1, 2, 3, 4, 5, 6 [1]: 

When you finish to introduce the options, a project will be created in `[project_folder]` folder

- **Encrypt/decrypt config** (86)
- New encryption and decryption feature with [AES](https://en.wikipedia.org/wiki/Advanced_Encryption_Standard)
- Create a key to encrypt config with new command line `pyms create-key`
- Encrypt a string with the new command line `pyms encrypt [STRING]`
- Set the key file with new environment variable `KEY_FILE`
- If you set in your config a var with the prefix "ENC_" or "enc_" PyMS search for the key file and decrypt the string. Now you can encrypt your database url for production environments. I.E.:
yaml
pyms:
[...]
config:
ENC_DATABASE: gAAAAABeSZ714r99iRIxhoH77vTdRJ0iqSymShfqgGN9PJveqhQWmshRDuV2a8sATey8_lHkln0TwezczucH-aJHGP_LyEiPxwM-88clNa7FB1u4g7Iaw3A=

you can access it in your code with `current_app.config["DATABASE"] == "http://database-url"`

- **Human readable config errors** 85
Show more help information if the config file not have a good structure with error messages like


Config file must start with `pyms` keyword, for example:
pyms:
 services:
 metrics: true
 requests:
 data: data
 swagger:
 path: ""
 file: "swagger.yaml"
 tracer:
 client: "jaeger"
 host: "localhost"
 component_name: "Python Microservice"
 config:
 DEBUG: true
 TESTING: true

- **Add service name label by default** 84 - alexppg 
It adds a label to all jaeger's generated metrics that can be used to identify every microservice.
See jaegertracing/jaeger-client-python269.
I messed up the previous PR, it's the same as this. https://github.com/python-microservices/pyms/pull/72

**Fixes**
- Send `path` to `ConfFile` from `Microservice` class to set path from code if you want to not use `CONFIGMAP_FILE` from env

**Refactors**
- Refactor config. Memoize of files moved to new class
Links

@coveralls
Copy link

Pull Request Test Coverage Report for Build 589

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 71.739%

Totals Coverage Status
Change from base Build 586: 0.0%
Covered Lines: 99
Relevant Lines: 138

💛 - Coveralls

@avara1986 avara1986 merged commit 237b098 into master Feb 25, 2020
@avara1986 avara1986 deleted the pyup-update-py-ms-2.1.0-to-2.2.0 branch March 8, 2020 19:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants