gitflux icon indicating copy to clipboard operation
gitflux copied to clipboard

Create Dockerfile for this project

Open SkYNewZ opened this issue 5 years ago • 7 comments

Hey! 👋

I created the Dockerfile in order to create the docker-compose.yml. Can you tell me exactly what do you want? Creating a docker-compose.yml for InfluxDB and Grafana is easy, but gitflux requires to run the commands manually. Would you just like the InfluxDB and the Grafana in the docker-compose.yml ?

In addition, do you want a CI and possibly a CD for the Docker images?

SkYNewZ avatar Oct 26 '20 23:10 SkYNewZ

We'll need a docker-compose with InfluxDB & Grafana being preconfigured:

  1. InfluxDB needs a bucket that we can write to
  2. Grafana needs to reach and know about the InfluxDB datasource

With regards to gitflux we have two options:

  1. Run it every couple of minutes as a service
  2. Add a daemon mode to gitflux, that keeps running and automatically polls data in intervals

muesli avatar Oct 27 '20 06:10 muesli

Do you want a CI/CD for Docker builds ?

SkYNewZ avatar Nov 01 '20 14:11 SkYNewZ

Do you want a CI/CD for Docker builds ?

It would be nice to automatically build and push new docker images from goreleaser, so we have a unified release approach. Additionally we could build an unstable image for every push to master.

muesli avatar Nov 01 '20 15:11 muesli

Okay! You are using InfluxDB version 2.0 right ?

SkYNewZ avatar Nov 01 '20 15:11 SkYNewZ

Using 1.8.3 here currently. I think there hasn't been a stable release of version 2 yet.

muesli avatar Nov 02 '20 14:11 muesli

Using 1.8.3 here currently. I think there hasn't been a stable release of version 2 yet.

Is it possible to generate a InfluxDB token in v1.8.3 ?

There is my draft docker-compose.yml file. It's working well. I would like to "auto setup" a user access token to make gitflux work out of the box, with the --influx-token. Searching about how to do this, I do not find any way to generate an access token for InfluxDB v1.8.3.

version: "3.8"

services:
  influxdb:
    image: influxdb:1.8.3-alpine
    volumes:
      - influxdb-data:/var/lib/influxdb
      - ./influxdb/create-token.sh:/docker-entrypoint-initdb.d/create-token.sh
    environment:
      INFLUXDB_ADMIN_USER: gitflux
      INFLUXDB_ADMIN_PASSWORD: gitflux
      INFLUXDB_DB: gitflux
      INFLUXDB_USER: gitflux
      INFLUXDB_USER_PASSWORD: gitflux
    ports:
      - 8086:8086
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:8086"]
      interval: 1m30s
      timeout: 10s
      retries: 3
      start_period: 20s
    restart: always

  grafana:
    image: grafana/grafana
    environment:
      GF_SECURITY_ADMIN_USER: gitflux
      GF_SECURITY_ADMIN_PASSWORD: gitflux
    ports:
      - 3000:3000
    user: 472:472
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:3000/api/health"]
      interval: 1m30s
      timeout: 10s
      retries: 3
      start_period: 20s
    volumes:
      - grafana-storage:/var/lib/grafana
      - ./grafana/influxdb-datasource.yml:/etc/grafana/provisioning/datasources/influxdb-datasource.yml
      - ./grafana/grafana-dashboard-provider.yml:/etc/grafana/provisioning/dashboards/grafana-dashboard-provider.yml
      - ./grafana/dashboard.json:/var/lib/grafana/dashboards/dashboard.json
      - ./grafana/project_dashboard.json:/var/lib/grafana/dashboards/project_dashboard.json
    depends_on:
      - influxdb
    restart: always

volumes:
  influxdb-data:
  grafana-storage:

SkYNewZ avatar Nov 03 '20 16:11 SkYNewZ

I think instead of the token you can also alternatively specify a user/password combination. Alternatively we could make influxdb only reachable from within the container's context and make it auth-less.

muesli avatar Nov 07 '20 05:11 muesli