influx to docker

This commit is contained in:
soraefir
2026-06-05 21:42:46 +02:00
parent 126f2f0c69
commit 87d648485e
2 changed files with 30 additions and 60 deletions

View File

@@ -22,22 +22,25 @@ in {
}];
containers = {
# db = builder.mkContainer {
# subdomain = containerCfg.subdomain;
# image = "influxdata/influxdb:3.0";
# port = 8181;
# secret = name;
# extraEnv = {
# INFLUXD_DB_PATH = "/db";
# INFLUXD_CONFIG_PATH = "/config";
# };
# overrides = {
# volumes = [
# "${serverCfg.path.data}/influxdb:/db:rw"
# "${serverCfg.path.config}/influxdb:/config:ro"
# ];
# };
# };
db = builder.mkContainer {
subdomain = containerCfg.subdomain;
image = "influxdb:3-core";
port = 8181;
secret = name;
extraEnv = {
INFLUXD_DB_PATH = "/db";
INFLUXD_CONFIG_PATH = "/config";
};
overrides = {
cmd = [ "influxdb3" "serve" "--node-id=node0" "--data-dir=/var/lib/influxdb3/data" "--admin-token-file=/var/lib/influxdb3/token.json" ];
ports = [ "8181:8181" ];
volumes = [
"${serverCfg.path.data}/influxdb:/var/lib/influxdb3/data:rw"
"${serverCfg.path.config}/influxdb/config/admin-token.json:/var/lib/influxdb3/token.json:ro"
];
};
};
server = builder.mkContainer {
tmpfs = true;
@@ -47,10 +50,9 @@ in {
secret = name;
extraEnv = {
DATABASE_URL = "/db/sqlite.db";
DEFAULT_INFLUX_SERVER = "http://${builder.host}:8181";
DEFAULT_INFLUX_SERVER = "http://influx-db:8181";
};
overrides = {
ports = [ "8888:8080" ];
cmd = [ "--mode=admin" ];
volumes = [
"${serverCfg.path.data}/influxdb:/db:rw"
@@ -71,7 +73,16 @@ in {
"DEFAULT_SERVER_NAME": "${serverCfg.domain}"
}
EOF
chmod -R 755 ${serverCfg.path.config}/influxdb
cat > ${serverCfg.path.config}/influxdb/config/admin-token.json <<EOF
{
"token": "$INFLUXDB_TOKEN",
"name": "admin",
"description": "Admin token for automated deployment"
}
EOF
chmod -R 755 ${serverCfg.path.config}/influxdb
'';
};
};