docs-v2/compose.yaml

634 lines
22 KiB
YAML

# This is a Docker Compose file for the InfluxData documentation site.
## Run documentation tests for code samples.
name: influxdata-docs
# Configure your credentials in the following secrets files.
secrets:
influxdb2-admin-username:
file: ~/.env.influxdb2-admin-username
influxdb2-admin-password:
file: ~/.env.influxdb2-admin-password
influxdb2-admin-token:
file: ~/.env.influxdb2-admin-token
influxdb3-core-token:
file: test/.influxdb3/core/.token
influxdb3-enterprise-admin-token:
file: ~/influxdata-docs/.influxdb3/enterprise/admin-token.json
services:
local-dev:
build:
context: .
dockerfile_inline: |
FROM hugomods/hugo:exts-0.123.8
RUN apk add --no-cache curl openssl
command: hugo server --bind 0.0.0.0
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:1313/influxdb3/cloud-dedicated/"]
interval: 1m
timeout: 10s
retries: 2
start_period: 40s
start_interval: 5s
ports:
- 1313:1313
volumes:
- type: bind
source: "$PWD"
target: /src
- type: bind
source: $HOME/hugo_cache
target: /tmp/hugo_cache
profiles:
- local
- lint
cloud-pytest:
container_name: cloud-pytest
image: influxdata/docs-pytest
build:
context: .
dockerfile: Dockerfile.pytest
entrypoint:
- /bin/bash
- /src/test/scripts/run-tests.sh
- pytest
command:
# In the command, pass file paths to test.
# The container preprocesses the files for testing and runs the tests.
- content/influxdb/cloud/**/*.md
environment:
- CONTENT_PATH=content/influxdb/cloud
profiles:
- test
- v2
stdin_open: true
tty: true
volumes:
# Site configuration files.
- type: bind
source: .
target: /src
read_only: true
# Files shared between host and container and writeable by both.
- type: bind
source: ./test/shared
target: /shared
- type: bind
source: ./content/influxdb/cloud/.env.test
target: /app/.env.test
read_only: true
# In your code samples, use `/app/data/<FILE.lp>` or `data/<FILE.lp>` to access sample data files from the `static/downloads` directory.
- type: bind
source: ./static/downloads
target: /app/data
read_only: true
# In your code samples, use `/app/iot-starter` to store example modules or project files.
- type: volume
source: cloud-tmp
target: /app/iot-starter
# Target directory for the content under test.
# Files are copied from /src/content/<productpath> to /app/content/<productpath> before running tests.
- type: volume
source: test-content
target: /app/content
- type: bind
source: ./test/shared/influxdb-templates
target: /root/influxdb-templates
working_dir: /app
cloud-dedicated-pytest:
container_name: cloud-dedicated-pytest
image: influxdata/docs-pytest
build:
context: .
dockerfile: Dockerfile.pytest
entrypoint:
- /bin/bash
- /src/test/scripts/run-tests.sh
- pytest
command:
# In the command, pass file paths to test.
# The container preprocesses the files for testing and runs the tests.
- content/influxdb3/cloud-dedicated/**/*.md
environment:
- CONTENT_PATH=content/influxdb3/cloud-dedicated
profiles:
- test
- v3
stdin_open: true
tty: true
volumes:
# Site configuration files.
- type: bind
source: .
target: /src
read_only: true
# Files shared between host and container and writeable by both.
- type: bind
source: ./test/shared
target: /shared
- type: bind
source: ./content/influxdb3/cloud-dedicated/.env.test
target: /app/.env.test
read_only: true
# The following mount assumes your influxctl configuration file is located at ./content/influxdb3/cloud-dedicated/config.toml.
- type: bind
source: ./content/influxdb3/cloud-dedicated/config.toml
target: /root/.config/influxctl/config.toml
read_only: true
# In your code samples, use `/app/data/<FILE.lp>` or `data/<FILE.lp>` to access sample data files from the `static/downloads` directory.
- type: bind
source: ./static/downloads
target: /app/data
read_only: true
# In your code samples, use `/app/iot-starter` to store example modules or project files.
- type: volume
source: cloud-dedicated-tmp
target: /app/iot-starter
# Target directory for the content under test.
# Files are copied from /src/content/<productpath> to /app/content/<productpath> before running tests.
- type: volume
source: test-content
target: /app/content
working_dir: /app
cloud-serverless-pytest:
container_name: cloud-serverless-pytest
image: influxdata/docs-pytest
build:
context: .
dockerfile: Dockerfile.pytest
entrypoint:
- /bin/bash
- /src/test/scripts/run-tests.sh
- pytest
command:
# In the command, pass file paths to test.
# The container preprocesses the files for testing and runs the tests.
- content/influxdb3/cloud-serverless/**/*.md
environment:
- CONTENT_PATH=content/influxdb3/cloud-serverless
profiles:
- test
- v3
stdin_open: true
tty: true
volumes:
# Site configuration files.
- type: bind
source: .
target: /src
read_only: true
# Files shared between host and container and writeable by both.
- type: bind
source: ./test/shared
target: /shared
- type: bind
source: ./content/influxdb3/cloud-serverless/.env.test
target: /app/.env.test
read_only: true
# In your code samples, use `/app/data/<FILE.lp>` or `data/<FILE.lp>` to access sample data files from the `static/downloads` directory.
- type: bind
source: ./static/downloads
target: /app/data
read_only: true
# In your code samples, use `/app/iot-starter` to store example modules or project files.
- type: volume
source: cloud-serverless-tmp
target: /app/iot-starter
# Target directory for the content under test.
# Files are copied from /src/content/<productpath> to /app/content/<productpath> before running tests.
- type: volume
source: test-content
target: /app/content
working_dir: /app
clustered-pytest:
container_name: clustered-pytest
image: influxdata/docs-pytest
build:
context: .
dockerfile: Dockerfile.pytest
entrypoint:
- /bin/bash
- /src/test/scripts/run-tests.sh
- pytest
command:
# In the command, pass file paths to test.
# The container preprocesses the files for testing and runs the tests.
- content/influxdb3/clustered/**/*.md
environment:
- CONTENT_PATH=content/influxdb3/clustered
profiles:
- test
- v3
stdin_open: true
tty: true
volumes:
# Site configuration files.
- type: bind
source: .
target: /src
read_only: true
# Files shared between host and container and writeable by both.
- type: bind
source: ./test/shared
target: /shared
- type: bind
source: ./content/influxdb3/clustered/.env.test
target: /app/.env.test
read_only: true
# The following mount assumes your influxctl configuration file is located at ./content/influxdb3/clustered/config.toml.
- type: bind
source: ./content/influxdb3/clustered/config.toml
target: /root/.config/influxctl/config.toml
read_only: true
# In your code samples, use `/app/data/<FILE.lp>` or `data/<FILE.lp>` to access sample data files from the `static/downloads` directory.
- type: bind
source: ./static/downloads
target: /app/data
read_only: true
# In your code samples, use `/app/iot-starter` to store example modules or project files.
- type: volume
source: clustered-tmp
target: /app/iot-starter
# Target directory for the content under test.
# Files are copied from /src/content/<productpath> to /app/content/<productpath> before running tests.
- type: volume
source: test-content
target: /app/content
working_dir: /app
influxdb3-core-pytest:
container_name: influxdb3-core-pytest
image: influxdata/docs-pytest
build:
context: .
dockerfile: Dockerfile.pytest
entrypoint:
- /bin/bash
- /src/test/scripts/run-tests.sh
- pytest
command:
# In the command, pass file paths to test.
# The container preprocesses the files for testing and runs the tests.
- content/influxdb3/core/**/*.md
- content/shared/**/*.md
environment:
- CONTENT_PATH=content/influxdb3/core
profiles:
- test
- influxdb3
stdin_open: true
tty: true
volumes:
# Site configuration files.
- type: bind
source: .
target: /src
read_only: true
# Files shared between host and container and writeable by both.
- type: bind
source: ./test/shared
target: /shared
- type: bind
source: ./content/influxdb3/core/.env.test
target: /app/.env.test
read_only: true
# In your code samples, use `/app/data/<FILE.lp>` or `data/<FILE.lp>` to access sample data files from the `static/downloads` directory.
- type: bind
source: ./static/downloads
target: /app/data
read_only: true
# In your code samples, use `/app/iot-starter` to store example modules or project files.
- type: volume
source: influxdb3-core-tmp
target: /app/iot-starter
# Target directory for the content under test.
# Files are copied from /src/content/<productpath> to /app/content/<productpath> before running tests.
- type: volume
source: test-content
target: /app/content
working_dir: /app
# ============================================================================
# InfluxDB 3 Core - PER-WORKTREE INSTANCE
# ============================================================================
# Data is stored in the worktree's test/ directory for isolation.
# Token is auto-generated on first start and saved to test/.influxdb3/core/.token
#
# USAGE:
# docker compose up -d influxdb3-core
#
# AUTHENTICATION:
# Uses Docker Compose secrets for secure token management
# Token file: test/.influxdb3/core/.token (mounted as secret)
# Secret location in container: /run/secrets/influxdb3-core-token
#
# FIRST-TIME SETUP:
# Run: ./test/scripts/init-influxdb3.sh core
# This creates directories, generates token, and starts the service
#
# MANUAL SETUP (if not using init script):
# 1. Create directories: mkdir -p test/.influxdb3/core/data test/.influxdb3/core/plugins test/.influxdb3/plugins
# 2. Generate token: openssl rand -hex 32 > test/.influxdb3/core/.token
# 3. Set permissions: chmod 600 test/.influxdb3/core/.token
# 4. Start: docker compose up -d influxdb3-core
#
# CI/CD USAGE:
# Token file can be created from environment variable or secret manager
# Example: echo "$INFLUXDB3_TOKEN" > test/.influxdb3/core/.token
# ============================================================================
influxdb3-core:
container_name: influxdb3-core
image: influxdb:3-core
pull_policy: always
env_file:
- path: .env.3core
required: false
ports:
- 8282:8181
command:
- influxdb3
- serve
- --node-id=node0
- --object-store=file
- --data-dir=/var/lib/influxdb3/data
- --plugin-dir=/var/lib/influxdb3/plugins
- --admin-token-file=/run/secrets/influxdb3-core-token
- --log-filter=info
volumes:
- type: bind
source: test/.influxdb3/core/data
target: /var/lib/influxdb3/data
- type: bind
source: test/.influxdb3/plugins
target: /var/lib/influxdb3/plugins
- type: bind
source: test/.influxdb3/core/plugins
target: /var/lib/influxdb3/plugins/custom
secrets:
- influxdb3-core-token
environment:
- INFLUXDB3_PLUGIN_DIR=/var/lib/influxdb3/plugins
# ============================================================================
# InfluxDB 3 Core - NO AUTH (for endpoint testing)
# ============================================================================
# Use this service to test /ping and /health endpoints without authentication.
# Auth is disabled only for health and ping endpoints.
#
# USAGE:
# docker compose up -d influxdb3-core-noauth
# curl -i http://localhost:8283/ping # Returns version headers + JSON
# curl -i http://localhost:8283/health # Returns "OK"
#
# NOTE: HEAD requests to /ping return 404 - use GET instead.
# ============================================================================
influxdb3-core-noauth:
container_name: influxdb3-core-noauth
image: influxdb:3-core
pull_policy: always
ports:
- 8283:8181
command:
- influxdb3
- serve
- --node-id=node0
- --object-store=file
- --data-dir=/var/lib/influxdb3/data
- --disable-authz=health,ping
- --log-filter=info
volumes:
- type: bind
source: test/.influxdb3/core-noauth/data
target: /var/lib/influxdb3/data
profiles:
- noauth
# ============================================================================
# InfluxDB 3 Enterprise - SHARED INSTANCE
# ============================================================================
# This service uses a shared data directory outside the worktree to:
# - Preserve license across worktrees (trial license in data dir)
# - Allow single Enterprise instance for all docs testing
# - Avoid conflicts with users' personal ~/.influxdb3/ installs
#
# USAGE:
# docker compose --profile shared up -d influxdb3-enterprise
#
# AUTHENTICATION:
# Uses Docker Compose secrets for secure token management
# Token file: ~/influxdata-docs/.influxdb3/enterprise/admin-token.json (mounted as secret)
# Secret location in container: /run/secrets/influxdb3-enterprise-admin-token
# Format: JSON file with {"token": "...", "description": "..."}
#
# FIRST-TIME SETUP:
# 1. Create license email file: echo "INFLUXDB3_ENTERPRISE_LICENSE_EMAIL=you@example.com" > ~/influxdata-docs/.influxdb3/enterprise/.env
# 2. Run: ./test/scripts/init-influxdb3.sh enterprise
# This creates directories, generates admin-token.json, and starts the service
#
# MANUAL SETUP (if not using init script):
# 1. Create directories: mkdir -p ~/influxdata-docs/.influxdb3/enterprise/data ~/influxdata-docs/.influxdb3/plugins
# 2. Generate admin token and create JSON file:
# TOKEN=$(openssl rand -hex 32)
# echo "{\"token\": \"${TOKEN}\", \"description\": \"Admin token\"}" > ~/influxdata-docs/.influxdb3/enterprise/admin-token.json
# chmod 600 ~/influxdata-docs/.influxdb3/enterprise/admin-token.json
# 3. Start: docker compose --profile shared up -d influxdb3-enterprise
#
# CI/CD USAGE:
# Token file can be created from environment variable or secret manager
# Example: echo "{\"token\": \"$ADMIN_TOKEN\"}" > ~/influxdata-docs/.influxdb3/enterprise/admin-token.json
#
# Note: License is persisted in data dir after first activation (30-day trial, renewable)
#
# The 'shared' profile prevents accidental startup from `docker compose up`.
# ============================================================================
influxdb3-enterprise:
container_name: influxdb3-enterprise
image: influxdb:3-enterprise
pull_policy: always
# License email for first-time activation (from shared .env file)
env_file:
- ~/influxdata-docs/.influxdb3/enterprise/.env
ports:
- 8181:8181
command:
- influxdb3
- serve
- --node-id=node0
- --cluster-id=cluster0
- --object-store=file
- --data-dir=/var/lib/influxdb3/data
- --plugin-dir=/var/lib/influxdb3/plugins
- --admin-token-file=/run/secrets/influxdb3-enterprise-admin-token
- --license-type=trial
- --log-filter=info
environment:
- INFLUXDB3_PLUGIN_DIR=/var/lib/influxdb3/plugins
volumes:
# Shared data directory - persists license and data across worktrees
- type: bind
source: ~/influxdata-docs/.influxdb3/enterprise/data
target: /var/lib/influxdb3/data
- type: bind
source: ~/influxdata-docs/.influxdb3/plugins
target: /var/lib/influxdb3/plugins
secrets:
- influxdb3-enterprise-admin-token
profiles:
- shared
influxdb3-explorer:
container_name: influxdb3-explorer
image: influxdata/influxdb3-ui:latest
pull_policy: always
ports:
- 8888:80
- 8889:8888
command:
- --mode=admin
profiles:
- explorer
- influxdb3
telegraf-pytest:
container_name: telegraf-pytest
image: influxdata/docs-pytest
build:
context: .
dockerfile: Dockerfile.pytest
entrypoint:
- /bin/bash
- /src/test/scripts/run-tests.sh
- pytest
command:
# In the command, pass file paths to test.
# The container preprocesses the files for testing and runs the tests.
- content/telegraf/**/*.md
environment:
- CONTENT_PATH=content/telegraf
profiles:
- test
stdin_open: true
tty: true
volumes:
# Site configuration files.
- type: bind
source: .
target: /src
read_only: true
# Files shared between host and container and writeable by both.
- type: bind
source: ./test/shared
target: /shared
- type: bind
source: ./content/telegraf/.env.test
target: /app/.env.test
read_only: true
# In your code samples, use `/app/data/<FILE.lp>` or `data/<FILE.lp>` to access sample data files from the `static/downloads` directory.
- type: bind
source: ./static/downloads
target: /app/data
read_only: true
# In your code samples, use `/app/iot-starter` to store example modules or project files.
- type: volume
source: telegraf-tmp
target: /app/iot-starter
# Target directory for the content under test.
# Files are copied from /src/content/<productpath> to /app/content/<productpath> before running tests.
- type: volume
source: test-content
target: /app/content
working_dir: /app
v2-pytest:
container_name: v2-pytest
image: influxdata/docs-pytest
build:
context: .
dockerfile: Dockerfile.pytest
entrypoint:
- /bin/bash
- /src/test/scripts/run-tests.sh
- pytest
command:
# In the command, pass file paths to test.
# The container preprocesses the files for testing and runs the tests.
- content/influxdb/v2/**/*.md
environment:
- CONTENT_PATH=content/influxdb/v2
profiles:
- test
- v2
stdin_open: true
tty: true
volumes:
# Site configuration files.
- type: bind
source: .
target: /src
read_only: true
# Files shared between host and container and writeable by both.
- type: bind
source: ./test/shared
target: /shared
- type: bind
source: ./content/influxdb/v2/.env.test
target: /app/.env.test
read_only: true
# In your code samples, use `/app/data/<FILE.lp>` or `data/<FILE.lp>` to access sample data files from the `static/downloads` directory.
- type: bind
source: ./static/downloads
target: /app/data
read_only: true
# In your code samples, use `/app/iot-starter` to store example modules or project files.
- type: volume
source: v2-tmp
target: /app/iot-starter
# Target directory for the content under test.
# Files are copied from /src/content/<productpath> to /app/content/<productpath> before running tests.
- type: volume
source: test-content
target: /app/content
working_dir: /app
influxdb2:
container_name: influxdb2
image: influxdb:2
ports:
- 8086:8086
environment:
DOCKER_INFLUXDB_INIT_MODE: setup
DOCKER_INFLUXDB_INIT_USERNAME_FILE: /run/secrets/influxdb2-admin-username
DOCKER_INFLUXDB_INIT_PASSWORD_FILE: /run/secrets/influxdb2-admin-password
DOCKER_INFLUXDB_INIT_ADMIN_TOKEN_FILE: /run/secrets/influxdb2-admin-token
DOCKER_INFLUXDB_INIT_ORG: docs
DOCKER_INFLUXDB_INIT_BUCKET: get-started
INFLUX_ORG: docs
INFLUX_BUCKET: get-started
profiles:
- v2
- local
secrets:
- influxdb2-admin-username
- influxdb2-admin-password
- influxdb2-admin-token
volumes:
- type: volume
source: influxdb2-data
target: /var/lib/influxdb2
- type: volume
source: influxdb2-config
target: /etc/influxdb2
remark-lint:
container_name: remark-lint
build:
context: .
dockerfile: .ci/Dockerfile.remark
profiles:
- lint
volumes:
# Mount repository to /workdir to avoid overwriting /app/ node_modules
# Remark will receive paths like /workdir/content/file.md or /workdir/README.md
# Writable mount allows auto-fixing instruction files (README.md, DOCS-*.md, etc.)
- type: bind
source: .
target: /workdir
read_only: false
volumes:
test-content:
cloud-tmp:
cloud-dedicated-tmp:
cloud-serverless-tmp:
clustered-tmp:
telegraf-tmp:
v2-tmp: