grafana/grafana-docker

Setting Docker S3 environment variables with docker-compose

kaspergrubbe opened this issue · 2 comments

I created an issue on the Grafana repo, but I think it is probably better suited here: grafana/grafana#12674

Please include this information:

What Grafana version are you using?

5.1.5

What datasource are you using?

InfluxDB

What OS are you running grafana on?

Debian Linux

What did you do?

I read the documentation stating that I could set configuration variables by using the pattern: GF_<SectionName>_<KeyName> (http://docs.grafana.org/installation/docker/#configuration)

The variables I want to set are the ones for S3 described here: http://docs.grafana.org/installation/configuration/#external-image-storage-s3

My full setup for docker-compose is:

version: "3"

services:
  grafana:
    image: grafana/grafana:5.1.5
    volumes:
      - /root/grafana-setup:/mnt/grafana-setup
      - grafana-data-volume:/var/lib/grafana
    environment:
      - GF_PATHS_PROVISIONING=/mnt/grafana-setup
      - GF_INSTALL_PLUGINS=grafana-clock-panel
      - GF_SECURITY_ADMIN_PASSWORD=snipped
      - GF_SMTP_ENABLED=true
      - GF_SMTP_HOST=smtp.mandrillapp.com:587
      - GF_SMTP_USER=snipped
      - GF_SMTP_PASSWORD=snipped
      - GF_SMTP_FROM_ADDRESS=development@snipped.dk
      - GF_SMTP_FROM_NAME=Grafana Snipped
      - GF_EXTERNAL_IMAGE_STORAGE_PROVIDER=s3
      - GF_EXTERNAL_IMAGE_STORAGE_PROVIDER.S3_BUCKET=snipped-grafana
      - GF_EXTERNAL_IMAGE_STORAGE_PROVIDER.S3_REGION=eu-west-1
      - GF_EXTERNAL_IMAGE_STORAGE_PROVIDER.S3_ACCESS_KEY=snipped
      - GF_EXTERNAL_IMAGE_STORAGE_PROVIDER.S3_SECRET_KEY=snipped

But when I go to /admin/settings I can see that none of the variables has been set.

I have also tried the following two configs:

      - GF_EXTERNAL_IMAGE_STORAGE_PROVIDER=s3
      - GF_EXTERNAL_IMAGE_STORAGE_PROVIDER_BUCKET=snipped-grafana
      - GF_EXTERNAL_IMAGE_STORAGE_PROVIDER_REGION=eu-west-1
      - GF_EXTERNAL_IMAGE_STORAGE_PROVIDER_ACCESS_KEY=snipped
      - GF_EXTERNAL_IMAGE_STORAGE_PROVIDER_SECRET_KEY=snipped

and

      - GF_EXTERNAL_IMAGE_STORAGE_PROVIDER=s3
      - GF_EXTERNAL_IMAGE_STORAGE_PROVIDER.s3_BUCKET=snipped-grafana
      - GF_EXTERNAL_IMAGE_STORAGE_PROVIDER.s3_REGION=eu-west-1
      - GF_EXTERNAL_IMAGE_STORAGE_PROVIDER.s3_ACCESS_KEY=snipped
      - GF_EXTERNAL_IMAGE_STORAGE_PROVIDER.s3_SECRET_KEY=snipped

What was the expected result?

That the configuration would contain my S3 settings.

What happened instead?

None of the S3 settings were set.

xlson commented

Hi, the reason is not working is that you aren't using the correct names for the env vars. Perhaps we can make some modifications to the documentation to make it easier to convert settings to vars in the future.

Your config should look something like this:

- GF_EXTERNAL_IMAGE_STORAGE_PROVIDER=s3
- GF_EXTERNAL_IMAGE_STORAGE_S3_BUCKET=snipped-grafana
- GF_EXTERNAL_IMAGE_STORAGE_S3_REGION=eu-west-1
- GF_EXTERNAL_IMAGE_STORAGE_S3_ACCESS_KEY=snipped
- GF_EXTERNAL_IMAGE_STORAGE_S3_SECRET_KEY=snipped

Thanks!