Unsere Setup-Routine für eine Rails-App mit Nginx, Passenger, rvm auf einen Host Europe-VPS mit Ubuntu 10.4.
apt-get update
apt-get install -y build-essential bison openssl libreadline5 libreadline5-dev curl \
| (function(){ | |
| // This snippet is a customized version of the code found on | |
| // stackoverflow. Since firefox only copies to the clipboard when the event | |
| // was triggered by a user, I had to add the button to the top of the page. | |
| // In chrome it might work without the need for a button, directly from a | |
| // bookmarklet. See the following for more information. | |
| // https://stackoverflow.com/questions/400212/how-do-i-copy-to-the-clipboard-in-javascript?page=1&tab=votes#tab-top | |
| // To create a bookmarklet you might want to use the following: | |
| // https://www.yourjs.com/bookmarklet/ |
| class DatabaseController < ApplicationController | |
| def database_dump | |
| database = Rails.configuration.database_configuration[Rails.env]["database"] | |
| send_file_headers!(:type => 'application/octet-stream', :filename => "#{database}_#{Time.now.to_s(:human)}.backup") | |
| pipe = IO.popen("pg_dump '#{database}' -F c") | |
| stream = response.stream | |
| while (line = pipe.gets) | |
| stream.write line | |
| sleep 0.0001 # HACK: Prevent server instance from sleeping forever if client disconnects during download |
| #!/usr/bin/python | |
| # This python script allows you to change the unity/gnome keyboard | |
| # settings for swapping the meta (windows) and alt keys. Should work with | |
| # Python 2.7 and 3.2 | |
| from gi.repository import Gio | |
| class KeySwapper: | |
| SWAP_ALT_WIN='altwin\taltwin:swap_lalt_lwin' |
| $ rvm install jruby | |
| jruby-1.6.7.2 - #downloading jruby-bin-1.6.7.2, this may take a while depending on your connection... | |
| jruby-1.6.7.2 - #extracting jruby-bin-1.6.7.2 to /Users/tony/.rvm/src/jruby-1.6.7.2 | |
| jruby-1.6.7.2 - #extracted to /Users/tony/.rvm/src/jruby-1.6.7.2 | |
| jruby-1.6.7.2 - #nailgun | |
| Error running 'jruby_install_build_nailgun', please read /Users/tony/.rvm/log/jruby-1.6.7.2/nailgun.log |
| # Rails edge includes pluggable sanitizers for mass assignment. Really cool is the | |
| # StrictSanitizer which raises an exception instead of a log message, which makes | |
| # problems easier to spot in development. | |
| # For the time being, there seems to be no way to achieve this in Rails 3.1 via | |
| # configuration. Monkey patching to the rescue! | |
| # Copy the gist into config/initializers and configure the environments in which the | |
| # exception gets raised. | |
| if ['development', 'test'].include?(Rails.env) | |
| ActiveModel::MassAssignmentSecurity::BlackList.class_eval do |