Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env bash
# wrapper script to check if mysql is up and then start service
# after 3 successful attempets or exit after timeout.
HOST=$1
shift
TIMEOUT=$1
shift
CMD=$@
version: '2'
networks:
nginx:
services:
nginx-proxy:
container_name: nginx-proxy
image: jwilder/nginx-proxy:alpine
restart: always
environment:
@halfb00t
halfb00t / ec2_cloud.groovy
Last active December 26, 2017 19:40 — forked from vrivellino/ec2_cloud.groovy
Jenkins EC2 Plugin Configuration via Groovy
/*
* Configure the Jenkins EC2 Plugin via Groovy Script
* EC2 Plugin URL: https://wiki.jenkins-ci.org/display/JENKINS/Amazon+EC2+Plugin
*/
import hudson.model.*
import jenkins.model.*
import hudson.plugins.ec2.*
import com.amazonaws.services.ec2.model.InstanceType
// add-jenkins-param.groovy
// Adds a parameter to all jobs on a Jenkins instance.
// The parameter is then exposed as an environment variable.
import hudson.model.*
key = 'GEM_SOURCE'
value = 'http://rubygems.delivery.puppetlabs.net'
desc = 'The Rubygems Mirror URL'
for(job in Hudson.instance.items) {
@halfb00t
halfb00t / 00-set-authorization.groovy
Created October 27, 2017 08:08 — forked from xbeta/00-set-authorization.groovy
put them in $JENKINS_HOME/init.groovy.d/
import jenkins.model.*;
import hudson.security.*;
// JVM did not like 'hypen' in the class name, it will crap out saying it is
// illegal class name.
class BuildPermission {
static buildNewAccessList(userOrGroup, permissions) {
def newPermissionsMap = [:]
permissions.each {
newPermissionsMap.put(Permission.fromId(it), userOrGroup)
FROM debian:stretch
LABEL maintainer="Andrew S. <halfb00t@gmail.com>"
RUN set -ex; \
apt-get update -qq && apt-get install -qqy \
apt-transport-https \
ca-certificates \
locales \
wget gnupg \
#!/bin/bash
eval "$(aws ecr get-login --no-include-email --region $2)"
docker build -t $1 -f docker/Dockerfile docker/.
docker push $1:latest
@halfb00t
halfb00t / ecr.tf
Last active December 29, 2017 09:44
resource "aws_ecr_repository" "pgbouncer" {
name = "${var.name}"
}
resource "null_resource" "build_pgbouncer_image" {
provisioner "local-exec" {
command = "./docker/build.sh ${aws_ecr_repository.pgbouncer.repository_url} ${var.region}"
}
}
[
{
"memory": ${memory},
"networkMode": "host",
"portMappings": [
{
"hostPort": ${host_port},
"containerPort": ${container_port},
"protocol": "tcp"
}
resource "aws_security_group" "pgbouncer" {
name = "${var.name}"
vpc_id = "${var.vpc_id}"
ingress {
from_port = "${var.port}"
to_port = "${var.port}"
protocol = "tcp"
//cidr_blocks = ["${data.aws_vpc.vpc.cidr_block}"]