main
HerrHase 1 year ago
parent c509dbf9a8
commit 996a7f165d

@ -0,0 +1,32 @@
#!/usr/bin/node
import mysql from 'mysql2/promise'
import select, { Separator } from '@inquirer/select'
import chalk from 'chalk'
const log = console.log
/**
*
*
*
*/
const install = await select({
message: 'Install',
choices: [{
name: 'Nginx',
value: 'nginx.js'
}, {
name: 'Mariadb',
value: 'mariadb.js'
}, {
name: 'php-fpm',
value: 'php-fpm.js'
}, {
name: 'Lets Encrypt',
value: 'lets-encrypt.js'
}]
})
log(install)

@ -1,3 +1,5 @@
#!/usr/bin/node
import mysql from 'mysql2/promise' import mysql from 'mysql2/promise'
import { input, password } from '@inquirer/prompts' import { input, password } from '@inquirer/prompts'
import generator from 'generate-password' import generator from 'generate-password'
@ -6,10 +8,8 @@ import chalk from 'chalk'
const log = console.log const log = console.log
/** /**
* mariadb-create.js * mariadb-drop.js
* *
* create database and generate name, user, password
* and grant this user single priveleges
* *
* *
*/ */

@ -1,3 +1,5 @@
#!/usr/bin/node
import mysql from 'mysql2/promise' import mysql from 'mysql2/promise'
import { input, password } from '@inquirer/prompts' import { input, password } from '@inquirer/prompts'
import chalk from 'chalk' import chalk from 'chalk'
@ -51,7 +53,7 @@ const connection = await mysql.createConnection({
password: user.password password: user.password
}) })
// create database // drop database
const [results ] = await connection.query("SELECT User FROM mysql.db WHERE Db = '" + database + "'") const [results ] = await connection.query("SELECT User FROM mysql.db WHERE Db = '" + database + "'")

@ -1,10 +1,10 @@
curl -LsS -O https://downloads.mariadb.com/MariaDB/mariadb_repo_setup //curl -LsS -O https://downloads.mariadb.com/MariaDB/mariadb_repo_setup
sudo bash mariadb_repo_setup --mariadb-server-version=10.6 //sudo bash mariadb_repo_setup --mariadb-server-version=10.6
apt update //apt update
apt install mariadb-server //apt install mariadb-server
mariadb-secure-installation //mariadb-secure-installation
systemctl start mariadb //systemctl start mariadb
systemctl enable mariadb //systemctl enable mariadb

9
package-lock.json generated

@ -7,6 +7,7 @@
"dependencies": { "dependencies": {
"@inquirer/prompts": "^3.2.0", "@inquirer/prompts": "^3.2.0",
"chalk": "^5.3.0", "chalk": "^5.3.0",
"commander": "^11.1.0",
"generate-password": "^1.7.1", "generate-password": "^1.7.1",
"mysql2": "^3.6.2" "mysql2": "^3.6.2"
} }
@ -416,6 +417,14 @@
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
}, },
"node_modules/commander": {
"version": "11.1.0",
"resolved": "https://registry.npmjs.org/commander/-/commander-11.1.0.tgz",
"integrity": "sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ==",
"engines": {
"node": ">=16"
}
},
"node_modules/denque": { "node_modules/denque": {
"version": "2.1.0", "version": "2.1.0",
"resolved": "https://registry.npmjs.org/denque/-/denque-2.1.0.tgz", "resolved": "https://registry.npmjs.org/denque/-/denque-2.1.0.tgz",

@ -4,6 +4,7 @@
"dependencies": { "dependencies": {
"@inquirer/prompts": "^3.2.0", "@inquirer/prompts": "^3.2.0",
"chalk": "^5.3.0", "chalk": "^5.3.0",
"commander": "^11.1.0",
"generate-password": "^1.7.1", "generate-password": "^1.7.1",
"mysql2": "^3.6.2" "mysql2": "^3.6.2"
} }

Loading…
Cancel
Save