Packer
-
Packer is used to build image from a base image, perform provisions and store (commit) the final image.
-
We use provisioners and Packer templates to do the actual work to create the final image.
-
We use Ansible for provisioning.
// modules | |
var redis = require('redis'); | |
var Step = require('step'); | |
// config file | |
var config = require('config'); | |
// mysql client connect | |
var mysql = require('mysql'); | |
var connection = mysql.createConnection({ |
// modules | |
var redis = require('redis'); | |
var Step = require('step'); | |
// config file | |
var config = require('config'); | |
// mysql client connect | |
var mysql = require('mysql'); | |
var connection = mysql.createConnection({ |
#!/bin/sh | |
# The following arguments are passed to the script: | |
# | |
# <master-name> <role> <state> <from-ip> <from-port> <to-ip> <to-port> | |
MASTER_IP=$6 | |
VIP=172.17.0.101 | |
NETMASK=16 | |
IF=eth0 | |
MY_IP=$(ip addr show dev $IF | grep "global $IF" | head -1 | sed -e "s/^.*inet \(.*\)\/$NETMASK .*$/\1/") |
#!/bin/sh | |
# redis-notify.sh | |
MAIL_FROM="[email protected]" | |
MAIL_TO="[email protected]" | |
if [ "$#" = "2" ]; then | |
mail_subject="Redis Notification" | |
mail_body=`cat << EOB | |
============================================ |
#!/bin/sh | |
_DEBUG="on" | |
DEBUGFILE=/tmp/sentinel_failover.log | |
VIP='10.125.125.30' | |
MASTERIP=${6} | |
MASK='24' | |
IFACE='eth0' | |
MYIP=$(ip -4 -o addr show dev ${IFACE}| grep -v secondary| awk '{split($4,a,"/");print a[1]}') | |
DEBUG () { |
Packer
Packer is used to build image from a base image, perform provisions and store (commit) the final image.
We use provisioners and Packer templates to do the actual work to create the final image.
We use Ansible for provisioning.
--- | |
hosts: all | |
tasks: | |
- name: add github ssh key | |
copy: > | |
src=files/id_rsa.github | |
dest=/root/.ssh/id_rsa.github | |
owner=root | |
group=root |
var fs = require('fs'); | |
var net = require('net'); | |
var http = require('http'); | |
var https = require('https'); | |
var httpAddress = '/path/to/http.sock'; | |
var httpsAddress = '/path/to/https.sock'; | |
fs.unlinkSync(httpAddress); | |
fs.unlinkSync(httpsAddress); |
#!/bin/sh | |
### BEGIN INIT INFO | |
# Provides: haproxy | |
# Required-Start: $local_fs $network $remote_fs | |
# Required-Stop: $local_fs $remote_fs | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: fast and reliable load balancing reverse proxy | |
# Description: This file should be used to start and stop haproxy. | |
### END INIT INFO |
#!/usr/bin/env bash | |
# | |
# Install HAProxy | |
# Script works on Ubuntu 12.04 and 14.04 only | |
set -e | |
set -u | |
set -o pipefail |