mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-04-19 00:26:54 +00:00
Remove or move most local namespaced commands
Change-type: major Signed-off-by: Cameron Diver <cameron@balena.io>
This commit is contained in:
parent
717c43f10b
commit
1a1861bfcb
@ -73,10 +73,6 @@ const capitanoDoc = {
|
||||
title: 'Logs',
|
||||
files: ['build/actions/logs.js'],
|
||||
},
|
||||
{
|
||||
title: 'Sync',
|
||||
files: ['build/actions/sync.js'],
|
||||
},
|
||||
{
|
||||
title: 'SSH',
|
||||
files: ['build/actions/ssh.js', 'build/actions/tunnel.js'],
|
||||
|
328
doc/cli.markdown
328
doc/cli.markdown
@ -138,10 +138,6 @@ If you come across any problems or would like to get in touch:
|
||||
|
||||
- [logs <uuidOrDevice>](#logs-uuidordevice)
|
||||
|
||||
- Sync
|
||||
|
||||
- [sync [uuid]](#sync-uuid)
|
||||
|
||||
- SSH
|
||||
|
||||
- [ssh <applicationOrDevice> [serviceName]](#ssh-applicationordevice-servicename)
|
||||
@ -182,12 +178,6 @@ If you come across any problems or would like to get in touch:
|
||||
- Local
|
||||
|
||||
- [local configure <target>](#local-configure-target)
|
||||
- [local flash <image>](#local-flash-image)
|
||||
- [local logs [deviceIp]](#local-logs-deviceip)
|
||||
- [local scan](#local-scan)
|
||||
- [local ssh [deviceIp]](#local-ssh-deviceip)
|
||||
- [local push [deviceIp]](#local-push-deviceip)
|
||||
- [local stop [deviceIp]](#local-stop-deviceip)
|
||||
|
||||
- Deploy
|
||||
|
||||
@ -893,93 +883,6 @@ Only show logs for a single service. This can be used in combination with --syst
|
||||
|
||||
Only show system logs. This can be used in combination with --service.
|
||||
|
||||
# Sync
|
||||
|
||||
## sync [uuid]
|
||||
|
||||
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
Deprecation notice: please note that `balena sync` is deprecated and will
|
||||
be removed in a future release of the CLI. We are working on an exciting
|
||||
replacement that will be released soon!
|
||||
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
Warning: 'balena sync' requires an openssh-compatible client and 'rsync' to
|
||||
be correctly installed in your shell environment. For more information (including
|
||||
Windows support) please check the README here: https://github.com/balena-io/balena-cli
|
||||
|
||||
Use this command to sync your local changes to a certain device on the fly.
|
||||
|
||||
After every 'balena sync' the updated settings will be saved in
|
||||
'<source>/.balena-sync.yml' and will be used in later invocations. You can
|
||||
also change any option by editing '.balena-sync.yml' directly.
|
||||
|
||||
Here is an example '.balena-sync.yml' :
|
||||
|
||||
$ cat $PWD/.balena-sync.yml
|
||||
uuid: 7cf02a6
|
||||
destination: '/usr/src/app'
|
||||
before: 'echo Hello'
|
||||
after: 'echo Done'
|
||||
ignore:
|
||||
- .git
|
||||
- node_modules/
|
||||
|
||||
Command line options have precedence over the ones saved in '.balena-sync.yml'.
|
||||
|
||||
If '.gitignore' is found in the source directory then all explicitly listed files will be
|
||||
excluded from the syncing process. You can choose to change this default behavior with the
|
||||
'--skip-gitignore' option.
|
||||
|
||||
Examples:
|
||||
|
||||
$ balena sync 7cf02a6 --source . --destination /usr/src/app
|
||||
$ balena sync 7cf02a6 -s /home/user/myBalenaProject -d /usr/src/app --before 'echo Hello' --after 'echo Done'
|
||||
$ balena sync --ignore lib/
|
||||
$ balena sync --verbose false
|
||||
$ balena sync
|
||||
|
||||
### Options
|
||||
|
||||
#### --source, -s <path>
|
||||
|
||||
local directory path to synchronize to device
|
||||
|
||||
#### --destination, -d <path>
|
||||
|
||||
destination path on device
|
||||
|
||||
#### --ignore, -i <paths>
|
||||
|
||||
comma delimited paths to ignore when syncing
|
||||
|
||||
#### --skip-gitignore
|
||||
|
||||
do not parse excluded/included files from .gitignore
|
||||
|
||||
#### --skip-restart
|
||||
|
||||
do not restart container after syncing
|
||||
|
||||
#### --before, -b <command>
|
||||
|
||||
execute a command before syncing
|
||||
|
||||
#### --after, -a <command>
|
||||
|
||||
execute a command after syncing
|
||||
|
||||
#### --port, -t <port>
|
||||
|
||||
ssh port
|
||||
|
||||
#### --progress, -p
|
||||
|
||||
show progress
|
||||
|
||||
#### --verbose, -v
|
||||
|
||||
increase verbosity
|
||||
|
||||
# SSH
|
||||
|
||||
## ssh <applicationOrDevice> [serviceName]
|
||||
@ -1402,9 +1305,8 @@ id of the application to preload
|
||||
|
||||
#### --commit, -c <hash>
|
||||
|
||||
The commit hash for a specific application release to preload, use "current" to specify the current
|
||||
release (ignored if no appId is given). The current release is usually also the latest, but can be
|
||||
manually pinned using https://github.com/balena-io-projects/staged-releases .
|
||||
the commit hash for a specific application release to preload, use "latest" to specify the latest release
|
||||
(ignored if no appId is given)
|
||||
|
||||
#### --splash-image, -s <splashImage.png>
|
||||
|
||||
@ -1580,232 +1482,6 @@ Examples:
|
||||
$ balena local configure /dev/sdc
|
||||
$ balena local configure path/to/image.img
|
||||
|
||||
## local flash <image>
|
||||
|
||||
Use this command to flash a balenaOS image to a drive.
|
||||
|
||||
Examples:
|
||||
|
||||
$ balena local flash path/to/balenaos.img[.zip|.gz|.bz2|.xz]
|
||||
$ balena local flash path/to/balenaos.img --drive /dev/disk2
|
||||
$ balena local flash path/to/balenaos.img --drive /dev/disk2 --yes
|
||||
|
||||
### Options
|
||||
|
||||
#### --yes, -y
|
||||
|
||||
confirm non-interactively
|
||||
|
||||
#### --drive, -d <drive>
|
||||
|
||||
drive
|
||||
|
||||
## local logs [deviceIp]
|
||||
|
||||
|
||||
Examples:
|
||||
|
||||
$ balena local logs
|
||||
$ balena local logs -f
|
||||
$ balena local logs 192.168.1.10
|
||||
$ balena local logs 192.168.1.10 -f
|
||||
$ balena local logs 192.168.1.10 -f --app-name myapp
|
||||
|
||||
### Options
|
||||
|
||||
#### --follow, -f
|
||||
|
||||
follow log
|
||||
|
||||
#### --app-name, -a <name>
|
||||
|
||||
name of container to get logs from
|
||||
|
||||
## local scan
|
||||
|
||||
|
||||
Examples:
|
||||
|
||||
$ balena local scan
|
||||
$ balena local scan --timeout 120
|
||||
$ balena local scan --verbose
|
||||
|
||||
### Options
|
||||
|
||||
#### --verbose, -v
|
||||
|
||||
Display full info
|
||||
|
||||
#### --timeout, -t <timeout>
|
||||
|
||||
Scan timeout in seconds
|
||||
|
||||
## local ssh [deviceIp]
|
||||
|
||||
Warning: 'balena local ssh' requires an openssh-compatible client to be correctly
|
||||
installed in your shell environment. For more information (including Windows
|
||||
support) please check the README here: https://github.com/balena-io/balena-cli
|
||||
|
||||
Use this command to get a shell into the running application container of
|
||||
your device.
|
||||
|
||||
The '--host' option will get you a shell into the Host OS of the balenaOS device.
|
||||
No option will return a list of containers to enter or you can explicitly select
|
||||
one by passing its name to the --container option
|
||||
|
||||
Examples:
|
||||
|
||||
$ balena local ssh
|
||||
$ balena local ssh --host
|
||||
$ balena local ssh --container chaotic_water
|
||||
$ balena local ssh --container chaotic_water --port 22222
|
||||
$ balena local ssh --verbose
|
||||
|
||||
### Options
|
||||
|
||||
#### --verbose, -v
|
||||
|
||||
increase verbosity
|
||||
|
||||
#### --host, -s
|
||||
|
||||
get a shell into the host OS
|
||||
|
||||
#### --container, -c <container>
|
||||
|
||||
name of container to access
|
||||
|
||||
#### --port, -p <port>
|
||||
|
||||
ssh port number (default: 22222)
|
||||
|
||||
## local push [deviceIp]
|
||||
|
||||
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
Deprecation notice: `balena local push` is deprecated and will be removed in a
|
||||
future release of the CLI. Please use `balena push <ipAddress>` instead.
|
||||
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
Use this command to push your local changes to a container on a LAN-accessible
|
||||
balenaOS device on the fly.
|
||||
|
||||
This command requires an openssh-compatible 'ssh' client and 'rsync' to be
|
||||
available in the executable PATH of the shell environment. For more information
|
||||
(including Windows support) please check the README at:
|
||||
https://github.com/balena-io/balena-cli
|
||||
|
||||
If `Dockerfile` or any file in the 'build-triggers' list is changed,
|
||||
a new container will be built and run on your device.
|
||||
If not, changes will simply be synced with `rsync` into the application container.
|
||||
|
||||
After every 'balena local push' the updated settings will be saved in
|
||||
'<source>/.balena-sync.yml' and will be used in later invocations. You can
|
||||
also change any option by editing '.balena-sync.yml' directly.
|
||||
|
||||
Here is an example '.balena-sync.yml' :
|
||||
|
||||
$ cat $PWD/.balena-sync.yml
|
||||
local_balenaos:
|
||||
app-name: local-app
|
||||
build-triggers:
|
||||
- Dockerfile: file-hash-abcdefabcdefabcdefabcdefabcdefabcdef
|
||||
- package.json: file-hash-abcdefabcdefabcdefabcdefabcdefabcdef
|
||||
environment:
|
||||
- MY_VARIABLE=123
|
||||
|
||||
|
||||
Command line options have precedence over the ones saved in '.balena-sync.yml'.
|
||||
|
||||
If '.gitignore' is found in the source directory then all explicitly listed files will be
|
||||
excluded when using rsync to update the container. You can choose to change this default behavior with the
|
||||
'--skip-gitignore' option.
|
||||
|
||||
Examples:
|
||||
|
||||
$ balena local push
|
||||
$ balena local push --app-name test-server --build-triggers package.json,requirements.txt
|
||||
$ balena local push --force-build
|
||||
$ balena local push --force-build --skip-logs
|
||||
$ balena local push --ignore lib/
|
||||
$ balena local push --verbose false
|
||||
$ balena local push 192.168.2.10 --source . --destination /usr/src/app
|
||||
$ balena local push 192.168.2.10 -s /home/user/balenaProject -d /usr/src/app --before 'echo Hello' --after 'echo Done'
|
||||
|
||||
### Options
|
||||
|
||||
#### --source, -s <path>
|
||||
|
||||
root of project directory to push
|
||||
|
||||
#### --destination, -d <path>
|
||||
|
||||
destination path on device container
|
||||
|
||||
#### --ignore, -i <paths>
|
||||
|
||||
comma delimited paths to ignore when syncing with 'rsync'
|
||||
|
||||
#### --skip-gitignore
|
||||
|
||||
do not parse excluded/included files from .gitignore
|
||||
|
||||
#### --before, -b <command>
|
||||
|
||||
execute a command before pushing
|
||||
|
||||
#### --after, -a <command>
|
||||
|
||||
execute a command after pushing
|
||||
|
||||
#### --progress, -p
|
||||
|
||||
show progress
|
||||
|
||||
#### --skip-logs
|
||||
|
||||
do not stream logs after push
|
||||
|
||||
#### --verbose, -v
|
||||
|
||||
increase verbosity
|
||||
|
||||
#### --app-name, -n <name>
|
||||
|
||||
application name - may contain lowercase characters, digits and one or more dashes. It may not start or end with a dash.
|
||||
|
||||
#### --build-triggers, -r <files>
|
||||
|
||||
comma delimited file list that will trigger a container rebuild if changed
|
||||
|
||||
#### --force-build, -f
|
||||
|
||||
force a container build and run
|
||||
|
||||
#### --env, -e <env>
|
||||
|
||||
environment variable (e.g. --env 'ENV=value'). Multiple --env parameters are supported.
|
||||
|
||||
## local stop [deviceIp]
|
||||
|
||||
|
||||
Examples:
|
||||
|
||||
$ balena local stop
|
||||
$ balena local stop --app-name myapp
|
||||
$ balena local stop --all
|
||||
$ balena local stop 192.168.1.10
|
||||
$ balena local stop 192.168.1.10 --app-name myapp
|
||||
|
||||
### Options
|
||||
|
||||
#### --all
|
||||
|
||||
stop all containers
|
||||
|
||||
#### --app-name, -a <name>
|
||||
|
||||
name of container to stop
|
||||
|
||||
# Deploy
|
||||
|
||||
## build [source]
|
||||
|
@ -35,7 +35,7 @@ async function getDrive(options: {
|
||||
}
|
||||
drive = d;
|
||||
} else {
|
||||
const { DriveList } = await import('../../utils/visuals/drive-list');
|
||||
const { DriveList } = await import('../utils/visuals/drive-list');
|
||||
const driveList = new DriveList(scanner);
|
||||
drive = await driveList.run();
|
||||
}
|
||||
@ -47,16 +47,16 @@ export const flash: CommandDefinition<
|
||||
{ image: string },
|
||||
{ drive: string; yes: boolean }
|
||||
> = {
|
||||
signature: 'local flash <image>',
|
||||
signature: 'flash <image>',
|
||||
description: 'Flash an image to a drive',
|
||||
help: stripIndent`
|
||||
Use this command to flash a balenaOS image to a drive.
|
||||
|
||||
Examples:
|
||||
|
||||
$ balena local flash path/to/balenaos.img[.zip|.gz|.bz2|.xz]
|
||||
$ balena local flash path/to/balenaos.img --drive /dev/disk2
|
||||
$ balena local flash path/to/balenaos.img --drive /dev/disk2 --yes
|
||||
$ balena flash path/to/balenaos.img[.zip|.gz|.bz2|.xz]
|
||||
$ balena flash path/to/balenaos.img --drive /dev/disk2
|
||||
$ balena flash path/to/balenaos.img --drive /dev/disk2 --yes
|
||||
`,
|
||||
options: [
|
||||
{
|
@ -25,12 +25,13 @@ module.exports =
|
||||
keys: require('./keys')
|
||||
logs: require('./logs')
|
||||
local: require('./local')
|
||||
scan: require('./scan')
|
||||
flash: require('./flash').flash
|
||||
notes: require('./notes')
|
||||
help: require('./help')
|
||||
os: require('./os')
|
||||
settings: require('./settings')
|
||||
config: require('./config')
|
||||
sync: require('./sync')
|
||||
ssh: require('./ssh')
|
||||
internal: require('./internal')
|
||||
build: require('./build')
|
||||
|
@ -15,9 +15,3 @@ limitations under the License.
|
||||
###
|
||||
|
||||
exports.configure = require('./configure')
|
||||
exports.flash = require('./flash').flash
|
||||
exports.logs = require('./logs')
|
||||
exports.scan = require('./scan')
|
||||
exports.ssh = require('./ssh')
|
||||
exports.push = require('./push')
|
||||
exports.stop = require('./stop')
|
||||
|
@ -33,15 +33,15 @@ dockerVersionProperties = [
|
||||
]
|
||||
|
||||
module.exports =
|
||||
signature: 'local scan'
|
||||
signature: 'scan'
|
||||
description: 'Scan for balenaOS devices in your local network'
|
||||
help: '''
|
||||
|
||||
Examples:
|
||||
|
||||
$ balena local scan
|
||||
$ balena local scan --timeout 120
|
||||
$ balena local scan --verbose
|
||||
$ balena scan
|
||||
$ balena scan --timeout 120
|
||||
$ balena scan --verbose
|
||||
'''
|
||||
options: [
|
||||
signature: 'verbose'
|
||||
@ -62,9 +62,9 @@ module.exports =
|
||||
prettyjson = require('prettyjson')
|
||||
{ discover } = require('balena-sync')
|
||||
{ SpinnerPromise } = require('resin-cli-visuals')
|
||||
{ dockerPort, dockerTimeout } = require('./common')
|
||||
dockerUtils = require('../../utils/docker')
|
||||
{ exitWithExpectedError } = require('../../utils/patterns')
|
||||
{ dockerPort, dockerTimeout } = require('./local/common')
|
||||
dockerUtils = require('../utils/docker')
|
||||
{ exitWithExpectedError } = require('../utils/patterns')
|
||||
|
||||
if options.timeout?
|
||||
options.timeout *= 1000
|
@ -249,6 +249,7 @@ export const ssh: CommandDefinition<
|
||||
> = {
|
||||
signature: 'ssh <applicationOrDevice> [serviceName]',
|
||||
description: 'SSH into the host or application container of a device',
|
||||
primary: true,
|
||||
help: stripIndent`
|
||||
This command can be used to start a shell on a local or remote device.
|
||||
|
||||
|
@ -1,44 +0,0 @@
|
||||
/*
|
||||
Copyright 2016-2019 Balena
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
import * as BalenaSync from 'balena-sync';
|
||||
import { CommandDefinition } from 'capitano';
|
||||
import { stripIndent } from 'common-tags';
|
||||
|
||||
export = deprecateSyncCmd(BalenaSync.capitano('balena-cli'));
|
||||
|
||||
const deprecationMsg = stripIndent`\
|
||||
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
Deprecation notice: please note that \`balena sync\` is deprecated and will
|
||||
be removed in a future release of the CLI. We are working on an exciting
|
||||
replacement that will be released soon!
|
||||
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
`;
|
||||
|
||||
function deprecateSyncCmd(syncCmd: CommandDefinition): CommandDefinition {
|
||||
syncCmd.primary = false;
|
||||
syncCmd.description = syncCmd.description.replace(
|
||||
'(beta)',
|
||||
'[deprecated: see "help sync"]',
|
||||
);
|
||||
syncCmd.help = deprecationMsg + '\n\n' + syncCmd.help;
|
||||
const originalAction = syncCmd.action;
|
||||
syncCmd.action = (params, options, done): void => {
|
||||
console.log(deprecationMsg);
|
||||
originalAction(params, options, done);
|
||||
};
|
||||
return syncCmd;
|
||||
}
|
@ -111,9 +111,6 @@ capitano.command(actions.settings.list)
|
||||
# ---------- Logs Module ----------
|
||||
capitano.command(actions.logs.logs)
|
||||
|
||||
# ---------- Sync Module ----------
|
||||
capitano.command(actions.sync)
|
||||
|
||||
# ---------- Tunnel Module ----------
|
||||
capitano.command(actions.tunnel.tunnel)
|
||||
|
||||
@ -125,12 +122,8 @@ capitano.command(actions.ssh.ssh)
|
||||
|
||||
# ---------- Local balenaOS Module ----------
|
||||
capitano.command(actions.local.configure)
|
||||
capitano.command(actions.local.flash)
|
||||
capitano.command(actions.local.logs)
|
||||
capitano.command(actions.local.push)
|
||||
capitano.command(actions.local.ssh)
|
||||
capitano.command(actions.local.scan)
|
||||
capitano.command(actions.local.stop)
|
||||
capitano.command(actions.flash)
|
||||
capitano.command(actions.scan)
|
||||
|
||||
# ---------- Public utils ----------
|
||||
capitano.command(actions.util.availableDrives)
|
||||
|
Loading…
x
Reference in New Issue
Block a user