@convertkit/cloudkit
Advanced tools
Comparing version 0.0.8 to 0.0.9
@@ -1,1 +0,1 @@ | ||
{"version":"0.0.8","commands":{"console":{"id":"console","description":"\nStarts a remote Rails console.\n","pluginName":"@convertkit/cloudkit","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"environment","default":"production"}]},"migrate":{"id":"migrate","description":"\nRuns db:migrate on a remote machine.\n","pluginName":"@convertkit/cloudkit","pluginType":"core","aliases":[],"flags":{"environment":{"name":"environment","type":"option","char":"e","description":"environment","default":"production"}},"args":[{"name":"version"}]},"migrate:status":{"id":"migrate:status","description":"\nRuns db:migrate:status on a remote machine.\n","pluginName":"@convertkit/cloudkit","pluginType":"core","aliases":[],"flags":{"environment":{"name":"environment","type":"option","char":"e","description":"environment","default":"production"}},"args":[]},"puma:restart":{"id":"puma:restart","description":"\nRestarts puma.\n","pluginName":"@convertkit/cloudkit","pluginType":"core","aliases":[],"flags":{"environment":{"name":"environment","type":"option","char":"e","description":"environment","default":"production"}},"args":[]},"schema:dump":{"id":"schema:dump","description":"\nRuns db:schema:dump on a remote machine.\n","pluginName":"@convertkit/cloudkit","pluginType":"core","aliases":[],"flags":{"environment":{"name":"environment","type":"option","char":"e","description":"environment","default":"production"}},"args":[]},"shell":{"id":"shell","description":"\nSSH into a remote machine.\n","pluginName":"@convertkit/cloudkit","pluginType":"core","aliases":[],"flags":{"environment":{"name":"environment","type":"option","char":"e","description":"environment","default":"production"}},"args":[]}}} | ||
{"version":"0.0.9","commands":{"console":{"id":"console","description":"\nStarts a remote Rails console.\n","pluginName":"@convertkit/cloudkit","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"environment","default":"production"}]},"migrate":{"id":"migrate","description":"\nRuns db:migrate on a remote machine.\n","pluginName":"@convertkit/cloudkit","pluginType":"core","aliases":[],"flags":{"environment":{"name":"environment","type":"option","char":"e","description":"environment","default":"production"}},"args":[{"name":"version"}]},"migrate:status":{"id":"migrate:status","description":"\nRuns db:migrate:status on a remote machine.\n","pluginName":"@convertkit/cloudkit","pluginType":"core","aliases":[],"flags":{"environment":{"name":"environment","type":"option","char":"e","description":"environment","default":"production"}},"args":[]},"puma:restart":{"id":"puma:restart","description":"\nRestarts puma.\n","pluginName":"@convertkit/cloudkit","pluginType":"core","aliases":[],"flags":{"environment":{"name":"environment","type":"option","char":"e","description":"environment","default":"production"}},"args":[]},"schema:dump":{"id":"schema:dump","description":"\nRuns db:schema:dump on a remote machine.\n","pluginName":"@convertkit/cloudkit","pluginType":"core","aliases":[],"flags":{"environment":{"name":"environment","type":"option","char":"e","description":"environment","default":"production"}},"args":[]},"shell":{"id":"shell","description":"\nSSH into a remote machine.\n","pluginName":"@convertkit/cloudkit","pluginType":"core","aliases":[],"flags":{"environment":{"name":"environment","type":"option","char":"e","description":"environment","default":"production"}},"args":[]}}} |
{ | ||
"name": "@convertkit/cloudkit", | ||
"version": "0.0.8", | ||
"version": "0.0.9", | ||
"author": "Brendan Carney @brendancarney", | ||
@@ -5,0 +5,0 @@ "bin": { |
@@ -22,3 +22,3 @@ @convertkit/cloudkit | ||
$ cloudkit (-v|--version|version) | ||
@convertkit/cloudkit/0.0.8 darwin-x64 node-v10.16.0 | ||
@convertkit/cloudkit/0.0.9 darwin-x64 node-v13.8.0 | ||
$ cloudkit --help [COMMAND] | ||
@@ -52,3 +52,3 @@ USAGE | ||
_See code: [src/commands/console.js](https://github.com/ConvertKit/cloudkit-cli/blob/v0.0.8/src/commands/console.js)_ | ||
_See code: [src/commands/console.js](https://github.com/ConvertKit/cloudkit-cli/blob/v0.0.9/src/commands/console.js)_ | ||
@@ -87,3 +87,3 @@ ## `cloudkit help [COMMAND]` | ||
_See code: [src/commands/migrate/index.js](https://github.com/ConvertKit/cloudkit-cli/blob/v0.0.8/src/commands/migrate/index.js)_ | ||
_See code: [src/commands/migrate/index.js](https://github.com/ConvertKit/cloudkit-cli/blob/v0.0.9/src/commands/migrate/index.js)_ | ||
@@ -105,3 +105,3 @@ ## `cloudkit migrate:status` | ||
_See code: [src/commands/migrate/status.js](https://github.com/ConvertKit/cloudkit-cli/blob/v0.0.8/src/commands/migrate/status.js)_ | ||
_See code: [src/commands/migrate/status.js](https://github.com/ConvertKit/cloudkit-cli/blob/v0.0.9/src/commands/migrate/status.js)_ | ||
@@ -123,3 +123,3 @@ ## `cloudkit puma:restart` | ||
_See code: [src/commands/puma/restart.js](https://github.com/ConvertKit/cloudkit-cli/blob/v0.0.8/src/commands/puma/restart.js)_ | ||
_See code: [src/commands/puma/restart.js](https://github.com/ConvertKit/cloudkit-cli/blob/v0.0.9/src/commands/puma/restart.js)_ | ||
@@ -141,3 +141,3 @@ ## `cloudkit schema:dump` | ||
_See code: [src/commands/schema/dump.js](https://github.com/ConvertKit/cloudkit-cli/blob/v0.0.8/src/commands/schema/dump.js)_ | ||
_See code: [src/commands/schema/dump.js](https://github.com/ConvertKit/cloudkit-cli/blob/v0.0.9/src/commands/schema/dump.js)_ | ||
@@ -159,3 +159,3 @@ ## `cloudkit shell` | ||
_See code: [src/commands/shell/index.js](https://github.com/ConvertKit/cloudkit-cli/blob/v0.0.8/src/commands/shell/index.js)_ | ||
_See code: [src/commands/shell/index.js](https://github.com/ConvertKit/cloudkit-cli/blob/v0.0.9/src/commands/shell/index.js)_ | ||
<!-- commandsstop --> |
const { Command, flags } = require("@oclif/command"); | ||
const { spawn } = require("child_process"); | ||
const getIP = require("../../utils/get-ip"); | ||
const genKubeConf = require("../../utils/gen-kubeconfig"); | ||
const getK8sNamespace = require("../../utils/get-k8s-namespace"); | ||
const getDeployHost = require("../../utils/get-deploy-host"); | ||
@@ -8,3 +10,5 @@ class MigrateCommand extends Command { | ||
const { flags, args } = this.parse(MigrateCommand); | ||
const ip = await getIP(flags.environment); | ||
const kubeConf = await genKubeConf(flags.environment); | ||
const deployHost = await getDeployHost(flags.environment); | ||
const k8sNamespace = await getK8sNamespace(flags.environment); | ||
@@ -14,5 +18,6 @@ const shell = spawn( | ||
[ | ||
ip, | ||
deployHost, | ||
"-o LogLevel=ERROR", | ||
"-t", | ||
`docker_image=$(sudo docker ps -aqf "name=puma|sidekiq"); sudo docker exec -ti $docker_image bundle exec rake db:migrate:up VERSION=${args.version}\n` | ||
`"\"kubectl exec -ti ckapp-console-0 bundle exec rake db:migrate:up VERSION=${args.version} -n ${k8sNamespace}\""` | ||
], | ||
@@ -19,0 +24,0 @@ { stdio: "inherit" } |
const { Command, flags } = require("@oclif/command"); | ||
const { spawn } = require("child_process"); | ||
const getIP = require("../../utils/get-ip"); | ||
const genKubeConf = require("../../utils/gen-kubeconfig"); | ||
const getK8sNamespace = require("../../utils/get-k8s-namespace"); | ||
const getDeployHost = require("../../utils/get-deploy-host"); | ||
@@ -8,3 +10,5 @@ class MigrateStatusCommand extends Command { | ||
const { flags } = this.parse(MigrateStatusCommand); | ||
const ip = await getIP(flags.environment); | ||
const kubeConf = await genKubeConf(flags.environment); | ||
const deployHost = await getDeployHost(flags.environment); | ||
const k8sNamespace = await getK8sNamespace(flags.environment); | ||
@@ -14,5 +18,6 @@ const shell = spawn( | ||
[ | ||
ip, | ||
deployHost, | ||
"-o LogLevel=ERROR", | ||
"-t", | ||
'docker_image=$(sudo docker ps -aqf "name=puma|sidekiq"); sudo docker exec -ti $docker_image bundle exec rake db:migrate:status \n' | ||
`"\"kubectl exec -ti ckapp-console-0 bundle exec rake db:migrate:status -n ${k8sNamespace}\""` | ||
], | ||
@@ -19,0 +24,0 @@ { stdio: "inherit" } |
const { Command, flags } = require("@oclif/command"); | ||
const { spawn } = require("child_process"); | ||
const getIP = require("../../utils/get-ip"); | ||
const { spawnSync } = require("child_process"); | ||
const genKubeConf = require("../../utils/gen-kubeconfig"); | ||
const getK8sNamespace = require("../../utils/get-k8s-namespace"); | ||
const getDeployHost = require("../../utils/get-deploy-host"); | ||
@@ -8,15 +10,35 @@ class SchemaDumpCommand extends Command { | ||
const { flags } = this.parse(SchemaDumpCommand); | ||
const ip = await getIP(flags.environment); | ||
const kubeConf = await genKubeConf(flags.environment); | ||
const deployHost = await getDeployHost(flags.environment); | ||
const k8sNamespace = await getK8sNamespace(flags.environment); | ||
const shell = spawn( | ||
const shell = await spawnSync( | ||
"ssh", | ||
[ | ||
ip, | ||
deployHost, | ||
"-o LogLevel=ERROR", | ||
"-t", | ||
'docker_image=$(sudo docker ps -aqf "name=puma|sidekiq"); sudo docker exec -ti $docker_image bundle exec rake db:schema:dump; sudo docker cp $docker_image:/app/db/schema.rb schema.rb; cat schema.rb\n' | ||
`"\"kubectl exec -ti ckapp-console-0 bundle exec rake db:schema:dump -n ${k8sNamespace}; kubectl cp ckapp-console-0:/app/db/schema.rb schema.rb -n ${k8sNamespace} > /dev/null\""` | ||
], | ||
{ stdio: "inherit" } | ||
); | ||
shell.on("close", code => {}); | ||
const scp = await spawnSync( | ||
"scp", | ||
[ | ||
"-o LogLevel=ERROR", | ||
"-q", | ||
`${deployHost}:./schema.rb`, | ||
"." | ||
], | ||
{ stdio: "inherit" } | ||
); | ||
const cat = await spawnSync( | ||
"cat", | ||
[ | ||
"./schema.rb" | ||
], | ||
{ stdio: "inherit" } | ||
); | ||
} | ||
@@ -23,0 +45,0 @@ } |
const { Command, flags } = require("@oclif/command"); | ||
const getIP = require("../../utils/get-ip"); | ||
const genKubeConf = require("../../utils/gen-kubeconfig"); | ||
const getDeployHost = require("../../utils/get-deploy-host"); | ||
const getRailsConsoleScript = require("../../utils/get-rails-console-script"); | ||
const { spawn } = require("child_process"); | ||
@@ -9,6 +11,19 @@ | ||
const ip = await getIP(flags.environment); | ||
const deployHost = await getDeployHost(flags.environment); | ||
const kubeConf = await genKubeConf(flags.environment); | ||
const consoleScript = await getRailsConsoleScript(flags.environment); | ||
const shell = spawn("ssh", [ip], { stdio: "inherit" }); | ||
shell.on("close", code => {}); | ||
if (kubeConf == 0){ | ||
const shell = spawn( | ||
"ssh", | ||
[ | ||
deployHost, | ||
"-t", | ||
"/bin/bash -c", | ||
`"cd ~/convertkit-deploy/rails-console ; ./${consoleScript} shell"` | ||
], | ||
{ stdio: "inherit" } | ||
); | ||
shell.on("close", code => {}); | ||
} | ||
} | ||
@@ -15,0 +30,0 @@ } |
@@ -15,2 +15,3 @@ const shell = require("shelljs"); | ||
deployHost, | ||
"-o LogLevel=ERROR", | ||
"-t", | ||
@@ -17,0 +18,0 @@ "/bin/bash -c", |
module.exports = function getRailsConsoleScript(environment) { | ||
return environment == "qa" ? "provision-rails-console-qa.sh" : "provision-rails-console.sh"; | ||
}; | ||
}; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
15970
19
288