chore(nix): rename demo docker to test docker and remove additional config and dependencies
This commit is contained in:
parent
a407094253
commit
f63f38bdaa
@ -1,4 +1,4 @@
|
|||||||
# SPDX-FileCopyrightText: 2022-2023 Gregor Kleen <gregor@kleen.consulting>, Sarah Vaupel <sarah.vaupel@ifi.lmu.de>, Steffen Jost <jost@tcs.ifi.lmu.de>
|
# SPDX-FileCopyrightText: 2022-2023 Sarah Vaupel <sarah.vaupel@uniworx.de>, Gregor Kleen <gregor@kleen.consulting>, Steffen Jost <jost@tcs.ifi.lmu.de>
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
|
|
||||||
@ -14,11 +14,11 @@ let
|
|||||||
'');
|
'');
|
||||||
in if self ? lastModified then fromDate else "1970-01-01T00:00:01Z";
|
in if self ? lastModified then fromDate else "1970-01-01T00:00:01Z";
|
||||||
|
|
||||||
mkUniworxDocker = { isDemo }: prev.dockerTools.buildImage {
|
mkUniworxDocker = { isTest }: prev.dockerTools.buildImage {
|
||||||
name = "uniworx${optionalString isDemo "-demo"}";
|
name = "uniworx${optionalString isTest "-test"}";
|
||||||
tag =
|
tag =
|
||||||
let
|
let
|
||||||
versionFile = if isDemo then ./demo-version.json else ./version.json;
|
versionFile = if isTest then ./test-version.json else ./version.json;
|
||||||
in (builtins.fromJSON (prev.lib.readFile versionFile)).version;
|
in (builtins.fromJSON (prev.lib.readFile versionFile)).version;
|
||||||
inherit created;
|
inherit created;
|
||||||
|
|
||||||
@ -44,7 +44,7 @@ let
|
|||||||
curl wget netcat openldap
|
curl wget netcat openldap
|
||||||
unixtools.netstat htop gnugrep
|
unixtools.netstat htop gnugrep
|
||||||
locale
|
locale
|
||||||
] ++ optionals isDemo [ postgresql_12 memcached uniworx.uniworx.components.exes.uniworxdb ];
|
];
|
||||||
|
|
||||||
runAsRoot = ''
|
runAsRoot = ''
|
||||||
#!${final.stdenv.shell}
|
#!${final.stdenv.shell}
|
||||||
@ -62,18 +62,6 @@ let
|
|||||||
|
|
||||||
# just to see how to create directories here
|
# just to see how to create directories here
|
||||||
mkdir -p /testdir
|
mkdir -p /testdir
|
||||||
|
|
||||||
${optionalString isDemo ''
|
|
||||||
install -d -g uniworx -o uniworx -m 0750 /var/lib/postgres
|
|
||||||
|
|
||||||
install -d -g uniworx -o uniworx -m 0750 /var/lib/memcached
|
|
||||||
|
|
||||||
install -d -g uniworx -o uniworx -m 0755 /var/log/postgres
|
|
||||||
install -d -g uniworx -o uniworx -m 0755 /var/log/memcached
|
|
||||||
|
|
||||||
mkdir -p /run
|
|
||||||
install -d -g uniworx -o uniworx -m 0755 /run/postgres
|
|
||||||
''}
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
config =
|
config =
|
||||||
@ -83,27 +71,6 @@ let
|
|||||||
|
|
||||||
cTime=$(date -Is)
|
cTime=$(date -Is)
|
||||||
|
|
||||||
${optionalString isDemo ''
|
|
||||||
pgDir=/var/lib/postgres
|
|
||||||
pgSockDir=/run/postgres
|
|
||||||
pgLogFile=/var/log/postgres/''${cTime}.log
|
|
||||||
export PGHOST=''${pgSockDir}
|
|
||||||
export PGLOG=''${pgLogFile}
|
|
||||||
|
|
||||||
pgNew=
|
|
||||||
if [[ -n "$(find ''${pgDir} -maxdepth 0 -type d -empty 2>/dev/null)" ]]; then
|
|
||||||
pgNew=1
|
|
||||||
fi
|
|
||||||
|
|
||||||
[[ -z "''${pgNew}" ]] || initdb --no-locale --encoding=UTF8 --username postgres --pgdata ''${pgDir}
|
|
||||||
pg_ctl start -D ''${pgDir} -l ''${pgLogFile} -w -o "-k ''${pgSockDir} -c listen_addresses= -c hba_file=${postgresHba} -c unix_socket_permissions=0777 -c max_connections=9990 -c shared_preload_libraries=pg_stat_statements -c auto_explain.log_min_duration=100ms"
|
|
||||||
[[ -z "''${pgNew}" ]] || psql -f ${postgresSchema} postgres postgres
|
|
||||||
|
|
||||||
( cd /var/lib/memcached; memcached -p 11212 ) &>/var/log/memcached/''${cTime}.log &
|
|
||||||
export SESSION_MEMCACHED_HOST=localhost
|
|
||||||
export SESSION_MEMCACHED_PORT=11212
|
|
||||||
''}
|
|
||||||
|
|
||||||
# export LOGDEST=/var/log/uniworx/''${cTime}.log # kubernetes prefers log via stdout
|
# export LOGDEST=/var/log/uniworx/''${cTime}.log # kubernetes prefers log via stdout
|
||||||
typeset -a configs
|
typeset -a configs
|
||||||
configs=()
|
configs=()
|
||||||
@ -115,9 +82,6 @@ let
|
|||||||
fi
|
fi
|
||||||
configs+=('${uniworxConfig}')
|
configs+=('${uniworxConfig}')
|
||||||
cd /var/lib/uniworx
|
cd /var/lib/uniworx
|
||||||
${optionalString isDemo ''
|
|
||||||
[[ -z "''${pgNew}" ]] || uniworxdb -f ''${configs}
|
|
||||||
''}
|
|
||||||
exec -- uniworx ''${configs}
|
exec -- uniworx ''${configs}
|
||||||
'';
|
'';
|
||||||
postgresSchema = prev.writeText "schema.sql" ''
|
postgresSchema = prev.writeText "schema.sql" ''
|
||||||
@ -142,13 +106,11 @@ let
|
|||||||
Volumes = {
|
Volumes = {
|
||||||
"/var/lib/uniworx" = {};
|
"/var/lib/uniworx" = {};
|
||||||
"/var/log" = {};
|
"/var/log" = {};
|
||||||
} // optionalAttrs isDemo {
|
|
||||||
"/var/lib/postgres" = {};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
mapAttrs (_name: mkUniworxDocker) {
|
mapAttrs (_name: mkUniworxDocker) {
|
||||||
uniworxDemoDocker = { isDemo = true; };
|
uniworxTestDocker = { isTest = true; };
|
||||||
uniworxDocker = { isDemo = false; };
|
uniworxDocker = { isTest = false; };
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"version": "27.4.13"
|
|
||||||
}
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
SPDX-FileCopyrightText: 2022 Gregor Kleen <gregor.kleen@ifi.lmu.de>,Steffen Jost <jost@tcs.ifi.lmu.de>
|
|
||||||
|
|
||||||
SPDX-License-Identifier: AGPL-3.0-or-later
|
|
||||||
3
nix/docker/test-version.json
Normal file
3
nix/docker/test-version.json
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"version": "0.1.0"
|
||||||
|
}
|
||||||
3
nix/docker/test-version.json.license
Normal file
3
nix/docker/test-version.json.license
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
SPDX-FileCopyrightText: 2022-2023 Sarah Vaupel <sarah.vaupel@uniworx.de>, Gregor Kleen <gregor.kleen@ifi.lmu.de>, Steffen Jost <jost@tcs.ifi.lmu.de>
|
||||||
|
|
||||||
|
SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
Loading…
Reference in New Issue
Block a user