gstreamer/subprojects/gst-plugins-bad/ext/gs
Sebastian Dröge a12762a29a gs: Add support for authenticating via Service Account Credentials
This allows authenticating directly with Server Account credentials
instead of having it configured on host system separately, and thus
allows using arbitrary accounts configured/selected at runtime.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/934>
2021-09-27 15:36:05 +00:00
..
.clang-format Move files from gst-plugins-bad into the "subprojects/gst-plugins-bad/" subdir 2021-09-24 16:14:36 -03:00
gstgs.cpp gs: Fix indentation and make it consistent 2021-09-27 15:36:05 +00:00
gstgscommon.cpp gs: Add support for authenticating via Service Account Credentials 2021-09-27 15:36:05 +00:00
gstgscommon.h gs: Add support for authenticating via Service Account Credentials 2021-09-27 15:36:05 +00:00
gstgssink.cpp gs: Add support for authenticating via Service Account Credentials 2021-09-27 15:36:05 +00:00
gstgssink.h gs: Fix indentation and make it consistent 2021-09-27 15:36:05 +00:00
gstgssrc.cpp gs: Add support for authenticating via Service Account Credentials 2021-09-27 15:36:05 +00:00
gstgssrc.h gs: Fix indentation and make it consistent 2021-09-27 15:36:05 +00:00
meson.build Move files from gst-plugins-bad into the "subprojects/gst-plugins-bad/" subdir 2021-09-24 16:14:36 -03:00
README.md Move files from gst-plugins-bad into the "subprojects/gst-plugins-bad/" subdir 2021-09-24 16:14:36 -03:00

Install the Google Cloud Storage dependencies.

sudo apt-get install \
    cmake \
    libcurl3-gnutls-dev \
    libgrpc++-dev \
    libprotobuf-dev \
    protobuf-compiler-grpc

Build the Google Cloud Storage library

git clone https://github.com/google/crc32c.git
cd crc32c && git checkout -b 1.1.1
mkdir build && cd build
cmake .. \
    -GNinja \
    -DCMAKE_INSTALL_PREFIX:PATH=~/dev/gst-build/prefix \
    -DCMAKE_INSTALL_LIBDIR:PATH=lib \
    -DBUILD_SHARED_LIBS=YES \
    -DCRC32C_USE_GLOG=NO \
    -DCRC32C_BUILD_TESTS=NO \
    -DCRC32C_BUILD_BENCHMARKS=NO
ninja && ninja install

git clone https://github.com/abseil/abseil-cpp.git
git checkout master
mkdir build && cd build
cmake .. \
    -GNinja \
    -DBUILD_TESTING=NO \
    -DCMAKE_INSTALL_PREFIX:PATH=~/dev/gst-build/prefix \
    -DCMAKE_INSTALL_LIBDIR:PATH=lib \
    -DBUILD_SHARED_LIBS=YES
ninja && ninja install

git clone https://github.com/googleapis/google-cloud-cpp.git
git checkout -b v1.25.0
mkdir build && cd build
cmake .. \
    -GNinja \
    -DCMAKE_INSTALL_PREFIX:PATH=~/dev/gst-build/prefix \
    -DCMAKE_INSTALL_LIBDIR:PATH=lib \
    -DBUILD_SHARED_LIBS=YES \
    -DBUILD_TESTING=NO \
    -DGOOGLE_CLOUD_CPP_ENABLE=storage
ninja && ninja install

Running the gs elements locally

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 https://cloud.google.com/docs/authentication/getting-started 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.

Running the gs elements in Google Cloud Run

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.

Running the gs elements in Google Cloud Kubernetes

You need to set GOOGLE_APPLICATION_CREDENTIALS in the container and ship the json file to which the environment variable points to.