This was tested on:
- Ubuntu 14.04 x64
- Ubuntu 16.04 x64
# Sidekiq interaction and startup script | |
commands: | |
create_post_dir: | |
command: "mkdir -p /opt/elasticbeanstalk/hooks/appdeploy/post" | |
ignoreErrors: true | |
files: | |
"/opt/elasticbeanstalk/hooks/appdeploy/post/50_restart_sidekiq.sh": | |
mode: "000755" | |
owner: root | |
group: root |
# Check if this is the very first time that this script is running | |
if ([ ! -f /root/.not-a-new-instance.txt ]) then | |
newEC2Instance=true | |
fi | |
if ([ $newEC2Instance ]) then | |
whoami | |
cd /tmp |
class AsynctestController < ApplicationController | |
require "em-synchrony/em-http" | |
def test | |
EventMachine.synchrony do | |
http = EventMachine::HttpRequest.new("https://www.google.co.uk/").get | |
render :json => {result: http.response} |
# lib/capistrano/tasks/assets.rake | |
Rake::Task['deploy:assets:precompile'].clear | |
namespace :deploy do | |
namespace :assets do | |
desc 'Precompile assets locally and then rsync to remote servers' | |
task :precompile do | |
local_manifest_path = %x{ls public/assets/manifest*}.strip |
#Heroku, Ruby on Rails and PhantomJS
In this post, I’m going to show you how to modify an existing Ruby on Rails app running on Heroku’s Cedar stack to use PhantomJS for screen scraping. If you’ve never heard of PhantomJS, it’s a command-line WebKit-based browser (that supports JavaScript, cookies, etc.).
Let’s get started. This is a high-level overview of the required steps:
======= Prolbem ================================================================================================================= | |
I have installed : ruby-2.0.0,postgres-9.2 , now in rails app when I execute: | |
rake db:create , command I get: | |
PG::InvalidParameterValue: ERROR: new encoding (UTF8) is incompatible with the encoding of the template database (SQL_ASCII) | |
HINT: Use the same encoding as in the template database, or use template0 as template. | |
: CREATE DATABASE "my_db_name" ENCODING = 'unicode'....... | |
bin/rake:16:in `load' |
# to generate your dhparam.pem file, run in the terminal | |
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048 |
# A sample Gemfile | |
source "https://rubygems.org" | |
# gem "rails" | |
gem 'faraday' | |
gem 'faraday_middleware' | |
gem 'em-synchrony' | |
gem 'em-http-request' | |
gem 'multi_xml' |
# updated from the original @ http://cheat.errtheblog.com/s/rspec_shoulda | |
# just a subset -- models -- is included here. I'll update this, and create cheat sheets for others, as I go along. | |
# I marked the ones I added with NEW and also added the links to the corresponding code, as I think it's useful. | |
# Any comments/corrections are welcome! | |
# ================= Data and Associations ======================= | |
# https://github.com/thoughtbot/shoulda-matchers/tree/master/lib/shoulda/matchers/active_record | |
it { should_not have_db_column(:admin).of_type(:boolean) } |