GithubHelp home page GithubHelp logo

asi's Introduction

ASI Coding Challenge

The service is being hosted on my raspberry pi so I apologise if it seems a bit slow. If it goes down for any reason drop me an email.

The code was written using flask and flask-restful, and the requests library for communicating with github. It is deployed with fabric and served with apache and wsgi.

I've deployed the code with the dev config. This is because flask only pretty prints json results when debug is true and I thought that would be a bit easier for you to read.

Usage

http://bmcalindin-asi.ddns.net/user/username/repo/

Optional GET Parameters

  • limit - integer (default=5) - the maximum number of repos to show
  • orderby - string (default=size) - the field to sort the results by

Deployment

Fabric was used for the deployment

  1. Github repo is checked out to /rootdir/releases/commit_timestamp
  2. Bootstrap script is ran to setup virtualenv and install packages
  3. The checkout is symlinked to /rootdir/releases/current
  4. Apache is restarted

Improvements

  • The checkouts and bootstrap should be done in parallel on all servers. Once that is done all servers should be switched and restarted in parallel in ensure that they are kept in sync as much as possible.
  • Normally part of my deployment code would remove old versions, keeping something like the 5 most recent deployments. I just forgot to do this.

Tests

I've added some unit tests for the repo controller. Obviously this could have a lot more tests, this was just an example. As well as more unit tests I would probably add some end-to-end integration tests that communicate with github. The tests are ran with:

./scripts/test

General Improvements

  • I messed up the apache config a bit. Normally I would keep the default config and add one line to include /rootdir/releases/current/conf/app_server.conf. This would contain a virtual host with everything relevant to this deployment.
  • My server isn't setup properly at all. I took this as more of a coding/deployment challenge rather than an infrastructure challenge.
  • More tests
  • I'm less experienced with flask than django so perhaps some of the create app boiler plate isn't perfect
  • Logging isn't setup properly

asi's People

Contributors

neb42 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.