Skip to content

Commit

Permalink
feat(api): Add zappa
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Moreno authored and photonbit committed Jul 1, 2021
1 parent 97789da commit 4352dc9
Show file tree
Hide file tree
Showing 10 changed files with 46 additions and 39 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

# Giges

The one hundred arms giant in charge of Tesselo's integrations
The one hundred arms giant in charge of Tesselo integrations

## Install runtime dependencies

Expand Down
6 changes: 3 additions & 3 deletions dev_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This file is autogenerated by pip-compile with python 3.9
# This file is autogenerated by pip-compile with python 3.8
# To update, run:
#
# pip-compile --output-file=./dev_requirements.txt dev_requirements.in
Expand All @@ -12,9 +12,9 @@ attrs==21.2.0
# via pytest
black==21.6b0
# via -r dev_requirements.in
boto3==1.17.101
boto3==1.17.102
# via -r dev_requirements.in
botocore==1.20.101
botocore==1.20.102
# via
# boto3
# s3transfer
Expand Down
7 changes: 4 additions & 3 deletions giges/app.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import connexion
from connexion_compose import compile_schema
from connexion.apps.flask_app import FlaskApp
from connexion.resolver import RestyResolver
from flask import Flask
Expand All @@ -10,11 +9,11 @@ def create_app(self):
return app

def create_connexion_app():
connexion_app = App(__package__)
connexion_app = App(__package__, specification_dir="schemas/")
flask_app = connexion_app.app

connexion_app.add_api(
compile_schema('giges/schemas'),
"api.yml",
validate_responses=True,
strict_validation=True,
resolver=RestyResolver("giges.handlers")
Expand All @@ -23,3 +22,5 @@ def create_connexion_app():
return connexion_app


def create_flask_app():
return create_connexion_app().app
17 changes: 10 additions & 7 deletions giges/schemas/api.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
openapi: '3.0.2'
swagger: ''
openapi: '3.0.3'
info:
title: Tesselo Giges integrations API
description: 'One giant with 50 heads and 100 arms'
version: 0.0.1
contact:
name: Tesselo integrations
x-slack: '#tech-team'
Expand All @@ -13,8 +13,11 @@ servers:

security: []

basePath: ''
consumes: ''
produces: ''
schemes: ''
definitions: ''
paths:
/ping:
get:
operationId: giges.handlers.health.ping
summary: Pong that ping
responses:
200:
description: 'Health check result'
16 changes: 0 additions & 16 deletions giges/schemas/paths/health.yml

This file was deleted.

2 changes: 0 additions & 2 deletions requirements.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
connexion[swagger-ui]
flask<2.0
zappa
typing
git+https://gitlab.com/jsmesami/connexion-compose
10 changes: 4 additions & 6 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This file is autogenerated by pip-compile with python 3.9
# This file is autogenerated by pip-compile with python 3.8
# To update, run:
#
# pip-compile --output-file=./requirements.txt requirements.in
Expand All @@ -8,11 +8,11 @@ argcomplete==1.12.3
# via zappa
attrs==21.2.0
# via jsonschema
boto3==1.17.101
boto3==1.17.102
# via
# kappa
# zappa
botocore==1.20.101
botocore==1.20.102
# via
# boto3
# s3transfer
Expand Down Expand Up @@ -79,7 +79,7 @@ pip-tools==6.2.0
# via zappa
placebo==0.9.0
# via kappa
pyrsistent==0.17.3
pyrsistent==0.18.0
# via jsonschema
python-dateutil==2.8.1
# via
Expand Down Expand Up @@ -121,8 +121,6 @@ tqdm==4.61.1
# via zappa
troposphere==2.7.1
# via zappa
typing==3.7.4.3
# via -r requirements.in
urllib3==1.26.6
# via
# botocore
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from setuptools import find_packages, setup

with open("requirements.in") as f:
install_requires = [line for line in f if line and line[0] not in "#-g"]
install_requires = [line for line in f if line and line[0] not in "#-"]

with open("dev_requirements.in") as f:
tests_require = [line for line in f if line and line[0] not in "#-"]
Expand Down
4 changes: 4 additions & 0 deletions zappa_init.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from giges.app import create_flask_app

app = create_flask_app()

19 changes: 19 additions & 0 deletions zappa_settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"staging": {
"app_function": "zappa_init.app",
"aws_region": "eu-central-1",
"project_name": "giges",
"profile_name": "default",
"runtime": "python3.8",
"s3_bucket": "zappa-giges-staging",
"domain": "integrations-staging.tesselo.com",
"certificate_arn": "arn:aws:acm:us-east-1:595064993071:certificate/3cac1dfe-5915-4325-91fa-a53952cbd2e1"
},
"production": {
"log_level": "WARNING",
"extends": "staging",
"project_name": "giges",
"s3_bucket": "zappa-giges-production",
"domain": "integrations.tesselo.com"
}
}

0 comments on commit 4352dc9

Please sign in to comment.