Sign inSign up

pcourbin/openapi-exposedb-safrs

By pcourbin

•Updated over 6 years ago

Image
0

997

pcourbin/openapi-exposedb-safrs repository overview

⁠Docker to use OpenAPI-ExposeDB-SAFRS⁠

This work is based on the great work of thomaxxl⁠ on SAFRS⁠ (SqlAlchemy Flask-Restful Swagger Json-API OpenAPI).

Docker image to deploy SAFRS-ExposeDB⁠ and expose a live SQL database using a generated API with OpenAPI/Swagger documentation.

This docker image is based on python:3-alpine⁠. It includes the packages needed to run SAFRS-ExposeDB⁠.

⁠Getting Started

⁠Prerequisities

In order to run this container you'll need docker installed.

⁠Quickstart

To run a full functional version, you can use the file docker-compose.yml.

version: '3'
services:
  safrs-expose_existing:
    image: pcourbin/openapi-exposedb-safrs:2.7.0
    environment:
      - DB_HOST=db.serveur.fr # Do not define if the DB is accessible on your docker host
      - DB_PORT=3306
      - DB_NAME=mydbname
      - DB_USER=user
      - DB_PASSWORD=password
      - PORT=3000
    ports:
      - 3000:3000

and run

docker-compose -f docker-compose.yml up

Then, go to http://localhost:3000/api⁠ to see your generated API for your SQL database.

If it does not work, see

docker-compose -f docker-compose.yml logs -f

⁠Environment Variables

NameDefault valueDescription
DB_HOSTDocker host ip if variable not definedHost of your sql database. If your database is on your docker host, do not define this variable.
DB_PORT3306Port of your sql database link with DB_HOST.
DB_NAMEmydbDatabase name.
DB_USERuserUsername with access to your sql database.
DB_PASSWORDpasswordPassword linked with DB_USER.
PORT3000Port where the API will be deployed inside the docker. Define the same PORT on your host and on the API inside the docker to be able to test it using the OpenAPI GUI

Tag summary

Content type

Image

Digest

Size

98.9 MB

Last updated

over 6 years ago

docker pull pcourbin/openapi-exposedb-safrs