[Example] Move systemd socket activation example (#33221)

pull/33227/head
AJ Heller 2 years ago committed by GitHub
parent d58af7397f
commit dbcb09d3d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 0
      examples/cpp/systemd_socket_activation/BUILD
  2. 13
      examples/cpp/systemd_socket_activation/README.md
  3. 0
      examples/cpp/systemd_socket_activation/client.cc
  4. 0
      examples/cpp/systemd_socket_activation/server.cc
  5. 9
      examples/cpp/systemd_socket_activation/test.sh

@ -0,0 +1,13 @@
gRPC systemd Socket Activation Example
================
This example shows how to use systemd's [socket-based activation](https://www.freedesktop.org/software/systemd/man/sd_listen_fds_with_names.html) with gRPC.
### Build and run the example
The simplest way to exercise this is via `test.sh`. It roughly does the following:
* Creates a systemd socket-activated service.
* Builds the gRPC client & server.
* Reloads the systemd daemon.
* Runs the gRPC client, which in turn runs the gRPC server.

@ -13,9 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# Test structure borrowed with gratitude from
# https://github.com/grpc/grpc-go/tree/master/examples/features
# Run this script as root
clean() {
@ -39,9 +36,9 @@ pass() {
echo "SUCCESS: $1"
}
bazel build --define=use_systemd=true //examples/cpp/features/sd_sock_act:all || fail "Failed to build sd_sock_act"
cp ../../../../bazel-bin/examples/cpp/features/sd_sock_act/server /tmp/greeter_server
cp ../../../../bazel-bin/examples/cpp/features/sd_sock_act/client /tmp/greeter_client
bazel build --define=use_systemd=true //examples/cpp/systemd_socket_activation:all || fail "Failed to build sd_sock_act"
cp ../../../../bazel-bin/examples/cpp/systemd_socket_activation/server /tmp/greeter_server
cp ../../../../bazel-bin/examples/cpp/systemd_socket_activation/client /tmp/greeter_client
cat << EOF > /etc/systemd/system/sdsockact.service
[Service]
Loading…
Cancel
Save