Skip to content

Instantly share code, notes, and snippets.

View aputs's full-sized avatar

Allan Ralph Hutalla aputs

  • Earth
  • Philippines
View GitHub Profile
@aputs
aputs / docker-install
Last active September 11, 2016 15:29
docker centos install
sudo wget --no-check-certificate https://get.docker.io/builds/Linux/x86_64/docker-latest -O /usr/bin/docker
sudo chmod +x /usr/bin/docker
sudo groupadd docker
sudo usermod -a -G docker wyrls
sudo yum install bridge-utils lxc
sudo sysctl -w net.ipv4.ip_forward=1
##/etc/sysctl.conf
sysctl net.ipv4.ip_forward=1
lvcreate --wipesignatures y -n thinpool arch -L 100G
lvcreate --wipesignatures y -n thinpoolmeta arch -L 1G
lvconvert -y --zero n -c 512K --thinpool arch/thinpool --poolmetadata arch/thinpoolmeta
cat <<EOF | tee /etc/lvm/profile/docker-thinpool.profile
activation {
thin_pool_autoextend_threshold=80
thin_pool_autoextend_percent=20
}
@aputs
aputs / tar-docker-image
Last active October 29, 2016 23:58
tar docker image (squash)
docker_root=/var/lib/docker/btrfs
subvolumes=subvolumes
docker_image=aputs/archlinux
tar_file=/tmp/image.tar.gz
# tar
cd $docker_root/$subvolumes/$(docker inspect --format='{{.Id}}' $docker_image)
tar --exclude={'.','..'} -Pcvzf $tar_file .* *
#!/bin/bash
set -e
set -o pipefail
function list_tars {
ROOT=$1
TAG=${2:-latest}
BASE=$(sed -e 's/.*{\(".*"\)}.*/\1/g' "${ROOT}/repositories" | sed 's/"//g' | awk -v RS=',' -F: '/^'${TAG}'/ {print $2}')
CUR=$BASE
TGZ=http://hkg.mirror.rackspace.com/archlinux/iso/2014.11.01/archlinux-bootstrap-2014.11.01-x86_64.tar.gz
ROOT=/var/lib/archlinux
TMPROOT=/tmp/archlinux
sudo mkdir -p ${TMPROOT}
wget "${TGZ}" -O- | sudo tar --strip-components=1 -C ${TMPROOT} -Pxzf-
sudo sed --in-place s/^#//g ${TMPROOT}/etc/pacman.d/mirrorlist
sudo btrfs subvolume delete ${ROOT}
sudo btrfs subvolume create ${ROOT}
@aputs
aputs / create-smartos-vm.sh
Created November 20, 2016 20:54 — forked from twobitfool/create-smartos-vm.sh
Create a SmartOS VM in VirtualBox
#!/bin/sh
#
# Creates a SmartOS VM in VirtualBox (assuming you alread have VirtualBox installed)
#
# This script will:
# * Download the latest live ISO image of SmartOS
# * Create a VirtualBox VM, or update an existing VM with the latest ISO
# * Configure the VM with a zones disk, and boot it!
#
#
@aputs
aputs / pacman.conf
Created November 9, 2014 16:00
minimal pacman config
[options]
NoUpgrade = etc/passwd etc/group etc/shadow
NoUpgrade = etc/pacman.conf
NoExtract = usr/share/doc/*
NoExtract = usr/share/info/*
NoExtract = usr/share/man/*
NoExtract = usr/share/locale/[a-d,f-k,m-z]*
NoExtract = usr/share/locale/e[a-m,o-z]*
NoExtract = usr/share/locale/l[a-n,p-z]*
NoExtract = usr/share/locale/lo
@aputs
aputs / etcd centos init.d script
Last active November 21, 2017 14:07
etcd init script
#!/bin/bash
# Startup script for etcd
#
# chkconfig: 2345 20 80
# description: Starts and stops etcd
. /etc/init.d/functions
prog="etcd"
ETCD_BIN=$(which etcd 2> /dev/null)
@aputs
aputs / redis_sentinel.py
Created September 15, 2018 05:41
add support for redis sentinel on django-redis
# -*- coding: utf-8 -*-
import logging
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from redis.sentinel import Sentinel
from django_redis.client import DefaultClient
@aputs
aputs / build-ubuntu-rootfs.sh
Last active February 6, 2019 10:00
shell script for creating ubuntu base image for running inside docker containers
#!/bin/sh
set -x
control_c()
# run if user hits control-c
{
echo -en "\n*** Ouch! Exiting ***\n"
exit $?
}