-
Notifications
You must be signed in to change notification settings - Fork 2
Build and Deploy instructions
Aarti edited this page Jun 3, 2020
·
10 revisions
- Create an AWS instance. For this, go to the AWS console
- Go to EC2
- Running instances > launch instances
- In the search box, "Ubuntu Server 18.04 LTS (HVM), SS Volume Type"
- Select t2.medium (the management cluster needs to be big enough, anything smaller than this didn't work at the time of doing this). Click on Next
- Add Storage, and then go to Add tag button
- Add "key name" as Name and "cloud_test" as Value
- Click on configure security group
- Select all default security groups by clicking on all the checkboxes
- Click on launch
- From the dropdown select "Create a new pair"
- Select key pair name as "cloud_test"
- Click download key pair(use this key to ssh into the instance). Save it in ~/
- Click on launch instance.
- Finally, use the "IPv4 Public IP" to ssh into the instance.
- On the AWS console, go to EC2 instances
- For the EC2 instance that you created, copy the
IPv4 public address
- on your terminal,
ssh -i <pem_file_created_above> ubuntu@<ip_adress from step2>
sudo su
curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.18.0/bin/linux/amd64/kubectl
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl
curl -Lo ./kind "https://kind.sigs.k8s.io/dl/v0.8.0/kind-$(uname)-amd64"
chmod +x ./kind
sudo mv ./kind /usr/local/bin/kind
kind version
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
apt-cache policy docker-ce
sudo apt-get install -y docker-ce
kind create cluster
kubectl cluster-info --context kind-kind
assuming you are still in your cloud instance
cd /home/ubuntu
mkdir -p /home/ubuntu/cloud/kubernetes
mkdir -p /home/ubuntu/cloud/bin
apt-get update
apt install make
Please note that the working directory("work" in the example below) should be an empty directory.
sudo su
curl -O https://dl.google.com/go/go1.14.3.linux-amd64.tar.gz
tar xvf go1.14.3.linux-amd64.tar.gz
sudo chown -R root:root ./go
sudo mv go /usr/local
mkdir -p $HOME/work
export GOPATH=$HOME/work
export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin
mkdir -p $HOME/work/src
cd $HOME/work/src
You should be in $HOME/work/src directory
git clone https://github.com/AartiJivrajani/All-On-Cloud-9.git
cd All-On-Cloud-9
export GO111MODULE=on
go mod tidy
export INSTANCE=<ip_address_of EC2 instance>
make deploy-local //ensure your pem file is present in ~/
cd /home/ubuntu/cloud
docker build -t aartij17/cloud:nats -f Dockerfile.nats --no-cache .
docker build -t aartij17/server:v1 -f Dockerfile.server --build-arg basedir=. --no-cache .
docker build -t aartij17/orderer:v1 -f Dockerfile.orderer --build-arg basedir=. --no-cache .
kind load docker-image aartij17/orderer:v1
kind load docker-image aartij17/server:v1
kind load docker-image aartij17/cloud:nats
cd kubernetes
kubectl create -f .
// now check if all the pods are running
kubectl get pods -w (all the pods should be in running state)
kubectl describe node | grep Internal | cut -f 2 -d : | sed 's/^ *//g'
curl -X POST \
http://<node_IP>:30085/app/manufacturer \
-H 'Content-Type: application/json' \
--data-raw '{
"num_units_to_sell":10,
"amount_to_be_collected":50,
"transaction_type": "LOCAL_TXN"
}'
kubectl get pods | grep manufacturer1
copy the name of the pod that you see
kubectl logs -f <pod_name>
You should be able to see logs such as these:
**********************************************************************************************
WARNING[0082] [Node], [Outgoing edges], [Incoming Edges]
WARNING[0082] {[XXX] [] [LOCAL-MANUFACTURER-11]}
WARNING[0082] {[LOCAL-MANUFACTURER-11] [XXX] []}
**********************************************************************************************
Repeat again for the below API(local supplier transaction)
curl -X POST \
http://<node_IP>:30086/app/supplier \
-H 'Content-Type: application/json' \
-H 'cache-control: no-cache' \
-d '{
"to_application":"SUPPLIER",
"num_units_to_buy":20,
"amount_paid":102,
"shipping_service": "FEDEX",
"shipping_cost": 2,
"transaction_type": "LOCAL_TXN"
}'