Skip to content

Instantly share code, notes, and snippets.

@duduribeiro
duduribeiro / Jenkinsfile
Created July 1, 2017 04:43
review_app-Jenkinsfile-envMethod
def createEnvironment(name) {
sh "docker-compose down"
sh "docker service rm ${name} || :"
sh "docker service rm ${name}-pg || :"
sh "docker service rm ${name}-redis || :"
sh script: """\
docker service create \
--name ${name}-pg \
--network traefik-net \
postgres \
@duduribeiro
duduribeiro / Jenkinsfile
Created July 1, 2017 03:28
review_app-Jenkinsfile
pipeline {
agent any
stages {
stage('Build') {
steps {
sh 'docker build -t openjobs:latest .'
sh 'docker-compose build'
sh 'docker-compose run web bundle install'
sh 'docker-compose run web yarn'
sh 'docker-compose run -e RAILS_ENV=test --rm web bundle exec rake db:drop db:create db:migrate'
@duduribeiro
duduribeiro / docker-compose.yml
Last active July 1, 2017 03:57
review_app-docker-compose.yml
version: '3'
services:
db:
image: postgres
volumes:
- /tmp/postgres_data:/var/lib/postgresql/data
redis:
image: redis
@duduribeiro
duduribeiro / Dockerfile
Last active June 30, 2017 20:35
review_app-Dockerfile
FROM ruby:2.4.1
MAINTAINER mail@carlosribeiro.me
RUN curl -sS http://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
&& curl -sL http://deb.nodesource.com/setup_6.x | bash - \
&& echo "deb http://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list \
&& apt-get update \
&& apt-get install -y \
build-essential \
imagemagick \
@duduribeiro
duduribeiro / blame_history.sh
Created June 8, 2017 12:12
blame history on git
git log --pretty=short -u -L 5,11:file
@duduribeiro
duduribeiro / output.tf
Created March 31, 2017 23:54
Terraform staging - output.tf
output "elb_hostname" {
value = "${module.web.elb.hostname}"
}
@duduribeiro
duduribeiro / terraform.tfvars
Created March 31, 2017 23:41
Terraform staging - terraform.tfvars2
environment = "staging"
key_name = "test"
region = "us-west-1"
availability_zone = "us-west-1a"
# vpc
vpc_cidr = "10.0.0.0/16"
public_subnet_cidr = "10.0.1.0/24"
private_subnet_cidr = "10.0.2.0/24"
@duduribeiro
duduribeiro / variables.tf
Created March 31, 2017 23:40
Terraform staging - variables.tf2
variable "environment" {
default = "staging"
}
variable "key_name" {
description = "The aws keypair to use"
}
variable "region" {
description = "Region that the instances will be created"
@duduribeiro
duduribeiro / web.tf
Created March 31, 2017 23:36
Terraform staging - web.tf
module "web" {
source = "../modules/web"
web_instance_count = "${var.web_instance_count}"
region = "${var.region}"
instance_type = "t2.micro"
private_subnet_id = "${module.networking.private_subnet_id}"
public_subnet_id = "${module.networking.public_subnet_id}"
vpc_sg_id = "${module.networking.default_sg_id}"
key_name = "${var.key_name}"
environment = "${var.environment}"
@duduribeiro
duduribeiro / output.tf
Created March 31, 2017 23:33
Terraform web module - output.tf
output "elb.hostname" {
value = "${aws_elb.web.dns_name}"
}