Skip to content

Commit

Permalink
dev: add: stop services before stopping ec2 instances (#154)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcello33 authored Feb 10, 2023
1 parent 6a3514e commit a1a75dc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/express/commands/cleanup.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 4 additions & 0 deletions src/express/commands/instances-stop.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import { loadDevnetConfig } from '../common/config-utils'
import { timer } from '../common/time-utils'
import { stopServices } from './cleanup'

const shell = require('shelljs')

Expand All @@ -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}`)
Expand Down

0 comments on commit a1a75dc

Please sign in to comment.