feat: add support for command arguments in application and database schemas

- Updated the application, mariadb, mongo, mysql, postgres, and redis schemas to include an optional `args` field for command arguments.
- Enhanced the AddCommand and ShowCustomCommand components to handle multiple arguments using a dynamic form.
- Modified the database build functions to incorporate the new `args` parameter when creating containers.
- Added SQL migrations to update the database schema for existing applications and services to accommodate the new `args` field.
This commit is contained in:
Mauricio Siu
2025-11-30 12:13:55 -06:00
parent 559753eae3
commit 272a8dbdb2
17 changed files with 7063 additions and 40 deletions

View File

@@ -29,6 +29,7 @@ export const buildMariadb = async (mariadb: MariadbNested) => {
cpuLimit,
cpuReservation,
command,
args,
mounts,
} = mariadb;
@@ -75,12 +76,14 @@ export const buildMariadb = async (mariadb: MariadbNested) => {
Mounts: [...volumesMount, ...bindsMount, ...filesMount],
...(StopGracePeriod !== null &&
StopGracePeriod !== undefined && { StopGracePeriod }),
...(command
? {
Command: ["/bin/sh"],
Args: ["-c", command],
}
: {}),
...(command && {
Command: command.split(" "),
}),
...(args &&
args.length > 0 && {
Args: args,
}),
Labels,
},
Networks,

View File

@@ -28,6 +28,7 @@ export const buildMongo = async (mongo: MongoNested) => {
databaseUser,
databasePassword,
command,
args,
mounts,
replicaSets,
} = mongo;
@@ -128,12 +129,17 @@ ${command ?? "wait $MONGOD_PID"}`;
Command: ["/bin/bash"],
Args: ["-c", startupScript],
}
: {
...(command && {
Command: ["/bin/bash"],
Args: ["-c", command],
}),
}),
: {}),
...(command &&
!replicaSets && {
Command: command.split(" "),
}),
...(args &&
args.length > 0 &&
!replicaSets && {
Args: args,
}),
Labels,
},
Networks,

View File

@@ -30,6 +30,7 @@ export const buildMysql = async (mysql: MysqlNested) => {
cpuLimit,
cpuReservation,
command,
args,
mounts,
} = mysql;
@@ -81,12 +82,14 @@ export const buildMysql = async (mysql: MysqlNested) => {
Mounts: [...volumesMount, ...bindsMount, ...filesMount],
...(StopGracePeriod !== null &&
StopGracePeriod !== undefined && { StopGracePeriod }),
...(command
? {
Command: ["/bin/sh"],
Args: ["-c", command],
}
: {}),
...(command && {
Command: command.split(" "),
}),
...(args &&
args.length > 0 && {
Args: args,
}),
Labels,
},
Networks,

View File

@@ -28,6 +28,7 @@ export const buildPostgres = async (postgres: PostgresNested) => {
databaseUser,
databasePassword,
command,
args,
mounts,
} = postgres;
@@ -74,12 +75,14 @@ export const buildPostgres = async (postgres: PostgresNested) => {
Mounts: [...volumesMount, ...bindsMount, ...filesMount],
...(StopGracePeriod !== null &&
StopGracePeriod !== undefined && { StopGracePeriod }),
...(command
? {
Command: ["/bin/sh"],
Args: ["-c", command],
}
: {}),
...(command && {
Command: command.split(" "),
}),
...(args &&
args.length > 0 && {
Args: args,
}),
Labels,
},
Networks,

View File

@@ -26,6 +26,7 @@ export const buildRedis = async (redis: RedisNested) => {
cpuLimit,
cpuReservation,
command,
args,
mounts,
} = redis;
@@ -72,11 +73,14 @@ export const buildRedis = async (redis: RedisNested) => {
Mounts: [...volumesMount, ...bindsMount, ...filesMount],
...(StopGracePeriod !== null &&
StopGracePeriod !== undefined && { StopGracePeriod }),
Command: ["/bin/sh"],
Args: [
"-c",
command ? command : `redis-server --requirepass ${databasePassword}`,
],
...(command && {
Command: command.split(" "),
}),
...(args &&
args.length > 0 && {
Args: args,
}),
Labels,
},
Networks,