Skip to content

Instantly share code, notes, and snippets.

@mdesanti
mdesanti / alb-ingress-controller.yaml
Created January 7, 2019 00:40
alb-ingress-controller
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
labels:
app: alb-ingress-controller
name: alb-ingress-controller
rules:
- apiGroups:
- ""
- extensions
@mdesanti
mdesanti / alb-policy.json
Last active January 7, 2019 00:49
ALB Ingress Controller IAM policy
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"ec2:AuthorizeSecurityGroupIngress",
"elasticloadbalancing:ModifyListener",
"ec2:DescribeInstances",
2018-10-15T11:04:04-03:00 [ℹ] using region us-east-1
2018-10-15T11:04:05-03:00 [▶] role ARN for the current session is "arn:aws:iam::832293009740:user/matias.desanti"
2018-10-15T11:04:06-03:00 [▶] resolving AMI using StaticGPUResolver for region us-east-1 and instanceType m5.large
2018-10-15T11:04:06-03:00 [▶] can't resolve AMI using StaticGPUResolver as instance type m5.large is non-GPU
2018-10-15T11:04:06-03:00 [▶] resolving AMI using StaticDefaultResolver for region us-east-1 and instanceType m5.large
2018-10-15T11:04:07-03:00 [ℹ] using "ami-0440e4f6b9713faf6" for nodes
2018-10-15T11:04:07-03:00 [▶] cfg = &api.ClusterConfig{Region:"us-east-1", Profile:"", Tags:map[string]string{}, ClusterName:"floral-monster-1539612246", NodeAMI:"ami-0440e4f6b9713faf6", NodeType:"m5.large", Nodes:2, MinNodes:0, MaxNodes:0, NodeVolumeSize:0, MaxPodsPerNode:0, NodePolicyARNs:[]string(nil), NodeSSH:false, SSHPublicKeyPath:"~/.ssh/id_rsa.pub", SSHPublicKey:[]uint8(nil), SSHPublicKeyName:"", WaitTimeout:1200000000000, Se
@Library('wolox-ci') _
node {
checkout scm
woloxCi('.woloxci/config.yml');
}
config:
dockerfile: .woloxci/Dockerfile
project_name: some-project-name
services:
- postgresql
- redis
steps:
analysis:
# sample Jenkinsfile. Might not compile
node {
checkout scm
withEnv(['MYTOOL_HOME=/usr/local/mytool']) {
docker.image("postgres:9.2").withRun() { db ->
withEnv(['DB_USERNAME=postgres', 'DB_PASSWORD=', "DB_HOST=db", "DB_PORT=5432"]) {
docker.image("redis:X").withRun() { redis ->
withEnv(["REDIS_URL=redis://redis"]) {
docker.build(imageName, "--file .woloxci/Dockerfile .").inside("--link ${db.id}:postgres --link ${redis.id}:redis") {
sh "rake db:create"
# Store Puma Application Logs in Cloudwatch
Mappings:
CWLogs:
PumaLogGroup:
LogFile: "/var/log/puma/puma.log"
TimestampFormat: ""
Outputs:
PumaCWLogGroup:
Description: "Puma Application Logs"
const winston = require('winston'),
moment = require('moment'),
config = require('../../config/config').config,
getNamespace = require('cls-hooked').getNamespace;
exports.logger = new winston.Logger({
transports: [
new winston.transports.Console({
formatter: (options) => {
const ns = getNamespace('application');
@mdesanti
mdesanti / production.rb
Created October 27, 2016 12:09
Logstasher Configuration
LogStashLogger.configure do |config|
config.customize_event do |event|
hash = event.to_hash
tags = hash['tags']
event['requestId'] = tags.present? ? tags[0] : RequestStore.store[:request_id]
event['subId'] = RequestStore.store[:sub_id]
event['service'] = 'Microservice A'
event['logLevel'] = hash['severity']
event['timestamp'] = Time.now.utc.iso8601(3)
end
console.log(cognitoUser)
AWS.config.region = 'us-east-1';
if (cognitoUser != null) {
cognitoUser.getSession(function(err, result) {
if (result) {
console.log('You are now logged in.');
// Add the User's Id Token to the Cognito credentials login map.