This file contains 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
// dependencies | |
var async = require('async'); | |
var path = require('path'); | |
var AWS = require('aws-sdk'); | |
var gm = require('gm') | |
.subClass({ imageMagick: true }); // Enable ImageMagick integration. | |
var util = require('util'); | |
// constants | |
var MAX_WIDTH = 640; |
This file contains 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
# config/initializers/carrierwave.rb | |
CarrierWave.configure do |config| | |
config.storage = :fog | |
config.fog_credentials = { | |
provider: 'AWS' | |
aws_access_key_id: Rails.application.secrets.aws_access_key_id | |
aws_secret_access_key: Rails.application.secrets.aws_secret_access_key | |
} | |
config.fog_directory = 'wlambdatest' | |
config.fog_public = false |
This file contains 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 PhotoUploader < CarrierWave::Uploader::Base | |
# Choose what kind of storage to use for this uploader: | |
storage :fog | |
# Override the directory where uploaded files will be stored. | |
# This is a sensible default for uploaders that are meant to be mounted: | |
def store_dir | |
if version_name == nil | |
"uploads/originals/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" |
This file contains 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
gem 'carrierwave' | |
gem 'fog', require: 'fog/aws' |
This file contains 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 AWS = require('aws-sdk'); | |
var mandrill = require('mandrill-api/mandrill'); | |
function sendTemplate(to, context) { | |
var mandrill_client = new mandrill.Mandrill('YOUR_MANDRILLAPP_KEY'); | |
var template_name = "your_template"; | |
var template_content = []; | |
var message = { | |
"subject": "Email Subject", | |
"from_email": "noreply@example.com", |
This file contains 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 AWS = require('aws-sdk'); | |
exports.handler = function(event, context) { | |
var AWS = require('aws-sdk'); | |
var simpledb = new AWS.SimpleDB({ | |
endpoint: 'sdb.amazonaws.com', | |
region: 'us-east-1' | |
}); | |
console.log(event) | |
var params = { |
This file contains 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 AWS = require('aws-sdk'); | |
var simpledb = new AWS.SimpleDB({ | |
endpoint: 'sdb.amazonaws.com', | |
region: 'us-east-1' | |
}); | |
var params = { | |
DomainName: 'STRING_VALUE' /* required */ | |
}; | |
simpledb.createDomain(params, function(err, data) { |
This file contains 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 | |
echo 'Zipping folders for save function' | |
zip -r Save.zip node_modules save.js | |
echo 'Zipped... uploading to AWS' | |
aws lambda update-function-code --region us-east-1 --function-name saveEmailSubscriptor --zip-file fileb://./Save.zip --profile your-profile | |
echo 'Zipping folders for list function' | |
zip -r List.zip node_modules list.js | |
echo 'Zipped... uploading to AWS' | |
aws lambda update-function-code --region us-east-1 --function-name listEmailSubscriptors --zip-file fileb://./List.zip --profile your-profile |
This file contains 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
files: | |
"/etc/yum.repos.d/logstash.repo": | |
mode: "000644" | |
owner: root | |
group: root | |
content: | | |
[logstash-2.3] | |
name=Logstash repository for 2.3.x packages | |
baseurl=https://packages.elastic.co/logstash/2.3/centos | |
gpgcheck=1 |
This file contains 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
commands: | |
create_post_dir: | |
command: "mkdir /opt/elasticbeanstalk/hooks/appdeploy/post" | |
ignoreErrors: true | |
create_restartappserver_post_dir: | |
command: "mkdir /opt/elasticbeanstalk/hooks/restartappserver/post" | |
ignoreErrors: true | |
100-install-logstash: | |
command: "sudo yum -y install logstash" | |
files: |
OlderNewer