This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ssl | |
from hyper import HTTPConnection | |
context = ssl.SSLContext(ssl.PROTOCOL_SSLv23) | |
context.load_verify_locations(cafile="CA_crt.pem") | |
context.set_alpn_protocols(['http/1.1', "spdy/1", 'spdy/2', "spdy/3"]) | |
conn = HTTPConnection('main.esodemoapp2.com', 50051, ssl_context=context, secure=True) | |
params = binascii.a2b_hex(frame) | |
headers = {"Content-type": "application/grpc", "TE": "trailers"} | |
conn.request(method="POST", url="/echo.EchoServer/SayHello", body=params, headers=headers) | |
resp = conn.get_response() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker run \ | |
--net=host \ | |
--add-host main.esodemoapp2.com:127.0.0.1 \ | |
-v `pwd`:/tmp/ \ | |
salrashid123/grpc_curl \ | |
curl -v -k --raw -X POST \ | |
--http2 \ | |
-H "Content-Type: application/grpc" \ | |
-H "TE: trailers" \ | |
--data-binary @/tmp/frame.bin \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker run -v `pwd`:/tmp/gcurl/ \ | |
--add-host main.esodemoapp2.com:127.0.0.1 \ | |
--net=host salrashid123/grpc_curl \ | |
curl -v -k --raw -X POST --http2 \ | |
-H "Content-Type: application/grpc" \ | |
-H "TE: trailers" \ | |
--data-binary @/tmp/gcurl/frame.bin \ | |
https://main.esodemoapp2.com:50051/echo.EchoServer/SayHello -o /tmp/gcurl/resp.bin |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
// SEE: https://medium.com/@salmaan.rashid/grpc-with-curl-a65d879a18f7 | |
import ( | |
"bytes" | |
"crypto/tls" | |
"encoding/hex" | |
"fmt" | |
"io/ioutil" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
from flask import Flask | |
from flask import Response | |
import logging | |
import socket | |
import time | |
import requests |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
apiVersion: v1 | |
kind: ReplicationController | |
metadata: | |
name: myapp-rs | |
labels: | |
type: myapp-rs-label | |
spec: | |
replicas: 1 | |
selector: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: myapp-srv | |
labels: | |
type: myapp-srv | |
spec: | |
type: LoadBalancer | |
#type: NodePort |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM alpine:3.5 | |
ARG CLOUD_SDK_VERSION=160.0.0 | |
ENV PATH /google-cloud-sdk/bin:$PATH | |
RUN apk --no-cache add curl python py-crcmod bash libc6-compat && \ | |
curl -O https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-${CLOUD_SDK_VERSION}-linux-x86_64.tar.gz && \ | |
tar xzf google-cloud-sdk-${CLOUD_SDK_VERSION}-linux-x86_64.tar.gz && \ | |
rm google-cloud-sdk-${CLOUD_SDK_VERSION}-linux-x86_64.tar.gz && \ | |
ln -s /lib /lib64 && \ | |
gcloud config set core/disable_usage_reporting true && \ | |
gcloud config set component_manager/disable_update_check true && \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM centos:centos7 | |
RUN echo $'[google-cloud-sdk]\n\ | |
name=Google Cloud SDK\n\ | |
baseurl=https://packages.cloud.google.com/yum/repos/cloud-sdk-el7-x86_64\n\ | |
enabled=1\n\ | |
gpgcheck=1\n\ | |
repo_gpgcheck=1\n\ | |
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg\n\ | |
https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg'\ | |
>> /etc/yum.repos.d/google-cloud-sdk.repo && \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM debian:jessie | |
ENV CLOUD_SDK_VERSION 168.0.0 | |
RUN apt-get -qqy update && apt-get install -qqy \ | |
curl \ | |
gcc \ | |
python-dev \ | |
python-setuptools \ | |
apt-transport-https \ | |
lsb-release \ |