GRPC Test App - Bookstore: Difference between revisions

From Federal Burro of Information
Jump to navigationJump to search
No edit summary
No edit summary
 
Line 1: Line 1:
<pre>
#!/bin/bash
#!/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
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
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
Line 24: Line 29:
   --net=esp_net \
   --net=esp_net \
   gcr.io/endpoints-release/endpoints-runtime:2 \
   gcr.io/endpoints-release/endpoints-runtime:2 \
   --service=bookstore.endpoints.dthornton-test-20220714-001.cloud.goog \
   --service=bookstore.endpoints.${PROJECT_ID}.cloud.goog \
   --rollout_strategy=managed \
   --rollout_strategy=managed \
   --listener_port=9000 \
   --listener_port=9000 \
Line 38: Line 43:
# PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python \
# PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python \
# python bookstore_client.py --host 127.0.0.1 --port 80
# python bookstore_client.py --host 127.0.0.1 --port 80
</pre>

Latest revision as of 13:53, 20 September 2023


#!/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