Skip to content

Commit

Permalink
[chore] dev tooling: add restart-service (#1302)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
puckpuck committed Dec 18, 2023
1 parent 889d455 commit 228f19e
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -155,3 +155,11 @@ stop:
docker compose down --remove-orphans --volumes
@echo ""
@echo "OpenTelemetry Demo is stopped."


# Use to rebuild and restart a single service component
# Example: make restart service=frontend
.PHONY: restart
restart:
# work with `service` or `SERVICE` as input
./restart-service.sh ${service}${SERVICE}
19 changes: 19 additions & 0 deletions restart-service.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/sh
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

# This script is used to build, then restart the newly built service container. It does this by forcing a full stop
# and removal of the container, then recreating it. This is useful for development, as it ensures the latest code
# is running in the container.

if [ -z "$1" ]
then
echo "Please provide a service name"
exit 1
fi

docker compose build "$1"
docker compose stop "$1"
docker compose rm --force "$1"
docker compose create "$1"
docker compose start "$1"

0 comments on commit 228f19e

Please sign in to comment.