Add scripts to run standalone in Docker (#54)

Fixes #32
This commit is contained in:
Chris Bono
2022-08-07 00:00:49 -05:00
committed by GitHub
parent de2d8a0600
commit cb5a2f006e
4 changed files with 51 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
== Docker scripts for Pulsar
=== Pulsar Standalone
Runs a local standalone Pulsar cluster in Docker.
* The broker is available at `pulsar://localhost:6650`.
* The admin is available at `http://localhost:8080`
* Two Docker volumes (`pulsardata`, `pulsarconf`) are created to store the data, metadata, and configuration in order to not start "fresh" every time the container is restarted.
==== Start
To start the cluster run the following script from project root dir:
[source,shell]
----
./tools/pulsar/docker/standalone/pulsar-start.sh
----
==== Stop
To stop the cluster run the following script from project root dir:
[source,shell]
----
./tools/pulsar/docker/standalone/pulsar-stop.sh
----
==== Destroy
To completely remove the cluster and volumes run the following script from project root dir:
[source,shell]
----
./tools/pulsar/docker/standalone/pulsar-destroy.sh
----
More information can be found in the official https://pulsar.apache.org/docs/next/getting-started-docker[Pulsar docs].

View File

@@ -0,0 +1,7 @@
#!/bin/bash
echo "Finding and removing Pulsar container..."
docker ps -a | grep "apachepulsar/pulsar" | awk '{print $1}' | xargs docker rm -f
echo "Removing Pulsar volumes..."
docker volume rm pulsardata pulsarconf
echo "All traces of Pulsar standalone removed"

View File

@@ -0,0 +1,7 @@
#!/bin/bash
docker run -it -p 6650:6650 -p 8080:8080 \
--mount source=pulsardata,target=/pulsar/data \
--mount source=pulsarconf,target=/pulsar/conf \
apachepulsar/pulsar:2.10.1 \
bin/pulsar standalone

View File

@@ -0,0 +1,5 @@
#!/bin/bash
echo "Finding and stopping Pulsar container..."
docker ps -a | grep "apachepulsar/pulsar" | awk '{print $1}' | xargs docker stop
echo "Container stopped - you can run 'pulsar-start.sh' when/if you want to restart it"