GRPC Test App - Bookstore

From Federal Burro of Information
Revision as of 00:47, 20 September 2023 by David (talk | contribs)
Jump to navigationJump to search
  1. !/bin/bash

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.dthornton-test-20220714-001.cloud.goog \
 --rollout_strategy=managed \
 --listener_port=9000 \
 --healthz=/healthz \
 --backend=grpc://bookstore:8000
  1. Client testing
  2. pip3 install virtualenv
  3. ~/.local/bin/virtualenv env
  4. source env/bin/activate
  5. python3 -m pip install -r requirements.txt
  6. PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python \
  7. python bookstore_client.py --host 127.0.0.1 --port 80