2020-06-23 19:41:27 +00:00
|
|
|
# Install the Google Cloud Storage dependencies.
|
|
|
|
```
|
|
|
|
sudo apt-get install \
|
|
|
|
cmake \
|
|
|
|
libcurl3-gnutls-dev \
|
|
|
|
libgrpc++-dev \
|
|
|
|
libprotobuf-dev \
|
2021-10-01 12:35:06 +00:00
|
|
|
protobuf-compiler-grpc \
|
2021-10-25 16:52:24 +00:00
|
|
|
flex bison pkg-config \
|
|
|
|
curl
|
2020-06-23 19:41:27 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
# Build the Google Cloud Storage library
|
|
|
|
|
|
|
|
```
|
2021-10-25 16:52:24 +00:00
|
|
|
export cmake_prefix=/usr/local
|
|
|
|
|
|
|
|
mkdir crc32c
|
|
|
|
cd crc32c
|
|
|
|
curl -sSL https://github.com/google/crc32c/archive/1.1.2.tar.gz | \
|
|
|
|
tar -xzf - --strip-components=1
|
|
|
|
cmake -S . -B build \
|
2020-06-23 19:41:27 +00:00
|
|
|
-GNinja \
|
2021-10-25 16:52:24 +00:00
|
|
|
-DCMAKE_INSTALL_PREFIX:PATH=$cmake_prefix \
|
2020-06-23 19:41:27 +00:00
|
|
|
-DCMAKE_INSTALL_LIBDIR:PATH=lib \
|
|
|
|
-DBUILD_SHARED_LIBS=YES \
|
|
|
|
-DCRC32C_USE_GLOG=NO \
|
|
|
|
-DCRC32C_BUILD_TESTS=NO \
|
|
|
|
-DCRC32C_BUILD_BENCHMARKS=NO
|
2021-10-25 16:52:24 +00:00
|
|
|
cmake --build build --target install
|
|
|
|
cd ..
|
2020-06-23 19:41:27 +00:00
|
|
|
|
2021-10-25 16:52:24 +00:00
|
|
|
mkdir abseil-cpp
|
|
|
|
cd abseil-cpp
|
|
|
|
curl -sSL https://github.com/abseil/abseil-cpp/archive/20210324.2.tar.gz | \
|
|
|
|
tar -xzf - --strip-components=1 && \
|
|
|
|
sed -i 's/^#define ABSL_OPTION_USE_\(.*\) 2/#define ABSL_OPTION_USE_\1 0/' "absl/base/options.h"
|
|
|
|
cmake -S . -B build \
|
2020-06-23 19:41:27 +00:00
|
|
|
-GNinja \
|
|
|
|
-DBUILD_TESTING=NO \
|
2021-10-25 16:52:24 +00:00
|
|
|
-DCMAKE_INSTALL_PREFIX:PATH=$cmake_prefix \
|
2020-06-23 19:41:27 +00:00
|
|
|
-DCMAKE_INSTALL_LIBDIR:PATH=lib \
|
|
|
|
-DBUILD_SHARED_LIBS=YES
|
2021-10-25 16:52:24 +00:00
|
|
|
cmake --build build --target install
|
|
|
|
cd ..
|
|
|
|
|
|
|
|
# Nlohman/json
|
|
|
|
mkdir json
|
|
|
|
cd json
|
|
|
|
curl -sSL https://github.com/nlohmann/json/archive/v3.10.4.tar.gz | \
|
|
|
|
tar -xzf - --strip-components=1
|
|
|
|
cmake \
|
|
|
|
-DCMAKE_BUILD_TYPE=Release \
|
|
|
|
-DBUILD_SHARED_LIBS=yes \
|
|
|
|
-DBUILD_TESTING=OFF \
|
|
|
|
-H. -Bcmake-out/nlohmann/json && \
|
|
|
|
cmake --build cmake-out/nlohmann/json --target install -- -j ${NCPU} && \
|
|
|
|
ldconfig
|
|
|
|
cd ..
|
2020-06-23 19:41:27 +00:00
|
|
|
|
2021-10-25 16:52:24 +00:00
|
|
|
mkdir google-cloud-cpp
|
|
|
|
cd google-cloud-cpp
|
|
|
|
curl -sSL https://github.com/googleapis/google-cloud-cpp/archive/v1.31.1.tar.gz | \
|
|
|
|
tar --strip-components=1 -zxf -
|
|
|
|
cmake -S . -B build \
|
2020-06-23 19:41:27 +00:00
|
|
|
-GNinja \
|
2021-10-25 16:52:24 +00:00
|
|
|
-DCMAKE_BUILD_TYPE=Debug \
|
|
|
|
-DCMAKE_CXX_STANDARD=14 \
|
|
|
|
-DCMAKE_INSTALL_PREFIX:PATH=$cmake_prefix \
|
2020-06-23 19:41:27 +00:00
|
|
|
-DCMAKE_INSTALL_LIBDIR:PATH=lib \
|
|
|
|
-DBUILD_SHARED_LIBS=YES \
|
|
|
|
-DBUILD_TESTING=NO \
|
|
|
|
-DGOOGLE_CLOUD_CPP_ENABLE=storage
|
2021-10-25 16:52:24 +00:00
|
|
|
cmake --build build --target install -- -v
|
|
|
|
cd ..
|
2020-06-23 19:41:27 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
# Running the gs elements locally
|
|
|
|
|
2021-10-25 16:52:24 +00:00
|
|
|
When running from the command line or in a container running locally, simply set the credentials by exporting
|
|
|
|
GOOGLE_APPLICATION_CREDENTIALS. If you are not familiar with this environment variable, check the documentation
|
2020-06-23 19:41:27 +00:00
|
|
|
https://cloud.google.com/docs/authentication/getting-started
|
2021-10-25 16:52:24 +00:00
|
|
|
Note that you can restrict a service account to the role Storage Admin or Storage Object Creator instead of the Project
|
|
|
|
Owner role from the above documentation.
|
2020-06-23 19:41:27 +00:00
|
|
|
|
|
|
|
# Running the gs elements in Google Cloud Run
|
|
|
|
|
2021-10-25 16:52:24 +00:00
|
|
|
Add the Storage Object Viewer role to the service account assigned to the Cloud Run service where gssrc runs. For gssink
|
|
|
|
add the role Storage Object Creator. Then just set the service-account-email property on the element.
|
2020-06-23 19:41:27 +00:00
|
|
|
|
|
|
|
# Running the gs elements in Google Cloud Kubernetes
|
|
|
|
|
2021-10-25 16:52:24 +00:00
|
|
|
You need to set GOOGLE_APPLICATION_CREDENTIALS in the container and ship the json file to which the environment variable
|
|
|
|
points to.
|