Skip to content

Instantly share code, notes, and snippets.

@rockon1985
rockon1985 / git_create_commits.py
Created May 5, 2020 20:01
Python script to initialize a git repo and generate several commits in it
# GIT COMMITS CREATOR #
# ======================
# WARNING!!!!!
# _____
# / \
# | () () |
# \ ^ /
# |||||
# |||||
# This script creates new commits in your existing folder.
@rockon1985
rockon1985 / deploying_nodejs_postgres_on_aws.md
Last active June 29, 2023 06:50
Walkthrough guide to deploy nodejs and postgres app using EC2, nginx and RDS

Deploying nodejs on AWS

1. Create AWS EC2 instance

We would prefer to go with Ubuntu Server 16.04 LTS (HVM) [ami-0d03add87774b12c5] for backward compatibility for older applications. But one can choose any version as per thier preference

2. Install nvm and Nodejs using nvm

@rockon1985
rockon1985 / values.yaml
Created November 12, 2019 13:23
Listing environment variables in helm chart
replicaCount: 1
image:
repository: nginx
tag: stable
pullPolicy: IfNotPresent
imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""
service:
@rockon1985
rockon1985 / pod_mounting_env_from_secret.yaml
Last active November 12, 2019 15:11
Kubernetes Pod using secret for mounting env variables
apiVersion: v1
kind: Pod
metadata:
name: secret-env-pod
spec:
containers:
- name: mycontainer
image: redis
env:
- name: PORT
@rockon1985
rockon1985 / query_chaincode.sh
Created September 17, 2018 08:03
Query the chaincode
# Query the chaincode
peer chaincode query -C buyer1seller1channel1 -n mycc2 -c '{"Args":["query","key"]}'
@rockon1985
rockon1985 / instantiate_chaincode.sh
Last active September 17, 2018 08:01
Intantiate chaincode
# Instantiate the chaincode
peer chaincode instantiate -o orderer-example-com:7050 --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example-com/tlsca.example-com-cert.pem -C buyer1seller1channel1 -n mycc2 -l node -v 2.0 -c '{"Args":["init","key", "test value"]}' -P "AND ('BuyerOneMSP.peer','SellerOneMSP.peer')"
@rockon1985
rockon1985 / bash2.sh
Last active September 17, 2018 10:05
Gist to install chaincode
# Update the environment variable for Peer0
export CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/buyerone-example-com/users/Admin@buyerone-example-com/msp
export CORE_PEER_LOCALMSPID="BuyerOneMSP"
export CORE_PEER_ADDRESS=peer0-buyerone-example-com:7051
export CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/buyerone-example-com/peers/peer0-buyerone-example-com/tls/ca.crt
# Install the chaincode for Peer0
peer chaincode install -n mycc2 -v 2.0 -l node -p /opt/gopath/src/github.com/chaincode/default_chaincode/node/
@rockon1985
rockon1985 / bash2.sh
Created September 17, 2018 07:58
Join channel
# Update the environment variable for Peer0
export CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/buyerone-example-com/users/Admin@buyerone-example-com/msp
export CORE_PEER_LOCALMSPID="BuyerOneMSP"
export CORE_PEER_ADDRESS=peer0-buyerone-example-com:7051
export CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/buyerone-example-com/peers/peer0-buyerone-geoverse-com/tls/ca.crt
# Install the chaincode for Peer0
peer chaincode install -n mycc2 -v 2.0 -l node -p /opt/gopath/src/github.com/chaincode/default_chaincode/node/
@rockon1985
rockon1985 / bash.sh
Created September 17, 2018 07:56
bash into a pod
kubectl exec -it <CLI_POD_ID> --namespace=peers -- /bin/bash
@rockon1985
rockon1985 / extraPods.yaml
Last active September 17, 2018 07:55
example ExtraPods
ExtraPods:
- Name: buyerone-node-app
Chart: ./buyerone
Values:
- name: "replicaCount"
value: "1"
- name: "name"
value: buyerone-node-app
- name: "NODE_ENV"
value: "production"