Skip to content
Snippets Groups Projects
Verified Commit 3d07c326 authored by Martin Weise's avatar Martin Weise
Browse files

Added count

parent 09e0ee01
No related branches found
No related tags found
2 merge requests!322Master,!321Dev
This commit is part of merge request !321. Comments created here will be created in the context of that merge request.
Showing
with 100 additions and 83 deletions
...@@ -530,7 +530,7 @@ ...@@ -530,7 +530,7 @@
"description" : "${default-container-handling}", "description" : "${default-container-handling}",
"composite" : true, "composite" : true,
"composites" : { "composites" : {
"realm" : [ "find-container", "list-containers" ] "realm" : [ "find-container" ]
}, },
"clientRole" : false, "clientRole" : false,
"containerId" : "82c39861-d877-4667-a0f3-4daa2ee230e0", "containerId" : "82c39861-d877-4667-a0f3-4daa2ee230e0",
...@@ -2143,7 +2143,7 @@ ...@@ -2143,7 +2143,7 @@
"subType" : "anonymous", "subType" : "anonymous",
"subComponents" : { }, "subComponents" : { },
"config" : { "config" : {
"allowed-protocol-mapper-types" : [ "oidc-usermodel-attribute-mapper", "saml-user-attribute-mapper", "oidc-usermodel-property-mapper", "saml-role-list-mapper", "oidc-address-mapper", "oidc-full-name-mapper", "oidc-sha256-pairwise-sub-mapper", "saml-user-property-mapper" ] "allowed-protocol-mapper-types" : [ "saml-user-attribute-mapper", "oidc-full-name-mapper", "oidc-sha256-pairwise-sub-mapper", "oidc-address-mapper", "saml-user-property-mapper", "oidc-usermodel-property-mapper", "oidc-usermodel-attribute-mapper", "saml-role-list-mapper" ]
} }
}, { }, {
"id" : "1849e52a-b8c9-44a8-af3d-ee19376a1ed1", "id" : "1849e52a-b8c9-44a8-af3d-ee19376a1ed1",
...@@ -2169,7 +2169,7 @@ ...@@ -2169,7 +2169,7 @@
"subType" : "authenticated", "subType" : "authenticated",
"subComponents" : { }, "subComponents" : { },
"config" : { "config" : {
"allowed-protocol-mapper-types" : [ "oidc-sha256-pairwise-sub-mapper", "oidc-full-name-mapper", "saml-user-property-mapper", "saml-user-attribute-mapper", "saml-role-list-mapper", "oidc-usermodel-attribute-mapper", "oidc-usermodel-property-mapper", "oidc-address-mapper" ] "allowed-protocol-mapper-types" : [ "saml-role-list-mapper", "oidc-sha256-pairwise-sub-mapper", "oidc-full-name-mapper", "oidc-usermodel-property-mapper", "oidc-usermodel-attribute-mapper", "saml-user-property-mapper", "saml-user-attribute-mapper", "oidc-address-mapper" ]
} }
} ], } ],
"org.keycloak.storage.UserStorageProvider" : [ { "org.keycloak.storage.UserStorageProvider" : [ {
...@@ -2185,8 +2185,8 @@ ...@@ -2185,8 +2185,8 @@
"config" : { "config" : {
"ldap.attribute" : [ "createTimestamp" ], "ldap.attribute" : [ "createTimestamp" ],
"is.mandatory.in.ldap" : [ "false" ], "is.mandatory.in.ldap" : [ "false" ],
"always.read.value.from.ldap" : [ "true" ],
"read.only" : [ "true" ], "read.only" : [ "true" ],
"always.read.value.from.ldap" : [ "true" ],
"user.model.attribute" : [ "createTimestamp" ] "user.model.attribute" : [ "createTimestamp" ]
} }
}, { }, {
...@@ -2221,8 +2221,8 @@ ...@@ -2221,8 +2221,8 @@
"config" : { "config" : {
"ldap.attribute" : [ "mail" ], "ldap.attribute" : [ "mail" ],
"is.mandatory.in.ldap" : [ "false" ], "is.mandatory.in.ldap" : [ "false" ],
"read.only" : [ "false" ],
"always.read.value.from.ldap" : [ "false" ], "always.read.value.from.ldap" : [ "false" ],
"read.only" : [ "false" ],
"user.model.attribute" : [ "email" ] "user.model.attribute" : [ "email" ]
} }
}, { }, {
...@@ -2233,17 +2233,17 @@ ...@@ -2233,17 +2233,17 @@
"config" : { "config" : {
"membership.attribute.type" : [ "DN" ], "membership.attribute.type" : [ "DN" ],
"group.name.ldap.attribute" : [ "cn" ], "group.name.ldap.attribute" : [ "cn" ],
"membership.user.ldap.attribute" : [ "uid" ],
"preserve.group.inheritance" : [ "false" ], "preserve.group.inheritance" : [ "false" ],
"membership.user.ldap.attribute" : [ "uid" ],
"groups.dn" : [ "ou=users,dc=dbrepo,dc=at" ], "groups.dn" : [ "ou=users,dc=dbrepo,dc=at" ],
"mode" : [ "LDAP_ONLY" ], "mode" : [ "LDAP_ONLY" ],
"user.roles.retrieve.strategy" : [ "LOAD_GROUPS_BY_MEMBER_ATTRIBUTE" ], "user.roles.retrieve.strategy" : [ "LOAD_GROUPS_BY_MEMBER_ATTRIBUTE" ],
"ignore.missing.groups" : [ "false" ], "ignore.missing.groups" : [ "false" ],
"membership.ldap.attribute" : [ "member" ], "membership.ldap.attribute" : [ "member" ],
"group.object.classes" : [ "groupOfNames" ],
"memberof.ldap.attribute" : [ "memberOf" ], "memberof.ldap.attribute" : [ "memberOf" ],
"drop.non.existing.groups.during.sync" : [ "false" ], "group.object.classes" : [ "groupOfNames" ],
"groups.path" : [ "/" ] "groups.path" : [ "/" ],
"drop.non.existing.groups.during.sync" : [ "false" ]
} }
}, { }, {
"id" : "b6ff3285-35af-4e86-8bb4-d94b8e0d70bb", "id" : "b6ff3285-35af-4e86-8bb4-d94b8e0d70bb",
...@@ -2253,8 +2253,8 @@ ...@@ -2253,8 +2253,8 @@
"config" : { "config" : {
"ldap.attribute" : [ "modifyTimestamp" ], "ldap.attribute" : [ "modifyTimestamp" ],
"is.mandatory.in.ldap" : [ "false" ], "is.mandatory.in.ldap" : [ "false" ],
"always.read.value.from.ldap" : [ "true" ],
"read.only" : [ "true" ], "read.only" : [ "true" ],
"always.read.value.from.ldap" : [ "true" ],
"user.model.attribute" : [ "modifyTimestamp" ] "user.model.attribute" : [ "modifyTimestamp" ]
} }
}, { }, {
...@@ -2277,21 +2277,21 @@ ...@@ -2277,21 +2277,21 @@
"fullSyncPeriod" : [ "-1" ], "fullSyncPeriod" : [ "-1" ],
"pagination" : [ "false" ], "pagination" : [ "false" ],
"startTls" : [ "false" ], "startTls" : [ "false" ],
"connectionPooling" : [ "true" ],
"usersDn" : [ "ou=users,dc=dbrepo,dc=at" ], "usersDn" : [ "ou=users,dc=dbrepo,dc=at" ],
"connectionPooling" : [ "true" ],
"cachePolicy" : [ "DEFAULT" ], "cachePolicy" : [ "DEFAULT" ],
"useKerberosForPasswordAuthentication" : [ "false" ], "useKerberosForPasswordAuthentication" : [ "false" ],
"importEnabled" : [ "true" ], "importEnabled" : [ "true" ],
"enabled" : [ "true" ], "enabled" : [ "true" ],
"changedSyncPeriod" : [ "-1" ],
"usernameLDAPAttribute" : [ "uid" ],
"bindDn" : [ "cn=admin,dc=dbrepo,dc=at" ], "bindDn" : [ "cn=admin,dc=dbrepo,dc=at" ],
"bindCredential" : [ "admin" ], "bindCredential" : [ "admin" ],
"usernameLDAPAttribute" : [ "uid" ],
"changedSyncPeriod" : [ "-1" ],
"lastSync" : [ "1719252666" ], "lastSync" : [ "1719252666" ],
"vendor" : [ "other" ], "vendor" : [ "other" ],
"uuidLDAPAttribute" : [ "entryUUID" ], "uuidLDAPAttribute" : [ "entryUUID" ],
"allowKerberosAuthentication" : [ "false" ],
"connectionUrl" : [ "ldap://identity-service:1389" ], "connectionUrl" : [ "ldap://identity-service:1389" ],
"allowKerberosAuthentication" : [ "false" ],
"syncRegistrations" : [ "true" ], "syncRegistrations" : [ "true" ],
"authType" : [ "simple" ], "authType" : [ "simple" ],
"useTruststoreSpi" : [ "always" ], "useTruststoreSpi" : [ "always" ],
......
...@@ -27,10 +27,12 @@ CREATE TABLE IF NOT EXISTS `mdb_images` ...@@ -27,10 +27,12 @@ CREATE TABLE IF NOT EXISTS `mdb_images`
dialect character varying(255) NOT NULL, dialect character varying(255) NOT NULL,
driver_class character varying(255) NOT NULL, driver_class character varying(255) NOT NULL,
jdbc_method character varying(255) NOT NULL, jdbc_method character varying(255) NOT NULL,
is_default BOOLEAN NOT NULL DEFAULT FALSE,
created timestamp NOT NULL DEFAULT NOW(), created timestamp NOT NULL DEFAULT NOW(),
last_modified timestamp, last_modified timestamp,
PRIMARY KEY (id), PRIMARY KEY (id),
UNIQUE (name, version) UNIQUE (name, version),
UNIQUE (is_default)
) WITH SYSTEM VERSIONING; ) WITH SYSTEM VERSIONING;
CREATE TABLE IF NOT EXISTS `mdb_images_date` CREATE TABLE IF NOT EXISTS `mdb_images_date`
......
...@@ -2,7 +2,7 @@ BEGIN; ...@@ -2,7 +2,7 @@ BEGIN;
INSERT INTO `mdb_containers` (name, internal_name, image_id, host, port, ui_host, ui_port, sidecar_host, sidecar_port, INSERT INTO `mdb_containers` (name, internal_name, image_id, host, port, ui_host, ui_port, sidecar_host, sidecar_port,
privileged_username, privileged_password) privileged_username, privileged_password)
VALUES ('MariaDB 11.1.3', 'mariadb_11_1_3', 1, 'data-db', 3306, 'localhost', 3306, 'data-db-sidecar', 8080, VALUES ('mariadb:11.1.3-debian-11-r6', 'mariadb_11_1_3', 1, 'data-db', 3306, 'localhost', 3306, 'data-db-sidecar', 8080,
'root', 'dbrepo'); 'root', 'dbrepo');
COMMIT; COMMIT;
...@@ -32,4 +32,9 @@ public class ImageBriefDto { ...@@ -32,4 +32,9 @@ public class ImageBriefDto {
@Schema(example = "mariadb") @Schema(example = "mariadb")
private String jdbcMethod; private String jdbcMethod;
@NotNull
@JsonProperty("default")
@Schema(example = "false")
private Boolean isDefault;
} }
...@@ -50,6 +50,11 @@ public class ImageDto { ...@@ -50,6 +50,11 @@ public class ImageDto {
@Schema(example = "mariadb") @Schema(example = "mariadb")
private String jdbcMethod; private String jdbcMethod;
@NotNull
@JsonProperty("default")
@Schema(example = "false")
private Boolean isDefault;
@NotNull @NotNull
@JsonProperty("default_port") @JsonProperty("default_port")
@Schema(example = "3306") @Schema(example = "3306")
......
...@@ -5,8 +5,6 @@ import com.fasterxml.jackson.annotation.JsonFormat; ...@@ -5,8 +5,6 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import jakarta.persistence.*; import jakarta.persistence.*;
import lombok.*; import lombok.*;
import org.hibernate.annotations.GenericGenerator; import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.OnDelete;
import org.hibernate.annotations.OnDeleteAction;
import org.springframework.data.annotation.CreatedDate; import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate; import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener; import org.springframework.data.jpa.domain.support.AuditingEntityListener;
...@@ -56,6 +54,9 @@ public class ContainerImage { ...@@ -56,6 +54,9 @@ public class ContainerImage {
@Column(nullable = false) @Column(nullable = false)
private Integer defaultPort; private Integer defaultPort;
@Column(nullable = false, columnDefinition = "BOOLEAN DEFAULT FALSE")
private Boolean isDefault = false;
@OneToMany(fetch = FetchType.LAZY, cascade = {CascadeType.ALL, CascadeType.PERSIST}, mappedBy = "image") @OneToMany(fetch = FetchType.LAZY, cascade = {CascadeType.ALL, CascadeType.PERSIST}, mappedBy = "image")
private List<ContainerImageDate> dateFormats; private List<ContainerImageDate> dateFormats;
......
package at.tuwien.init;
import at.tuwien.api.keycloak.UserDto;
import at.tuwien.config.GatewayConfig;
import at.tuwien.config.MetadataConfig;
import at.tuwien.entities.user.User;
import at.tuwien.exception.AuthServiceConnectionException;
import at.tuwien.exception.AuthServiceException;
import at.tuwien.exception.UserNotFoundException;
import at.tuwien.gateway.KeycloakGateway;
import at.tuwien.repository.UserRepository;
import at.tuwien.service.UserService;
import jakarta.annotation.PostConstruct;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Component;
@Log4j2
@Component
@Profile("!junit")
public class InitHandler {
private final UserService userService;
private final GatewayConfig gatewayConfig;
private final MetadataConfig metadataConfig;
private final UserRepository userRepository;
private final KeycloakGateway keycloakGateway;
@Autowired
public InitHandler(UserService userService, GatewayConfig gatewayConfig, MetadataConfig metadataConfig,
UserRepository userRepository, KeycloakGateway keycloakGateway) {
this.userService = userService;
this.gatewayConfig = gatewayConfig;
this.metadataConfig = metadataConfig;
this.userRepository = userRepository;
this.keycloakGateway = keycloakGateway;
}
@PostConstruct
public void init() throws UserNotFoundException, AuthServiceException, AuthServiceConnectionException {
try {
userService.findByUsername(gatewayConfig.getSystemUsername());
} catch (UserNotFoundException e) {
log.warn("Failed to find system user with username {} in metadata database", gatewayConfig.getSystemUsername());
final UserDto user = keycloakGateway.findByUsername(gatewayConfig.getSystemUsername());
final User entity = User.builder()
.id(user.getId())
.username(user.getUsername())
.email(metadataConfig.getAdminEmail())
.theme("light")
.mariadbPassword(userService.getMariaDbPassword(gatewayConfig.getSystemPassword()))
.language("en")
.build();
userRepository.save(entity);
log.info("Saved system user with username: {}", gatewayConfig.getSystemUsername());
}
}
}
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<v-divider class="mx-4" /> <v-divider class="mx-4" />
<v-card-title <v-card-title
v-text="container.name" /> v-text="container.name" />
<v-card-subtitle>Container</v-card-subtitle> <v-card-subtitle v-text="$t('pages.container.subtitle.text')" />
<v-card-text> <v-card-text>
<v-progress-linear <v-progress-linear
v-model="utilization" v-model="utilization"
......
...@@ -40,7 +40,17 @@ ...@@ -40,7 +40,17 @@
item-value="id" item-value="id"
:rules="[v => !!v || $t('validation.required')]" :rules="[v => !!v || $t('validation.required')]"
return-object return-object
required /> required>
<template
v-slot:selection>
<span>{{ engine.name }}</span>
</template>
<template
v-if="engine"
v-slot:details>
{{ $t('pages.database.subpages.create.utilization.label') }} {{ engine.count }}/{{ engine.quota }}
</template>
</v-select>
</v-col> </v-col>
</v-row> </v-row>
</v-card-text> </v-card-text>
...@@ -106,7 +116,13 @@ export default { ...@@ -106,7 +116,13 @@ export default {
this.loadingContainers = true this.loadingContainers = true
containerService.findAll() containerService.findAll()
.then((containers) => { .then((containers) => {
this.engines = containers.filter(c => c.count < c.quota) const freeContainers = containers.filter(c => c.count < c.quota)
const defaultContainers = freeContainers.filter(c => c.image.default)
defaultContainers.sort(this.compareContainerUtilization)
this.engines = defaultContainers
const other = freeContainers.filter(c => !c.image.default)
other.sort(this.compareContainerUtilization)
other.forEach(c => this.engines.push(c))
if (this.engines.length > 0) { if (this.engines.length > 0) {
this.engine = this.engines[0] this.engine = this.engines[0]
} }
...@@ -139,6 +155,9 @@ export default { ...@@ -139,6 +155,9 @@ export default {
toast.error(this.$t(code)) toast.error(this.$t(code))
}) })
}, },
compareContainerUtilization (container, other) {
return Math.round(container.count / container.quota) < Math.round(other.count / other.quota)
},
notEmpty notEmpty
} }
} }
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
<v-list-item <v-list-item
v-if="canListContainers" v-if="canListContainers"
to="/container" to="/container"
prepend-icon="mdi-docker" prepend-icon="mdi-database-settings"
:title="$t('navigation.container')" /> :title="$t('navigation.container')" />
</v-list> </v-list>
<template v-slot:append> <template v-slot:append>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
"navigation": { "navigation": {
"information": "Information", "information": "Information",
"search": "Search", "search": "Search",
"container": "Containers", "container": "Engines",
"ontologies": "Ontologies", "ontologies": "Ontologies",
"logout": "Logout", "logout": "Logout",
"login": "Login", "login": "Login",
...@@ -642,6 +642,9 @@ ...@@ -642,6 +642,9 @@
}, },
"submit": { "submit": {
"text": "Create" "text": "Create"
},
"utilization": {
"label": "Utilization"
} }
}, },
"tables": { "tables": {
...@@ -1034,10 +1037,13 @@ ...@@ -1034,10 +1037,13 @@
} }
}, },
"container": { "container": {
"title": "Containers", "title": "Engines",
"name": { "name": {
"title": "Name" "title": "Name"
}, },
"subtitle": {
"text": "Engine"
},
"internal-name": { "internal-name": {
"title": "Internal Name" "title": "Internal Name"
}, },
......
volumes: volumes:
metadata-db-data: metadata-db-data:
data-db-data: data-db-data:
data2-db-data:
data3-db-data:
auth-db-data: auth-db-data:
broker-service-data: broker-service-data:
upload-service-data: upload-service-data:
...@@ -51,6 +53,42 @@ services: ...@@ -51,6 +53,42 @@ services:
logging: logging:
driver: json-file driver: json-file
dbrepo-data2-db:
restart: "no"
container_name: dbrepo-data2-db
hostname: data2-db
image: docker.io/bitnami/mariadb:10.5.26-debian-12-r2
volumes:
- data2-db-data:/bitnami/mariadb
- "${SHARED_VOLUME:-/tmp}:/tmp"
environment:
MARIADB_ROOT_PASSWORD: "${DATA_DB_PASSWORD:-dbrepo}"
healthcheck:
test: mysqladmin ping --user=root --password="${DATA_DB_PASSWORD:-dbrepo}" --silent
interval: 10s
timeout: 5s
retries: 12
logging:
driver: json-file
dbrepo-data3-db:
restart: "no"
container_name: dbrepo-data3-db
hostname: data3-db
image: docker.io/bitnami/mariadb:11.4.3-debian-12-r1
volumes:
- data3-db-data:/bitnami/mariadb
- "${SHARED_VOLUME:-/tmp}:/tmp"
environment:
MARIADB_ROOT_PASSWORD: "${DATA_DB_PASSWORD:-dbrepo}"
healthcheck:
test: mysqladmin ping --user=root --password="${DATA_DB_PASSWORD:-dbrepo}" --silent
interval: 10s
timeout: 5s
retries: 12
logging:
driver: json-file
dbrepo-auth-db: dbrepo-auth-db:
restart: "no" restart: "no"
container_name: dbrepo-auth-db container_name: dbrepo-auth-db
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment