GRPC Test App - Bookstore

From Federal Burro of Information
Jump to navigationJump to search

#!/bin/bash

export PROJECT_ID="myproject"

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

apt-get install -y docker tree mlocate vim lsof net-tools

apt-get install -y apt-transport-https ca-certificates curl software-properties-common

apt update
apt-cache policy docker-ce
apt install -y docker-ce
systemctl status docker

sudo docker network create --driver bridge esp_net
sudo docker run \
  --detach \
  --name=bookstore \
  --net=esp_net \
  gcr.io/endpointsv2/python-grpc-bookstore-server:1
sudo docker run \
  --detach \
  --name=esp \
  --publish=80:9000 \
  --net=esp_net \
  gcr.io/endpoints-release/endpoints-runtime:2 \
  --service=bookstore.endpoints.${PROJECT_ID}.cloud.goog \
  --rollout_strategy=managed \
  --listener_port=9000 \
  --healthz=/healthz \
  --backend=grpc://bookstore:8000

# Client testing
# pip3 install virtualenv
# ~/.local/bin/virtualenv env
# source env/bin/activate
# python3 -m pip install -r requirements.txt
#
# PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python \
# python bookstore_client.py --host 127.0.0.1 --port 80