@dokploy/cli 0.2.3 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +21 -0
- package/dist/commands/app/create.d.ts +4 -0
- package/dist/commands/app/create.js +87 -37
- package/dist/commands/app/delete.d.ts +2 -0
- package/dist/commands/app/delete.js +50 -28
- package/dist/commands/app/deploy.d.ts +5 -0
- package/dist/commands/app/deploy.js +93 -55
- package/dist/commands/app/stop.d.ts +5 -0
- package/dist/commands/app/stop.js +87 -54
- package/dist/commands/database/mariadb/create.d.ts +9 -0
- package/dist/commands/database/mariadb/create.js +160 -66
- package/dist/commands/database/mariadb/delete.d.ts +2 -0
- package/dist/commands/database/mariadb/delete.js +56 -47
- package/dist/commands/database/mariadb/deploy.d.ts +5 -0
- package/dist/commands/database/mariadb/deploy.js +88 -54
- package/dist/commands/database/mariadb/stop.d.ts +5 -0
- package/dist/commands/database/mariadb/stop.js +88 -54
- package/dist/commands/database/mongo/create.d.ts +8 -0
- package/dist/commands/database/mongo/create.js +145 -76
- package/dist/commands/database/mongo/delete.d.ts +2 -0
- package/dist/commands/database/mongo/delete.js +56 -45
- package/dist/commands/database/mongo/deploy.d.ts +5 -0
- package/dist/commands/database/mongo/deploy.js +88 -54
- package/dist/commands/database/mongo/stop.d.ts +5 -0
- package/dist/commands/database/mongo/stop.js +88 -54
- package/dist/commands/database/mysql/create.d.ts +9 -0
- package/dist/commands/database/mysql/create.js +168 -81
- package/dist/commands/database/mysql/delete.d.ts +2 -0
- package/dist/commands/database/mysql/delete.js +56 -47
- package/dist/commands/database/mysql/deploy.js +70 -53
- package/dist/commands/database/mysql/stop.js +70 -53
- package/dist/commands/database/postgres/create.d.ts +8 -0
- package/dist/commands/database/postgres/create.js +155 -76
- package/dist/commands/database/postgres/delete.d.ts +2 -0
- package/dist/commands/database/postgres/delete.js +56 -44
- package/dist/commands/database/postgres/deploy.d.ts +5 -0
- package/dist/commands/database/postgres/deploy.js +90 -56
- package/dist/commands/database/postgres/stop.d.ts +5 -0
- package/dist/commands/database/postgres/stop.js +91 -57
- package/dist/commands/database/redis/create.d.ts +6 -0
- package/dist/commands/database/redis/create.js +129 -65
- package/dist/commands/database/redis/delete.d.ts +2 -0
- package/dist/commands/database/redis/delete.js +60 -50
- package/dist/commands/database/redis/deploy.d.ts +5 -0
- package/dist/commands/database/redis/deploy.js +90 -56
- package/dist/commands/database/redis/stop.d.ts +5 -0
- package/dist/commands/database/redis/stop.js +91 -57
- package/dist/commands/env/pull.d.ts +10 -0
- package/dist/commands/env/pull.js +68 -0
- package/dist/commands/env/push.d.ts +10 -0
- package/dist/commands/env/push.js +106 -0
- package/dist/commands/project/create.d.ts +2 -1
- package/dist/commands/project/create.js +53 -34
- package/dist/utils/utils.js +9 -2
- package/oclif.manifest.json +895 -110
- package/package.json +3 -2
- package/{README.md → readme.md} +16 -1
|
@@ -16,65 +16,75 @@ export default class DatabaseMysqlDelete extends Command {
|
|
|
16
16
|
description: "ID of the project",
|
|
17
17
|
required: false,
|
|
18
18
|
}),
|
|
19
|
+
mysqlId: Flags.string({
|
|
20
|
+
char: "i",
|
|
21
|
+
description: "ID of the MySQL database",
|
|
22
|
+
required: false,
|
|
23
|
+
}),
|
|
24
|
+
skipConfirm: Flags.boolean({
|
|
25
|
+
char: "y",
|
|
26
|
+
description: "Skip confirmation",
|
|
27
|
+
required: false,
|
|
28
|
+
}),
|
|
19
29
|
};
|
|
20
30
|
async run() {
|
|
21
31
|
const auth = await readAuthConfig(this);
|
|
22
32
|
const { flags } = await this.parse(DatabaseMysqlDelete);
|
|
23
|
-
let { projectId } = flags;
|
|
24
|
-
|
|
33
|
+
let { projectId, mysqlId } = flags;
|
|
34
|
+
// Modo interactivo si no se proporcionan los flags necesarios
|
|
35
|
+
if (!projectId || !mysqlId) {
|
|
25
36
|
console.log(chalk.blue.bold("\n Listing all Projects \n"));
|
|
26
37
|
const projects = await getProjects(auth, this);
|
|
27
|
-
if (
|
|
28
|
-
|
|
29
|
-
|
|
38
|
+
if (!projectId) {
|
|
39
|
+
const answers = await inquirer.prompt([
|
|
40
|
+
{
|
|
41
|
+
choices: projects.map((project) => ({
|
|
42
|
+
name: project.name,
|
|
43
|
+
value: project.projectId,
|
|
44
|
+
})),
|
|
45
|
+
message: "Select a project to delete the MySQL instance from:",
|
|
46
|
+
name: "selectedProject",
|
|
47
|
+
type: "list",
|
|
48
|
+
},
|
|
49
|
+
]);
|
|
50
|
+
projectId = answers.selectedProject;
|
|
30
51
|
}
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
name: project.name,
|
|
35
|
-
value: project.projectId,
|
|
36
|
-
})),
|
|
37
|
-
message: "Select a project to delete the MySQL database from:",
|
|
38
|
-
name: "selectedProject",
|
|
39
|
-
type: "list",
|
|
40
|
-
},
|
|
41
|
-
]);
|
|
42
|
-
projectId = answers.selectedProject;
|
|
43
|
-
}
|
|
44
|
-
try {
|
|
45
|
-
const project = await getProject(projectId, auth, this);
|
|
46
|
-
if (!project.mysql || project.mysql.length === 0) {
|
|
47
|
-
this.log(chalk.yellow("No MySQL databases found in this project."));
|
|
48
|
-
return;
|
|
52
|
+
const projectSelected = await getProject(projectId, auth, this);
|
|
53
|
+
if (!projectSelected.mysql || projectSelected.mysql.length === 0) {
|
|
54
|
+
this.error(chalk.yellow("No MySQL instances found in this project."));
|
|
49
55
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
56
|
+
if (!mysqlId) {
|
|
57
|
+
const dbAnswers = await inquirer.prompt([
|
|
58
|
+
{
|
|
59
|
+
// @ts-ignore
|
|
60
|
+
choices: projectSelected.mysql.map((db) => ({
|
|
61
|
+
name: db.name,
|
|
62
|
+
value: db.mysqlId,
|
|
63
|
+
})),
|
|
64
|
+
message: "Select the MySQL instance to delete:",
|
|
65
|
+
name: "selectedDb",
|
|
66
|
+
type: "list",
|
|
67
|
+
},
|
|
68
|
+
]);
|
|
69
|
+
mysqlId = dbAnswers.selectedDb;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
// Confirmar si no se especifica --skipConfirm
|
|
73
|
+
if (!flags.skipConfirm) {
|
|
64
74
|
const confirmAnswers = await inquirer.prompt([
|
|
65
75
|
{
|
|
66
76
|
default: false,
|
|
67
|
-
message: "Are you sure you want to delete this
|
|
77
|
+
message: "Are you sure you want to delete this MySQL instance?",
|
|
68
78
|
name: "confirmDelete",
|
|
69
79
|
type: "confirm",
|
|
70
80
|
},
|
|
71
81
|
]);
|
|
72
82
|
if (!confirmAnswers.confirmDelete) {
|
|
73
|
-
this.
|
|
74
|
-
return;
|
|
83
|
+
this.error(chalk.yellow("MySQL deletion cancelled."));
|
|
75
84
|
}
|
|
76
|
-
|
|
77
|
-
|
|
85
|
+
}
|
|
86
|
+
try {
|
|
87
|
+
const response = await axios.post(`${auth.url}/api/trpc/mysql.remove`, {
|
|
78
88
|
json: {
|
|
79
89
|
mysqlId,
|
|
80
90
|
},
|
|
@@ -84,14 +94,13 @@ export default class DatabaseMysqlDelete extends Command {
|
|
|
84
94
|
"Content-Type": "application/json",
|
|
85
95
|
},
|
|
86
96
|
});
|
|
87
|
-
if (!
|
|
88
|
-
this.error(chalk.red("Error deleting
|
|
97
|
+
if (!response.data.result.data.json) {
|
|
98
|
+
this.error(chalk.red("Error deleting MySQL instance"));
|
|
89
99
|
}
|
|
90
|
-
this.log(chalk.green("
|
|
100
|
+
this.log(chalk.green("MySQL instance deleted successfully."));
|
|
91
101
|
}
|
|
92
102
|
catch (error) {
|
|
93
|
-
|
|
94
|
-
this.error(chalk.red(`Failed to delete application: ${error.message}`));
|
|
103
|
+
this.error(chalk.red(`Error deleting MySQL instance: ${error.message}`));
|
|
95
104
|
}
|
|
96
105
|
}
|
|
97
106
|
}
|
|
@@ -9,61 +9,78 @@ export default class DatabaseMysqlDeploy extends Command {
|
|
|
9
9
|
static examples = ["$ <%= config.bin %> app deploy"];
|
|
10
10
|
async run() {
|
|
11
11
|
const auth = await readAuthConfig(this);
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
12
|
+
const { flags } = await this.parse(DatabaseMysqlDeploy);
|
|
13
|
+
let { projectId, mysqlId } = flags;
|
|
14
|
+
// Modo interactivo si no se proporcionan los flags necesarios
|
|
15
|
+
if (!projectId || !mysqlId) {
|
|
16
|
+
console.log(chalk.blue.bold("\n Listing all Projects \n"));
|
|
17
|
+
const projects = await getProjects(auth, this);
|
|
18
|
+
if (!projectId) {
|
|
19
|
+
const { project } = await inquirer.prompt([
|
|
20
|
+
{
|
|
21
|
+
choices: projects.map((project) => ({
|
|
22
|
+
name: project.name,
|
|
23
|
+
value: project,
|
|
24
|
+
})),
|
|
25
|
+
message: "Select a project to deploy the MySQL instance from:",
|
|
26
|
+
name: "project",
|
|
27
|
+
type: "list",
|
|
28
|
+
},
|
|
29
|
+
]);
|
|
30
|
+
projectId = project.projectId;
|
|
31
|
+
}
|
|
32
|
+
const projectSelected = await getProject(projectId, auth, this);
|
|
33
|
+
if (projectSelected.mysql.length === 0) {
|
|
34
|
+
this.error(chalk.yellow("No MySQL instances found in this project."));
|
|
35
|
+
}
|
|
36
|
+
if (!mysqlId) {
|
|
37
|
+
const dbAnswers = await inquirer.prompt([
|
|
38
|
+
{
|
|
39
|
+
// @ts-ignore
|
|
40
|
+
choices: projectSelected.mysql.map((db) => ({
|
|
41
|
+
name: db.name,
|
|
42
|
+
value: db.mysqlId,
|
|
43
|
+
})),
|
|
44
|
+
message: "Select the MySQL instance to deploy:",
|
|
45
|
+
name: "selectedDb",
|
|
46
|
+
type: "list",
|
|
47
|
+
},
|
|
48
|
+
]);
|
|
49
|
+
mysqlId = dbAnswers.selectedDb;
|
|
50
|
+
}
|
|
29
51
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
const confirmAnswers = await inquirer.prompt([
|
|
44
|
-
{
|
|
45
|
-
default: false,
|
|
46
|
-
message: "Are you sure you want to deploy this mysql?",
|
|
47
|
-
name: "confirmDelete",
|
|
48
|
-
type: "confirm",
|
|
49
|
-
},
|
|
50
|
-
]);
|
|
51
|
-
if (!confirmAnswers.confirmDelete) {
|
|
52
|
-
this.error(chalk.yellow("mysql deployment cancelled."));
|
|
52
|
+
// Confirmar si no se especifica --skipConfirm
|
|
53
|
+
if (!flags.skipConfirm) {
|
|
54
|
+
const confirmAnswers = await inquirer.prompt([
|
|
55
|
+
{
|
|
56
|
+
default: false,
|
|
57
|
+
message: "Are you sure you want to deploy this MySQL instance?",
|
|
58
|
+
name: "confirmDeploy",
|
|
59
|
+
type: "confirm",
|
|
60
|
+
},
|
|
61
|
+
]);
|
|
62
|
+
if (!confirmAnswers.confirmDeploy) {
|
|
63
|
+
this.error(chalk.yellow("MySQL deployment cancelled."));
|
|
64
|
+
}
|
|
53
65
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
+
try {
|
|
67
|
+
const response = await axios.post(`${auth.url}/api/trpc/mysql.deploy`, {
|
|
68
|
+
json: {
|
|
69
|
+
mysqlId,
|
|
70
|
+
},
|
|
71
|
+
}, {
|
|
72
|
+
headers: {
|
|
73
|
+
Authorization: `Bearer ${auth.token}`,
|
|
74
|
+
"Content-Type": "application/json",
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
if (response.status !== 200) {
|
|
78
|
+
this.error(chalk.red("Error deploying MySQL instance"));
|
|
79
|
+
}
|
|
80
|
+
this.log(chalk.green("MySQL instance deployed successfully."));
|
|
81
|
+
}
|
|
82
|
+
catch (error) {
|
|
83
|
+
this.error(chalk.red(`Error deploying MySQL instance: ${error.message}`));
|
|
66
84
|
}
|
|
67
|
-
this.log(chalk.green("Mysql deployed successful."));
|
|
68
85
|
}
|
|
69
86
|
}
|
|
@@ -9,61 +9,78 @@ export default class DatabaseMysqlStop extends Command {
|
|
|
9
9
|
static examples = ["$ <%= config.bin %> mysql stop"];
|
|
10
10
|
async run() {
|
|
11
11
|
const auth = await readAuthConfig(this);
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
12
|
+
const { flags } = await this.parse(DatabaseMysqlStop);
|
|
13
|
+
let { projectId, mysqlId } = flags;
|
|
14
|
+
// Modo interactivo si no se proporcionan los flags necesarios
|
|
15
|
+
if (!projectId || !mysqlId) {
|
|
16
|
+
console.log(chalk.blue.bold("\n Listing all Projects \n"));
|
|
17
|
+
const projects = await getProjects(auth, this);
|
|
18
|
+
if (!projectId) {
|
|
19
|
+
const { project } = await inquirer.prompt([
|
|
20
|
+
{
|
|
21
|
+
choices: projects.map((project) => ({
|
|
22
|
+
name: project.name,
|
|
23
|
+
value: project,
|
|
24
|
+
})),
|
|
25
|
+
message: "Select a project to stop the MySQL instance from:",
|
|
26
|
+
name: "project",
|
|
27
|
+
type: "list",
|
|
28
|
+
},
|
|
29
|
+
]);
|
|
30
|
+
projectId = project.projectId;
|
|
31
|
+
}
|
|
32
|
+
const projectSelected = await getProject(projectId, auth, this);
|
|
33
|
+
if (projectSelected.mysql.length === 0) {
|
|
34
|
+
this.error(chalk.yellow("No MySQL instances found in this project."));
|
|
35
|
+
}
|
|
36
|
+
if (!mysqlId) {
|
|
37
|
+
const dbAnswers = await inquirer.prompt([
|
|
38
|
+
{
|
|
39
|
+
// @ts-ignore
|
|
40
|
+
choices: projectSelected.mysql.map((db) => ({
|
|
41
|
+
name: db.name,
|
|
42
|
+
value: db.mysqlId,
|
|
43
|
+
})),
|
|
44
|
+
message: "Select the MySQL instance to stop:",
|
|
45
|
+
name: "selectedDb",
|
|
46
|
+
type: "list",
|
|
47
|
+
},
|
|
48
|
+
]);
|
|
49
|
+
mysqlId = dbAnswers.selectedDb;
|
|
50
|
+
}
|
|
29
51
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
const confirmAnswers = await inquirer.prompt([
|
|
44
|
-
{
|
|
45
|
-
default: false,
|
|
46
|
-
message: "Are you sure you want to stop this mysql?",
|
|
47
|
-
name: "confirmDelete",
|
|
48
|
-
type: "confirm",
|
|
49
|
-
},
|
|
50
|
-
]);
|
|
51
|
-
if (!confirmAnswers.confirmDelete) {
|
|
52
|
-
this.error(chalk.yellow("mysql stop cancelled."));
|
|
52
|
+
// Confirmar si no se especifica --skipConfirm
|
|
53
|
+
if (!flags.skipConfirm) {
|
|
54
|
+
const confirmAnswers = await inquirer.prompt([
|
|
55
|
+
{
|
|
56
|
+
default: false,
|
|
57
|
+
message: "Are you sure you want to stop this MySQL instance?",
|
|
58
|
+
name: "confirmStop",
|
|
59
|
+
type: "confirm",
|
|
60
|
+
},
|
|
61
|
+
]);
|
|
62
|
+
if (!confirmAnswers.confirmStop) {
|
|
63
|
+
this.error(chalk.yellow("MySQL stop cancelled."));
|
|
64
|
+
}
|
|
53
65
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
+
try {
|
|
67
|
+
const response = await axios.post(`${auth.url}/api/trpc/mysql.stop`, {
|
|
68
|
+
json: {
|
|
69
|
+
mysqlId,
|
|
70
|
+
},
|
|
71
|
+
}, {
|
|
72
|
+
headers: {
|
|
73
|
+
Authorization: `Bearer ${auth.token}`,
|
|
74
|
+
"Content-Type": "application/json",
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
if (response.status !== 200) {
|
|
78
|
+
this.error(chalk.red("Error stopping MySQL instance"));
|
|
79
|
+
}
|
|
80
|
+
this.log(chalk.green("MySQL instance stopped successfully."));
|
|
81
|
+
}
|
|
82
|
+
catch (error) {
|
|
83
|
+
this.error(chalk.red(`Error stopping MySQL instance: ${error.message}`));
|
|
66
84
|
}
|
|
67
|
-
this.log(chalk.green("Mysql stop successful."));
|
|
68
85
|
}
|
|
69
86
|
}
|
|
@@ -4,6 +4,14 @@ export default class DatabasePostgresCreate extends Command {
|
|
|
4
4
|
static examples: string[];
|
|
5
5
|
static flags: {
|
|
6
6
|
projectId: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
7
|
+
name: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
8
|
+
databaseName: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
9
|
+
description: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
10
|
+
databasePassword: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
11
|
+
databaseUser: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
12
|
+
dockerImage: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
13
|
+
skipConfirm: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
14
|
+
appName: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
7
15
|
};
|
|
8
16
|
run(): Promise<void>;
|
|
9
17
|
}
|