Skip to content

Commit 5bdd057

Browse files
authored
Merge pull request #11 from python-microservices/feature/doc_update
Updated doc due to py-ms library separation.
2 parents 8636d84 + 7de98f3 commit 5bdd057

File tree

6 files changed

+27
-47
lines changed

6 files changed

+27
-47
lines changed

docs/_static/aws_alias0.png

-23 KB
Binary file not shown.

docs/_static/aws_alias1.png

-35.9 KB
Binary file not shown.

docs/_static/aws_alias2.png

-27.6 KB
Binary file not shown.

docs/_static/aws_environments.png

-42.3 KB
Binary file not shown.

docs/configuration.rst

+2-10
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,8 @@
11
Configuration
22
=============
33

4-
The project is configured in `project/config.py`. You must set the project name `APP_NAME` and the path prefix
5-
of the project `APPLICATION_ROOT`. This constants is defined in the class Config:
6-
7-
.. code-block:: python
8-
9-
class Config:
10-
DEBUG = False
11-
TESTING = False
12-
APP_NAME = "Template"
13-
APPLICATION_ROOT = "/template"
4+
Project configuration is loaded using py-ms library based on yml or json file.
5+
Some example files are config.yml, config-docker.yml and tests/config-tests.yml.
146

157
Documentation
168
-------------

docs/structure.rst

+25-37
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,17 @@ You have a project with this structure:
55

66
.. code-block:: bash
77
8-
manager.py
8+
Dockerfile
9+
LICENSE
10+
manage.py
11+
README.md
912
requirements.txt
1013
requirements-tests.txt
1114
requirements-docker.txt
15+
service.yaml
1216
setup.py
17+
tests.sh
1318
tox.ini
14-
myms
15-
├ healthcheck
16-
│ └ healthcheck.py
17-
├ logger
18-
│ └ logger.py
19-
├ models
20-
│ └ __init__.py
21-
└ tracer
22-
└ main.py
2319
project
2420
├ __init__.py
2521
├ config.py
@@ -33,7 +29,8 @@ You have a project with this structure:
3329
└views
3430
├ __init__.py
3531
└ views.py
36-
32+
docs/
33+
tests/
3734
3835
3936
manager.py
@@ -51,43 +48,34 @@ You can set the host and the port with:
5148
5249
python manage.py runserver -h 0.0.0.0 -p 8080
5350
54-
Common Structure
51+
Common Libraries
5552
----------------
5653

57-
myms/healthcheck/healthcheck.py
58-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
59-
This views is usually used by Kubernetes, Eureka and other systems to check if our application is up and running
54+
py-ms is a library that contains a set of common features for microservices.
6055

61-
myms/logger/logger.py
62-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
63-
Print logger in JSON format to send to server like Elasticsearch. Inject span traces in logger
56+
Structure of a project
57+
----------------------
6458

65-
myms/models/__init__.py
66-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
67-
Initizalize `flask_sqlalchemy.SQLAlchemy object`
59+
For project configuration see :doc:`configuration </configuration>` section.
6860

69-
myms/tracer/main.py
61+
project/models/init_db.py
7062
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
71-
Create an injector `flask_opentracing.FlaskTracer` to use in our projects
72-
73-
Structure of a project
74-
----------------------
63+
Initialize `flask_sqlalchemy.SQLAlchemy object`.
7564

76-
project/__init__.py
77-
~~~~~~~~~~~~~~~~~~~
78-
This file init the project with the funcion `create_app`. Initialize the Flask app, register `blueprints <http://flask.pocoo.org/docs/0.12/blueprints/>`_
79-
and intialize all libraries like Swagger, database, the trace system...
65+
project/models/models.py
66+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
67+
Project specific models.
8068

81-
project/config.py
82-
~~~~~~~~~~~~~~~~~
83-
See :doc:`configuration </configuration>` section
69+
project/swagger/swagger.yaml
70+
~~~~~~~~~~~~~
71+
Use to define your rest behaviour, endpoints and routes. See `connexion <http://connexion.readthedocs.io>`_ docs to how add new views.
8472

8573
project/views
8674
~~~~~~~~~~~~~
8775
use views.py or create your file.
8876

89-
swagger/swagger.yaml
90-
~~~~~~~~~~~~~
91-
Use to define your rest behaviour, endpoints and routes. See `connexion <http://connexion.readthedocs.io>`_ docs to how add new views
92-
77+
project/__init__.py
78+
~~~~~~~~~~~~~~~~~~~
79+
This file init the project calling `create_app` method. Initialize the Flask app, register `blueprints <http://flask.pocoo.org/docs/0.12/blueprints/>`_
80+
and initialize all libraries like Swagger, database, trace system, custom logger format, etc.
9381

0 commit comments

Comments
 (0)