Skip to content

Instantly share code, notes, and snippets.

View flomotlik's full-sized avatar

Florian Motlik flomotlik

View GitHub Profile

Setting the AWS API Key & Secret

To start using Serverless and access the AWS API you need to set the AWS API Access Key & Secret.

Quick Setup

As a quick setup to get started you can export them as environment variables so they will be accessible to Serverless and the AWS SDK in your shell:

export AWS_ACCESS_KEY_ID=<key>
export AWS_SECRET_ACCESS_KEY=<secret>
@flomotlik
flomotlik / install_go.sh
Created February 28, 2014 11:44
Install Go 1.2
cd
rm -fr go
wget http://go.googlecode.com/files/go1.2.linux-amd64.tar.gz
tar xfz go1.2.linux-amd64.tar.gz
cd clone
go get github.com/kr/godep
module exports = class SomePlugin extends ServerlessPlugin{
//Contructor should be defined in ServerlessPlugin so you don't have to recreate it here
constructor(pluginConfig, serverlessConfig, serverlessUtils) {
this.pluginConfig = pluginConfig;
this.serverlessConfig = serverlessConfig;
this.serverlessUtils = serverlessUtils;
}
beforeDeployResources(params) {
@flomotlik
flomotlik / debrief-template
Last active May 5, 2016 16:22
Codeship Debrief Template
# Service Interruption Debrief
## Brief Executive Summary
EXECUTIVE SUMMARY HERE
***On Call during outage***:
***Time outage started***:
@flomotlik
flomotlik / deploy_branch.rb
Created July 14, 2014 14:24
Create new Heroku App for branch
#!/usr/bin/env ruby
require "open3"
git_branch = ENV['CI_BRANCH'] || `git rev-parse --abbrev-ref HEAD`
@app_name = "csqa-#{git_branch[0..24].gsub(/\W/, '-')}"
def exec command
Open3.popen2e(command){ |stdin, stdout_err, wait_thr|
while line = stdout_err.gets
*) Ask them if they ever spend time manually testing features that have been out for a while
*) Ask them if they ever shipped new features that broke old features
*) Ask them if they are happy with this?
*) Ask them if they think it makes them and their company successful or if they think they need to change
You can take a couple of points from the business case blogpost about why to do CI here:
http://blog.codeship.io/2013/04/11/a-business-case-for-continuous-integration.html
Testing is about making sure your users can walk through the most important parts of your system and use your product. When testing you should be thinking about your users first and how they interact with your system, not how you can get 100% unit test coverage (which is a nonsense metric)
@flomotlik
flomotlik / Hooks
Created October 31, 2013 19:45
Webhooks on Codeship
If you only want to send a hook for successful builds at the end of your test commands add something like:
wget YOUR_URL
and it will send the hook whenever your build passes. You can run any command there and aren't limited to wget or anything at all.
2) Send a hook for a failed command and fail the build:
SOME_COMMAND || bash -c "ANY_COMMAND_TO_SEND_HOOK; exit 1"
phpunit -d xdebug.max_nesting_level=250
# or
echo "xdebug.max_nesting_level=250" >> ~/.phpenv/versions/$php_version/etc/php.ini
mkdir .casperjs
cd .casperjs
wget --retry-connrefused -q -O - https://codeload.github.com/n1k0/casperjs/legacy.zip/1.1-beta1 > casperjs.zip
unzip casperjs.zip
mv n1k0-casperjs*/* ./
cd ..
# Add .casperjs to the beginning of the path so it takes 1.1-beta1
export PATH=/home/rof/clone/.casperjs/bin:$PATH
@flomotlik
flomotlik / start_server.rb
Created September 12, 2013 08:50
Setting up our Amazon machines
# Creating the EC2 Instance
instance = ec2.instances.create(
:image_id => "ami-7739b41e",
:instance_type => 'cc2.8xlarge',
:key_name => "CloudshipCreateServerKey",
:instance_initiated_shutdown_behavior => 'terminate',
:block_device_mappings => {
"/dev/sda1" => {
:volume_size => 50,