diff --git a/examples/cpp/features/sd_sock_act/BUILD b/examples/cpp/systemd_socket_activation/BUILD similarity index 100% rename from examples/cpp/features/sd_sock_act/BUILD rename to examples/cpp/systemd_socket_activation/BUILD diff --git a/examples/cpp/systemd_socket_activation/README.md b/examples/cpp/systemd_socket_activation/README.md new file mode 100644 index 00000000000..8c4182cf044 --- /dev/null +++ b/examples/cpp/systemd_socket_activation/README.md @@ -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. diff --git a/examples/cpp/features/sd_sock_act/client.cc b/examples/cpp/systemd_socket_activation/client.cc similarity index 100% rename from examples/cpp/features/sd_sock_act/client.cc rename to examples/cpp/systemd_socket_activation/client.cc diff --git a/examples/cpp/features/sd_sock_act/server.cc b/examples/cpp/systemd_socket_activation/server.cc similarity index 100% rename from examples/cpp/features/sd_sock_act/server.cc rename to examples/cpp/systemd_socket_activation/server.cc diff --git a/examples/cpp/features/sd_sock_act/test.sh b/examples/cpp/systemd_socket_activation/test.sh similarity index 78% rename from examples/cpp/features/sd_sock_act/test.sh rename to examples/cpp/systemd_socket_activation/test.sh index 02c51cd2549..f7cd42ebc64 100755 --- a/examples/cpp/features/sd_sock_act/test.sh +++ b/examples/cpp/systemd_socket_activation/test.sh @@ -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]