forked from encode/broadcaster
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Pulsar start and stop scripts with GitHub Actions integration #cl…
…eanup
- Loading branch information
Showing
4 changed files
with
59 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/bash | ||
|
||
# Install Docker Compose if it's not available | ||
if ! command -v docker-compose &> /dev/null; then | ||
echo "Docker Compose not found. Installing..." | ||
sudo apt-get update | ||
sudo apt-get install -y docker-compose | ||
else | ||
echo "Docker Compose is already installed." | ||
fi | ||
|
||
# Start Pulsar using Docker Compose | ||
echo "Starting Pulsar..." | ||
docker-compose up -d pulsar | ||
|
||
echo "Pulsar startup complete." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
|
||
|
||
echo "Stopping Pulsar container..." | ||
|
||
# Stop and remove containers defined in docker-compose.yml | ||
if docker-compose down; then | ||
echo "Pulsar container have been stopped and removed successfully." | ||
else | ||
echo "Error: Failed to stop Pulsar containers. Please check Docker Compose configuration." | ||
exit 1 | ||
fi | ||
|
||
# Optional: Remove volumes | ||
# docker-compose down -v | ||
|
||
echo "Cleanup complete." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/bash | ||
|
||
MAX_RETRIES=60 | ||
RETRY_INTERVAL=5 | ||
HEALTH_CHECK_URL="http://localhost:8080/admin/v2/brokers/healthcheck" | ||
|
||
echo "Waiting for Pulsar to be ready..." | ||
|
||
for i in $(seq 1 $MAX_RETRIES); do | ||
if curl -s "$HEALTH_CHECK_URL" > /dev/null; then | ||
echo "Pulsar is ready!" | ||
exit 0 | ||
fi | ||
echo "Attempt $i/$MAX_RETRIES: Pulsar is not ready yet. Retrying in $RETRY_INTERVAL seconds..." | ||
sleep $RETRY_INTERVAL | ||
done | ||
|
||
echo "Error: Pulsar did not become ready within the allocated time." | ||
exit 1 |