Skip to content

Instantly share code, notes, and snippets.

@luhonghai
luhonghai / canary.yml
Created December 24, 2019 10:05
Example of canary configuration
apiVersion: flagger.app/v1alpha3
kind: Canary
metadata:
name: my-app
namespace: dev
spec:
targetRef:
apiVersion: apps/v1
kind: Deployment
name: my-app
@luhonghai
luhonghai / k6.sh
Created December 24, 2019 09:53
Example k6 script
#!/usr/local/bin/bash
postman-to-k6 script.json -e env.json --csv data.source.csv -o k6-script.js
k6 run --vus 30 --duration 300s k6-script.js
[ $? -eq 0 ] || exit 1
@luhonghai
luhonghai / newman.sh
Created December 24, 2019 09:52
Example newman script
#!/usr/local/bin/bash
newman run script.json -e env.json -d data.csv
[ $? -eq 0 ] || exit 1
@luhonghai
luhonghai / Dockerfile
Created December 24, 2019 09:34
Add newman, k6 and, postman-to-k6 command to image flagger-loadtester
FROM weaveworks/flagger-loadtester:0.12.0
USER root
RUN apk update && apk add nodejs npm gettext
RUN npm install -g newman
RUN npm install postman-to-k6
COPY --from=loadimpact/k6:latest /usr/bin/k6 /usr/bin/k6
COPY scripts .
USER app
resource "google_compute_instance" "sontn-master01" {
boot_disk {
auto_delete = "true"
device_name = "sontn-master01"
initialize_params {
image = "https://www.googleapis.com/compute/v1/projects/ubuntu-os-cloud/global/images/ubuntu-1604-xenial-v20191204"
size = "20"
type = "pd-standard"
}
@luhonghai
luhonghai / delete-feature-branch.sh
Created November 21, 2018 07:17
Delete feature/* branch
git branch -D $(git for-each-ref --format='%(refname:short)' refs/heads/feature/*)
fdisk /dev/xvdb # n > w
mkfs -t ext4 /dev/xvdb1
vim /etc/fstab # /dev/xvdb1 /datadrive ext4 defaults 0 2
mkdir /datadrive
mount /dev/xvdb1 /datadrive
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
apt-get update
apt-get install docker-ce
@luhonghai
luhonghai / env-variable-android-studio.sh
Last active September 13, 2018 08:17
Set environment variable Android studio
launchctl setenv KEY VALUE
nginx -c /etc/nginx/nginx.conf -t