Skip to content

Commit 228f19e

Browse files
authored
[chore] dev tooling: add restart-service (#1302)
* add restart-service Signed-off-by: Pierre Tessier <[email protected]> * comments are good Signed-off-by: Pierre Tessier <[email protected]> * support service and SERVICE Signed-off-by: Pierre Tessier <[email protected]> * add license Signed-off-by: Pierre Tessier <[email protected]> * add license Signed-off-by: Pierre Tessier <[email protected]> --------- Signed-off-by: Pierre Tessier <[email protected]>
1 parent 889d455 commit 228f19e

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,3 +155,11 @@ stop:
155155
docker compose down --remove-orphans --volumes
156156
@echo ""
157157
@echo "OpenTelemetry Demo is stopped."
158+
159+
160+
# Use to rebuild and restart a single service component
161+
# Example: make restart service=frontend
162+
.PHONY: restart
163+
restart:
164+
# work with `service` or `SERVICE` as input
165+
./restart-service.sh ${service}${SERVICE}

restart-service.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/sh
2+
# Copyright The OpenTelemetry Authors
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
# This script is used to build, then restart the newly built service container. It does this by forcing a full stop
6+
# and removal of the container, then recreating it. This is useful for development, as it ensures the latest code
7+
# is running in the container.
8+
9+
if [ -z "$1" ]
10+
then
11+
echo "Please provide a service name"
12+
exit 1
13+
fi
14+
15+
docker compose build "$1"
16+
docker compose stop "$1"
17+
docker compose rm --force "$1"
18+
docker compose create "$1"
19+
docker compose start "$1"

0 commit comments

Comments
 (0)