I wanted to create influx DB CI/CD pipeline using Jenkins and host it on Kubernetes

Hi Team,

I want to setup InfluxDB CI/CD and host it on kubernetes env, Can you pls share me the sample

Hi @Manjunath_V,

Just to clarify, you are looking for a way to deploy Jenkins in Kubernetes and set up a pipeline which will compile and deploy InfluxDB from source?

InfluxData does not provide any examples of that kind, but perhaps someone from the community has something they would like to share.

Hi Noahcrowley,

Can you please share me the Docker file where I can create the InfluxDB database during the docker image creation process and run the docker images on influxdb user id

Regards,

Manjunath VS

You can find Dockerfiles for version 1.7.x at the root of the 1.7 branch of the influxdb repo on GitHub, or for the 2.0 version (in Alpha) in the master branch under /docker/influxd/.

Hi Noahcrowley,

I have seen those files but I am unable to create a specific database using the init script where I need to make changes to create the database can you pls point me exact line if you can share me an example it will be great help

Thank you

Manjunath

Creating a bucket during the image creation process is not a good practice, so we don’t have any examples of that.

Can you write more about what you are trying to do? Are you looking for a way to deploy Jenkins in Kubernetes and set up a pipeline which will compile and deploy InfluxDB from source, or are you trying to do something else?

Hi Noahcrowley,

What is the best way to create database on Docker image

I am trying to automate to create the influxdb Docker image create database as part of CI/CD pipeline

Regards

Manjunath

For InfluxDB 2 you can use the CLI for first-time configuration:

$ influx setup --help
Setup instance with initial user, org, bucket

Usage:
  influx setup [flags]

Flags:
  -b, --bucket string     primary bucket name
  -f, --force             skip confirmation prompt
  -h, --help              Help for the setup command 
  -o, --org string        primary organization name
  -p, --password string   password for username
  -r, --retention int     retention period in hours, else infinite (default -1)
  -u, --username string   primary username

Global Flags:
      --host string    HTTP address of Influx (default "http://localhost:9999")
      --local          Run commands locally against the filesystem
  -t, --token string   API token to be used throughout client calls

You can run this command using docker exec, where influxdb2 is the name of your container:

$ docker exec influxdb2 influx setup [flags]

HI Team,

I am trying use the official InfluxDB docker image and wanted to create the database as part of Docker file or Docker build, Can you please share me the steps.

Based on the docs I tried to modify init-influxdb.sh

I have made these changes but nothing worked for me.

INIT_USERS=$([ ! -z “$AUTH_ENABLED” ] && [ ! -z “$INFLUXDB_ADMIN_USER” ] && echo 1 || echo)

if ( [ ! -z “INIT_USERS" ] || [ ! -z "DCMA_EVENTS" ] || [ "(ls -A /docker-entrypoint-initdb.d 2> /dev/null)” ] ) && [ ! “$(ls -A /var/lib/influxdb)” ]; then

INIT_QUERY=""

CREATE_DB_QUERY="CREATE DATABASE DCMA_EVENTS"

if [ ! -z "$INIT_USERS" ]; then

	if [ -z "$INFLUXDB_ADMIN_PASSWORD" ]; then

		INFLUXDB_ADMIN_PASSWORD="$(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c32;echo;)"

		echo "INFLUXDB_ADMIN_PASSWORD:$INFLUXDB_ADMIN_PASSWORD"

But unable to create the custom database. As part of the test I wanted to build the docker image along with a Custom Database.

Regards,

Manjuanth VS

Hi Team,

I am unable to run the Influxdb docker image on a service id. Here is the Dockerfile which I am using

FROM resin/rpi-raspbian:jessie

Setup external package-sources

RUN apt-get update && apt-get install -y \

apt-transport-https \

curl \

--no-install-recommends && \

curl -sL [https://repos.influxdata.com/influxdb.key](https://repos.influxdata.com/influxdb.key) | sudo apt-key add - source /etc/os-release && \

echo "deb [https://repos.influxdata.com/debian](https://repos.influxdata.com/debian) jessie stable" | sudo tee /etc/apt/sources.list.d/influxdb.list && \

apt-get update && apt-get install -y \

influxdb \

--no-install-recommends && \

apt-get remove --auto-remove -y \

apt-transport-https && \

rm -rf /var/lib/apt/lists/*

#COPY config files

COPY influxdb.conf /etc/influxdb/influxdb.conf

#copy influxdb scripts

COPY . .

ADD run.sh /run.sh

RUN chmod +x /*.sh

RUN chown influxdb:influxdb /usr/bin/influx

RUN chmod 777 /usr/bin/influx

RUN chown -R influxdb:influxdb /var

RUN chmod -R 777 /var

RUN chown -R influxdb:influxdb /etc/influxdb

RUN chmod 777 /etc/influxdb/influxdb.conf

ENV PRE_CREATE_DB “DCMA_Events”

ENV ADMIN_USER=“admin”

ENV INFLUXDB_INIT_PWD=“Dev@1234”

HTTP API

EXPOSE 8086

VOLUME ["/dcaw/influx"]

CMD ["/run.sh"]

USER influxdb