mirror of
https://github.com/badges/shields.git
synced 2025-04-18 19:44:04 +03:00
remove script for adding/removing heroku dynos (#6234)
This commit is contained in:
parent
cf7c9c1147
commit
ddc9ee5394
4
Procfile
4
Procfile
@ -1,5 +1 @@
|
||||
web: npm run start:server:prod
|
||||
scale4: npm run heroku:scale 4
|
||||
scale5: npm run heroku:scale 5
|
||||
scale6: npm run heroku:scale 6
|
||||
scale7: npm run heroku:scale 7
|
||||
|
12
package-lock.json
generated
12
package-lock.json
generated
@ -21373,15 +21373,6 @@
|
||||
"integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==",
|
||||
"dev": true
|
||||
},
|
||||
"heroku-client": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/heroku-client/-/heroku-client-3.1.0.tgz",
|
||||
"integrity": "sha512-UfGKwUm5duzzSVI8uUXlNAE1mus6uPxmZPji4vuG1ArV5DYL1rXsZShp0OoxraWdEwYoxCUrM6KGztC68x5EZQ==",
|
||||
"requires": {
|
||||
"is-retry-allowed": "^1.0.0",
|
||||
"tunnel-agent": "^0.6.0"
|
||||
}
|
||||
},
|
||||
"hex-color-regex": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/hex-color-regex/-/hex-color-regex-1.1.0.tgz",
|
||||
@ -22928,7 +22919,8 @@
|
||||
"is-retry-allowed": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/is-retry-allowed/-/is-retry-allowed-1.2.0.tgz",
|
||||
"integrity": "sha512-RUbUeKwvm3XG2VYamhJL1xFktgjvPzL0Hq8C+6yrWIswDy3BIXGqCxhxkc30N9jqK311gVU137K8Ei55/zVJRg=="
|
||||
"integrity": "sha512-RUbUeKwvm3XG2VYamhJL1xFktgjvPzL0Hq8C+6yrWIswDy3BIXGqCxhxkc30N9jqK311gVU137K8Ei55/zVJRg==",
|
||||
"dev": true
|
||||
},
|
||||
"is-root": {
|
||||
"version": "1.0.0",
|
||||
|
@ -39,7 +39,6 @@
|
||||
"glob": "^7.1.6",
|
||||
"graphql": "^14.7.0",
|
||||
"graphql-tag": "^2.11.0",
|
||||
"heroku-client": "^3.1.0",
|
||||
"ioredis": "4.23.0",
|
||||
"joi": "17.4.0",
|
||||
"joi-extension-semver": "5.0.0",
|
||||
@ -101,7 +100,6 @@
|
||||
"defs": "node scripts/export-service-definitions-cli.js > service-definitions.yml",
|
||||
"build": "run-s defs features && gatsby build",
|
||||
"heroku-postbuild": "run-s --silent build",
|
||||
"heroku:scale": "node scripts/heroku-scale.js",
|
||||
"start:server:prod": "node server",
|
||||
"now-start": "npm run start:server:prod",
|
||||
"start:server:e2e-on-build": "node server 8080",
|
||||
|
@ -1,38 +0,0 @@
|
||||
'use strict'
|
||||
|
||||
if (process.argv.length < 3 || !/^\d+$/.test(process.argv[2])) {
|
||||
console.log('Usage: npm run heroku:scale [num-dynos]')
|
||||
process.exit(0)
|
||||
}
|
||||
if (!('HEROKU_API_TOKEN' in process.env)) {
|
||||
throw new Error("'HEROKU_API_TOKEN' env var must be set")
|
||||
}
|
||||
if (!('HEROKU_APP_ID' in process.env)) {
|
||||
throw new Error("'HEROKU_APP_ID' env var must be set")
|
||||
}
|
||||
|
||||
const Heroku = require('heroku-client')
|
||||
const HEROKU_API_TOKEN = process.env.HEROKU_API_TOKEN
|
||||
const HEROKU_APP_ID = process.env.HEROKU_APP_ID
|
||||
const numDynos = parseInt(process.argv[2])
|
||||
|
||||
const heroku = new Heroku({ token: HEROKU_API_TOKEN })
|
||||
|
||||
;(async () => {
|
||||
const currentConfig = await heroku.get(`/apps/${HEROKU_APP_ID}/formation/web`)
|
||||
if (currentConfig.quantity === numDynos) {
|
||||
console.log(
|
||||
`Already running the desired number of dynos (${numDynos}). No changes necessary.`
|
||||
)
|
||||
process.exit(0)
|
||||
}
|
||||
|
||||
console.log(`Scaling to ${numDynos} dynos...`)
|
||||
const newConfig = await heroku.patch(`/apps/${HEROKU_APP_ID}/formation/web`, {
|
||||
body: {
|
||||
quantity: numDynos,
|
||||
},
|
||||
})
|
||||
console.log(`..done!`)
|
||||
console.log(newConfig)
|
||||
})()
|
Loading…
x
Reference in New Issue
Block a user