Skip to content

Commit

Permalink
replaced docker-compose by docker compose
Browse files Browse the repository at this point in the history
  • Loading branch information
gfusee committed Mar 15, 2024
1 parent 371f596 commit f48927a
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 15 deletions.
8 changes: 4 additions & 4 deletions cli/src/prerequisites/dockerPrerequisites.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ export class DockerPrerequisites implements Prerequisites {
}
dockerSpinner.succeed('Docker is installed')

const dockerComposeSpinner = ora('Checking if docker-compose is installed...').start()
const dockerComposeSpinner = ora('Checking if docker compose is installed...').start()
try {
await execCustom('which docker-compose')
await execCustom('docker compose')
} catch (e) {
dockerComposeSpinner.fail('Docker-compose is not installed')
dockerComposeSpinner.fail('Docker compose is not installed')
throw dockerNotInstalledMessage
}
dockerComposeSpinner.succeed('Docker-compose is installed')
dockerComposeSpinner.succeed('Docker compose is installed')

const dockerDaemonSpinner = ora('Checking if docker daemon is running...').start()
try {
Expand Down
4 changes: 2 additions & 2 deletions cli/src/result/resultLogger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export class ResultLogger {
}

if (containerResults.genesisEgldPemPath) {
const addressPrivateKey = (await execCustomInRepo(`docker-compose exec localnet cat ${containerResults.genesisEgldPemPath}`)).stdout.toString()
const addressPrivateKey = (await execCustomInRepo(`docker compose exec localnet cat ${containerResults.genesisEgldPemPath}`)).stdout.toString()
firstPartResultString += `
An address with 1,000,000 EGLD was generated for you. Here are the details:
Expand All @@ -55,7 +55,7 @@ export class ResultLogger {
let mxOpsDisplayString = ''

if (config.mxOpsScenesPath) {
const mxopsXNetworkValuesRaw = (await execCustomInRepo(`docker-compose exec localnet python3 -m mxops data get -n LOCAL -s xnetwork`)).stdout.toString()
const mxopsXNetworkValuesRaw = (await execCustomInRepo(`docker compose exec localnet python3 -m mxops data get -n LOCAL -s xnetwork`)).stdout.toString()
const searchString = 'ABSOLUTELY NO WARRANTY\n'
const mxopsXNetworkValues = mxopsXNetworkValuesRaw.substring(mxopsXNetworkValuesRaw.lastIndexOf(searchString) + searchString.length).trim()
const mxopsXNetworkValuesObject = JSON.parse(mxopsXNetworkValues)
Expand Down
4 changes: 2 additions & 2 deletions cli/src/utils/docker/createNetwork.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ export async function createNetwork(config: CLIConfig) {

if (config.mxOpsScenesPath) {
const copyingScenesSpinner = ora('Copying mxops scenes...').start()
await execCustomInRepo(`docker-compose cp ${config.mxOpsScenesPath} localnet:/home/ubuntu/mxops`)
await execCustomInRepo(`docker compose cp ${config.mxOpsScenesPath} localnet:/home/ubuntu/mxops`)
copyingScenesSpinner.succeed('Copied mxops scenes')

const runningScenesSpinner = ora('Running mxops scenes...').start()
await execCustomInRepo(`docker-compose exec localnet python3 run_mxops.py`)
await execCustomInRepo(`docker compose exec localnet python3 run_mxops.py`)
runningScenesSpinner.succeed('Ran mxops scenes')
}

Expand Down
4 changes: 2 additions & 2 deletions cli/src/utils/docker/getNetworkState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export async function getNetworkState(): Promise<NetworkState> {
const containerState = await getLocalnetContainerState()

try {
const containerResultsRaw = (await execCustomInRepo("docker-compose exec localnet cat /home/ubuntu/results.json")).stdout.toString()
const containerResultsRaw = (await execCustomInRepo("docker compose exec localnet cat /home/ubuntu/results.json")).stdout.toString()
const containerResults: LocalnetResult = JSON.parse(containerResultsRaw)

return {
Expand All @@ -35,7 +35,7 @@ export async function getNetworkState(): Promise<NetworkState> {

async function getLocalnetContainerState(): Promise<ContainerState> {
try {
const stdout = (await execCustomInRepo('docker-compose ps -a -q localnet')).stdout.toString()
const stdout = (await execCustomInRepo('docker compose ps -a -q localnet')).stdout.toString()

const containerId = stdout.trim()

Expand Down
2 changes: 1 addition & 1 deletion cli/src/utils/docker/pauseExistingNetwork.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export async function pauseExistingNetwork() {
}

async function pauseContainer(containerInfos: ContainerInfos) {
const command = containerInfos.pauseBehavior === PauseBehavior.PAUSE ? 'docker-compose stop' : 'yes | docker-compose rm -s -v'
const command = containerInfos.pauseBehavior === PauseBehavior.PAUSE ? 'docker compose stop' : 'yes | docker compose rm -s -v'
const pausingVerb = containerInfos.pauseBehavior === PauseBehavior.PAUSE ? 'Pausing' : 'Stopping'
const pausedVerb = containerInfos.pauseBehavior === PauseBehavior.PAUSE ? 'Paused' : 'Stopped'

Expand Down
2 changes: 1 addition & 1 deletion cli/src/utils/docker/removeExistingNetwork.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ import ora from "ora";

export async function removeExistingNetwork() {
const removingNetworkSpinner = ora('Removing the previous network...').start()
await execCustomInRepo(`docker-compose down`, false)
await execCustomInRepo(`docker compose down`, false)
removingNetworkSpinner.succeed('Removed the previous network successfully')
}
2 changes: 1 addition & 1 deletion cli/src/utils/docker/resumeExistingNetwork.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ async function resumeContainer(containerInfos: ContainerInfos) {
const removingNetworkSpinner = ora(`Resuming ${containerInfos.name}...`).start()

if (containerInfos.pauseBehavior === PauseBehavior.PAUSE) {
await execCustomInRepo(`docker-compose start ${containerInfos.name}`, false)
await execCustomInRepo(`docker compose start ${containerInfos.name}`, false)
} else {
await upContainer(containerInfos.name, undefined, false)
}
Expand Down
4 changes: 2 additions & 2 deletions cli/src/utils/docker/upContainer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {execCustomInRepo} from "../exec.js";

export async function upContainer(containerName: string, env?: NodeJS.ProcessEnv, shouldBuild: boolean = true) {
if (shouldBuild) {
await execCustomInRepo(`docker-compose build --no-cache ${containerName}`, false, {env: env})
await execCustomInRepo(`docker compose build --no-cache ${containerName}`, false, {env: env})
}
await execCustomInRepo(`docker-compose up -d ${containerName}`, false, {env: env})
await execCustomInRepo(`docker compose up -d ${containerName}`, false, {env: env})
}

0 comments on commit f48927a

Please sign in to comment.