-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(cli:deploy): deploy from CLI with instance creation (#87)
Now it is possible to deploy project with creating during the process, e.g.: ``` s deploy --create-instance <my_new_instance> s deploy --i <my_new_instance> ```
- Loading branch information
Showing
8 changed files
with
105 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import format from 'chalk' | ||
|
||
import logger from '../../utils/debug' | ||
import { echo, echon, error } from '../../utils/print-tools' | ||
|
||
const { debug } = logger('cmd-helpers-socket') | ||
|
||
export const createInstance = async (instanceName, session) => { | ||
let newInstance = null | ||
try { | ||
debug('Creating Instance') | ||
echo() | ||
echon(4)('Creating Syncano Instance... ') | ||
newInstance = await session.createInstance(instanceName) | ||
} catch (err) { | ||
echo() | ||
echo() | ||
if (err.message === 'No such API Key.') { | ||
error(4)('It looks like your account key is invalid.') | ||
echo(4)(`Try ${format.cyan('syncano-cli logout')} and ${format.cyan('syncano-cli login')} again.`) | ||
} else if (err.message === 'name: This field must be unique.') { | ||
error(4)('Instance already exist!') | ||
echo(4)('Try another instace name.') | ||
} else { | ||
error(4)(err.message || 'Error while creating instance. Try again!') | ||
} | ||
echo() | ||
process.exit(1) | ||
} finally { | ||
echo(`${format.green('Done')}`) | ||
echo(4)(`Syncano Instance ${format.cyan(newInstance.name)} has been created!`) | ||
echo() | ||
} | ||
return newInstance | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters