diff --git a/lib/actions/local/common.d.ts b/lib/actions/local/common.d.ts deleted file mode 100644 index cdc6f0c0..00000000 --- a/lib/actions/local/common.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -/** - * @license - * Copyright 2020 Balena Ltd. - * - * 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. - */ - -export const dockerPort: number; -export const dockerTimeout: number; diff --git a/lib/actions/local/logs.coffee b/lib/actions/local/logs.coffee deleted file mode 100644 index 26a7a339..00000000 --- a/lib/actions/local/logs.coffee +++ /dev/null @@ -1,66 +0,0 @@ -### -Copyright 2017 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. -### - -# A function to reliably execute a command -# in all supported operating systems, including -# different Windows environments like `cmd.exe` -# and `Cygwin` should be encapsulated in a -# re-usable package. -# -module.exports = - signature: 'local logs [deviceIp]' - description: 'Get or attach to logs of a running container on a balenaOS device' - help: ''' - - 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: [ - signature: 'follow' - boolean: true - description: 'follow log' - alias: 'f' - , - signature: 'app-name' - parameter: 'name' - description: 'name of container to get logs from' - alias: 'a' - ] - root: true - action: (params, options, done) -> - Promise = require('bluebird') - { forms } = require('balena-sync') - { selectContainerFromDevice, pipeContainerStream } = require('./common') - - Promise.try -> - if not params.deviceIp? - return forms.selectLocalBalenaOsDevice() - return params.deviceIp - .then (@deviceIp) => - if not options['app-name']? - return selectContainerFromDevice(@deviceIp) - return options['app-name'] - .then (appName) => - pipeContainerStream - deviceIp: @deviceIp - name: appName - outStream: process.stdout - follow: options['follow'] diff --git a/lib/actions/local/push.coffee b/lib/actions/local/push.coffee deleted file mode 100644 index de9936bc..00000000 --- a/lib/actions/local/push.coffee +++ /dev/null @@ -1,95 +0,0 @@ -### -Copyright 2016-2017 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. -### - -# Loads '.balena-sync.yml' configuration from 'source' directory. -# Returns the configuration object on success -# - -_ = require('lodash') - -balenaPush = require('balena-sync').capitano('balena-toolbox') -originalAction = balenaPush.action - -# TODO: This is a temporary workaround to reuse the existing `rdt push` -# capitano frontend in `balena local push`. - -# coffeelint: disable-next-line ("Line ends with trailing whitespace") -deprecationMsg = ''' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Deprecation notice: `balena local push` is deprecated and will be removed in a - future release of the CLI. Please use `balena push ` instead. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -''' - -balenaPushHelp = """#{deprecationMsg} - 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 - '/.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' -""" - - - -module.exports = _.assign balenaPush, - signature: 'local push [deviceIp]' - description: '[deprecated: use "balena push ipAddress"] ' + balenaPush.description - help: balenaPushHelp - primary: false - root: true - action: (params, options, done) -> - console.log deprecationMsg - originalAction(params, options, done) diff --git a/lib/actions/local/stop.coffee b/lib/actions/local/stop.coffee deleted file mode 100644 index 38308d5c..00000000 --- a/lib/actions/local/stop.coffee +++ /dev/null @@ -1,82 +0,0 @@ -### -Copyright 2017 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. -### - -# A function to reliably execute a command -# in all supported operating systems, including -# different Windows environments like `cmd.exe` -# and `Cygwin` should be encapsulated in a -# re-usable package. -# - -{ getChalk } = require('../../utils/lazy') - -module.exports = - signature: 'local stop [deviceIp]' - description: 'Stop a running container on a balenaOS device' - help: ''' - - 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: [ - signature: 'all' - boolean: true - description: 'stop all containers' - , - signature: 'app-name' - parameter: 'name' - description: 'name of container to stop' - alias: 'a' - ] - root: true - action: (params, options) -> - Promise = require('bluebird') - chalk = getChalk() - { forms, config, BalenaLocalDockerUtils } = require('balena-sync') - { selectContainerFromDevice, filterOutSupervisorContainer } = require('./common') - - Promise.try -> - if not params.deviceIp? - return forms.selectLocalBalenaOsDevice() - return params.deviceIp - .then (@deviceIp) => - @docker = new BalenaLocalDockerUtils(@deviceIp) - - if options.all - # Only list running containers - return @docker.docker.listContainersAsync(all: false) - .filter(filterOutSupervisorContainer) - .then (containers) => - Promise.map containers, ({ Names, Id }) => - console.log(chalk.yellow.bold("* Stopping container #{Names[0]}")) - @docker.stopContainer(Id) - - ymlConfig = config.load() - @appName = options['app-name'] ? ymlConfig['local_balenaos']?['app-name'] - @docker.checkForRunningContainer(@appName) - .then (isRunning) => - if not isRunning - return selectContainerFromDevice(@deviceIp, true) - - console.log(chalk.yellow.bold("* Stopping container #{@appName}")) - return @appName - .then (runningContainerName) => - @docker.stopContainer(runningContainerName)