[Example] Move systemd socket activation example (#33221)
This commit is contained in:
parent
d58af7397f
commit
dbcb09d3d4
|
|
@ -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
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# 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
|
# Run this script as root
|
||||||
|
|
||||||
clean() {
|
clean() {
|
||||||
|
|
@ -39,9 +36,9 @@ pass() {
|
||||||
echo "SUCCESS: $1"
|
echo "SUCCESS: $1"
|
||||||
}
|
}
|
||||||
|
|
||||||
bazel build --define=use_systemd=true //examples/cpp/features/sd_sock_act:all || fail "Failed to build sd_sock_act"
|
bazel build --define=use_systemd=true //examples/cpp/systemd_socket_activation: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/systemd_socket_activation/server /tmp/greeter_server
|
||||||
cp ../../../../bazel-bin/examples/cpp/features/sd_sock_act/client /tmp/greeter_client
|
cp ../../../../bazel-bin/examples/cpp/systemd_socket_activation/client /tmp/greeter_client
|
||||||
|
|
||||||
cat << EOF > /etc/systemd/system/sdsockact.service
|
cat << EOF > /etc/systemd/system/sdsockact.service
|
||||||
[Service]
|
[Service]
|
||||||
Loading…
Reference in New Issue