Various cleanings, including missing EOL, typos, comments, ...

Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
This commit is contained in:
Silvin Lubecki 2019-01-21 15:36:22 +01:00
Родитель 312da0ca0e
Коммит d8fe337d8d
12 изменённых файлов: 38 добавлений и 41 удалений

2
.gitattributes поставляемый
Просмотреть файл

@ -4,4 +4,4 @@
*.exe binary
*.ico binary
*.jar binary
vendor/** -text
vendor/** -text

Просмотреть файл

@ -149,17 +149,17 @@ More examples are available in the [examples](examples) directory.
## CNAB
Under the hood `docker-app` produces a CNAB bundle (a docker invocation image and a `bundle.json`) from an Application Package, but is also a generic CNAB client.
CNAB proposes four actions, and docker-app adds them as commands:
Under the hood `docker-app` is CNAB compliant. It generates a CNAB from your application source and is able to install and manage any other CNAB too.
CNAB specifies four actions which `docker-app` provides as commands:
- `install`
- `upgrade`
- `status`
- `uninstall`
**Note**: These four commands needs a Docker Context to know which daemon or orchestrator to target.
**Note**: These commands need a Docker Context so that `docker-app` knows which endpoint and orchestrator to target.
```sh
$ docker context create swarm --description "swarm context" --default-stack-orchestrator=swarm --docker=host=unix:///var/run/docker.sock
```console
$ docker context create swarm --description "swarm context" --default-stack-orchestrator=swarm --docker=host=unix:///var/run/docker.sock
swarm
Successfully created context "swarm"
@ -170,7 +170,7 @@ swarm * swarm context unix:///var/run/do
```
Here is an example installing an application package, querying a status and then uninstalling it:
```sh
```console
$ docker-app install examples/hello-world/hello-world.dockerapp --name hello --target-context=swarm
Creating network hello_default
Creating service hello_hello
@ -258,9 +258,9 @@ Options:
-H, --host list Daemon socket(s) to connect to
-l, --log-level string Set the logging level ("debug"|"info"|"warn"|"error"|"fatal") (default "info")
--tls Use TLS; implied by --tlsverify
--tlscacert string Trust certs signed only by this CA (default "/Users/silvin/.docker/ca.pem")
--tlscert string Path to TLS certificate file (default "/Users/silvin/.docker/cert.pem")
--tlskey string Path to TLS key file (default "/Users/silvin/.docker/key.pem")
--tlscacert string Trust certs signed only by this CA (default "/[home]/.docker/ca.pem")
--tlscert string Path to TLS certificate file (default "/[home]/.docker/cert.pem")
--tlskey string Path to TLS key file (default "/[home]/.docker/key.pem")
--tlsverify Use TLS and verify the remote
-v, --version Print version information
@ -274,7 +274,7 @@ Commands:
push Push the application to a registry
render Render the Compose file for the application
split Split a single-file application into multiple files
status Get an application status
status Get the installation status. If the installation is a docker application, the status shows the stack services.
uninstall Uninstall an application
upgrade Upgrade an installed application
validate Checks the rendered application is syntactically correct
@ -288,11 +288,11 @@ Run 'docker-app COMMAND --help' for more information on a command.
### Bash
Load the docker-app completion code for bash into the current shell:
```sh
```console
$ source <(docker-app completion bash)
```
Set the docker-app completion code for bash to autoload on startup in your ~/.bashrc, ~/.profile or ~/.bash_profile:
```sh
```console
source <(docker-app completion bash)
```
**Note**: `bash-completion` is needed.
@ -300,11 +300,11 @@ source <(docker-app completion bash)
### Zsh
Load the docker-app completion code for zsh into the current shell
```sh
```console
$ source <(docker-app completion zsh)
```
Set the docker-app completion code for zsh to autoload on startup in your ~/.zshrc
```sh
```console
source <(docker-app completion zsh)
```

Просмотреть файл

@ -19,7 +19,7 @@ func install(instanceName string) error {
return errors.Wrap(err, "unable to restore docker context")
}
app, err := packager.Extract("")
// todo: merge addition compose file
// todo: merge additional compose file
if err != nil {
return err
}

Просмотреть файл

@ -13,7 +13,6 @@ var (
initSingleFile bool
)
// initCmd represents the init command
func initCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "init <app-name> [-c <compose-file>] [-d <description>] [-m name:email ...]",

Просмотреть файл

@ -15,7 +15,6 @@ var (
inspectEnv []string
)
// inspectCmd represents the inspect command
func inspectCmd(dockerCli command.Cli) *cobra.Command {
cmd := &cobra.Command{
Use: "inspect [<app-name>] [-s key=value...] [-f parameters-file...]",

Просмотреть файл

@ -36,19 +36,18 @@ const (
)
const longDescription = `Install the application on either Swarm or Kubernetes.
Bundle name is optional, and can be
- empty: resolve to any *.dockerapp file or directory in working dir
- existing file path: work with any *.dockerapp file or dir, or any CNAB bundle file (signed or unsigned)
Bundle name is optional, and can:
- be empty and resolve to any *.dockerapp in working directory
- be a BUNDLE file path and resolve to any *.dockerapp file or dir, or any CNAB file (signed or unsigned)
- match a bundle name in the local duffle bundle repository
- refers to a CNAB bundle in a container registry
- refer to a CNAB in a container registry
`
// installCmd represents the install command
func installCmd(dockerCli command.Cli) *cobra.Command {
var opts installOptions
cmd := &cobra.Command{
Use: "install [<bundle name>] [options]",
Use: "install [<bundle name>] [OPTIONS]",
Aliases: []string{"deploy"},
Short: "Install an application",
Long: longDescription,
@ -134,6 +133,8 @@ func runInstall(dockerCli command.Cli, appname string, opts installOptions) erro
Driver: driverImpl,
}
err = inst.Run(c, creds, dockerCli.Out())
// Even if the installation failed, the claim is persisted with its failure status,
// so any installation needs a clean uninstallation.
err2 := claimStore.Store(*c)
if err != nil {
return fmt.Errorf("install failed: %v", err)

Просмотреть файл

@ -15,7 +15,7 @@ func statusCmd(dockerCli command.Cli) *cobra.Command {
cmd := &cobra.Command{
Use: "status <installation-name>",
Short: "Get an application status",
Short: "Get the installation status. If the installation is a docker application, the status shows the stack services.",
Args: cli.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
return runStatus(dockerCli, args[0], opts)

Просмотреть файл

@ -1,6 +1,6 @@
## Requirements
* Working Docker Desktop install with Kubernetes enabled
* Any with Kubernetes enabled with [compose-on-kubernetes](https://github.com/docker/compose-on-kubernetes) installed
* [`docker-app` with CNAB support](https://github.com/docker/app/releases/tag/cnab-dockercon-preview) installed
* Source code from this directory
* Create a context with `docker-app context`
@ -10,11 +10,11 @@
## Examples
Install the Helm chart example using `docker-app`
**Note**: This example comes from [deislabs/bundles](https://github.com/deislabs/bundles/tree/master/hellohelm).
```
```console
$ docker-app install -c local bundle.json
Do install for hellohelm
helm install --namespace hellohelm -n hellohelm /cnab/app/charts/alpine
@ -29,7 +29,6 @@ NAME AGE
hellohelm-alpine 0s
```
Check the status of the Helm-based application:
```console

Просмотреть файл

@ -1,4 +1,4 @@
FROM cnab/k8sbase:latest
COPY app/Makefile /cnab/app/Makefile
COPY app/charts /cnab/app/charts
COPY app/charts /cnab/app/charts

Просмотреть файл

@ -1,3 +1,3 @@
FROM alpine:3.7
CMD ["sleep", "9000"]
CMD ["sleep", "9000"]

Просмотреть файл

@ -31,27 +31,26 @@ version latest
Install the application:
```
docker-app install
```console
$ docker-app install
```
Show the details of the installation:
```
docker-app status hello
```console
$ docker-app status hello
```
Upgrade the installation, demonstrating setting parameters:
```
docker-app upgrade--set port=9876 --set text="hello DockerCon EU"
```console
$ docker-app upgrade--set port=9876 --set text="hello DockerCon EU"
```
Uninstall the application installation:
```
docker-app uninstall hello
```console
$ docker-app uninstall hello
```
Demonstrate building a `bundle.json` for CNAB.

2
internal/packager/testdata/parameters.yml поставляемый
Просмотреть файл

@ -6,4 +6,4 @@ cc:
aa:
dd: val
bb: val
cc: val
cc: val