Completed feature #391

This commit is contained in:
Sven Heidemann 2023-10-02 08:24:20 +02:00
parent 2182c021b9
commit f5d88ec94c
11 changed files with 113 additions and 82 deletions

View File

@ -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
attachable: true

View File

@ -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
attachable: true

View File

@ -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};

View File

@ -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

View File

@ -17,6 +17,7 @@ export interface ServerConfig extends DataWithHistory {
teamChannelId?: string;
loginMessageChannelId?: string;
defaultRoleId?: string;
shortRoleNameOnlySetHighestRole?: boolean;
featureFlags: FeatureFlag[];
afkChannelIds: string[];
moderatorRoleIds: string[];

View File

@ -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

View File

@ -487,6 +487,7 @@ export class Queries {
teamChannelId
loginMessageChannelId
defaultRoleId
shortRoleNameOnlySetHighestRole
featureFlags {
key
value

View File

@ -122,6 +122,14 @@
</div>
</div>
<div class="content-row">
<div class="content-column">
<div class="content-data-name">{{'view.server.config.bot.short_role_name_only_set_highest_role' | translate}}:</div>
<p-dropdown class="content-data-value" [options]="boolAsStrings" [(ngModel)]="config.shortRoleNameOnlySetHighestRole"
placeholder="{{'view.server.config.bot.short_role_name_only_set_highest_role' | translate}}"></p-dropdown>
</div>
</div>
<div class="content-divider"></div>
<app-config-list [options]="voiceChannels" optionLabel="name" optionValue="id" translationKey="view.server.config.bot.afk_channels"
[(data)]="config.afkChannelIds"></app-config-list>

View File

@ -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,

View File

@ -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",

View File

@ -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",