This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Document < ActiveRecord::Base | |
validates :name, uniqueness: { scope: [:description, :date] } | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
aws iam upload-server-certificate \ | |
--server-certificate-name server-certificate-name \ | |
--certificate-body file:///path-to-your-certificate/your-certificate.pem \ | |
--private-key file:///path-to-private-key/private-key.pem \ | |
--certificate-chain file://path-to-chain-certificate/chain-certificate.pem \ | |
--path /cloudfront/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Sid": "PublicReadGetObject", | |
"Effect": "Allow", | |
"Principal": { | |
"AWS": "*" | |
}, | |
"Action": "s3:GetObject", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<RoutingRules> | |
<RoutingRule> | |
<Condition> | |
<HttpErrorCodeReturnedEquals>404</HttpErrorCodeReturnedEquals> | |
</Condition> | |
<Redirect> | |
<HostName>your-app-dns</HostName> | |
<Protocol>https</Protocol> | |
<ReplaceKeyPrefixWith>#/</ReplaceKeyPrefixWith> | |
</Redirect> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
'production': { | |
'accessKeyId': 'Amazon_s3_production_access_key', | |
'secretAccessKey': 'Amazon_s3_production_secret_key', | |
'region': 'Amazon_s3_production_region', | |
'params': { | |
'Bucket': 'Amazon_s3_production_bucket_name' | |
} | |
}, | |
'productionHeaders': {}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var gulp = require('gulp'), | |
awspublish = require('gulp-awspublish'); | |
var localConfig = { | |
buildSrc: './build/**/*', | |
getAwsConf: function (environment) { | |
var conf = require('../../config/aws'); | |
if (!conf[environment]) { | |
throw 'No aws conf for env: ' + environment; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# rescue... | |
data = { | |
id: sqs_msg.attributes['SentTimestamp'].to_i, | |
worker: worker_instance.class.to_s, | |
queue: queue, | |
arguments: body, | |
enqueued_at: Time.at(sqs_msg.attributes['SentTimestamp'].to_i / 1000) | |
} | |
REDIS.lpush("sqs-dashboard-failures", data) | |
# end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DashboardMiddleware | |
def call(worker_instance, queue, sqs_msg, body) | |
# send before process information | |
yield | |
# send after process information | |
rescue Exception => e | |
# send exception information | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set :stage, :production | |
role :app, %w(user@url) | |
role :web, %w(user@url) | |
role :db, %w(user@url) | |
set :bundle_binstubs, -> { shared_path.join('bin') } | |
set :ssh_options, keys: %w(~/.ssh/your-project-production.pem), forward_agent: true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
### BEGIN INIT INFO | |
# Provides: unicorn | |
# Required-Start: $remote_fs $syslog | |
# Required-Stop: $remote_fs $syslog | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: Manage unicorn server | |
# Description: Start, stop, restart unicorn server for a specific application. | |
### END INIT INFO |