Skip to content

Commit 636052d

Browse files
author
Mike Trinkala
authored
Merge pull request #292 from mozilla-services/gcp_pubsub
Add grpc Pub/Sub support
2 parents 4540c98 + 0c3e49d commit 636052d

27 files changed

+1420
-6
lines changed

CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ cjson
7474
compat
7575
cuckoo_filter
7676
elasticsearch
77+
gcp
7778
# geoip # deprecated use maxminddb
7879
hindsight
7980
heka

Dockerfile

+9-2
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,22 @@ RUN yum makecache && \
2727
rpm -i parquet-cpp-1.3.1-1.x86_64.rpm && \
2828
cat /etc/yum.conf | grep -v override_install_langs > /etc/yum.conf.lang && \
2929
cp /etc/yum.conf.lang /etc/yum.conf && \
30-
yum reinstall -y glibc-common
30+
yum reinstall -y glibc-common && \
31+
yum install -y stow && \
32+
curl -OL https://hsadmin.trink.com/packages/centos7/external/grpc_stow.tgz && \
33+
if [[ `sha256sum grpc_stow.tgz | awk '{print $1}'` != \
34+
"65dba4a11ccc09ced4dad64ef196cab6299736a5f5e0df83fef6f1046213797b" ]]; then exit 1; fi && \
35+
tar -C / -zxf grpc_stow.tgz && \
36+
stow -d /usr/local/stow protobuf-3 grpc googleapis
3137

3238
# Use devtoolset-6
3339
ENV PERL5LIB='PERL5LIB=/opt/rh/devtoolset-6/root//usr/lib64/perl5/vendor_perl:/opt/rh/devtoolset-6/root/usr/lib/perl5:/opt/rh/devtoolset-6/root//usr/share/perl5/vendor_perl' \
3440
X_SCLS=devtoolset-6 \
3541
PCP_DIR=/opt/rh/devtoolset-6/root \
3642
LD_LIBRARY_PATH=/opt/rh/devtoolset-6/root/usr/lib64:/opt/rh/devtoolset-6/root/usr/lib \
3743
PATH=/opt/rh/devtoolset-6/root/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
38-
PYTHONPATH=/opt/rh/devtoolset-6/root/usr/lib64/python2.7/site-packages:/opt/rh/devtoolset-6/root/usr/lib/python2.7/site-packages
44+
PYTHONPATH=/opt/rh/devtoolset-6/root/usr/lib64/python2.7/site-packages:/opt/rh/devtoolset-6/root/usr/lib/python2.7/site-packages \
45+
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
3946

4047
# Compile and install lua_sandbox and hindsight using master branch
4148
RUN git clone https://github.com/mozilla-services/lua_sandbox && \

aws/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@ find_package(aws-cpp-sdk-monitoring 1.1.46 REQUIRED CONFIG)
1414

1515
set(MODULE_SRCS kinesis.cpp aws.def)
1616
set(INSTALL_MODULE_PATH ${INSTALL_IOMODULE_PATH})
17+
set(TEST_CONFIGURATION "aws")
1718
include(sandbox_module)
1819
target_link_libraries(aws aws-cpp-sdk-kinesis aws-cpp-sdk-monitoring)

cmake/sandbox_module.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ else()
1111
set(CPACK_GENERATOR "TGZ")
1212
set(CMAKE_C_FLAGS "-std=c99 -pedantic -Werror -Wall -Wextra -fPIC")
1313
set(CMAKE_C_FLAGS_RELEASE "-O2")
14-
set(CMAKE_CXX_FLAGS "-std=c++0x -pedantic -Werror -Wall -Wextra -fPIC -isystem /usr/local/include -isystem /opt/local/include")
14+
set(CMAKE_CXX_FLAGS "-std=c++14 -pedantic -Werror -Wall -Wextra -fPIC -isystem /usr/local/include -isystem /opt/local/include")
1515
set(CMAKE_CXX_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE})
1616
set(CMAKE_SHARED_LIBRARY_SUFFIX ".so")
1717
endif()

gcp/CMakeLists.txt

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# This Source Code Form is subject to the terms of the Mozilla Public
2+
# License, v. 2.0. If a copy of the MPL was not distributed with this
3+
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
4+
5+
cmake_minimum_required(VERSION 3.6)
6+
project(gcp VERSION 0.0.1 LANGUAGES C CXX)
7+
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "GCP Lua Modules")
8+
set(CPACK_DEBIAN_PACKAGE_DEPENDS "luasandbox-lpeg (>= 1.0.9)")
9+
string(REGEX REPLACE "[()]" "" CPACK_RPM_PACKAGE_REQUIRES ${CPACK_DEBIAN_PACKAGE_DEPENDS})
10+
11+
find_package(PkgConfig)
12+
pkg_check_modules(GRPC REQUIRED IMPORTED_TARGET protobuf grpc++ grpc)
13+
14+
set(GOOGLE_APIS_DIR "/usr/local/include")
15+
include_directories(${GOOGLE_APIS_DIR})
16+
set(PUBSUB_PB ${GOOGLE_APIS_DIR}/google/pubsub/v1/pubsub.pb.cc)
17+
set(HTTP_PB ${GOOGLE_APIS_DIR}/google/api/http.pb.cc)
18+
19+
set(MODULE_SRCS
20+
pubsub.cpp
21+
${GOOGLE_APIS_DIR}/google/api/annotations.pb.cc
22+
${HTTP_PB}
23+
${PUBSUB_PB}
24+
${GOOGLE_APIS_DIR}/google/pubsub/v1/pubsub.grpc.pb.cc
25+
gcp.def)
26+
set(INSTALL_MODULE_PATH ${INSTALL_IOMODULE_PATH})
27+
set(TEST_CONFIGURATION "gcp")
28+
include(sandbox_module)
29+
30+
set_source_files_properties(${PUBSUB_PB} PROPERTIES COMPILE_FLAGS -Wno-unused-parameter)
31+
set_source_files_properties(${HTTP_PB} PROPERTIES COMPILE_FLAGS -Wno-unused-parameter)
32+
target_link_libraries(gcp ${GRPC_STATIC_LIBRARIES})
33+
set(GRPC_SHARE_DIR ${CMAKE_INSTALL_DATAROOTDIR}/luasandbox/grpc)
34+
install(FILES /usr/local/share/grpc/roots.pem DESTINATION ${GRPC_SHARE_DIR})

gcp/gcp.def

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
EXPORTS
2+
luaopen_gcp_pubsub

gcp/index.md

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# GCP Lua Module
2+
3+
## Overview
4+
Lua wrapper for the GCP gRPC APIs.
5+
6+
## Modules
7+
8+
* [Pub/Sub](pubsub.md)

0 commit comments

Comments
 (0)