Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
avara1986 committed Dec 8, 2019
2 parents fc68017 + c9a75b7 commit 1ad7ac2
Show file tree
Hide file tree
Showing 8 changed files with 110 additions and 16 deletions.
52 changes: 44 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,33 +18,69 @@ microservices with Python which handles cross-cutting concerns:

# How to run the scaffold

## Instalation
```bash
virtualenv --python=python[3.6|3.7|3.8] venv
source venv/bin/activate
pip install -r requirements.txt
```

## Run your python script
```bash
python manage.py runserver
```

Open in your browser http://localhost:5000/template/ui/
## Check the result

Your default endpoint will be in this url:
```bash
http://127.0.0.1:5000/template/
```

This URL is setted in your `config.yml`:

```yaml
ms:
DEBUG: false
TESTING: false
APP_NAME: Template
APPLICATION_ROOT : /template # <!---
```

You can acceded to a [swagger ui](https://swagger.io/tools/swagger-ui/) in the next url:
```bash
http://127.0.0.1:5000/template/ui/
```

This PATH is setted in your `config.yml`:

```yaml
pyms:
swagger:
path: "swagger"
file: "swagger.yaml"
url: "/ui/" # <!---
```

Read more info in the documentation page:
https://microservices-scaffold.readthedocs.io/en/latest/

# Docker

Create and push the image
You can dockerize this microservice wit this steps:
* Create and push the image

docker build -t template -f Dockerfile .

Test the image:
* Run the image:

docker run -d -p 5000:5000 template


Push to Kubernetes:

# Kubernetes
You can run this microservice in a Kubernetes cluster with:

kubectl apply -f service.yaml


See a simple tutorial in [the doc](https://microservices-scaffold.readthedocs.io/en/latest/runinkubernetes.html)

## How to contrib

Expand Down
1 change: 1 addition & 0 deletions config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ pyms:
swagger:
path: "swagger"
file: "swagger.yaml"
url: "/ui/"
tracer:
client: "jaeger"
host: "localhost"
Expand Down
6 changes: 5 additions & 1 deletion docs/codeexample.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
Code Examples
=============

See simple examples in https://github.com/python-microservices/pyms/tree/master/examples
* See simple examples in https://github.com/python-microservices/pyms/tree/master/examples

* Build a Chat with 3 Microservices and Kubernetes: https://github.com/python-microservices/microservices-chat

* Build a Chat with 4 Microservices and Docker Compose: https://github.com/avara1986/pivoandcode-2019-11-15
13 changes: 12 additions & 1 deletion docs/configuration.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Configuration
=============

Project configuration is loaded using py-ms package based on yml or json file.
Project configuration is loaded using `PyMS <https://github.com/python-microservices/pyms>`_ package based on yml or json file.
Some example files are config.yml, config-docker.yml and tests/config-tests.yml or see `PyMS configuration <https://py-ms.readthedocs.io/en/latest/configuration/>`_

Documentation
Expand All @@ -12,5 +12,16 @@ The Microservice create a URL to inspect the Swagger documentation of the api in
localhost:5000/[APPLICATION_ROOT]/ui/
This URL is setted in your `config.yml`:

.. code-block:: yaml
ms:
DEBUG: false
TESTING: false
APP_NAME: Template
APPLICATION_ROOT : /template # <!---
Our API Rest work with `connexion <http://connexion.readthedocs.io>`_. You can see connexion docs or the official
`Swagger documentation <https://swagger.io/specification/>`_ to add the syntax to your APIS and create your Swagger docs
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ Content
:maxdepth: 4

installation
runinkubernetes
quickstart
structure
configuration
codeexample
project
runinkubernetes
4 changes: 3 additions & 1 deletion docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ Clone the project
git clone https://github.com/python-microservices/microservices-scaffold.git
Install your virtualenv

.. code-block:: bash
virtualenv --python=python[3.6|3.7|3.8] venv
source venv/bin/activate
pip install -r requirements.txt
python manage.py runserver
Configure your project and the path of your MS. See :doc:`configuration </configuration>` section.

Expand Down
46 changes: 43 additions & 3 deletions docs/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,59 @@ Quickstart
Scaffold
--------

Clone and start this scaffold
Clone the project

.. code-block:: bash
git clone https://github.com/python-microservices/microservices-scaffold.git
cd microservices-scaffold
Install your virtualenv

.. code-block:: bash
virtualenv --python=python[3.6|3.7|3.8] venv
source venv/bin/activate
pip install -r requirements.txt
Run the script

.. code-block:: bash
python manage.py runserver
*Check the result*

Your default endpoint will be in this url:

.. code-block:: bash
http://127.0.0.1:5000/template/
This URL is setted in your `config.yml`:

.. code-block:: yaml
ms:
DEBUG: false
TESTING: false
APP_NAME: Template
APPLICATION_ROOT : /template # <!---
You can acceded to a `swagger ui <https://swagger.io/tools/swagger-ui/>`_ in the next url:

.. code-block:: bash
http://127.0.0.1:5000/template/ui/
This PATH is setted in your `config.yml`:

Open in your browser http://localhost:8080/template/ui/
.. code-block:: yaml
pyms:
swagger:
path: "swagger"
file: "swagger.yaml"
url: "/ui/" # <!---
Template
--------
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Flask-SQLAlchemy==2.4.1
SQLAlchemy==1.3.11
Flask-Script==2.0.6
py-ms==1.4.1
py-ms==1.5.0

0 comments on commit 1ad7ac2

Please sign in to comment.