diff --git a/docker-compose.staging.yml b/docker-compose.staging.yml index 2d80f245..83db65c7 100644 --- a/docker-compose.staging.yml +++ b/docker-compose.staging.yml @@ -6,7 +6,6 @@ volumes: services: kdb_bot_staging_1: image: sh-edraft.de/kdb-bot:1.1.8 - container_name: kdb_bot_staging_1 depends_on: - kdb_db_staging_1 networks: @@ -25,15 +24,19 @@ services: mode: replicated replicas: 1 placement: - constraints: [ node.role == manager ] + constraints: [node.role == manager] resources: reservations: cpus: "0.5" memory: 1024M + restart_policy: + condition: on-failure + delay: 3s + max_attempts: 3 + window: 60s kdb_web_staging_1: image: sh-edraft.de/kdb-web:1.1.8 - container_name: kdb_web_staging_1 depends_on: - kdb_bot_staging_1 networks: @@ -42,12 +45,12 @@ services: volumes: - /opt/kdb/staging/web/config.json:/usr/share/nginx/html/assets/config.json environment: - BOT_CONTAINER_NAME: "kdb_bot_staging_1" + BOT_CONTAINER_NAME: "kdb_bot_staging_1" deploy: mode: replicated replicas: 1 placement: - constraints: [ node.role == manager ] + constraints: [node.role == manager] resources: limits: cpus: "0.4" @@ -58,7 +61,6 @@ services: kdb_db_staging_1: image: mysql:latest - container_name: kdb_db_staging_1 command: mysqld --default-authentication-plugin=mysql_native_password --log_bin_trust_function_creators=1 networks: - kdb_test @@ -75,7 +77,7 @@ services: mode: replicated replicas: 1 placement: - constraints: [ node.role == manager ] + constraints: [node.role == manager] resources: reservations: cpus: "0.1" @@ -86,4 +88,4 @@ networks: external: true kdb_test: driver: overlay - attachable: true \ No newline at end of file + attachable: true diff --git a/docker-compose.yml b/docker-compose.yml index 31514c79..dd6faa84 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,86 +1,91 @@ version: "3.9" volumes: - kdb_db_prod_1: + kdb_db_prod_1: services: - kdb_bot_prod_1: - image: sh-edraft.de/kdb-bot:1.1.8 - depends_on: - - kdb_db_prod_1 - networks: - - kdb_prod - - reverse_proxy - volumes: - - /opt/kdb/production/bot/config:/app/bot/config - - /opt/kdb/production/bot/api_config:/app/bot_api/config - - /opt/kdb/production/bot/logs:/app/bot/logs - environment: - KDB_ENVIRONMENT: "production" - KDB_TOKEN: "OTk4MTU5NTEyNDYyNzA4Nzg2.Gx0hSB.Ouq2dfRKxLBJvHfEq8OrFBHVUF24AQrVf55coM" - KDB_PREFIX: "!k " - deploy: - mode: replicated - replicas: 1 - placement: - constraints: [ node.role == manager ] - resources: - reservations: - cpus: "0.5" - memory: 1024M + kdb_bot_prod_1: + image: sh-edraft.de/kdb-bot:1.1.8 + depends_on: + - kdb_db_prod_1 + networks: + - kdb_prod + - reverse_proxy + volumes: + - /opt/kdb/production/bot/config:/app/bot/config + - /opt/kdb/production/bot/api_config:/app/bot_api/config + - /opt/kdb/production/bot/logs:/app/bot/logs + environment: + KDB_ENVIRONMENT: "production" + KDB_TOKEN: "OTk4MTU5NTEyNDYyNzA4Nzg2.Gx0hSB.Ouq2dfRKxLBJvHfEq8OrFBHVUF24AQrVf55coM" + KDB_PREFIX: "!k " + deploy: + mode: replicated + replicas: 1 + placement: + constraints: [node.role == manager] + resources: + reservations: + cpus: "0.5" + memory: 1024M + restart_policy: + condition: on-failure + delay: 3s + max_attempts: 3 + window: 60s - kdb_web_prod_1: - image: sh-edraft.de/kdb-web:1.1.8 - depends_on: - - kdb_bot_prod_1 - networks: - - kdb_prod - - reverse_proxy - volumes: - - /opt/kdb/production/web/config.json:/usr/share/nginx/html/assets/config.json - environment: - BOT_CONTAINER_NAME: "kdb_bot_prod_1" - deploy: - mode: replicated - replicas: 1 - placement: - constraints: [ node.role == manager ] - resources: - limits: - cpus: "0.4" - memory: 400M - reservations: - cpus: "0.1" - memory: 20M + kdb_web_prod_1: + image: sh-edraft.de/kdb-web:1.1.8 + depends_on: + - kdb_bot_prod_1 + networks: + - kdb_prod + - reverse_proxy + volumes: + - /opt/kdb/production/web/config.json:/usr/share/nginx/html/assets/config.json + environment: + BOT_CONTAINER_NAME: "kdb_bot_prod_1" + deploy: + mode: replicated + replicas: 1 + placement: + constraints: [node.role == manager] + resources: + limits: + cpus: "0.4" + memory: 400M + reservations: + cpus: "0.1" + memory: 20M - kdb_db_prod_1: - image: mysql:latest - command: mysqld --default-authentication-plugin=mysql_native_password --log_bin_trust_function_creators=1 - networks: - - kdb_prod - restart: unless-stopped - environment: - MYSQL_ROOT_PASSWORD: "kd_kdb" - MYSQL_USER: "kd_kdb" - MYSQL_PASSWORD: ",2#MzfN4J=7r(q,Tz3npDkCR§>VE&}7T" - MYSQL_DATABASE: "kd_kdb" - ports: - - "3307:3306" - volumes: - - kdb_db_prod_1:/var/lib/mysql - deploy: - mode: replicated - replicas: 1 - placement: - constraints: [ node.role == manager ] - resources: - reservations: - cpus: "0.1" - memory: 150M + kdb_db_prod_1: + image: mysql:latest + command: mysqld --default-authentication-plugin=mysql_native_password --log_bin_trust_function_creators=1 + networks: + - kdb_prod + restart: unless-stopped + environment: + MYSQL_ROOT_PASSWORD: "kd_kdb" + MYSQL_USER: "kd_kdb" + MYSQL_PASSWORD: ",2#MzfN4J=7r(q,Tz3npDkCR§>VE&}7T" + MYSQL_DATABASE: "kd_kdb" + ports: + - "3307:3306" + volumes: + - kdb_db_prod_1:/var/lib/mysql + deploy: + mode: replicated + replicas: 1 + placement: + constraints: [node.role == manager] + resources: + reservations: + cpus: "0.1" + memory: 150M networks: reverse_proxy: external: true kdb_prod: driver: overlay - attachable: true \ No newline at end of file + attachable: true diff --git a/kdb-bot/src/bot_data/model/server_config.py b/kdb-bot/src/bot_data/model/server_config.py index c98921f4..8a36ac6f 100644 --- a/kdb-bot/src/bot_data/model/server_config.py +++ b/kdb-bot/src/bot_data/model/server_config.py @@ -285,6 +285,7 @@ class ServerConfig(TableABC, ConfigurationModelABC): `TeamChannelId`, `LoginMessageChannelId`, `DefaultRoleId`, + `ShortRoleNameSetOnlyHighest`, `FeatureFlags`, `ServerId` ) VALUES ( @@ -302,6 +303,7 @@ class ServerConfig(TableABC, ConfigurationModelABC): {self._team_channel_id}, {self._login_message_channel_id}, {"NULL" if self._default_role_id is None else self._default_role_id}, + {self._short_role_name_only_set_highest_role}, '{json.dumps(self._feature_flags)}', {self._server.id} ); @@ -327,6 +329,7 @@ class ServerConfig(TableABC, ConfigurationModelABC): `TeamChannelId` = {self._team_channel_id}, `LoginMessageChannelId` = {self._login_message_channel_id}, `DefaultRoleId` = {"NULL" if self._default_role_id is None else self._default_role_id}, + `ShortRoleNameSetOnlyHighest` = {self._short_role_name_only_set_highest_role}, `FeatureFlags` = '{json.dumps(self._feature_flags)}', `ServerId` = {self._server.id} WHERE `Id` = {self._id}; diff --git a/kdb-bot/src/bot_graphql/mutations/server_config_mutation.py b/kdb-bot/src/bot_graphql/mutations/server_config_mutation.py index 35ea4896..1c4d4d5e 100644 --- a/kdb-bot/src/bot_graphql/mutations/server_config_mutation.py +++ b/kdb-bot/src/bot_graphql/mutations/server_config_mutation.py @@ -92,7 +92,7 @@ class ServerConfigMutation(QueryABC): server_config.default_role_id = ( input["defaultRoleId"] if "defaultRoleId" in input else server_config.default_role_id ) - server_config.default_role_id = ( + server_config.short_role_name_only_set_highest_role = ( input["shortRoleNameOnlySetHighestRole"] if "shortRoleNameOnlySetHighestRole" in input else server_config.short_role_name_only_set_highest_role diff --git a/kdb-web/src/app/models/config/server-config.model.ts b/kdb-web/src/app/models/config/server-config.model.ts index 3d17b8d2..a1873b49 100644 --- a/kdb-web/src/app/models/config/server-config.model.ts +++ b/kdb-web/src/app/models/config/server-config.model.ts @@ -17,6 +17,7 @@ export interface ServerConfig extends DataWithHistory { teamChannelId?: string; loginMessageChannelId?: string; defaultRoleId?: string; + shortRoleNameOnlySetHighestRole?: boolean; featureFlags: FeatureFlag[]; afkChannelIds: string[]; moderatorRoleIds: string[]; diff --git a/kdb-web/src/app/models/graphql/mutations.model.ts b/kdb-web/src/app/models/graphql/mutations.model.ts index e600d07d..ece931d6 100644 --- a/kdb-web/src/app/models/graphql/mutations.model.ts +++ b/kdb-web/src/app/models/graphql/mutations.model.ts @@ -254,6 +254,7 @@ export class Mutations { $teamChannelId: String, $loginMessageChannelId: String, $defaultRoleId: String, + $shortRoleNameOnlySetHighestRole: Boolean $featureFlags: [FeatureFlagInput], $afkChannelIds: [String], $moderatorRoleIds: [String], @@ -276,6 +277,7 @@ export class Mutations { teamChannelId: $teamChannelId, loginMessageChannelId: $loginMessageChannelId, defaultRoleId: $defaultRoleId, + shortRoleNameOnlySetHighestRole: $shortRoleNameOnlySetHighestRole, featureFlags: $featureFlags, afkChannelIds: $afkChannelIds, moderatorRoleIds: $moderatorRoleIds, @@ -295,6 +297,8 @@ export class Mutations { helpVoiceChannelId teamChannelId loginMessageChannelId + defaultRoleId + shortRoleNameOnlySetHighestRole featureFlags { key value diff --git a/kdb-web/src/app/models/graphql/queries.model.ts b/kdb-web/src/app/models/graphql/queries.model.ts index 51d51e2e..02c2da1d 100644 --- a/kdb-web/src/app/models/graphql/queries.model.ts +++ b/kdb-web/src/app/models/graphql/queries.model.ts @@ -487,6 +487,7 @@ export class Queries { teamChannelId loginMessageChannelId defaultRoleId + shortRoleNameOnlySetHighestRole featureFlags { key value diff --git a/kdb-web/src/app/modules/view/server/config/components/config/config.component.html b/kdb-web/src/app/modules/view/server/config/components/config/config.component.html index 2512a986..d21e71f9 100644 --- a/kdb-web/src/app/modules/view/server/config/components/config/config.component.html +++ b/kdb-web/src/app/modules/view/server/config/components/config/config.component.html @@ -122,6 +122,14 @@ +
+
+
{{'view.server.config.bot.short_role_name_only_set_highest_role' | translate}}:
+ +
+
+
diff --git a/kdb-web/src/app/modules/view/server/config/components/config/config.component.ts b/kdb-web/src/app/modules/view/server/config/components/config/config.component.ts index ed82b024..0a41f365 100644 --- a/kdb-web/src/app/modules/view/server/config/components/config/config.component.ts +++ b/kdb-web/src/app/modules/view/server/config/components/config/config.component.ts @@ -46,6 +46,10 @@ export class ConfigComponent implements OnInit { roles?: Role[]; voiceChannels: Channel[] = []; textChannels: Channel[] = []; + boolAsStrings = [ + { label: this.translate.instant("common.bool_as_string.true"), value: true }, + { label: this.translate.instant("common.bool_as_string.false"), value: false } + ]; constructor( private data: DataService, @@ -119,6 +123,7 @@ export class ConfigComponent implements OnInit { teamChannelId: this.config.teamChannelId, loginMessageChannelId: this.config.loginMessageChannelId, defaultRoleId: this.config.defaultRoleId, + shortRoleNameOnlySetHighestRole: this.config.shortRoleNameOnlySetHighestRole, featureFlags: this.config.featureFlags, afkChannelIds: this.config.afkChannelIds, moderatorRoleIds: this.config.moderatorRoleIds, diff --git a/kdb-web/src/assets/i18n/de.json b/kdb-web/src/assets/i18n/de.json index b6ba456e..12b18760 100644 --- a/kdb-web/src/assets/i18n/de.json +++ b/kdb-web/src/assets/i18n/de.json @@ -419,6 +419,7 @@ "afk_channels": "AFK Sprachkanäle", "afk_command_channel_id": "AFK Kanal für den Befehl /afk", "default_role_id": "Standardrolle des Servers", + "short_role_name_only_set_highest_role": "Bei Rollen Kürzeln nur die höchste Rolle verwenden", "header": "Bot Konfiguration", "help_voice_channel_id": "Sprachkanal für Hilfsbenachrichtung", "login_message_channel_id": "Kanal für die Nachricht vom Bot nach Start", diff --git a/kdb-web/src/assets/i18n/en.json b/kdb-web/src/assets/i18n/en.json index 4c647124..ca81d078 100644 --- a/kdb-web/src/assets/i18n/en.json +++ b/kdb-web/src/assets/i18n/en.json @@ -419,6 +419,7 @@ "afk_channels": "AFK Voicechannel", "afk_command_channel_id": "AFK Channel for the command /afk", "default_role_id": "Default role", + "short_role_name_only_set_highest_role": "For role abbreviations use only the highest role", "header": "Bot configuration", "help_voice_channel_id": "Voicechannel für help notifications", "login_message_channel_id": "Channel for bot message after start",