docs-v2 icon indicating copy to clipboard operation
docs-v2 copied to clipboard

add a docker-compose example to the oss setup docs

Open russorat opened this issue 4 years ago • 4 comments

We should add the following docker-compose file to the oss setup section of the docs so that someone setting up docker can see an example using the docker setup env vars:

version: '3'
services:
  influxdb:
    image: influxdb:latest
    volumes:
      - influxdbv2:/.influxdbv2
      - ./ssl/influxdb-selfsigned.crt:/etc/ssl/influxdb-selfsigned.crt
      - ./ssl/influxdb-selfsigned.key:/etc/ssl/influxdb-selfsigned.key
    environment: 
      - DOCKER_INFLUXDB_INIT_MODE=setup
      - DOCKER_INFLUXDB_INIT_USERNAME=russ
      - DOCKER_INFLUXDB_INIT_PASSWORD=something
      - DOCKER_INFLUXDB_INIT_ORG=InfluxData
      - DOCKER_INFLUXDB_INIT_BUCKET=telegraf
      - DOCKER_INFLUXDB_INIT_ADMIN_TOKEN=mytoken
      - INFLUXD_TLS_CERT=/etc/ssl/influxdb-selfsigned.crt
      - INFLUXD_TLS_KEY=/etc/ssl/influxdb-selfsigned.key
    ports:
      - "8086:8086"
volumes:
  influxdbv2:

see also #2699

russorat avatar Jun 11 '21 18:06 russorat

Running this file with docker-compose up, the process exited with an error:

influxdb_1  | ts=2021-07-28T15:54:55.741047Z lvl=info msg=Starting log_id=0VcT3MFl000 service=telemetry interval=8h
influxdb_1  | ts=2021-07-28T15:54:55.742025Z lvl=error msg="Failed to load x509 key pair" log_id=0VcT3MFl000 service=tcp-listener cert-path=/etc/ssl/influxdb-selfsigned.crt key-path=/etc/ssl/influxdb-selfsigned.key
influxdb_1  | Error: read /etc/ssl/influxdb-selfsigned.crt: is a directory
influxdb_1  | See 'influxd -h' for help
comp_influxdb_1 exited with code 1

Do we need to document creating the self-signed certs? What's the best way to go about that? @russorat

pierwill avatar Jul 28 '21 15:07 pierwill

https://docs.influxdata.com/influxdb/v2.0/security/enable-tls/#configure-influxdb-to-use-tls

russorat avatar Jul 28 '21 19:07 russorat

@russorat : I'm not able to reproduce the correct setup here. Can you share the directory structure that has worked for you?

pierwill avatar Jul 30 '21 16:07 pierwill

i think you just need this:

➜  influxdb-telegraf-docker ls -l
total 48
-rw-r--r--  1 rsavage  staff   1714 Jul  6 12:41 docker-compose.yml
drwxr-xr-x  4 rsavage  staff    128 Jun 11 12:37 ssl/
➜  influxdb-telegraf-docker ls -l ssl
total 16
-rwxrwxrwx  1 root  staff   956 Jun 11 12:34 influxdb-selfsigned.crt
-rwxrwxrwx  1 root  staff  1708 Jun 11 12:34 influxdb-selfsigned.key

russorat avatar Jul 30 '21 17:07 russorat