GithubHelp home page GithubHelp logo

shantanoo-desai / influxdb-docker-init-poc Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 1.0 40 KB

Proof-of-Concept of Provisioning your InfluxDBv2.x container through Docker Init Containers using Compose files

License: Apache License 2.0

Shell 100.00%
docker docker-compose influxdb init-containers

influxdb-docker-init-poc's Introduction

Initialize and Provision your InfluxDBv2.x Container using Docker Init Containers

Proof-of-Concept of Provisioning your InfluxDBv2.x container through Docker Init Containers using Compose files

InfluxDB has already of provisioning the database by using scripts as volume mounts in the /docker-entrypoint-initdb.d directory. See Docker Hub Documentation for InfluxDB under section Custom Initialization Scripts.

This Repository is a proof-of-concept that once achieve similar initialization via the docker init containers in compose file

Usage

docker compose up

Should provide you verbose logs that the default initialization user and a custom user are created via the init-db docker init containers.

Results

  • Login into the UI at http://localhost:8086 using the default admin credentials (see influxdb.env)

  • Once logged into UI click User Icon on the left-side panel you will observe the provisioned Organization in the bootstrap-influxdb.sh script

Provisioned Organizations in InfluxDB UI main page

  • Select the coreOrg organization and click on the user icon on left-side panel and click on Members, you also see the provisioned members

Provisioned User in InfluxDB Org coreOrg

Docker Init Container in Compose

NOTE: this feature is similar to Kubernetes Init Containers, which is available for Docker Compose since version 1.29.

The Init Container can initialize your container by using the depends_on spec. Depending on the intialization process, you can set three conditions of the container's state you wish to initialize:

  • service_started
  • service_healthy
  • service_completed_sucessfully

Unfortunately, this feature is yet to be documented. However, some resources to look into:

  1. Feature Request Issue on Docker Compose
  2. Pending Pull-Request for Documentation of Init Containers
  3. StackExchange Query with a possible example

System Specs

Docker Engine version

Client:
 Version:           20.10.12
 API version:       1.41
 Go version:        go1.17.5
 Git commit:        e91ed5707e
 Built:             Mon Dec 13 22:31:40 2021
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server:
 Engine:
  Version:          20.10.12
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.17.5
  Git commit:       459d0dfbbb
  Built:            Mon Dec 13 22:30:43 2021
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.6.1
  GitCommit:        10f428dac7cec44c864e1b830a4623af27a9fc70.m
 runc:
  Version:          1.1.0
  GitCommit:        v1.1.0-0-g067aaf85
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Docker Compose CLI Version (part of docker CLI)

Docker Compose version 2.3.3

influxdb-docker-init-poc's People

Watchers

 avatar

Forkers

danroscigno

influxdb-docker-init-poc's Issues

bug: default values are not resolved if env vars for InfluxDB are not set

The bootstraper script should have the following syntax:

DOCKER_INFLUXDB_INIT_ADMIN_TOKEN=${DOCKER_INFLUXDB_INIT_ADMIN_TOKEN:-$DEFAULT_INFLUXDB_ADMIN_TOKEN}
DOCKER_INFLUXDB_INIT_BUCKET=${DOCKER_INFLUXDB_INIT_BUCKET:-$DEFAULT_INFLUXDB_BUCKET}
DOCKER_INFLUXDB_INIT_ORG=${DOCKER_INFLUXDB_INIT_ORG:-$DEFAULT_INFLUXDB_ORG}
DOCKER_INFLUXDB_INIT_PASSWORD=${DOCKER_INFLUXDB_INIT_PASSWORD:-$DEFAULT_INFLUXDB_PASSWORD}
DOCKER_INFLUXDB_INIT_USERNAME=${DOCKER_INFLUXDB_INIT_USERNAME:-$DEFAULT_INFLUXDB_USERNAME}

because of the missing $ before the default variable names, resolution won't be correct

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.