Skip to content

Instantly share code, notes, and snippets.

@beldpro-ci
beldpro-ci / .hyper.js
Created April 15, 2017 14:50
My hypeterm config
module.exports = {
config: {
// default font size for all tabs
fontSize: 14,
// font family with optional fallbacks
fontFamily: 'Hack, "DejaVu Sans Mono", "Lucida Console", monospace',
// terminal cursor background color (hex)
cursorColor: 'rgba(255,255,255,.4)',
@beldpro-ci
beldpro-ci / 01-filladb.sh
Created April 29, 2017 14:56
Initialization script for `postgre:alpine`
#!/bin/bash
# Immediately exits if any error occurs during the script
# execution. If not set, an error could occur and the
# script would continue its execution.
set -o errexit
# Creating an array that defines the environment variables
# that must be set. This can be consumed later via arrray
@beldpro-ci
beldpro-ci / docker-compose-filladb.sh
Last active April 29, 2017 15:02
Use of `build` directive to build sample postgres database
# Make a directory `db` encapsulates your image, having
# a docker-compose at the same level.
$ tree
.
├── db
│ ├── Dockerfile
│ └── init
│ └── 01-filladb.sh
└── docker-compose.yml
@beldpro-ci
beldpro-ci / postgres_1-initialization.sh
Created April 29, 2017 15:04
Result of running docker-compose.yml with our custom image
postgres_1 | Success. You can now start the database server using:
postgres_1 |
postgres_1 | pg_ctl -D /var/lib/postgresql/data -l logfile start
postgres_1 |
postgres_1 | waiting for server to start....LOG: could not bind IPv6 socket: Address not available
postgres_1 | HINT: Is another postmaster already running on port 5432? If not, wait a few seconds and retry.
postgres_1 | LOG: database system was shut down at 2017-04-29 15:03:23 UTC
postgres_1 | LOG: MultiXact member wraparound protections are now enabled
postgres_1 | LOG: database system is ready to accept connections
postgres_1 | LOG: autovacuum launcher started
@beldpro-ci
beldpro-ci / exec-into-db.sh
Created April 29, 2017 15:06
Execute into the database
docker exec -it infra_postgres_1 /bin/sh
/ # psql -U filla -d filladb1
psql (9.6.2)
Type "help" for help.
filladb1=> CREATE TABLE films ( title varchar(40) NOT NULL );
CREATE TABLE
filladb1=>
@beldpro-ci
beldpro-ci / docker-compose.yml
Created May 2, 2017 14:16
3-server consul cluster with docker swarm
# Using the latest docker-compose version as of 02/May/2017 so that
# we can leverage the `deploy` section with all of its properties.
# Using docker 17.05.0-ce-rc1 you should be able to deploy this without
# problems.
version: '3.2'
services:
# Declaring a consul-server service that is made up of 3 containers (replica=3)
# with endpoint-mode==dnsrr. This makes docker not create a virtual IP but just
# rely on dsn round-robin load-balancing.
@beldpro-ci
beldpro-ci / deploy.sh
Created May 2, 2017 14:22
consul stack deploy - terminal
docker stack deploy \
--compose-file ./docker-compose.yml \
mystack
docker service ls
NAME MODE REPLICAS IMAGE
mystack_consul replicated 3/3 consul:0.7.2
@beldpro-ci
beldpro-ci / ami.json
Created May 3, 2017 20:40
Docker-enabled AMI
{
"variables": {
"aws_access_key": "<access_key>",
"aws_secret_key": "<secret_key>"
},
"builders": [
{
"type": "amazon-ebs",
"access_key": "{{user `aws_access_key`}}",
"secret_key": "{{user `aws_secret_key`}}",
@beldpro-ci
beldpro-ci / Makefile
Created May 9, 2017 00:05
makefile to run openresty container w/ header replacement
CONTAINER_NAME := nginx-lua-tests
# RUN is responsible for running our container.
# First it removes any prvevious containers that
# were set up during testing, ignoring errors.
# Then, it runs a container using
# openresty/opernresty:alpine-fat as the base image.
# It binds a volume with our nginx configuration and
# lua volumes so that we don't need to create a custom
# image and keep restarting the container.
@beldpro-ci
beldpro-ci / nginx.conf
Created May 9, 2017 00:23
Configuration for a NGINX configuration that loads some lua modules
worker_processes 1;
events {
worker_connections 1024;
}
http {
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;