diff --git a/src/express/commands/cleanup.js b/src/express/commands/cleanup.js index f7326036..390f8726 100644 --- a/src/express/commands/cleanup.js +++ b/src/express/commands/cleanup.js @@ -11,7 +11,7 @@ export async function cleanup() { await deployBorContractsAndStateSync(doc) } -async function stopServices(doc) { +export async function stopServices(doc) { const borUsers = splitToArray(doc.devnetBorUsers.toString()) const nodeIps = [] const isHostMap = new Map() diff --git a/src/express/commands/instances-stop.js b/src/express/commands/instances-stop.js index 7402060c..75e9c544 100644 --- a/src/express/commands/instances-stop.js +++ b/src/express/commands/instances-stop.js @@ -2,6 +2,7 @@ import { loadDevnetConfig } from '../common/config-utils' import { timer } from '../common/time-utils' +import { stopServices } from './cleanup' const shell = require('shelljs') @@ -10,7 +11,10 @@ export async function stopInstances() { require('dotenv').config({ path: `${process.cwd()}/.env` }) const devnetType = process.env.TF_VAR_DOCKERIZED === 'yes' ? 'docker' : 'remote' + const doc = await loadDevnetConfig(devnetType) + await stopServices(doc) + const instances = doc.instancesIds.toString().replace(/,/g, ' ') shell.exec(`aws ec2 stop-instances --instance-ids ${instances}`)