🏋️♂️
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
config :healthchex, | |
liveness_path: "/health/live", | |
liveness_response: "OK" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule PlainPlug do | |
use Plug.Router | |
plug(Liveness) | |
# regular paths defined here | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule PlugForward do | |
use Plug.Router | |
plug(:match) | |
plug(:dispatch) | |
forward( | |
"/health/live", | |
to: Liveness | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule List do | |
def flatten(list, acc \\ []) | |
def flatten([], acc), do: acc | |
def flatten([[] | t], acc), do: flatten(t, acc) | |
def flatten([h | t], acc) when is_list(h), do: flatten(h, flatten(t, acc)) | |
def flatten([h | t], acc), do: [h | flatten(t, acc)] | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: extensions/v1beta1 | |
kind: Ingress | |
metadata: | |
name: example-ingress | |
annotations: | |
kubernetes.io/ingress.class: nginx | |
spec: | |
rules: | |
- host: kamil.lelonek.me | |
http: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: example-node-port | |
spec: | |
type: NodePort | |
selector: | |
app: api | |
ports: | |
- port: 4444 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: example-deployment | |
spec: | |
replicas: 1 | |
selector: | |
matchLabels: | |
app: api | |
template: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "google_project_service" "kubernetes" { | |
project = "k8s-project" | |
service = "container.googleapis.com" | |
} | |
resource "google_container_cluster" "kubernetes" { | |
name = "k8s-cluster" | |
depends_on = ["google_project_service.kubernetes"] | |
initial_node_count = 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const address = "localhost:50051" | |
func main() { | |
conn, err := grpc.Dial(address, grpc.WithInsecure()) | |
if err != nil { | |
log.Fatalf("did not connect: %v", err) | |
} | |
defer conn.Close() | |
c := pb.NewGravatarServiceClient(conn) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const port = ":50051" | |
type gravatarService struct{} | |
func (s *gravatarService) Generate(ctx context.Context, in *pb.GravatarRequest) (*pb.GravatarResponse, error) { | |
log.Printf("Received email %v with size %v", in.Email, in.Size) | |
return &pb.GravatarResponse{Url: gravatar(in.Email, in.Size)}, nil | |
} | |
func main() { |