Giter Club home page Giter Club logo

lando-api's Introduction

Lando API

A microservice that transforms Phabricator revisions into Autoland Transplant requests.

Part of Mozilla Conduit, our code-management microservice ecosystem.

What's Deployed

Building the service

Prerequisites

  • docker and docker-compose (on OS X and Windows you should use the full Docker for Mac or Docker for Windows systems, respectively)
  • pyinvoke
    • Because pyinvoke currently has no backward-compatibility guarantees, it is suggested that you install exactly version 0.21.0 via pip: pip install invoke==0.21.0 or pip install --user invoke==0.21.0.
    • You can use a virtualenv instead of installing it system-wide, but you should create the virtualenv outside of the lando-api source directory so that the linter doesn't check the virtualenv files.
    • If you are running Windows, you will need a special file in your user directory (typically C:\Users\<username>\) called .invoke.yml. It should contain the following:
      run:
        shell: C:\Windows\System32\cmd.exe

Running the development server

To build and start the development services containers (remove -d if logs should be printed out):

$ docker-compose up -d

To create a database:

$ invoke init

You can use a tool like httpie to test the service.

To stop the containers run

$ docker-compose down

Browsing the API documentation

Start the development services and visit http://localhost:8888/ui/ in your browser to view the API documentation.

Testing

lando-api's tests use pytest with pytest-flask, executed within a Docker container. The tests are located in ./tests/. You can run all of them via invoke:

$ invoke test

You can provide options to pytest in testargs argument:

$ invoke test --testargs tests/test_landings.py

Please wrap the testargs with "" if more than one is needed.

Subsets of the tests, e.g. linters, and other commands are also available. Run invoke -l to see all tasks.

Migrations

Developer machine

Please run the lando-api.db container before accessing the database.

Add a new migration:

$ invoke add-migration "{description of applied changes}"

Upgrade to the newest revision:

$ invoke upgrade

Deployed server

Upgrade to the newest migration:

$ docker run [OPTIONS] IMAGE lando-cli db upgrade

Accessing the database

Run lando-api.db container if development containers are down.

$ docker-compose up -d lando-api.db

Access the database server (password is password)

$ psql -h localhost --port 54321 --user postgres -d lando_api_dev
Password for user postgres:

lando-api's People

Contributors

dependabot-support avatar dklawren avatar dylanwh avatar globau avatar mars-f avatar mozilla-github-standards avatar purelogiq avatar smacleod avatar zalun avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.