Browse Source

Add Docker instructions and update README.

Tim Burks 9 years ago
parent
commit
cad400eb08
2 changed files with 92 additions and 16 deletions
  1. 82 0
      DOCKER.md
  2. 10 16
      README.md

+ 82 - 0
DOCKER.md

@@ -0,0 +1,82 @@
+# Swift gRPC in Docker
+
+Swift gRPC works great within Docker.  
+Follow these steps to build and run Swift gRPC in the Docker container 
+from [swiftdocker](https://github.com/swiftdocker/docker-swift).
+
+## Prerequisites
+
+[Docker for Mac](https://docs.docker.com/docker-for-mac/).
+
+## Fetch the Docker image
+
+Run this command on your local system:
+
+`docker pull swiftdocker/swift`
+
+## Start Docker
+
+Start a docker instance with the swiftdocker image:
+
+`docker run -it --name swiftgrpc swiftdocker/swift:latest /bin/bash`
+
+## Install Dependencies
+
+    # update package list
+    apt-get update
+    # install a few missing pieces
+    apt-get install libz-dev
+
+## Configure git (optional)
+
+    git config --global user.email <your email address>
+    git config --global user.name "<your name>"
+
+## Get grpc-swift
+
+    cd
+    git clone https://github.com/grpc/grpc-swift
+
+## Run the grpc-swift unit tests
+
+    cd grpc-swift
+    make test
+
+## Build the Echo sample
+
+    cd
+    cd grpc-swift/Examples/Echo/Swift/SwiftPM
+    make
+
+## Run the test client and server 
+
+    # start the server
+    .build/debug/Echo serve &
+    # run the client to test each Echo API
+    .build/debug/Echo get
+    .build/debug/Echo expand
+    .build/debug/Echo collect
+    .build/debug/Echo update
+	
+## Test the Swift gRPC plugin
+
+    # install protoc build dependencies
+    apt-get install autoconf automake libtool curl make g++ unzip
+    # build and install protoc
+    cd
+    git clone https://github.com/google/protobuf.git
+    cd protobuf
+    autogen.sh
+    ./configure
+    make install
+    # build the Swift gRPC plugin
+    cd
+    cd grpc-swift/Plugin
+    make
+    # set envirinment variables to allow protoc and the plugin to run 
+    export LD_LIBRARY_PATH=/usr/local/lib
+    export PATH=.:$PATH
+    # test the plugin by regenerating code for a sample .proto service
+    make test
+
+

+ 10 - 16
README.md

@@ -24,27 +24,21 @@ The [Echo](Examples/Echo) example provides a comprehensive
 demonstration of currently-supported features.
 
 Swift Package Manager builds may also be made on Linux 
-systems. Please see [LINUX.md](LINUX.md) for details.
+systems. Please see [DOCKER.md](DOCKER.md) and 
+[LINUX.md](LINUX.md) for details.
 
-## Getting started
+## gRPC dependencies are vendored  
 
-After cloning this repository, `cd third_party; RUNME.sh` to
-download its dependencies. (We don't use `git submodules` so
-that the repository will stay lean when it is imported with the
-the Swift Package Manager.)
-
-## Building grpc
-
-Swift gRPC currently requires a separate build of the grpc core
-library. To do this, enter the grpc directory and run 
-`git submodule update --init` and then `make install`. 
-If you get build errors, edit the Makefile and remove 
-"-Werror" from the line that begins with "CPPFLAGS +=".
+Swift gRPC now includes vendored copies of the gRPC core 
+library and "BoringSSL", an OpenSSL fork that is used by
+the gRPC Core. These are built automatically in Swift Package
+Manager builds. The repository also includes SwiftGRPC.xcodeproj,
+an Xcode project which is automatically-generated by the Swift
+Package Manager.
 
 ## Having build problems?
 
-grpc-swift depends on Swift, Xcode, and swift-proto, all of which
-are in flux and potential sources of breaking changes. We are currently
+grpc-swift depends on Swift, Xcode, and swift-proto. We are currently
 testing with the following versions:
 
 - Xcode 8.2