- Notifications
You must be signed in to change notification settings - Fork0
A convenient Node.js wrapper to interact with fly.io CLI.
License
Kikobeats/flyctl
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
A convenient Node.js wrapper to interact withfly.io CLI.
$ npm install flyctl --save
First, call the library passig the app name of your project:
constfly=require('flyctl')('teslahunt-api')
Once initialized, you can interact with anyfly CLI command via Node.js.
You can run a one-off command:
const{ stdout}=awaitfly('scale show')console.log(stdout)
or pipe directly into your Node.js process usingfly.stream()
:
fly.stream('logs')
Additionally, you can usefly.json()
to return a JSON payload of the command.
This is convenient for combining multiple command and create your own commands:
constCPU_CORES=1constCPU_KIND='shared'constMEMORY_IN_BYTES=768constRESTART_POLICY='always'constmachineList=awaitfly.json('machine list')constmachines=machineList.map(({ id, config})=>({ id,zone:config.env.FLY_PROCESS_GROUP}))for(const{ id}ofmachines){awaitfly(`machine update${id} --vm-cpus${CPU_CORES} --vm-cpu-kind${CPU_KIND} --vm-memory=${MEMORY_IN_BYTES} --restart${RESTART_POLICY} --yes`)}
Seeexamples.
Required
Type:string
The name of yourfly.io application.
Type:boolean
Default:true
Print the raw fly command every time it's executed.
Type:string
Default:process.env.FLY_PATH
It sets where is theflyctl
binary path.
It runs the command provided and buffer the output.
It accepts a second argument to be passed tochild_process.spawn#options.
It runs the command provided, streaming the output to the parent process.
It runs the command provided, parsing the stdout into a JSON.
flyctl ©Kiko Beats, released under theMIT License.
Authored and maintained byKiko Beats with help fromcontributors.
kikobeats.com · GitHubKiko Beats · Twitter@kikobeats
About
A convenient Node.js wrapper to interact with fly.io CLI.
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors2
Uh oh!
There was an error while loading.Please reload this page.