Skip to content

Commit 658fac1

Browse files
committed
feat(influxdb): upgrade to influxdb 2.x
1 parent a8227ee commit 658fac1

6 files changed

Lines changed: 20 additions & 29 deletions

File tree

charts/controller/templates/controller-deployment.yaml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -155,25 +155,25 @@ spec:
155155
secretKeyRef:
156156
name: influxdb-creds
157157
key: url
158-
- name: "INFLUXDB_DATABASE"
158+
{{- else }}
159+
- name: "INFLUXDB_URL"
160+
value: http://$(DRYCC_INFLUXDB_SERVICE_HOST):$(DRYCC_INFLUXDB_SERVICE_PORT_TRANSPORT)
161+
{{- end }}
162+
- name: "INFLUXDB_BUCKET"
159163
valueFrom:
160164
secretKeyRef:
161165
name: influxdb-creds
162-
key: database
163-
- name: "INFLUXDB_USER"
166+
key: bucket
167+
- name: "INFLUXDB_ORG"
164168
valueFrom:
165169
secretKeyRef:
166170
name: influxdb-creds
167-
key: user
168-
- name: "INFLUXDB_PASSWORD"
171+
key: org
172+
- name: "INFLUXDB_TOKEN"
169173
valueFrom:
170174
secretKeyRef:
171175
name: influxdb-creds
172-
key: password
173-
{{- else }}
174-
- name: "INFLUXDB_URL"
175-
value: http://$(DRYCC_INFLUXDB_SERVICE_HOST):$(DRYCC_INFLUXDB_SERVICE_PORT_TRANSPORT)
176-
{{- end }}
176+
key: token
177177
{{- range $key, $value := .Values.environment }}
178178
- name: {{ $key }}
179179
value: {{ $value | quote }}

rootfs/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM python:3.7-alpine
1+
FROM python:3.8-alpine
22

33
COPY requirements.txt /app/requirements.txt
44

rootfs/Dockerfile.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM python:3.7-alpine
1+
FROM python:3.8-alpine
22

33
COPY requirements.txt /app/requirements.txt
44
COPY dev_requirements.txt /app/dev_requirements.txt

rootfs/api/settings/production.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,6 @@
530530

531531
# Influxdb Configuration Options
532532
INFLUXDB_URL = os.environ.get('DRYCC_INFLUXDB_URL', 'http://localhost:8086')
533-
INFLUXDB_DATABASE = os.environ.get('DRYCC_INFLUXDB_DATABASE', 'drycc')
534-
INFLUXDB_USER = os.environ.get('DRYCC_INFLUXDB_USER', 'root')
535-
INFLUXDB_PASSWORD = os.environ.get('DRYCC_INFLUXDB_PASSWORD', 'root')
533+
INFLUXDB_BUCKET = os.environ.get('DRYCC_INFLUXDB_BUCKET', 'drycc')
534+
INFLUXDB_ORG = os.environ.get('DRYCC_INFLUXDB_ORG', 'root')
535+
INFLUXDB_TOKEN = os.environ.get('DRYCC_INFLUXDB_TOKEN', 'root')

rootfs/api/utils.py

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,8 @@
88
import random
99
import threading
1010
from copy import deepcopy
11-
from urllib.parse import urlparse
1211
from django.conf import settings
13-
from influxdb import InfluxDBClient
14-
12+
from influxdb_client import InfluxDBClient
1513

1614
local = threading.local()
1715
logger = logging.getLogger(__name__)
@@ -168,17 +166,10 @@ def apply_tasks(tasks):
168166

169167
def get_influxdb_client():
170168
if not hasattr(local, "influxdb_client"):
171-
addr = urlparse(settings.INFLUXDB_URL).netloc
172-
if ":" in addr:
173-
host, port = addr.rsplit(":")
174-
else:
175-
host, port = addr, 8086
176169
local.influxdb_client = InfluxDBClient(
177-
host,
178-
port,
179-
settings.INFLUXDB_USER,
180-
settings.INFLUXDB_PASSWORD,
181-
settings.INFLUXDB_DATABASE
170+
url=settings.INFLUXDB_URL,
171+
token=settings.INFLUXDB_TOKEN,
172+
org=settings.INFLUXDB_ORG
182173
)
183174
return local.influxdb_client
184175

rootfs/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ requests==2.24.0
2222
requests-toolbelt==0.9.1
2323
celery==5.0.2
2424
django_redis==4.12.1
25-
influxdb==5.3.1
25+
influxdb-client==1.13.0

0 commit comments

Comments
 (0)