See how a minor change to your commit message style can make you a better programmer.
Format: <type>(<scope>): <subject>
<scope>
is optional
--- | |
# Deploy rails app from localhost to remote servers | |
- name: Set up AWS infrastructure | |
hosts: localhost | |
connection: local | |
roles: | |
- setup_aws | |
- name: Package app |
class AddFieldsToDelayedJobs < ActiveRecord::Migration | |
def change | |
add_column :delayed_jobs, :signature, :string | |
add_column :delayed_jobs, :args, :text | |
end | |
end |
Following script may be used for configuring complete and secure email server on fresh install of Debian 7. It will probably work on other distributions using apt-get. After minor changes you'll be able to use it on other Linux distros.
postfix.sh
script.
Most instructions for using Capistrano tell you how to make it restart Phusion Passenger by 'touch'ing the restart.txt
file, but this doesn't immediately restart the app - instead the first person to try to use the application will cause it to be restarted, so they will see a delay of at least a few seconds.
This shows how to add a post-deploy task to 'ping' the server, to cause it to restart immediately.
Then add a deploy:ping
task to config/deploy.rb
and set it to run automatically after deploy:restart
. Alternatively you could put it into the deploy:restart
task directly.
TODO: Test the response HTTP header of the ping, that it is a 200, and not some other error response (404/500).
# to generate your dhparam.pem file, run in the terminal | |
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048 |
# Schedule script for using Whenever toghether with rbenv | |
# | |
# Whenever: https://github.com/javan/whenever | |
# rbenv: https://github.com/sstephenson/rbenv | |
set :env_path, '"$HOME/.rbenv/shims":"$HOME/.rbenv/bin"' | |
# doesn't need modifications | |
# job_type :command, ":task :output" |
#... | |
gem 'backup', require: false, | |
github: 'kavu/backup', | |
branch: 'bump_fog_version', | |
ref: 'c3fd8e6eb4f464de1c8' | |
gem 'whenever', require: false | |
#... |
t = 236 # seconds | |
Time.at(t).utc.strftime("%H:%M:%S") | |
=> "00:03:56" | |
# Reference | |
# http://stackoverflow.com/questions/3963930/ruby-rails-how-to-convert-seconds-to-time |
<!doctype html> | |
<title>Site Maintenance</title> | |
<style> | |
body { text-align: center; padding: 150px; } | |
h1 { font-size: 50px; } | |
body { font: 20px Helvetica, sans-serif; color: #333; } | |
article { display: block; text-align: left; width: 650px; margin: 0 auto; } | |
a { color: #dc8100; text-decoration: none; } | |
a:hover { color: #333; text-decoration: none; } | |
</style> |