Skip to content

Instantly share code, notes, and snippets.

@epishan
epishan / run.tpl
Last active June 12, 2017 13:40 — forked from efrecon/run.tpl
[docker] `docker inspect` template to regenerate the `docker run` command that created a container
docker run \
--name={{.Name}} \
{{range $e := .Config.Env}}--env="{{$e}}" \
{{end}}{{range $p, $conf := .NetworkSettings.Ports}}-p {{(index $conf 0).HostIp}}:{{(index $conf 0).HostPort}}:{{$p}} \
{{end}}{{range $v := .HostConfig.VolumesFrom}}--volumes-from="{{.}}" \
{{end}}{{range $v := .HostConfig.Binds}}--volume="{{.}}" \
{{end}}{{range $l, $v := .Config.Labels}}--label "{{$l}}"="{{$v}}" \
{{end}}{{range $v := .HostConfig.CapAdd}}--cap-add {{.}} \
{{end}}{{range $v := .HostConfig.CapDrop}}--cap-drop {{.}} \
{{end}}{{range $d := .HostConfig.Devices}}--device={{(index $d).PathOnHost}}:{{(index $d).PathInContainer}}:{{(index $d).CgroupPermissions}} \
@epishan
epishan / disable_job.groovy
Last active June 12, 2017 13:41 — forked from sergey-epishkin-lzd/delete_job.groovy
[jenlins] Jenkins jobs cleanup
// Groovy script to disable job in Hudson
import hudson.model.*;
def JOB_PATTERN = ~/^GO.*.deploy*.staging2$/; //find all jobs starting with "MY_JOB".
(Hudson.instance.items.findAll { job -> job.name =~ JOB_PATTERN }).each { job_to_update ->
if (job_to_update.name =~ "^\$") {
return;
}
else {
package main
import (
"bytes"
"flag"
"fmt"
"io/ioutil"
"net/http"
"strconv"
)
@epishan
epishan / deploy.sh
Created January 22, 2014 15:41 — forked from tokudu/deploy.sh
http://blog.umanoapp.com/post/35685965949/writing-a-simple-deployment-script-for-your-ec2-servers If your backend is running on the Amazon Web Services EC2 stack, you always have to deal with deploying the latest version of your code to all of your instances. The archaic way of doing this is SSH’ing into every instance, manually pulling the late…
#!/bin/bash
# Updates all EC2 instances from git
# Author: anton@sothree.com
CODE_LOCATION=/var/www/your_project
SERVER_PREFIX=your_project
# exit if something fails
set -e