First create a Ubuntu 13.04 x64 droplet on DigitalOcean Control Panel
Then ssh with root account, run this in termianl:
$ wget -qO- https://raw.github.com/progrium/dokku/master/bootstrap.sh | sudo bash| # Capistrano configuration | |
| # | |
| # require 'new_relic/recipes' - Newrelic notification about deployment | |
| # require 'capistrano/ext/multistage' - We use 2 deployment environment: staging and production. | |
| # set :deploy_via, :remote_cache - fetch only latest changes during deployment | |
| # set :normalize_asset_timestamps - no need to touch (date modification) every assets | |
| # "deploy:web:disable" - traditional maintenance page (during DB migrations deployment) | |
| # task :restart - Unicorn with preload_app should be reloaded by USR2+QUIT signals, not HUP |
| # Capistrano configuration | |
| # | |
| # require 'new_relic/recipes' - Newrelic notification about deployment | |
| # require 'capistrano/ext/multistage' - We use 2 deployment environment: staging and production. | |
| # set :deploy_via, :remote_cache - fetch only latest changes during deployment | |
| # set :normalize_asset_timestamps - no need to touch (date modification) every assets | |
| # "deploy:web:disable" - traditional maintenance page (during DB migrations deployment) | |
| # task :restart - Unicorn with preload_app should be reloaded by USR2+QUIT signals, not HUP |
| # Capistrano configuration | |
| # | |
| # require 'new_relic/recipes' - Newrelic notification about deployment | |
| # require 'capistrano/ext/multistage' - We use 2 deployment environment: staging and production. | |
| # set :deploy_via, :remote_cache - fetch only latest changes during deployment | |
| # set :normalize_asset_timestamps - no need to touch (date modification) every assets | |
| # "deploy:web:disable" - traditional maintenance page (during DB migrations deployment) | |
| # task :restart - Unicorn with preload_app should be reloaded by USR2+QUIT signals, not HUP |
| По дефолту для Mongoid он пагинирует Criteria. Если нужно Ruby-Array-массив: | |
| Kaminary.paginate_array(...) |
| namespace :routes do | |
| desc "Writes doc/routes.html. Requires Graphviz (dot)" | |
| task :visualizer => :environment do | |
| File.open(Rails.root.join('doc', 'routes.html'), 'wb') do |f| | |
| f.write Rails.application.routes.router.visualizer | |
| end | |
| end | |
| end |
| [core] | |
| ... | |
| [remote "dokku"] | |
| url = git@remote:appname | |
| fetch = +refs/heads/*:refs/remotes/dokku/* |
| require "xmlsimple" | |
| def transactions(filename) | |
| data = XmlSimple.xml_in(filename) | |
| data["LIST_G_CLIENT"][0]['G_CLIENT'][0]['LIST_G_ACC_CURR'][0]['G_ACC_CURR'][0]['LIST_G_TRANS_CARD'][0]['G_TRANS_CARD'][1]['LIST_G_TRANS_DETAILS'][0]['G_TRANS_DETAILS'] | |
| end | |
| fields = %w(TRANS_DATE_XML TRANS_AMOUNT TRANS_CURR ACC_AMOUNT TRANS_DETAILS ) | |
| puts fields.join(", ") |
| require 'fileutils' | |
| namespace :db do | |
| desc 'pull the production PostgreSQL database into the development SQLite' | |
| task :pull do | |
| Rake::Task['db:download_pg_dump'].invoke | |
| Rake::Task['db:optimze_pg_dump_for_sqlite'].invoke | |
| Rake::Task['db:recreate_with_dump'].invoke | |
| end |
| // Use Gists to store code you would like to remember later on | |
| console.log(window); // log the "window" object to the console |