This note will walk you though setting up and securing a Ubuntu 10.04 LTS then deploying a Rails application with mulit-stage deployment.
TODO:
- Add section for NGINX setup
| #!/usr/bin/env ruby | |
| ## WP2TUMBLR: WordPress 2 Tumblr Importing tool | |
| ## | |
| ## Usage: wp2tumblr [OPTION] WORDPRESS_XML_FILE | |
| ## | |
| ## Import the WORDPRESS_XML_FILE to a Tumblr blog. | |
| ## Provide `--group` option to publish to a group. | |
| ## This could take a long time... | |
| ## | |
| ## To install, download the script and chmod to 755. |
| require 'rubygems' | |
| require 'net/http' | |
| require 'nokogiri' | |
| TUMBLR_USER = '[email protected]' | |
| TUMBLR_PASS = 'yourpassword' | |
| url = URI.parse('http://www.tumblr.com/api/write') | |
| # Read the WP export file |
| #!/bin/bash | |
| if [[ ! -n $1 ]]; then | |
| echo "Please insert a project name" | |
| exit 1 | |
| fi | |
| # Mysql Config | |
| MYSQL_USER="" |
| namespace :heroku do | |
| def app_name | |
| @app_name ||= Heroku::Command::BaseWithApp.new([]).app | |
| end | |
| def latest_bundle(timeout = 30) | |
| puts "Attempting to get latest bundle..." | |
| get_bundle = lambda do | |
| bundles = Heroku::Command.run('bundles', {}) | |
| bundles.sort { |b1, b2| b1[:created_at] <=> b2[:created_at] } |
| #!/bin/sh | |
| # | |
| # Removes trailing whitespace from all source files in the current directory and its children. | |
| # Note the `-i .bak` switch to sed. This will create a backup copy alongside any modified files | |
| # like `Somefile.cpp.bak` Simply remove the `.bak` argument to `-i` to prevent the backup | |
| # files from being generated | |
| # | |
| /usr/bin/find . -type f -and \( -name '*.m' -or -name '*.h' -or -name '*.mm' -or -name '*.cpp' -or -name '*.c' \) -and -print0 | xargs -0 sed -i .bak -E "s/[[:space:]]+$//" |
| desc "Remove trailing whitespace for source files" | |
| task :strip_whitespace do | |
| files = %w[ .autotest .rspec .rvmrc Gemfile ] | |
| globs = %w[ lib/**/*.rb spec/**/*.rb ] | |
| files_from_globs = globs.map { |glob| Dir[glob] } | |
| files_to_strip = (files + files_from_globs).flatten | |
| system "sed -e 's/[ \t]*$//' -i '' #{files_to_strip.join(" ")}" | |
| end |
| class ImportedContactsController << ApplicationController | |
| require 'net/http' | |
| require 'net/https' | |
| require 'uri' | |
| #THIS METHOD TO SEND USER TO THE GOOGLE AUTHENTICATION PAGE. | |
| def authenticate | |
| # initiate authentication w/ gmail | |
| # create url with url-encoded params to initiate connection with contacts api | |
| # next - The URL of the page that Google should redirect the user to after authentication. | |
| # scope - Indicates that the application is requesting a token to access contacts feeds. |
| #user nobody; | |
| worker_processes 10; | |
| error_log logs/error.log; | |
| #error_log logs/error.log notice; | |
| #error_log logs/error.log info; | |
| #pid logs/nginx.pid; | |