-
Notifications
You must be signed in to change notification settings - Fork 142
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
144 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
dist-newstyle | ||
src-gen/ |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
FROM docker.io/library/haskell:8.10.7 | ||
|
||
RUN apt-get update && apt-get install -y \ | ||
build-essential autoconf libtool libssl-dev pkg-config cmake git | ||
|
||
ARG PARALLEL | ||
RUN BUILD_DIR=$(mktemp -d) && \ | ||
cd $BUILD_DIR && \ | ||
git clone --depth 1 --branch v1.42.0 --recurse-submodules https://github.com/grpc/grpc && \ | ||
cd grpc && \ | ||
cmake -DCMAKE_INSTALL_PREFIX=/usr \ | ||
-DgRPC_BUILD_TESTS=OFF \ | ||
-DBUILD_SHARED_LIBS=ON \ | ||
-DgRPC_INSTALL=ON \ | ||
-DCMAKE_BUILD_TYPE=Release \ | ||
-DgRPC_SSL_PROVIDER=package \ | ||
. && \ | ||
make -j ${PARALLEL:-$(nproc)} && \ | ||
make install -j${PARALLEL:-$(nproc)} && \ | ||
rm -rf $BUILD_DIR | ||
|
||
COPY haskell_grpc_haskell_bench /app/bench | ||
COPY proto /app/proto | ||
|
||
RUN cd /app/bench && cabal update && make && cabal install | ||
|
||
RUN rm -rf /app | ||
|
||
ENTRYPOINT /root/.cabal/bin/haskell-grpc-haskell-bench +RTS -N${GRPC_SERVER_CPUS:-1} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
CABAL ?= cabal | ||
PROTO_COMPILE_HS = ~/.cabal/bin/compile-proto-file | ||
|
||
grpc-haskell: | ||
($(CABAL) build proto3-suite && mkdir -p ~/.cabal/bin && \ | ||
$(CABAL) exec which compile-proto-file | tail -1 | xargs -I{} cp {} $(PROTO_COMPILE_HS)) | ||
($(PROTO_COMPILE_HS) \ | ||
--includeDir /usr/local/include \ | ||
--includeDir ../proto/helloworld \ | ||
--proto helloworld.proto \ | ||
--out ./src-gen/) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{-# LANGUAGE DataKinds #-} | ||
{-# LANGUAGE GADTs #-} | ||
{-# LANGUAGE OverloadedLists #-} | ||
{-# LANGUAGE OverloadedStrings #-} | ||
{-# LANGUAGE RecordWildCards #-} | ||
|
||
module Main where | ||
|
||
import Network.GRPC.HighLevel | ||
import Network.GRPC.HighLevel.Generated | ||
|
||
import Helloworld | ||
|
||
main :: IO () | ||
main = | ||
greeterServer | ||
(Greeter{ greeterSayHello = sayHello }) | ||
defaultServiceOptions{serverHost = "0.0.0.0", serverPort = 50051} | ||
|
||
sayHello | ||
:: ServerRequest 'Normal HelloRequest HelloReply | ||
-> IO (ServerResponse 'Normal HelloReply) | ||
sayHello (ServerNormalRequest _metadata HelloRequest{..}) = do | ||
return $ ServerNormalResponse (HelloReply helloRequestRequest) [] StatusOk "" |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
packages: | ||
. | ||
|
||
source-repository-package | ||
type: git | ||
location: https://github.com/awakesecurity/gRPC-haskell.git | ||
tag: d20c20d63c170b5eaf5725f03f7b7060352af402 | ||
|
||
source-repository-package | ||
type: git | ||
location: https://github.com/awakesecurity/gRPC-haskell.git | ||
tag: d20c20d63c170b5eaf5725f03f7b7060352af402 | ||
subdir: core | ||
|
||
package grpc-haskell-core | ||
extra-include-dirs: /usr/local/include | ||
extra-lib-dirs: /usr/local/lib |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
cabal-version: 2.4 | ||
name: grpc-haskell-bench | ||
version: 0.1.0.0 | ||
|
||
executable haskell-grpc-haskell-bench | ||
main-is: Main.hs | ||
hs-source-dirs: app src-gen | ||
other-modules: Helloworld | ||
build-depends: | ||
, base >=4.14 && <5 | ||
, bytestring | ||
, containers | ||
, deepseq | ||
, grpc-haskell | ||
, grpc-haskell-core | ||
, proto3-suite ^>=0.6 | ||
, proto3-wire ^>=1.4 | ||
, text | ||
, vector | ||
|
||
default-language: Haskell2010 | ||
ghc-options: | ||
-O2 -Wall -Wcompat -Widentities -Wincomplete-record-updates | ||
-Wincomplete-uni-patterns -Wpartial-fields -Wredundant-constraints | ||
-threaded -rtsopts |