# Containers

## Setup the project

* Create [new github repo](https://github.com/new):\
  ![](https://412027953-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LBulIh9Wa6TPIk4F7x5%2F-LBulwFWKqpOjjszN_cy%2F-LBulyyMg52qJrlJ4BRE%2Fcreate-github-repo-for-project.png?generation=1525699591984392\&alt=media)
* Clone repo:

  ```
  git clone https://github.com/denseidel/consumer-marketplace-service.git
  cd consumer-marketplace-service
  git secrets --install
  git secrets --register-aws
  ```
* Start a virtual environment

  ```
  virtualenv venv --python=python3
  source venv/bin/activate
  # install pylint 
  pip install pylint
  ```

  If you use visual studio code do this first in your terminal window and then open the folder again with `code .`.

## Developer a docker microservice in Python

1. Check that you have have a local docker environment in [Plattform](https://den.gitbook.io/developerplaybook/plattform) -> Setup Docker Environment.
2. Create Dockerfile and docker-compose that starts the Mock Server([Code](https://github.com/denseidel/products-marketplace-service/commit/6303f0ba152be610dc4fabcf85d624a4e32faa31)) - make sure the Swagger  file does not include custom functions like `x-tokenInfoFunc`. **TODO create it for the mock**&#x20;
   * [Environment Variables to connect to AWS](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html)
3. Implement Frontend against mocks
4. Update Dockerfile to production config
5. Implement API (including DB, ...)

Connexion Examples:

* <https://github.com/hjacobs/connexion-example>
* <https://github.com/ssola/python-flask-microservice>
* <http://blog.bejanalex.com/2017/03/mongodb-rest-api-interface-in-docker/>

Create a client library for the API:

* <https://realpython.com/blog/python/api-integration-in-python/>

Use Feature flags:

* <https://featureflags.io/python-feature-flags/>

Python Testing:

* Unit Testing
* Mocks
* Code Coverage

Python Functional Programming:

* <https://maryrosecook.com/blog/post/a-practical-introduction-to-functional-programming>

Python Clean Code:

* <http://pythonforengineers.com/writing-great-code/>
* <https://github.com/zedr/clean-code-python>
* [https://github.com/rmariano/Clean-code-in-Python/blob/master/build/Clean code in Python.pdf](https://github.com/rmariano/Clean-code-in-Python/blob/master/build/Clean%20code%20in%20Python.pdf)
* <http://docs.python-guide.org/en/latest/writing/reading/>

Benefits API First:

![](https://412027953-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LBulIh9Wa6TPIk4F7x5%2F-LBulwFWKqpOjjszN_cy%2F-LBum-1PWDj4NY-NNESI%2Fadvantages-of-api-first.png?generation=1525699591870428\&alt=media)

<https://github.com/swagger-api/swagger-codegen/wiki/server-stub-generator-howto#python-flask-connexion>

<http://connexion.readthedocs.io/en/latest/cli.html>

<https://blog.runscope.com/posts/openapi-swagger-resource-list-for-api-developers>

<https://medium.com/ibm-data-science-experience/deploy-your-python-functions-as-a-rest-api-811981ec7ec5>

<https://github.com/zalando/connexion>

<http://michal.karzynski.pl/blog/2016/06/19/building-beautiful-restful-apis-using-flask-swagger-ui-flask-restplus/>

<https://cidrblock.github.io/zero-to-api-in-4-minutes.html>

Beispiel: <https://github.com/hjacobs/connexion-example>

### Develop API First in Python

Get started with Connextion: <http://connexion.readthedocs.io/en/latest/quickstart.html>

<https://github.com/zalando/connexion>

<https://github.com/hjacobs/connexion-example>

<https://cidrblock.github.io/zero-to-api-in-4-minutes.html>

<https://github.com/ssola/python-flask-microservice/blob/master/api/room.py>

<https://medium.com/@ssola/building-microservices-with-python-part-i-5240a8dcc2fb>

<http://coderobot.downley.net/swagger-driven-testing-in-python.html>

<https://uwsgi-docs.readthedocs.io/en/latest/>

<http://connexion.readthedocs.io/en/latest/routing.html>

* <https://medium.com/@ssola/building-microservices-with-python-part-i-5240a8dcc2fb>
* <https://github.com/hjacobs/connexion-example/blob/master/app.py>
* <http://connexion.readthedocs.io/en/latest/request.html>
* Check a token: <https://auth0.com/docs/api-auth/tutorials/verify-access-token>

API Sources / public api collection: <https://any-api.com>

<https://www.programmableweb.com/apis/directory>

<https://apis.guru/browse-apis/>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://den.gitbook.io/developerplaybook/services-api/containers.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
