Skip to content

Instantly share code, notes, and snippets.

@ozbillwang
ozbillwang / kubernetes-auto-completion-fish.md
Last active February 22, 2022 09:43
Kubernetes auto-completion works with FISH (better than Bash)
View kubernetes-auto-completion-fish.md
@ozbillwang
ozbillwang / rkind.sh
Created June 13, 2020 13:28 — forked from anapsix/rkind.sh
Rancher in KIND (Rancher in Kubernetes-in-Docker)
View rkind.sh
#!/usr/bin/env bash
#
# RKIND is a naive helper script to start KIND and Rancher Management Server
#
set -u
set -o pipefail
RANCHER_CONTAINER_NAME="rancher-for-kind"
RANCHER_HTTP_HOST_PORT=$[$[RANDOM%9000]+30000]
@ozbillwang
ozbillwang / ssh-fingerprint.md
Created April 27, 2020 01:26
show ssh key's fingerprint
View ssh-fingerprint.md

ssh-keygen -l -E md5 -f id_rsa

@ozbillwang
ozbillwang / packer-on-gcp.md
Last active December 5, 2022 23:54
google cloud - account.json file for packer
View packer-on-gcp.md

The problem

The document quality of Google Cloud is far away if compare with AWS. Here is a sample.

If you met below error, when running packer or other SDK,

$ cat packer.json
{
 "builders": [
@ozbillwang
ozbillwang / Git_Behind_Proxy.md
Last active March 14, 2023 06:27
Configure Git to use a proxy (https or SSH+GIT)
View Git_Behind_Proxy.md
View ecs-service-targetgroup-twin.yaml
AWSTemplateFormatVersion: 2010-09-09
Description: 'Registers ecs tasks to a second target group'
Parameters:
ClusterArn:
Description: 'ANR of cluster the service resides in'
Type: String
ServiceName:
Description: 'Name of the service to register'
Type: String
ContainerName:
View multiple-ports-per-ecs-service.md

Unfortunately as of writing this (Oct 18, 2017) there is no built in integration for multiple target groups per AWS ECS service. Here are a few things you can try:

  1. If your application just serves port 80 (HTTP) & port 443 (HTTPS) then you should consider using the application load balancer and terminating SSL at the load balancer. This will allow your application to function using just port 80.

  2. If your application serves different ports that are backed by different components, perhaps speaking different protocols then you should consider splitting the application into multiple ECS services. This has the benefit of allowing the different components to independently scale

@ozbillwang
ozbillwang / a new way to manage tags with terraform.md
Created February 1, 2018 02:06
a new way to manage tags with terraform
View a new way to manage tags with terraform.md
@ozbillwang
ozbillwang / varnishlog-examples.sh
Created January 15, 2018 23:39 — forked from cupracer/varnishlog-examples.sh
varnishlog examples (version 4.x)
View varnishlog-examples.sh
# filter by request host header
varnishlog -q 'ReqHeader ~ "Host: example.com"'
# filter by request url
varnishlog -q 'ReqURL ~ "^/some/path/"'
# filter by client ip (behind reverse proxy)
varnishlog -q 'ReqHeader ~ "X-Real-IP: .*123.123.123.123"'
# filter by request host header and show request url and referrer header
@ozbillwang
ozbillwang / serverelss_build.md
Last active January 24, 2018 05:57
how to build serverless framework by yourself.
View serverelss_build.md

Sometime, you can't wait and try new features in serverless framework (github.com/serverless/serverless)

serverless/serverless#4325 (comment)

run below commands, this build will generate new serverless command.

cd <serverless_repo_full_path>
# Fake the environment "SENTRY_DSN", otherwise, it will stop the build
export SENTRY_DSN=demo