-
Notifications
You must be signed in to change notification settings - Fork 164
chore(scripts): fix script and supports podman #836
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,5 +1,16 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| RELEASE=${1:-latest} | ||
|
|
||
| docker buildx build -f docker/Dockerfile docker --tag grafana/otel-lgtm:"${RELEASE}" | ||
| if command -v docker >/dev/null 2>&1; then | ||
| RUNTIME=docker | ||
| elif command -v podman >/dev/null 2>&1; then | ||
| RUNTIME=podman | ||
| else | ||
| echo "Unable to find a suitable container runtime such as Docker or Podman. Exiting." | ||
| exit 1 | ||
| fi | ||
|
|
||
| $RUNTIME buildx build -f docker/Dockerfile docker --tag grafana/otel-lgtm:"${RELEASE}" |
This file contains hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,4 +1,12 @@ | ||
| @echo off | ||
|
|
||
| powershell -ExecutionPolicy ByPass -NoProfile -Command "& '%~dp0\run-lgtm.ps1'" | ||
| set "releasetag=%~1" | ||
| set "local=%~2" | ||
|
|
||
| if "%releasetag%"=="" set "releasetag=latest" | ||
| if "%localimg%"=="" set "localimg=0" | ||
| if "%localimg%"=="false" set "localimg=0" | ||
| if "%localimg%"=="true" set "localimg=1" | ||
|
|
||
| powershell -ExecutionPolicy ByPass -NoProfile -Command "& '%~dp0\run-lgtm.ps1' -ReleaseTag '%releasetag%' -UseLocalImage %localimg%" | ||
| exit /b %ERRORLEVEL% |
This file contains hidden or 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
martincostello marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or 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 |
|---|---|---|
| @@ -1,21 +1,54 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| RELEASE=${1:-latest} | ||
| LOCAL_VOLUME=${PWD}/container | ||
| # Only set this to "true" if you built the image with the 'build-lgtm.sh' script | ||
| USE_LOCAL_IMAGE=${2:-false} | ||
|
|
||
| for dir in grafana prometheus loki; do | ||
| test -d "${LOCAL_VOLUME}"/${dir} || mkdir -p "${LOCAL_VOLUME}"/${dir} | ||
| done | ||
|
|
||
| test -f .env || touch .env | ||
|
|
||
| docker pull docker.io/grafana/otel-lgtm:"${RELEASE}" | ||
| if command -v docker >/dev/null 2>&1; then | ||
| RUNTIME=docker | ||
| MOUNT_OPTS=rw | ||
| elif command -v podman >/dev/null 2>&1; then | ||
| RUNTIME=podman | ||
| # Fedora, by default, runs with SELinux on. We require the "z" option for bind mounts. | ||
| # See: https://docs.docker.com/engine/storage/bind-mounts/#configure-the-selinux-label | ||
| # See: https://docs.podman.io/en/stable/markdown/podman-run.1.html section "Labeling Volume Mounts" | ||
| MOUNT_OPTS="rw,z" | ||
| else | ||
| echo "Unable to find a suitable container runtime such as Docker or Podman. Exiting." | ||
| exit 1 | ||
| fi | ||
|
|
||
| touch .env | ||
| if [ "$USE_LOCAL_IMAGE" = true ]; then | ||
| if [ "$RUNTIME" = "podman" ]; then | ||
| # Default address when building with Podman. | ||
| IMAGE="localhost/grafana/otel-lgtm:latest" | ||
| else | ||
| IMAGE="grafana/otel-lgtm:latest" | ||
| fi | ||
| else | ||
| IMAGE="docker.io/grafana/otel-lgtm:${RELEASE}" | ||
| $RUNTIME image pull "$IMAGE" | ||
| fi | ||
|
|
||
| docker run \ | ||
| $RUNTIME container run \ | ||
| --name lgtm \ | ||
| -p 3000:3000 \ | ||
| -p 4317:4317 \ | ||
| -p 4318:4318 \ | ||
| --rm \ | ||
| -ti \ | ||
| -v "$PWD"/container/grafana:/data/grafana \ | ||
| -v "$PWD"/container/prometheus:/data/prometheus \ | ||
| -v "$PWD"/container/loki:/data/loki \ | ||
| -v "${LOCAL_VOLUME}"/grafana:/data/grafana:"${MOUNT_OPTS}" \ | ||
| -v "${LOCAL_VOLUME}"/prometheus:/data/prometheus:"${MOUNT_OPTS}" \ | ||
| -v "${LOCAL_VOLUME}"/loki:/data/loki:"${MOUNT_OPTS}" \ | ||
| -e GF_PATHS_DATA=/data/grafana \ | ||
| --env-file .env \ | ||
| docker.io/grafana/otel-lgtm:"${RELEASE}" | ||
| "$IMAGE" |
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.