Coder Social home page Coder Social logo

moonshine_redis's Introduction

Five Minute Rails Application Deployment

Ready to deploy your Rails application to Rails Machine? Follow these steps and you’ll have it running in no time! Feel free to utilize Rails Machine’s Ask Us Anything Support and contact us with any questions you have along the way.

Update Gems

Install the latest version of the railsmachine gem:

  
    $ sudo gem install railsmachine
  

Install Phusion Passenger and Ruby Enterprise Edition

If you do not have Phusion Passenger and Ruby Enterprise Edition installed on your Rails Machine yet you can run this installer on your server.

  
    $ wget http://assets.railsmachine.com/wiki/centos_passenger_install.sh
    $ sh centos_passenger_install.sh
  

Setup Capistrano

Capify your application:

  
    $ capify .
  

Configure Capistrano for Rails Machine

The following step customizes your config/deploy.rb with two bits of information you provide:

  • --name: a simple name for your application. no spaces, please.
    • example: my-cool-app
  • --domain: the primary domain name for your application. please omit the ‘www’ – we automaticaly alias www.whateveryouprovide.com as needed.
    • example: my-cool-app.com
  
    $ railsmachine --apply-to . --name my-cool-app --domain my-cool-app.com 
  

Please note that the domain name provided will need to be correctly pointed at your Rails Machine account. If you don’t have a DNS provider, we’ve been more than happy with DNS Made Easy.

Update Database Config

Update your applications config/database.yml’s section with your desired MySQL datbase name, username, and password. The database and user will be created for you in a forthcoming step.

Application Setup

Rails Machine defaults to using mongrel + mod_proxy_balancer to run your Rails Application. If you’d like to switch to Phusion Passenger, edit the line in your application’s config/deploy.rb that begins set :app_server to reflect your choice. For example:

  
    set :app_server, :passenger
  

Run the following Capistrano task to setup your MySQL databases and configure your application servers (mongrel/passenger):

  
    $ cap servers:setup
  

Source Control

If you’re already using Source Control…

…edit the lines in your application’s config/deploy.rb that begin set :scm and set :repository. For example:

  
    set :scm, :git
    set :repository, "[email protected]:yourname/my-cool-app.git"
  

If you’re not yet using Source Control…

…you can easily setup a Git/Subversion repository on your Rails Machine. Subversion is the default, edit the line in your application’s config/deploy.rb that begins set :scm if you’d like to change it to git. For example:

  
    set :scm, :git
  

Next, run the following task to import your application into a Git/SVN repository on your Rails Machine:

  
    $ cap repos:setup
  

Initial Deploy

That’s it! You’re ready to use Capistrano to deploy your app for the first time:

  
    $ cap deploy:cold
  

Once that’s done, open your application in a web browser and test it out!

To perform a subsequent deploy with Capistrano:

  
    $ cap deploy
  

or, if you need to run migrations as well:

  
    $ cap deploy:migrations
  

moonshine_redis's People

Contributors

benstein avatar bryantraywick avatar ches avatar dbrm avatar ernie avatar jdhollis avatar jnewland avatar kplawver avatar leejones avatar mattrogish avatar nragaz avatar railsmachine-ops avatar skalnik avatar technicalpickles avatar wfarr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

moonshine_redis's Issues

Support for Redis 3.0.7

Any plans on supporting Redis 3.0.7 version? It does not work if I change the configuration to 3.0.7. In application_manifest.rb:

configure(:redis => { :version => '3.0.7', :ruby_client => :latest }
recipe :redis

Exec[install redis] fails if redis-cli isn't present

There were some recent modifications to moonshine_redis to allow for upgrades to happen. This exec will try to shutdown with redis-cli first before re-installing.

I'm not sure if this worked in the first place with new installs, or if it's something to do with the shadow_puppet version with 1.9 support.

I'm thinking these two things should be split off (shutdown redis if its installed and would be updated, then install it).

Use vm.memory_overcommit=1 by default

From http://redis.io/topics/faq

Background saving is failing with a fork() error under Linux even if I've a lot of free RAM!

Short answer: echo 1 > /proc/sys/vm/overcommit_memory :)

And now the long one:

Redis background saving schema relies on the copy-on-write semantic of fork in modern operating systems: Redis forks (creates a child process) that is an exact copy of the parent. The child process dumps the DB on disk and finally exits. In theory the child should use as much memory as the parent being a copy, but actually thanks to the copy-on-write semantic implemented by most modern operating systems the parent and child process will share the common memory pages. A page will be duplicated only when it changes in the child or in the parent. Since in theory all the pages may change while the child process is saving, Linux can't tell in advance how much memory the child will take, so if the overcommit_memory setting is set to zero fork will fail unless there is as much free RAM as required to really duplicate all the parent memory pages, with the result that if you have a Redis dataset of 3 GB and just 2 GB of free memory it will fail.

Setting overcommit_memory to 1 says Linux to relax and perform the fork in a more optimistic allocation fashion, and this is indeed what you want for Redis.

A good source to understand how Linux Virtual Memory work and other alternatives for overcommit_memory and overcommit_ratio is this classic from Red Hat Magazine, "Understanding Virtual Memory".

We already have moonshine_sysctl for managing this, so ideally it should just work when you install moonshine_redis. At the very least, the documentation should recommend it.

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.