Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[chore] dev tooling: add restart-service #1302

Merged
merged 6 commits into from
Dec 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
Loading