Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
yum install -y parted
if [ -b /dev/xvdcz ]; then
parted /dev/xvdcz mklabel gpt --script
parted /dev/xvdcz mkpart primary 0% 100% --script
mkfs.ext4 /dev/xvdcz1
mkdir /var/lib/docker
mount /dev/xvdcz1 -orw,noatime,nodiratime /var/lib/docker
data "aws_ami" "main" {
most_recent = true
filter {
name = "name"
values = ["amzn-ami-*-x86_64-gp2"]
}
filter {
name = "virtualization-type"
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}"]
[
{
"memory": ${memory},
"networkMode": "host",
"portMappings": [
{
"hostPort": ${host_port},
"containerPort": ${container_port},
"protocol": "tcp"
}
@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}"
}
}
#!/bin/bash
eval "$(aws ecr get-login --no-include-email --region $2)"
docker build -t $1 -f docker/Dockerfile docker/.
docker push $1:latest
FROM debian:stretch
LABEL maintainer="Andrew S. <[email protected]>"
RUN set -ex; \
apt-get update -qq && apt-get install -qqy \
apt-transport-https \
ca-certificates \
locales \
wget gnupg \
@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)
// 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 / 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