Giter VIP home page Giter VIP logo

remote_rails_rake_runner's Introduction

Remote Rails Rake Runner

The goal to deal with one problem: The startup time of a big Rails project when running a functional suite across multiple servers.

Background

The project this lil' app was started on is running a Cucumber suite that spans a total of 10 concurrent runners, all of whom need data at different times. It was originally developed with rake tasks that was reused from local development and run on the servers remotely through SSH.

But ~30s startup time per task was starting to have too big of an effect, so this gem was born with the hope of removing all the starting cost while keeping it really simple to reuse the already existing rake tasks.

Installation

Add to your Gemfile and ensure you mount the app in your routes.

To your Gemfile:

gem 'remote_rails_rake_runner'

To your routes.rb:

Rails.application.routes.draw do

  mount RemoteRailsRakeRunner::Engine => '/rake'
end

Configuration

You can specify the path to your Rakefile by setting the option Rails.application.config.remote_rake_runner_rakefile_path which defaults to Rails.root.join('Rakefile').to_s.

Usage

The app exposes two endpoints, a listing of all the rake tasks and the actual runner. To run a task with arguments just put the arguments in into the argument args separated by commas. The task will not be considered successful if it raises an exception, otherwise it's assumed to have been successful.

If you mount the app under /rake as suggested above:

$ curl http://localhost:3000/rake
[{"name":"about","args":[],"description":null}, …] # a listing of all tasks (like rake -T)

$ curl http://localhost:3000/rake/simple:hello -d args=Björn
{"success":true,"output":"Hello Björn!\n"}

Acknowledgements

The running and capturing of output that was taken from this blog post by Andrea Ercolino.

License

This project rocks and uses MIT-LICENSE.

remote_rails_rake_runner's People

Watchers

Sebastian Schkudlara avatar James Cloos 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.