Skip to content

Commit

Permalink
Deafult run.cmd to not include monitoring, flag for monitoring profile
Browse files Browse the repository at this point in the history
  • Loading branch information
martinothamar committed May 16, 2024
1 parent 4bcbdd3 commit cb0b393
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 8 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,12 @@ Either docker or podman must be installed.
./run.cmd
```
Optionally, if you want access to Grafana and a local monitoring setup based on OpenTelemetry:

```shell
./run.cmd -m
```

If the localtest setup is already running, it will restart.

To stop localtest
Expand Down
20 changes: 17 additions & 3 deletions scripts/run.ps1
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
#!/usr/bin/env pwsh

param(
[Parameter(HelpMessage="")]
[switch]$m = $False,
)

$Profile = ""

if ($m)
{
$Profile = "--profile ""monitoring"""
}

if ($args[0] -eq "stop")
{
Write-Host "Stopping localtest!"
Expand All @@ -25,6 +37,7 @@ if ($args[0] -eq "stop")
else
{
Write-host "Preqreqs missing - please install docker or podman"
exit 1
}
}
else
Expand All @@ -35,7 +48,7 @@ else
{
Write-host "Running using docker"
docker compose --profile "*" down -v
docker compose --profile "*" up -d --build
iex "docker compose $Profile -d --build"
}
elseif (Get-Command "docker-compose" -errorAction SilentlyContinue)
{
Expand All @@ -44,16 +57,17 @@ else
# whereas podman-compose has only recently added support, and not many users have the latest versions
Write-host "Running using docker-compose"
docker-compose --file podman-compose.yml --profile "*" down -v
docker-compose --file podman-compose.yml --profile "*" up -d --build
iex "docker-compose --file podman-compose.yml $Profile -d --build"
}
elseif (Get-Command "podman" -errorAction SilentlyContinue)
{
Write-host "Running using podman"
podman compose --file podman-compose.yml --profile "*" down -v
podman compose --file podman-compose.yml --profile "*" up -d --build
iex "podman compose --file podman-compose.yml $Profile -d --build"
}
else
{
Write-host "Preqreqs missing - please install docker or podman"
exit 1
}
}
24 changes: 19 additions & 5 deletions scripts/run.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
#!/usr/bin/env sh

set -ex
set -e

if [ $1 = "stop" ]; then
include_monitoring=false
while getopts "m" flag; do
case "${flag}" in
m) include_monitoring=true ;;
\?) exit 1 ;;
esac
done
shift $((${OPTIND} - 1))

profile=""
if [ "$include_monitoring" = true ]; then
profile="--profile \"monitoring\""
fi

if [ "$1" = "stop" ]; then
echo "Stopping localtest!"
if [ -x "$(command -v docker)" ]; then
echo "Stopping using docker"
Expand All @@ -25,18 +39,18 @@ else
if [ -x "$(command -v docker)" ]; then
echo "Running using docker"
docker compose --profile "*" down -v
docker compose --profile "*" up -d --build
eval "docker compose $profile up -d --build"
elif [ -x "$(command -v docker-compose)" ]; then
# If the user is not using docker, there should be podman installed
# If additionally docker-compose is installed, we use that since it has had '--profile' support for a long time,
# whereas podman-compose has only recently added support, and not many users have the latest versions
echo "Running using docker-compose"
docker-compose --file podman-compose.yml --profile "*" down -v
docker-compose --file podman-compose.yml --profile "*" up -d --build
eval "docker-compose --file podman-compose.yml $profile up -d --build"
elif [ -x "$(command -v podman)" ]; then
echo "Running using podman"
podman compose --file podman-compose.yml --profile "*" down -v
podman compose --file podman-compose.yml --profile "*" up -d --build
eval "podman compose --file podman-compose.yml $profile up -d --build"
else
echo "Preqreqs missing - please install docker or podman"
exit 1
Expand Down

0 comments on commit cb0b393

Please sign in to comment.