Skip to content

Instantly share code, notes, and snippets.

View prayagsingh's full-sized avatar
:octocat:
Working from home

Prayag Singh prayagsingh

:octocat:
Working from home
View GitHub Profile
@prayagsingh
prayagsingh / parseTransaction.go
Created January 16, 2023 18:02 — forked from crazygit/parseTransaction.go
Parse Ethereum Transaction, Decode input data, Decode output data
package main
import (
"context"
"encoding/hex"
"fmt"
"github.com/ethereum/go-ethereum/accounts/abi"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/ethclient"
@prayagsingh
prayagsingh / frontend-ws-connection.ts
Created March 9, 2021 19:32 — forked from jsdevtom/frontend-ws-connection.ts
kubernetes-ingress websockets with nodejs
export const ws = webSocket<WebsocketMessage>(`wss://${location.hostname}:${location.protocol === 'https:' ? 443 : 80}/ws/`);
export const wsObserver = ws
.pipe(
retryWhen(errors =>
errors.pipe(
delay(1000)
)
)
);
Ingress - https://kubernetes.io/docs/concepts/services-networking/ingress/
Ingress controller - https://kubernetes.io/docs/concepts/services-networking/ingress-controllers/
DEMO 1
=======================
Centos 7 system
yum install docker -y
systemctl start docker
systemctl enable docker
#install docker-compose
sudo curl -L "https://github.com/docker/compose/releases/download/1.26.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
@prayagsingh
prayagsingh / traefik.yml
Created April 27, 2020 11:07 — forked from jakubhajek/traefik.yml
The example of Traefik 2.x configuration that is set on startup.
log:
level: info
format: json
accessLog:
format: json
bufferingSize: 5
providers:
docker:
@prayagsingh
prayagsingh / stack-canary.yml
Created April 27, 2020 11:07 — forked from jakubhajek/stack-canary.yml
The example of canary deployment using Traefik 2.x
# docker stack deploy -c stack-canary.yml canary --with-registry-auth --prune
version: "3.7"
services:
app1:
image: jakubhajek/app1-node:v1
healthcheck:
test: wget --quiet --tries=1 --spider http://localhost:3000/ || exit 1
interval: 3s
timeout: 1s
# docker stack deploy -c stack-app.yml app --with-registry-auth --prune
version: "3.7"
services:
backend:
image: jakubhajek/nodejs-backend:latest
healthcheck:
test: wget --quiet --tries=1 --spider http://localhost:3000/ || exit 1
interval: 3s
timeout: 1s
# docker stack deploy -c stack-tr-main.yml traefik --prune
version: "3.7"
services:
main:
image: traefik:v2.1.2
healthcheck:
test: wget --quiet --tries=1 --spider https://traefik.labs.cometari.eu/ping || exit 1
interval: 3s
timeout: 1s
@prayagsingh
prayagsingh / middlewares.toml
Created April 27, 2020 11:05 — forked from jakubhajek/middlewares.toml
The configuration of Traefik v2 that can be defined dynamically
[http]
[http.middlewares]
[http.middlewares.https-redirect.redirectscheme]
scheme = "https"
permanent = true
[http.middlewares.security-headers.headers]
# CORS
AccessControlAllowMethods = ["GET", "OPTIONS", "PUT"]
AccessControlAllowOrigin = "origin-list-or-null"
@prayagsingh
prayagsingh / traefik-manual-ssl.yml
Created February 25, 2020 08:02 — forked from ohnotnow/traefik-manual-ssl.yml
Traefik v2 with manual SSL certs
version: "3.7"
services:
traefik:
image: traefik:v2.1.3
restart: always
container_name: traefik
ports:
- target: 80
published: 80
@prayagsingh
prayagsingh / git_cheat-sheet.md
Created July 8, 2019 05:38 — forked from davfre/git_cheat-sheet.md
git commandline cheat-sheet