MCPcopy Index your code
hub / github.com/cloudgraphdev/cli / run

Method run

src/commands/launch.ts:67–152  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

65 // eslint-disable-next-line no-warning-comments
66 // TODO: convert this func to handle any storage provider
67 async run() : Promise<void> {
68 // const {flags: {debug, dev: devMode}} = this.parse(Launch)
69 // eslint-disable-next-line no-warning-comments
70 // TODO: not a huge fan of this pattern, rework how to do debug and devmode tasks (specifically how to use in providers)
71 // const opts: Opts = {logger: this.logger, debug, devMode}
72 this.logger.startSpinner('Checking for Docker')
73 try {
74 await this.checkForDockerInstallation()
75 this.logger.successSpinner('Docker found')
76 } catch (error: any) {
77 this.logger.failSpinner(
78 'It appears Docker is not installed, please install it at: https://docs.docker.com/get-docker/'
79 // { level: 'error' }
80 )
81 this.logger.error(error)
82 this.exit()
83 }
84
85 this.logger.startSpinner(
86 'Checking for an existing Dgraph docker instance'
87 )
88 let runningContainerId
89 try {
90 const containerId = await findExistingDGraphContainerId('running')
91 if (containerId) {
92 runningContainerId = containerId
93 }
94 } catch (error: any) {
95 this.logger.error(error)
96 }
97
98 let exitedContainerId
99 if (!runningContainerId) {
100 try {
101 const containerId = await findExistingDGraphContainerId('exited')
102 if (containerId) {
103 exitedContainerId = containerId
104 this.logger.successSpinner('Reusable container found!')
105 }
106 } catch (error: any) {
107 this.logger.error(error)
108 }
109 }
110
111 if (!exitedContainerId && !runningContainerId) {
112 this.logger.successSpinner('No reusable instances found')
113 this.logger.startSpinner(
114 'pulling Dgraph Docker image'
115 )
116 try {
117 this.createDgraphFolder()
118 await this.pullDGraphDockerImage()
119 this.logger.successSpinner('Pulled Dgraph Docker image')
120 } catch (error: any) {
121 this.logger.failSpinner(
122 'Failed pulling Dgraph Docker image please check your docker installation'
123 // { level: 'error' }
124 )

Callers

nothing calls this directly

Tested by

no test coverage detected