Skip to content
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ __pycache__
scrape_configs.yml
!vars/scrape_configs.yml
.venv
.env
9 changes: 9 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@ Once you can run docker commands and have `docker compose` you can proceed to th

Now that you have `docker` you can proceed to configure the stack.

### Ensuring proper user and group

To properly configure the user and group which will be used for all docker workloads
run the following setup script:
```bash
# NOTE: you have to be within the same directory as this README!
./setup.sh
```

### Scraping targets

First thing that you have to configure is your scraping targets. To do that, find your
Expand Down
1 change: 1 addition & 0 deletions docker/docker-compose.tools.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ services:
volumes:
- ./config/prometheus:/config/prometheus
- ./tools/prom-config-builder/:/tools/prom-config-builder
user: "${UID}:${GID}"

1 change: 1 addition & 0 deletions docker/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ services:
- /msd/definitions.json
volumes:
- ./volumes/msd:/msd
user: "${UID}:${GID}"

prometheus:
image: quay.io/prometheus/prometheus:v2.51.1
Expand Down
25 changes: 25 additions & 0 deletions docker/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# /usr/bin/env bash
set -euo pipefail

# Resolve the directory of the script (so it works regardless of where it's run from)
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ENV_FILE="${SCRIPT_DIR}/.env"

# If .env already exists, do nothing
if [[ -f "$ENV_FILE" ]]; then
echo ".env already exists at $ENV_FILE"
exit 0
fi

# Get current user's UID and GID
UID_VAL=$(id -u)
GID_VAL=$(id -g)

# Write them to .env
cat > "$ENV_FILE" <<EOF
UID=${UID_VAL}
GID=${GID_VAL}
EOF

echo "Created $ENV_FILE with UID=${UID_VAL} and GID=${GID_VAL}"