Skip to content

Instantly share code, notes, and snippets.

View naviat's full-sized avatar
🪲

Harry Dam naviat

🪲
View GitHub Profile
@naviat
naviat / docker-compose.yml
Created August 1, 2018 16:34 — forked from mlabouardy/docker-compose.yml
TICK stack: telegraf, influxdb, chronograf, kapacitor with swarm mode
version: "3.3"
services:
telegraf:
image: telegraf:1.3
networks:
- tick-net
volumes:
- /var/run/docker.sock:/var/run/docker.sock
configs:
@naviat
naviat / deploy.sh
Created August 1, 2018 16:34 — forked from mlabouardy/deploy.sh
Deploy Lambda function with CloudWatch event rule trigger
#!/bin/bash
## Override
JENKINS_HOST=""
JENKINS_USERNAME=""
JENKINS_PASSWORD=""
JENKINS_JOB=""
CRON_EXPRESSION="cron(0 8 * * ? *)"
## Global variables
AWS_REGION="us-east-1"
@naviat
naviat / invoke.sh
Created August 1, 2018 16:35 — forked from mlabouardy/invoke.sh
Invoke Lambda
aws lambda invoke --function-name RestartJob output
@naviat
naviat / main.go
Created August 1, 2018 16:35 — forked from mlabouardy/main.go
Lambda function to trigger Jenkins job
func triggerJob() error {
url := fmt.Sprintf(`%s/job/%s/build`, os.Getenv("JENKINS_HOST"), os.Getenv("JENKINS_JOB"))
client := http.Client{}
req, err := http.NewRequest("POST", url, nil)
if err != nil {
return err
}
crumb, err := getToken()
@naviat
naviat / Dockerfile
Created August 1, 2018 16:35 — forked from mlabouardy/Dockerfile
Dockerfile to build a Golang based application image
FROM golang:1.10
WORKDIR /go/src/github.com/mlabouardy/lambda-oneshot-container
COPY main.go .
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o app .
FROM alpine:latest
RUN apk --no-cache add ca-certificates
WORKDIR /root/
COPY --from=0 /go/src/github.com/mlabouardy/lambda-oneshot-container/app .
CMD ["./app"]
@naviat
naviat / 03-start-telegraf.config
Created August 1, 2018 16:35 — forked from mlabouardy/03-start-telegraf.config
Start Telegraf service
container_commands:
01starttelegraf:
command: "service telegraf start"
ignoreErrors: true
@naviat
naviat / 02-config-file.config
Created August 1, 2018 16:35 — forked from mlabouardy/02-config-file.config
Telegraf configuration file
files:
"/etc/telegraf/telegraf.conf":
mode: "000666"
owner: root
group: root
content: |
[global_tags]
hostname="Avengers"
# Read metrics about CPU usage
@naviat
naviat / 01-install-telegraf.config
Created August 1, 2018 16:35 — forked from mlabouardy/01-install-telegraf.config
Install telegraf agent on Elastic Beanstalk
container_commands:
01downloadpackage:
command: "wget https://dl.influxdata.com/telegraf/releases/telegraf-1.6.0-1.x86_64.rpm -O /tmp/telegraf.rpm"
ignoreErrors: true
02installpackage:
command: "yum localinstall -y /tmp/telegraf.rpm"
ignoreErrors: true
03removepackage:
command: "rm /tmp/telegraf.rpm"
ignoreErrors: true
@naviat
naviat / k8s.sh
Created August 1, 2018 16:37 — forked from riuvshin/k8s.sh
#!/bin/bash
set -e
up() {
echo "[k8s] starting k8s dind cluster"
docker run -d --privileged --shm-size 8G --name=k8s_dind -p 30000:30000 -p 8443:8443 -p 80:80 --rm riuvshin/minikube-dind:latest
wait_k8s
enable_ingress_addon
install_helm
@naviat
naviat / populate.sh
Created August 1, 2018 16:39 — forked from thomastaylor312/populate.sh
A population script for creating Kubernetes spec files
#!/bin/bash
if [ $# -lt 2 ]; then
echo 'Expects 2 arguments: ./populate.sh APPLICATION K8S_ENVIRONMENT'
exit 1
fi
extra_vars="--extra-vars @group_vars/secrets.yml"
application=$1
k8s_environment=$2