{"id":27098635,"url":"https://github.com/edonosotti/ci-cd-tutorial-sample-app","last_synced_at":"2025-04-06T11:50:57.750Z","repository":{"id":39590663,"uuid":"156769976","full_name":"edonosotti/ci-cd-tutorial-sample-app","owner":"edonosotti","description":"A sample Python app that implements a REST API, with database migrations and CI/CD support.","archived":false,"fork":false,"pushed_at":"2023-05-09T09:06:32.000Z","size":24,"stargazers_count":12,"open_issues_count":3,"forks_count":104,"subscribers_count":4,"default_branch":"master","last_synced_at":"2023-10-20T19:36:46.496Z","etag":null,"topics":["alembic","continuous-delivery","continuous-integration","flask","flask-migrate","flask-sqlalchemy","heroku","heroku-deployment","heroku-ready","migrations","python","sqlalchemy","unit-testing","unittest"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/edonosotti.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2018-11-08T21:16:30.000Z","updated_at":"2023-10-20T19:36:47.919Z","dependencies_parsed_at":"2022-09-02T12:43:32.215Z","dependency_job_id":"a94d4291-403f-4e84-8cc9-001e745ee071","html_url":"https://github.com/edonosotti/ci-cd-tutorial-sample-app","commit_stats":null,"previous_names":[],"tags_count":8,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edonosotti%2Fci-cd-tutorial-sample-app","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edonosotti%2Fci-cd-tutorial-sample-app/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edonosotti%2Fci-cd-tutorial-sample-app/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edonosotti%2Fci-cd-tutorial-sample-app/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/edonosotti","download_url":"https://codeload.github.com/edonosotti/ci-cd-tutorial-sample-app/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247478295,"owners_count":20945265,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["alembic","continuous-delivery","continuous-integration","flask","flask-migrate","flask-sqlalchemy","heroku","heroku-deployment","heroku-ready","migrations","python","sqlalchemy","unit-testing","unittest"],"created_at":"2025-04-06T11:50:57.317Z","updated_at":"2025-04-06T11:50:57.744Z","avatar_url":"https://github.com/edonosotti.png","language":"Python","readme":"[![Build Status](https://travis-ci.org/edonosotti/ci-cd-tutorial-sample-app.svg?branch=master)](https://travis-ci.org/edonosotti/ci-cd-tutorial-sample-app)\n[![codebeat badge](https://codebeat.co/badges/0e006c74-a2f9-4f34-9cf4-2378fb7d995a)](https://codebeat.co/projects/github-com-edonosotti-ci-cd-tutorial-sample-app-master)\n[![Maintainability](https://api.codeclimate.com/v1/badges/e14a2647843de209fd5e/maintainability)](https://codeclimate.com/github/edonosotti/ci-cd-tutorial-sample-app/maintainability)\n\n# CD/CI Tutorial Sample Application\n\n## Description\n\nThis sample Python REST API application was written for a tutorial on implementing Continuous Integration and Delivery pipelines.\n\nIt demonstrates how to:\n\n * Write a basic REST API using the [Flask](http://flask.pocoo.org) microframework\n * Basic database operations and migrations using the Flask wrappers around [Alembic](https://bitbucket.org/zzzeek/alembic) and [SQLAlchemy](https://www.sqlalchemy.org)\n * Write automated unit tests with [unittest](https://docs.python.org/2/library/unittest.html)\n\nAlso:\n\n * How to use [GitHub Actions](https://github.com/features/actions)\n\nRelated article: https://medium.com/rockedscience/docker-ci-cd-pipeline-with-github-actions-6d4cd1731030\n\n## Requirements\n\n * `Python 3.8`\n * `Pip`\n * `virtualenv`, or `conda`, or `miniconda`\n\nThe `psycopg2` package does require `libpq-dev` and `gcc`.\nTo install them (with `apt`), run:\n\n```sh\n$ sudo apt-get install libpq-dev gcc\n```\n\n## Installation\n\nWith `virtualenv`:\n\n```sh\n$ python -m venv venv\n$ source venv/bin/activate\n$ pip install -r requirements.txt\n```\n\nWith `conda` or `miniconda`:\n\n```sh\n$ conda env create -n ci-cd-tutorial-sample-app python=3.8\n$ source activate ci-cd-tutorial-sample-app\n$ pip install -r requirements.txt\n```\n\nOptional: set the `DATABASE_URL` environment variable to a valid SQLAlchemy connection string. Otherwise, a local SQLite database will be created.\n\nInitalize and seed the database:\n\n```sh\n$ flask db upgrade\n$ python seed.py\n```\n\n## Running tests\n\nRun:\n\n```sh\n$ python -m unittest discover\n```\n\n## Running the application\n\n### Running locally\n\nRun the application using the built-in Flask server:\n\n```sh\n$ flask run\n```\n\n### Running on a production server\n\nRun the application using `gunicorn`:\n\n```sh\n$ pip install -r requirements-server.txt\n$ gunicorn app:app\n```\n\nTo set the listening address and port, run:\n\n```\n$ gunicorn app:app -b 0.0.0.0:8000\n```\n\n## Running on Docker\n\nRun:\n\n```\n$ docker build -t ci-cd-tutorial-sample-app:latest .\n$ docker run -d -p 8000:8000 ci-cd-tutorial-sample-app:latest\n```\n\n## Deploying to Heroku\n\nRun:\n\n```sh\n$ heroku create\n$ git push heroku master\n$ heroku run flask db upgrade\n$ heroku run python seed.py\n$ heroku open\n```\n\nor use the automated deploy feature:\n\n[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy)\n\nFor more information about using Python on Heroku, see these Dev Center articles:\n\n - [Python on Heroku](https://devcenter.heroku.com/categories/python)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedonosotti%2Fci-cd-tutorial-sample-app","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fedonosotti%2Fci-cd-tutorial-sample-app","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedonosotti%2Fci-cd-tutorial-sample-app/lists"}