Compare commits

...

122 Commits

Author SHA1 Message Date
Jose Diaz-Gonzalez
dbc5182193 Release 0.15.4
# History

## 0.15.4

Install/update via the bootstrap script:

```shell
wget https://raw.githubusercontent.com/dokku/dokku/v0.15.4/bootstrap.sh
sudo DOKKU_TAG=v0.15.4 bash bootstrap.sh
```

### Bug Fixes

- #3499: @josegonzalez Ensure the .buildpacks file exists before writing to it
- #3500: @josegonzalez Always allow ps:scale proc=0
- #3497: @josegonzalez Allow reporting domains when there are none specified

### New Features

- #3502: @josegonzalez Add a trigger to fetch the git revision
- #3501: @josegonzalez Move log retrieval to docker-local scheduler
- #3498: @josegonzalez Add ability to report domains globally
- #3496: @josegonzalez Cleanup glide plugins when running src-clean

### Documentation

- #3504: @vanastassiou Edits for readability and conciseness
- #3490: @josegonzalez Add missing link to resource management docs
2019-04-17 17:24:10 -04:00
Jose Diaz-Gonzalez
46c023e73d Merge pull request #3504 from vanastassiou/patch-1
Edits for readability and conciseness
2019-04-17 17:22:05 -04:00
Jose Diaz-Gonzalez
f39d0fc0cf docs: correct docs link to work on both site and github
[ci skip]
2019-04-17 17:21:45 -04:00
Jose Diaz-Gonzalez
277429db5a Merge pull request #3502 from dokku/3484-git-revision-trigger
Add a trigger to fetch the git revision
2019-04-17 17:20:51 -04:00
Jose Diaz-Gonzalez
9a447c16f2 feat: add a trigger to fetch the git revision
This allows other plugins to fetch the current git revision without needing to duplicate logic from the git plugin.

Closes #3484
2019-04-17 17:19:59 -04:00
V Anastassiou
c4c7d0d82d Edits for readability and conciseness 2019-04-17 14:03:48 -07:00
Jose Diaz-Gonzalez
e5c76d3795 Merge pull request #3501 from dokku/3487-scheduler-logs
Move log retrieval to docker-local scheduler
2019-04-17 15:44:55 -04:00
Jose Diaz-Gonzalez
662c8c2831 refactor: move log retrieval to docker-local scheduler
This change will allow other schedulers to implement log retrieval as necessary for the platform specified.

Closes #3487
2019-04-17 15:03:37 -04:00
Jose Diaz-Gonzalez
3ec67073ce Merge pull request #3499 from dokku/3491-buildpacks-writing
Ensure the .buildpacks file exists before writing to it
2019-04-17 02:52:49 -04:00
Jose Diaz-Gonzalez
322dd2246f fix: ensure the .buildpacks file exists before writing to it 2019-04-17 02:04:06 -04:00
Jose Diaz-Gonzalez
13e3950f4a Merge pull request #3498 from dokku/global-domains-report
Add ability to report domains globally
2019-04-17 01:32:45 -04:00
Jose Diaz-Gonzalez
d03d5bc40c Merge pull request #3500 from dokku/3428-ps-scale-0
Always allow ps:scale proc=0
2019-04-17 01:32:26 -04:00
Jose Diaz-Gonzalez
5038050968 Merge pull request #3497 from dokku/empty-domains
Allow reporting domains when there are none specified
2019-04-16 23:06:05 -04:00
Jose Diaz-Gonzalez
97fe3f56b7 fix: Always allow ps:scale proc=0
With the introduciton of procfile-util, scaling a non-existent process to 0 was disabled. This brings back that functionality, allowing users to scale all processes to 0. This is especially useful when a user has accidentally scaled a non-existent process up, causing deploys to fail without any way to revert outside of manually editing files.

Closes #3428
2019-04-16 23:04:45 -04:00
Jose Diaz-Gonzalez
887c0ebdd6 feat: add ability to report domains globally
The `domains` command previously had this functionality, but is deprecated, and thus we should provide an alternative method of presenting the information.
2019-04-16 21:58:56 -04:00
Jose Diaz-Gonzalez
99869c520f Merge pull request #3496 from dokku/cleanup-plugins
Cleanup glide plugins when running src-clean
2019-04-16 21:34:26 -04:00
Jose Diaz-Gonzalez
65e82bcea1 fix: allow reporting domains when there are none specified
This previously bailed if the response was empty, which in this case is incorrect, as the response isn't based on whether the app is deployed or not.
2019-04-16 21:24:56 -04:00
Jose Diaz-Gonzalez
bf8b67b35d feat: cleanup glide plugins when running src-clean 2019-04-16 20:00:35 -04:00
Jose Diaz-Gonzalez
8a56740a7c Merge pull request #3490 from dokku/josegonzalez-patch-1
Add missing link to resource management docs
2019-04-10 00:44:40 -04:00
Jose Diaz-Gonzalez
3a7bac6218 docs: Add missing link to resource management docs
[ci skip]
2019-04-10 00:44:25 -04:00
Jose Diaz-Gonzalez
5b9e8ddb7d Release 0.15.3
# History

## 0.15.3

Install/update via the bootstrap script:

```shell
wget https://raw.githubusercontent.com/dokku/dokku/v0.15.3/bootstrap.sh
sudo DOKKU_TAG=v0.15.3 bash bootstrap.sh
```

### New Features

- #3489: @josegonzalez feat: upgrade herokuish to 0.5.0 (Ubuntu 18.04)
2019-04-09 11:40:30 -04:00
Jose Diaz-Gonzalez
97649e86dd fix: update ruby version 2019-04-09 07:27:30 -04:00
Jose Diaz-Gonzalez
f8e3518aa6 Merge pull request #3489 from dokku/upgrade-herokuish
feat: upgrade herokuish to 0.5.0 (Ubuntu 18.04)
2019-04-09 06:56:02 -04:00
Jose Diaz-Gonzalez
ef5f7fe03e feat: upgrade herokuish to 0.5.0 (Ubuntu 18.04)
This moves the base image from Xenial to Bionic, which is the latest supported LTS release of Ubuntu. Note that all previous releases of herokuish are no longer supported, and users are encouraged to upgrade where possible.

In the case of upgrades, a 'dokku repo:purge-cache APP' should be called for each app, or built applications may include code linked to non-ABI compatible libraries due to the OS upgrade.

This sort of change is usually performed _only_ during a minor release, but as the window since the release is fairly small, the risk to our users is negligible in comparison to the inability to stay on a maintained herokuish release.
2019-04-09 06:55:34 -04:00
Jose Diaz-Gonzalez
286c6ed39d Release 0.15.2
# History

## 0.15.2

Install/update via the bootstrap script:

```shell
wget https://raw.githubusercontent.com/dokku/dokku/v0.15.2/bootstrap.sh
sudo DOKKU_TAG=v0.15.2 bash bootstrap.sh
```

### Bug Fixes

- #3488: @josegonzalez fix: call ps:retire from system service
2019-04-09 06:18:54 -04:00
Jose Diaz-Gonzalez
f04fd6f218 Merge pull request #3488 from dokku/josegonzalez-patch-1
fix: call ps:retire from system service
2019-04-09 06:18:33 -04:00
Jose Diaz-Gonzalez
75239ae8b5 fix: call ps:retire from system service
[ci skip]
2019-04-09 06:18:16 -04:00
Jose Diaz-Gonzalez
b120a9cc57 Release 0.15.1
# History

## 0.15.1

Install/update via the bootstrap script:

```shell
wget https://raw.githubusercontent.com/dokku/dokku/v0.15.1/bootstrap.sh
sudo DOKKU_TAG=v0.15.1 bash bootstrap.sh
```

### Bug Fixes

- #3485: @josegonzalez fix: ensure 'dokku report' always succeeds for any app
2019-04-09 03:19:40 -04:00
Jose Diaz-Gonzalez
6b71b66f8d Merge pull request #3485 from dokku/fix-report
fix: ensure 'dokku report' always succeeds for any app
2019-04-09 03:19:12 -04:00
Jose Diaz-Gonzalez
ecd88fbeeb fix: correctly name the testcase 2019-04-09 03:18:28 -04:00
Jose Diaz-Gonzalez
929c98ee90 fix: ensure 'dokku report' always succeeds for any app 2019-04-09 02:41:02 -04:00
Jose Diaz-Gonzalez
642c293d5a Release 0.15.0
# History

## 0.15.0

Install/update via the bootstrap script:

```shell
wget https://raw.githubusercontent.com/dokku/dokku/v0.15.0/bootstrap.sh
sudo DOKKU_TAG=v0.15.0 bash bootstrap.sh
```

### Bug Fixes

- #3479: @josegonzalez Turn off logging for nginx validate configuration
- #3470: @josegonzalez fix: correct the argument for get_release_cmd

### New Features

- #3469: @josegonzalez Resource management
- #3466: @josegonzalez Quieter builds
- #3467: @josegonzalez feat: update golang in use for binary building
- #3465: @josegonzalez Vagrant VM Enhancements
- #3464: @josegonzalez Upgrade to go-procfile-util version 0.6.0
- #3463: @josegonzalez Implement version flags
- #3462: @josegonzalez Upgrade procfile-util
- #3449: @josegonzalez Only override the `WORKDIR` in copy_from_image if the image is `gliderlabs/herokuish` based
- #3461: @josegonzalez Allow skipping aws releases for plugins
- #3459: @josegonzalez Upgrade to herokuish:0.4.9
- #3413: @josegonzalez Implement buildpacks plugin

### Documentation

- #3482: @multikatt rails-database -> railsdatabase
- #3476: @lazyatom Add chrome plugin to documentation
- #3468: @josegonzalez Doc cleanup

### Other

- #3471: @josegonzalez chore: drop plugn package building
2019-04-08 18:03:29 -04:00
Jose Diaz-Gonzalez
f05247226d Merge pull request #3469 from dokku/resource-management
Resource management
2019-04-08 17:17:42 -04:00
Jose Diaz-Gonzalez
a4c30c2ba9 chore: standardize variable naming 2019-04-08 16:36:30 -04:00
Jose Diaz-Gonzalez
b24697443a fix: correct the name 2019-04-08 15:18:46 -04:00
Jose Diaz-Gonzalez
a4114bb29d fix: clearing values has no returnable errors 2019-04-08 14:36:38 -04:00
Jose Diaz-Gonzalez
c41753c747 fix: clearing resources for web doesn't actually clear for everything 2019-04-08 14:17:16 -04:00
Jose Diaz-Gonzalez
4a6d3c25a4 fix: do not crash when clearing properties 2019-04-08 13:56:06 -04:00
Jose Diaz-Gonzalez
beef464cc1 fix: only uncomment port for sshd-config 2019-04-08 13:42:01 -04:00
Jose Diaz-Gonzalez
6cc6d5a33f fix: correct port application during local tests 2019-04-08 13:22:40 -04:00
Jose Diaz-Gonzalez
ff945c64fe fix: correct local test running 2019-04-08 13:18:28 -04:00
Jose Diaz-Gonzalez
d7c7511ea9 fix: correct comment on GetResourceValue 2019-04-08 12:52:30 -04:00
Jose Diaz-Gonzalez
0af8b2421d fix: correct range call 2019-04-08 12:42:25 -04:00
Jose Diaz-Gonzalez
71be7026d7 fix: correct GetResourceValue errors 2019-04-08 12:41:48 -04:00
Jose Diaz-Gonzalez
1683095233 fix: try and decrease number of compiles during release process 2019-04-08 12:41:06 -04:00
Jose Diaz-Gonzalez
c2898ec040 feat: add trigger to allow retrieving resource properties on the fly 2019-04-08 11:31:34 -04:00
Jose Diaz-Gonzalez
243d5ecc43 feat: integrate resource plugin with scheduler-docker-local 2019-04-08 11:31:34 -04:00
Jose Diaz-Gonzalez
3f0126a471 fix: do not output empty arguments
Also ensure we use Printf instead of Print...
2019-04-08 11:31:34 -04:00
Jose Diaz-Gonzalez
8db3b8e333 fix: do not barf if there are no resources specified for an application 2019-04-08 11:31:34 -04:00
Jose Diaz-Gonzalez
00c9e5a5e9 feat: first pass at implement resource limitation on a pre-process basis 2019-04-08 11:31:34 -04:00
Jose Diaz-Gonzalez
e8134f9c2c feat: implement resource:report 2019-04-08 11:31:34 -04:00
Jose Diaz-Gonzalez
c9bbddcfcb refactor: drop global resource limits
Global limits make it harder to reason about the inheritance in the system. Rather than support global limits, Dokku should provide primitives to automatically set them on an app at provision time, or explicitly set them for an app. Both of these are likely best suited for a higher-level provisioner, or a community plugin.
2019-04-08 11:31:34 -04:00
Jose Diaz-Gonzalez
278a80cc25 feat: switch from _all_ to _default_ for process type
This is a special process type that signifies it's the default value for everything.
2019-04-08 11:31:34 -04:00
Jose Diaz-Gonzalez
3ab271f756 refactor: drop implicit returns 2019-04-08 11:31:34 -04:00
Jose Diaz-Gonzalez
982895ff71 fix: add missing argument 2019-04-08 11:31:34 -04:00
Jose Diaz-Gonzalez
9acb9e527d feat: implement resource:*-clear commands 2019-04-08 11:31:34 -04:00
Jose Diaz-Gonzalez
ab9f516c08 refactor: clean up duplication in retrieving and verifying the APP argument 2019-04-08 11:31:34 -04:00
Jose Diaz-Gonzalez
c5717510ee feat: always get keys in order
Ranging over maps is unordered in golang, so we need to use the correct data structure if we need the output in an ordered way.
2019-04-08 11:31:34 -04:00
Jose Diaz-Gonzalez
8d23556831 fix: omit 2nd, unused value from range 2019-04-08 11:31:34 -04:00
Jose Diaz-Gonzalez
04a6e30e45 refactor: drop -defaults command in favor of --global flag
This makes usage a bit simpler, at the cost of interface complexity.
2019-04-08 11:31:34 -04:00
Jose Diaz-Gonzalez
bdfde9a481 feat: initial stub implementation for resource:*-clear commands 2019-04-08 11:31:34 -04:00
Jose Diaz-Gonzalez
9808ecde81 feat: implement default limit management
Also add generic report information when no flags are specified
2019-04-08 11:31:34 -04:00
Jose Diaz-Gonzalez
b36ab54b87 fix: correct variable name 2019-04-08 11:31:34 -04:00
Jose Diaz-Gonzalez
ff35e95924 fix: correct type comment declaration 2019-04-08 11:31:34 -04:00
Jose Diaz-Gonzalez
49e44ce59b fix: correct stickler-ci issues 2019-04-08 11:31:34 -04:00
Jose Diaz-Gonzalez
ab88dbb03d feat: Implement resource:limit and resource:reserve
Also add the install and post-delete hooks
2019-04-08 11:31:34 -04:00
Jose Diaz-Gonzalez
2e895286cf docs: drop ability to process multiple process types at once 2019-04-08 11:31:34 -04:00
Jose Diaz-Gonzalez
5b2d4b3559 feat: add initial documentation for resource management plugin 2019-04-08 11:31:34 -04:00
Jose Diaz-Gonzalez
8ad74d0814 fix: correct buildpack plugin version 2019-04-08 11:31:34 -04:00
Jose Diaz-Gonzalez
9486576add fix: drop nil err reference from log output 2019-04-08 11:31:34 -04:00
Jose Diaz-Gonzalez
2a353a9ca5 Merge pull request #3482 from multikatt/patch-1
rails-database -> railsdatabase
2019-04-05 18:20:29 -04:00
David
2d1f241677 rails-database -> railsdatabase
Naming the database rails-database throws
```Please specify a valid name for the service. Valid characters are: [A-Za-z0-9_]+```
2019-04-05 23:46:36 +02:00
Jose Diaz-Gonzalez
d6f122bfda Merge pull request #3479 from dokku/josegonzalez-patch-1
Turn off logging for nginx validate configuration
2019-03-28 12:30:27 -04:00
Jose Diaz-Gonzalez
54ef6514d5 fix: turn off error logging for validate config
This will allow validation to work if the default logging locations cannot be written to but the configuration is otherwise okay. This will be the case for users with custom nginx configurations that log to other places, such as syslog.
2019-03-26 17:10:32 -04:00
Jose Diaz-Gonzalez
abf7addaa6 Merge pull request #3476 from lazyatom/patch-1
Add chrome plugin to documentation
2019-03-19 14:29:25 -04:00
James Adam
e831b786f0 Add chrome plugin to documentation
Adds a link to the headless chrome plugin to the plugin documentation.
2019-03-19 17:20:21 +00:00
Jose Diaz-Gonzalez
c6074baad5 Merge pull request #3471 from dokku/plugn-builds-its-own-packages
chore: drop plugn package building
2019-03-16 03:49:05 -04:00
Jose Diaz-Gonzalez
7cb0d11b95 chore: drop plugn package building
The dokku/plugn project now builds and releases it's own packages on release creation.

Also upgrade to latest plugn version, 0.3.2
2019-03-16 03:16:28 -04:00
Jose Diaz-Gonzalez
87c77b1aa0 Merge pull request #3470 from dokku/josegonzalez-patch-1
fix: correct the argument for get_release_cmd
2019-03-14 14:26:10 -04:00
Jose Diaz-Gonzalez
7d2f5b84c8 fix: add missing head -n1 call to second build-env test
Otherwise `docker inspect` outputs a "condensed" json output that doesn't parse as well...
2019-03-14 13:44:54 -04:00
Jose Diaz-Gonzalez
8dcbfe5542 fix: correct case where there could be multiple build containers post-build
This happens when we execute several post-release scripts.
2019-03-14 13:12:07 -04:00
Jose Diaz-Gonzalez
f9023402ad fix: correct the argument for get_release_cmd
Closes #3438
2019-03-14 12:00:23 -04:00
Jose Diaz-Gonzalez
c658d60dc2 Merge pull request #3468 from dokku/doc-cleanup
Doc cleanup
2019-03-13 17:50:09 -04:00
Jose Diaz-Gonzalez
c1781c39ca docs: correct header
[ci skip]
2019-03-13 16:55:39 -04:00
Jose Diaz-Gonzalez
5f75b24fb2 docs: correct docker options information output 2019-03-13 16:55:11 -04:00
Jose Diaz-Gonzalez
3db5de1a9e Merge pull request #3466 from dokku/quieter-builds
Quieter builds
2019-03-13 15:00:27 -04:00
Jose Diaz-Gonzalez
520a72078e fix: remove useless cat 2019-03-13 14:12:35 -04:00
Jose Diaz-Gonzalez
ef5a45c7cb feat: add DOKKU_QUIET_OUTPUT=1 to all config_set/config_unset calls
This makes build output a bit more digestable.
2019-03-13 02:05:18 -04:00
Jose Diaz-Gonzalez
c6a1c0dcbf feat: respect --quiet in config.go
When setting environment variables, we should respect a passed `--quiet` flag - and the respective environment variable. This will allow users to have a nicer experience when using the config functions within their own plugins.
2019-03-13 02:05:18 -04:00
Jose Diaz-Gonzalez
c701429a05 chore: quiet down logging around scale declarations 2019-03-13 02:05:18 -04:00
Jose Diaz-Gonzalez
7f1fe3ccfd chore: follow logging pattern from heroku for phase command declarations 2019-03-13 02:05:18 -04:00
Jose Diaz-Gonzalez
6797971016 chore: drop extra echo in app-json method calls 2019-03-13 02:05:18 -04:00
Jose Diaz-Gonzalez
dc6abe691a Merge pull request #3467 from dokku/upgrade-golang
feat: update golang in use for binary building
2019-03-13 02:04:45 -04:00
Jose Diaz-Gonzalez
7333a630a1 feat: update golang in use for binary building
This change is not necessary other than for good house-keeping. All dokku-related binaries should _also_ be built with the latest golang.
2019-03-13 00:28:55 -04:00
Jose Diaz-Gonzalez
2edbc3fe39 Merge pull request #3465 from dokku/vm-enhancements
Vagrant VM Enhancements
2019-03-12 21:27:58 -04:00
Jose Diaz-Gonzalez
50357eb682 feat: add support for new vmware_desktop provider 2019-03-12 21:26:39 -04:00
Jose Diaz-Gonzalez
1203146ab9 feat: switch vagrant vm to ubuntu 18.04 2019-03-12 21:26:07 -04:00
Jose Diaz-Gonzalez
fc8637a0f5 Merge pull request #3464 from dokku/josegonzalez-patch-1
Upgrade to go-procfile-util version 0.6.0
2019-03-12 16:56:08 -04:00
Jose Diaz-Gonzalez
f3ace60a98 feat: upgrade to go-procfile-util version 0.6.0
Refs #3428
2019-03-12 16:23:33 -04:00
Jose Diaz-Gonzalez
8fe87358e1 Merge pull request #3463 from dokku/version-command
Implement version flags
2019-03-11 22:46:26 -04:00
Jose Diaz-Gonzalez
297a26aa20 feat: implement version flags
This moves the version command to the dokku binary, and also implements both -v and --version flags on the binary.
2019-03-11 21:50:05 -04:00
Jose Diaz-Gonzalez
2da16265cb Merge pull request #3462 from dokku/upgrade-procfile-util
feat: upgrade procfile-util
2019-03-11 21:13:28 -04:00
Jose Diaz-Gonzalez
25a65add4a Merge pull request #3449 from dokku/3263-copy-from-image
Only override the `WORKDIR` in copy_from_image if the image is `gliderlabs/herokuish` based
2019-03-11 21:01:21 -04:00
Jose Diaz-Gonzalez
a721abd972 feat: upgrade procfile-util
The new version properly handles trailing inline comments.
2019-03-11 20:09:53 -04:00
Jose Diaz-Gonzalez
acbe8fa805 fix: Only override the WORKDIR in copy_from_image if the image is gliderlabs/herokuish based
Rather than always assuming a missing `WORKDIR` means herokuish, we instead inspect the image to verify that it is. If it is, then and _only_ then do we set WORKDIR. Otherwise, we respect the decision of `docker cp` to execute from within the last known `WORKDIR` context, which is inherited at the image level, not image metadata level.

Additionally, speed up `is_image_herokuish_based` by inspecting the environment variables on the image. When there is a "USER=herokuishuser", we can more or less safely assume it is an image that Dokku built, and is therefore a herokuish image. While possible, it would be very strange if a non-herokuish image had this environment variable set, so it is a relatively safe change.
2019-03-11 20:09:13 -04:00
Jose Diaz-Gonzalez
57a1c68aba fix: correct shfmt 2019-03-11 19:12:57 -04:00
Jose Diaz-Gonzalez
83104bf919 Merge pull request #3461 from dokku/plugin-releasing
feat: allow skipping aws releases for plugins
2019-03-11 18:46:40 -04:00
Jose Diaz-Gonzalez
7574c407fa feat: allow skipping aws releases for plugins
If there is no configured s3 bucket/path, avoid attempting to push when `true` is passed as the second argument.
2019-03-11 18:30:03 -04:00
Jose Diaz-Gonzalez
f67a38864c Merge pull request #3459 from dokku/upgrade-herokuish
feat: upgrade to herokuish:0.4.9
2019-03-07 17:32:47 -05:00
Jose Diaz-Gonzalez
f632795904 feat: upgrade to herokuish:0.4.9 2019-03-07 17:29:42 -05:00
Jose Diaz-Gonzalez
0cf43b8623 Merge pull request #3413 from dokku/3256-buildpack-management
Implement buildpacks plugin
2019-03-05 22:22:56 -05:00
Jose Diaz-Gonzalez
d3d426a8d9 tests: add functional tests for buildpacks plugin 2019-03-05 21:41:23 -05:00
Jose Diaz-Gonzalez
6cae92e1f1 fix: add missing comments to exported functions 2019-03-05 21:41:23 -05:00
Jose Diaz-Gonzalez
3670d7efcd fix: correct fmt.Errorf violations 2019-03-05 21:41:23 -05:00
Jose Diaz-Gonzalez
887c1d4254 feat: implement buildpacks plugin
This will allow users to specify buildpacks outside of a git repository.

Note that this does not override any specified `BUILDPACK_URL`.

Closes #3256
2019-03-05 21:41:23 -05:00
Jose Diaz-Gonzalez
a56ae22614 refactor: switch to path.Join
This is the _correct_ way to join paths in golang
2019-03-05 21:34:26 -05:00
Jose Diaz-Gonzalez
884c45de0c chore: move print calls together 2019-03-05 21:34:26 -05:00
Jose Diaz-Gonzalez
8d6a1773a3 fix: correct the DOKKU_QUIET_OUTPUT env var check for golang log methods 2019-03-05 21:34:26 -05:00
Jose Diaz-Gonzalez
6f1e964c9f refactor: ensure all property-handling functions return an error
This will allow upstream functions to handle errors in the most appropriate manner
2019-03-05 21:34:26 -05:00
Jose Diaz-Gonzalez
4db7ebd743 feat: add helper method for ensuring a property file exists 2019-03-05 21:34:26 -05:00
Jose Diaz-Gonzalez
83f5e380d4 refactor: add helper method for getting the path of a property 2019-03-05 21:34:26 -05:00
Jose Diaz-Gonzalez
34f5eaeaa2 chore: rename helper method 2019-03-05 21:34:26 -05:00
185 changed files with 5678 additions and 572 deletions

View File

@@ -1,5 +1,109 @@
# History
## 0.15.4
Install/update via the bootstrap script:
```shell
wget https://raw.githubusercontent.com/dokku/dokku/v0.15.4/bootstrap.sh
sudo DOKKU_TAG=v0.15.4 bash bootstrap.sh
```
### Bug Fixes
- #3499: @josegonzalez Ensure the .buildpacks file exists before writing to it
- #3500: @josegonzalez Always allow ps:scale proc=0
- #3497: @josegonzalez Allow reporting domains when there are none specified
### New Features
- #3502: @josegonzalez Add a trigger to fetch the git revision
- #3501: @josegonzalez Move log retrieval to docker-local scheduler
- #3498: @josegonzalez Add ability to report domains globally
- #3496: @josegonzalez Cleanup glide plugins when running src-clean
### Documentation
- #3504: @vanastassiou Edits for readability and conciseness
- #3490: @josegonzalez Add missing link to resource management docs
## 0.15.3
Install/update via the bootstrap script:
```shell
wget https://raw.githubusercontent.com/dokku/dokku/v0.15.3/bootstrap.sh
sudo DOKKU_TAG=v0.15.3 bash bootstrap.sh
```
### New Features
- #3489: @josegonzalez feat: upgrade herokuish to 0.5.0 (Ubuntu 18.04)
## 0.15.2
Install/update via the bootstrap script:
```shell
wget https://raw.githubusercontent.com/dokku/dokku/v0.15.2/bootstrap.sh
sudo DOKKU_TAG=v0.15.2 bash bootstrap.sh
```
### Bug Fixes
- #3488: @josegonzalez fix: call ps:retire from system service
## 0.15.1
Install/update via the bootstrap script:
```shell
wget https://raw.githubusercontent.com/dokku/dokku/v0.15.1/bootstrap.sh
sudo DOKKU_TAG=v0.15.1 bash bootstrap.sh
```
### Bug Fixes
- #3485: @josegonzalez fix: ensure 'dokku report' always succeeds for any app
## 0.15.0
Install/update via the bootstrap script:
```shell
wget https://raw.githubusercontent.com/dokku/dokku/v0.15.0/bootstrap.sh
sudo DOKKU_TAG=v0.15.0 bash bootstrap.sh
```
### Bug Fixes
- #3479: @josegonzalez Turn off logging for nginx validate configuration
- #3470: @josegonzalez fix: correct the argument for get_release_cmd
### New Features
- #3469: @josegonzalez Resource management
- #3466: @josegonzalez Quieter builds
- #3467: @josegonzalez feat: update golang in use for binary building
- #3465: @josegonzalez Vagrant VM Enhancements
- #3464: @josegonzalez Upgrade to go-procfile-util version 0.6.0
- #3463: @josegonzalez Implement version flags
- #3462: @josegonzalez Upgrade procfile-util
- #3449: @josegonzalez Only override the `WORKDIR` in copy_from_image if the image is `gliderlabs/herokuish` based
- #3461: @josegonzalez Allow skipping aws releases for plugins
- #3459: @josegonzalez Upgrade to herokuish:0.4.9
- #3413: @josegonzalez Implement buildpacks plugin
### Documentation
- #3482: @multikatt rails-database -> railsdatabase
- #3476: @lazyatom Add chrome plugin to documentation
- #3468: @josegonzalez Doc cleanup
### Other
- #3471: @josegonzalez chore: drop plugn package building
## 0.14.6
Install/update via the bootstrap script:

View File

@@ -1,9 +1,10 @@
DOKKU_VERSION ?= master
PROCFILE_VERSION ?= 0.4.0
PROCFILE_VERSION ?= 0.6.0
PLUGN_VERSION ?= 0.3.2
SSHCOMMAND_URL ?= https://raw.githubusercontent.com/dokku/sshcommand/v0.7.0/sshcommand
PROCFILE_UTIL_URL ?= https://github.com/josegonzalez/go-procfile-util/releases/download/v${PROCFILE_VERSION}/procfile-util_${PROCFILE_VERSION}_linux_x86_64.tgz
PLUGN_URL ?= https://github.com/dokku/plugn/releases/download/v0.3.0/plugn_0.3.0_linux_x86_64.tgz
PLUGN_URL ?= https://github.com/dokku/plugn/releases/download/v${PLUGN_VERSION}/plugn_${PLUGN_VERSION}_linux_x86_64.tgz
SIGIL_URL ?= https://github.com/gliderlabs/sigil/releases/download/v0.4.0/sigil_0.4.0_Linux_x86_64.tgz
STACK_URL ?= https://github.com/gliderlabs/herokuish.git
PREBUILT_STACK_URL ?= gliderlabs/herokuish:latest
@@ -31,6 +32,7 @@ include common.mk
.PHONY: all apt-update install version copyfiles copyplugin man-db plugins dependencies sshcommand procfile-util plugn docker aufs stack count dokku-installer vagrant-acl-add vagrant-dokku go-build
include tests.mk
include package.mk
include deb.mk
include rpm.mk
include arch.mk

View File

@@ -98,8 +98,8 @@ A fresh VM running any of the following operating systems:
To install the latest stable release, run the following commands as a user who has access to `sudo`:
```shell
wget https://raw.githubusercontent.com/dokku/dokku/v0.14.6/bootstrap.sh
sudo DOKKU_TAG=v0.14.6 bash bootstrap.sh
wget https://raw.githubusercontent.com/dokku/dokku/v0.15.4/bootstrap.sh
sudo DOKKU_TAG=v0.15.4 bash bootstrap.sh
```
You can then proceed to the ip address or domain name associated with your server to complete the web-based installation.

6
Vagrantfile vendored
View File

@@ -1,7 +1,7 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
BOX_NAME = ENV["BOX_NAME"] || "bento/ubuntu-14.04"
BOX_NAME = ENV["BOX_NAME"] || "bento/ubuntu-18.04"
BOX_CPUS = ENV["BOX_CPUS"] || "1"
BOX_MEMORY = ENV["BOX_MEMORY"] || "1024"
DOKKU_DOMAIN = ENV["DOKKU_DOMAIN"] || "dokku.me"
@@ -33,6 +33,10 @@ Vagrant::configure("2") do |config|
v.vmx["memsize"] = BOX_MEMORY
end
config.vm.provider :vmware_desktop do |v, override|
v.vmx["memsize"] = BOX_MEMORY
end
config.vm.define "empty", autostart: false
config.vm.define "dokku", primary: true do |vm|

View File

@@ -1,4 +1,4 @@
GO_REPO_ROOT := /go/src/github.com/dokku/dokku
BUILD_IMAGE := golang:1.9.1
BUILD_IMAGE := golang:1.12
.PHONY: build-in-docker build clean src-clean

View File

@@ -36,7 +36,7 @@ RUN PLUGIN_MAKE_TARGET=${PLUGIN_MAKE_TARGET} \
SKIP_GO_CLEAN=true \
make version copyfiles \
&& rm -rf plugins/common/*.go plugins/common/glide* plugins/common/vendor/ \
&& make deb-dokku deb-plugn deb-sshcommand deb-sigil \
rpm-dokku rpm-plugn rpm-sshcommand rpm-sigil
&& make deb-dokku deb-sshcommand deb-sigil \
rpm-dokku rpm-sshcommand rpm-sigil
RUN ls -lha /tmp/

View File

@@ -10,7 +10,7 @@ import subprocess
import sys
import threading
VERSION = 'v0.14.6'
VERSION = 'v0.15.4'
hostname = ''
try:

View File

@@ -219,7 +219,7 @@ fn-repo-update() {
if [[ "$RELEASE" == 'patch' ]]; then
fn-replace-version "$CURRENT_VERSION" "$NEXT_VERSION" docs/assets/versions.json
else
versions=$(python -c 'import json,sys;d=json.load(sys.stdin);d["max-versions"].append("'"${NEXT_VERSION}"'"); print json.dumps(d, indent=2, sort_keys=True)' <docs/assets/versions.json)
versions=$(python -c 'import json,sys;d=json.load(sys.stdin);d["max-versions"].append("'"${NEXT_VERSION}"'"); print(json.dumps(d, indent=2, sort_keys=True))' <docs/assets/versions.json)
echo "$versions" >docs/assets/versions.json
git add docs/assets/versions.json
fi

View File

@@ -53,7 +53,7 @@ fn-require-bin() {
}
main() {
local RELEASE="$1"
local RELEASE="$1" AWS_RELEASE="$2"
local CURRENT_VERSION FILENAME NEXT_VERSION ORG_REPO_NAME REPO_NAME major minor patch
if [[ -z "$RELEASE" ]]; then
@@ -91,6 +91,10 @@ EOF
fn-require-bin "git"
if [[ "$AWS_RELEASE" != "true" ]] && [[ "$AWS_RELEASE" != "false" ]]; then
local AWS_RELEASE=true
fi
if [[ "$CI" != "true" ]] && [[ -z "$DOKKU_PLUGIN_GITHUB_ACCESS_TOKEN" ]]; then
log-info "You are running this without a DOKKU_PLUGIN_GITHUB_ACCESS_TOKEN environment variable."
log-info "Doing so disables uploading releases to S3, which may be necessary for installing private plugins."
@@ -104,7 +108,7 @@ EOF
done
fi
if [[ -n "$DOKKU_PLUGIN_GITHUB_ACCESS_TOKEN" ]]; then
if [[ "$AWS_RELEASE" == "true" ]]; then
fn-require-bin "aws"
fn-require-bin "curl"
if [[ -z "$DOKKU_PLUGIN_S3_BUCKET" ]]; then
@@ -156,7 +160,7 @@ EOF
REPO_NAME="$(echo "$ORG_REPO_NAME" | cut -d'/' -f2)"
FILENAME="${REPO_NAME}-${NEXT_VERSION}.tar.gz"
if [[ -n "$DOKKU_PLUGIN_GITHUB_ACCESS_TOKEN" ]]; then
if [[ "$AWS_RELEASE" == "true" ]]; then
DOKKU_PLUGIN_S3_BUCKET="${DOKKU_PLUGIN_S3_BUCKET%/}"
DOKKU_PLUGIN_S3_PATH="${DOKKU_PLUGIN_S3_PATH%/}"
if [[ "$DOKKU_PLUGIN_S3_PATH" != "/" ]]; then

97
deb.mk
View File

@@ -2,7 +2,7 @@ BUILD_DIRECTORY ?= /tmp
HEROKUISH_DESCRIPTION = 'Herokuish uses Docker and Buildpacks to build applications like Heroku'
HEROKUISH_REPO_NAME ?= gliderlabs/herokuish
HEROKUISH_VERSION ?= 0.4.8
HEROKUISH_VERSION ?= 0.5.0
HEROKUISH_ARCHITECTURE = amd64
HEROKUISH_PACKAGE_NAME = herokuish_$(HEROKUISH_VERSION)_$(HEROKUISH_ARCHITECTURE).deb
@@ -16,18 +16,6 @@ DOKKU_UPDATE_VERSION ?= 0.1.0
DOKKU_UPDATE_ARCHITECTURE = amd64
DOKKU_UPDATE_PACKAGE_NAME = dokku-update_$(DOKKU_UPDATE_VERSION)_$(DOKKU_UPDATE_ARCHITECTURE).deb
define PLUGN_DESCRIPTION
Hook system that lets users extend your application with plugins
Plugin triggers are simply scripts that are executed by the system.
You can use any language you want, so long as the script is
executable and has the proper language requirements installed
endef
PLUGN_REPO_NAME ?= dokku/plugn
PLUGN_VERSION ?= 0.3.0
PLUGN_ARCHITECTURE = amd64
PLUGN_PACKAGE_NAME = plugn_$(PLUGN_VERSION)_$(PLUGN_ARCHITECTURE).deb
PLUGN_URL = https://github.com/dokku/plugn/releases/download/v$(PLUGN_VERSION)/plugn_$(PLUGN_VERSION)_linux_x86_64.tgz
define SSHCOMMAND_DESCRIPTION
Turn SSH into a thin client specifically for your app
Simplifies running a single command over SSH, and
@@ -56,11 +44,10 @@ ifndef IS_RELEASE
IS_RELEASE = true
endif
export PLUGN_DESCRIPTION
export SIGIL_DESCRIPTION
export SSHCOMMAND_DESCRIPTION
.PHONY: install-from-deb deb-all deb-herokuish deb-dokku deb-dokku-update deb-plugn deb-setup deb-sshcommand deb-sigil
.PHONY: install-from-deb deb-all deb-herokuish deb-dokku deb-dokku-update deb-setup deb-sshcommand deb-sigil
install-from-deb:
@echo "--> Initial apt-get update"
@@ -76,7 +63,7 @@ install-from-deb:
sudo apt-get update -qq >/dev/null
sudo DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true apt-get install -yy dokku
deb-all: deb-setup deb-herokuish deb-dokku deb-plugn deb-sshcommand deb-sigil deb-dokku-update
deb-all: deb-setup deb-herokuish deb-dokku deb-sshcommand deb-sigil deb-dokku-update
mv $(BUILD_DIRECTORY)/*.deb .
@echo "Done"
@@ -113,53 +100,20 @@ deb-herokuish:
--license 'MIT License' \
.
deb-dokku:
rm -rf /tmp/tmp /tmp/build dokku_*_$(DOKKU_ARCHITECTURE).deb
mkdir -p /tmp/tmp /tmp/build
deb-dokku: /tmp/build-dokku/var/lib/dokku/GIT_REV
rm -f $(BUILD_DIRECTORY)/dokku_*_$(DOKKU_ARCHITECTURE).deb
cp -r debian /tmp/build/DEBIAN
mkdir -p /tmp/build/usr/share/bash-completion/completions
mkdir -p /tmp/build/usr/bin
mkdir -p /tmp/build/usr/share/doc/dokku
mkdir -p /tmp/build/usr/share/dokku/contrib
mkdir -p /tmp/build/usr/share/lintian/overrides
mkdir -p /tmp/build/usr/share/man/man1
mkdir -p /tmp/build/var/lib/dokku/core-plugins/available
cp dokku /tmp/build/usr/bin
cp LICENSE /tmp/build/usr/share/doc/dokku/copyright
cp contrib/bash-completion /tmp/build/usr/share/bash-completion/completions/dokku
find . -name ".DS_Store" -depth -exec rm {} \;
$(MAKE) go-build
cp common.mk /tmp/build/var/lib/dokku/core-plugins/common.mk
cp -r plugins/* /tmp/build/var/lib/dokku/core-plugins/available
find plugins/ -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | while read plugin; do cd /tmp/build/var/lib/dokku/core-plugins/available/$$plugin && if [ -e Makefile ]; then $(MAKE) src-clean; fi; done
find plugins/ -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | while read plugin; do touch /tmp/build/var/lib/dokku/core-plugins/available/$$plugin/.core; done
rm /tmp/build/var/lib/dokku/core-plugins/common.mk
$(MAKE) help2man
$(MAKE) addman
cp /usr/local/share/man/man1/dokku.1 /tmp/build/usr/share/man/man1/dokku.1
gzip -9 /tmp/build/usr/share/man/man1/dokku.1
cp contrib/dokku-installer.py /tmp/build/usr/share/dokku/contrib
ifeq ($(DOKKU_VERSION),master)
git describe --tags > /tmp/build/var/lib/dokku/VERSION
else
echo $(DOKKU_VERSION) > /tmp/build/var/lib/dokku/VERSION
endif
cat /tmp/build/var/lib/dokku/VERSION | cut -d '-' -f 1 | cut -d 'v' -f 2 > /tmp/build/var/lib/dokku/STABLE_VERSION
cat /tmp/build-dokku/var/lib/dokku/VERSION | cut -d '-' -f 1 | cut -d 'v' -f 2 > /tmp/build-dokku/var/lib/dokku/STABLE_VERSION
ifneq (,$(findstring false,$(IS_RELEASE)))
sed -i.bak -e "s/^/`date +%s`:/" /tmp/build/var/lib/dokku/STABLE_VERSION && rm /tmp/build/var/lib/dokku/STABLE_VERSION.bak
sed -i.bak -e "s/^/`date +%s`:/" /tmp/build-dokku/var/lib/dokku/STABLE_VERSION && rm /tmp/build-dokku/var/lib/dokku/STABLE_VERSION.bak
endif
rm -f /tmp/build/DEBIAN/lintian-overrides
cp debian/lintian-overrides /tmp/build/usr/share/lintian/overrides/dokku
ifdef DOKKU_GIT_REV
echo "$(DOKKU_GIT_REV)" > /tmp/build/var/lib/dokku/GIT_REV
else
git rev-parse HEAD > /tmp/build/var/lib/dokku/GIT_REV
endif
sed -i.bak "s/^Version: .*/Version: `cat /tmp/build/var/lib/dokku/STABLE_VERSION`/g" /tmp/build/DEBIAN/control && rm /tmp/build/DEBIAN/control.bak
dpkg-deb --build /tmp/build "$(BUILD_DIRECTORY)/dokku_`cat /tmp/build/var/lib/dokku/VERSION`_$(DOKKU_ARCHITECTURE).deb"
lintian "$(BUILD_DIRECTORY)/dokku_`cat /tmp/build/var/lib/dokku/VERSION`_$(DOKKU_ARCHITECTURE).deb"
cp -r debian /tmp/build-dokku/DEBIAN
rm -f /tmp/build-dokku/DEBIAN/lintian-overrides
cp debian/lintian-overrides /tmp/build-dokku/usr/share/lintian/overrides/dokku
sed -i.bak "s/^Version: .*/Version: `cat /tmp/build-dokku/var/lib/dokku/STABLE_VERSION`/g" /tmp/build-dokku/DEBIAN/control && rm /tmp/build-dokku/DEBIAN/control.bak
dpkg-deb --build /tmp/build-dokku "$(BUILD_DIRECTORY)/dokku_`cat /tmp/build-dokku/var/lib/dokku/VERSION`_$(DOKKU_ARCHITECTURE).deb"
lintian "$(BUILD_DIRECTORY)/dokku_`cat /tmp/build-dokku/var/lib/dokku/VERSION`_$(DOKKU_ARCHITECTURE).deb"
deb-dokku-update:
rm -rf /tmp/dokku-update*.deb dokku-update*.deb
@@ -175,29 +129,6 @@ deb-dokku-update:
contrib/dokku-update=/usr/local/bin/dokku-update \
contrib/dokku-update-version=/var/lib/dokku-update/VERSION
deb-plugn:
rm -rf /tmp/tmp /tmp/build $(PLUGN_PACKAGE_NAME)
mkdir -p /tmp/tmp /tmp/build /tmp/build/usr/bin
@echo "-> Downloading package"
wget -q -O /tmp/tmp/plugn-$(PLUGN_VERSION).tgz $(PLUGN_URL)
cd /tmp/tmp/ && tar zxf /tmp/tmp/plugn-$(PLUGN_VERSION).tgz
@echo "-> Copying files into place"
cp /tmp/tmp/plugn /tmp/build/usr/bin/plugn && chmod +x /tmp/build/usr/bin/plugn
@echo "-> Creating $(PLUGN_PACKAGE_NAME)"
sudo fpm -t deb -s dir -C /tmp/build -n plugn \
--version $(PLUGN_VERSION) \
--architecture $(PLUGN_ARCHITECTURE) \
--package $(BUILD_DIRECTORY)/$(PLUGN_PACKAGE_NAME) \
--url "https://github.com/$(PLUGN_REPO_NAME)" \
--maintainer "Jose Diaz-Gonzalez <dokku@josediazgonzalez.com>" \
--category utils \
--description "$$PLUGN_DESCRIPTION" \
--license 'MIT License' \
.
deb-sshcommand:
rm -rf /tmp/tmp /tmp/build $(SSHCOMMAND_PACKAGE_NAME)
mkdir -p /tmp/tmp /tmp/build /tmp/build/usr/local/bin

2
debian/control vendored
View File

@@ -1,5 +1,5 @@
Package: dokku
Version: 0.14.6
Version: 0.15.4
Section: web
Priority: optional
Architecture: amd64

View File

@@ -44,7 +44,7 @@ dokku docker-options:add node-js-app run "-v /var/log/node-js-app:/app/logs"
dokku docker-options:remove node-js-app run "-v /var/log/node-js-app:/app/logs"
```
### Displaying docker-options reports about an app
### Displaying docker-options reports for an app
> New as of 0.8.1
@@ -77,9 +77,9 @@ dokku docker-options:report node-js-app
```
=====> node-js-app docker options information
Storage build mounts:
Storage deploy mounts: -v /var/log/node-js-app:/app/logs
Storage run mounts: -v /var/log/node-js-app:/app/logs
Docker options build:
Docker options deploy: -v /var/log/node-js-app:/app/logs
Docker options run: -v /var/log/node-js-app:/app/logs
```
You can pass flags which will output only the value of the specific information you want. For example:
@@ -88,7 +88,6 @@ You can pass flags which will output only the value of the specific information
dokku docker-options:report node-js-app --docker-options-build
```
## Advanced usage
In your applications folder `/home/dokku/app_name` create a file called `DOCKER_OPTIONS_RUN` (or `DOCKER_OPTIONS_BUILD` or `DOCKER_OPTIONS_DEPLOY`).

View File

@@ -65,7 +65,7 @@ dokku storage:mount app-name /var/lib/dokku/data/storage/node-js-app:/app/storag
You can mount one or more directories as desired by following the above pattern.
### Displaying storage reports about an app
### Displaying storage reports for an app
> New as of 0.8.1

View File

@@ -31,31 +31,31 @@ dokku plugin
```
plugn: dev
00_dokku-standard 0.14.6 enabled dokku core standard plugin
20_events 0.14.6 enabled dokku core events logging plugin
apps 0.14.6 enabled dokku core apps plugin
build-env 0.14.6 enabled dokku core build-env plugin
certs 0.14.6 enabled dokku core certificate management plugin
checks 0.14.6 enabled dokku core checks plugin
common 0.14.6 enabled dokku core common plugin
config 0.14.6 enabled dokku core config plugin
docker-options 0.14.6 enabled dokku core docker-options plugin
domains 0.14.6 enabled dokku core domains plugin
enter 0.14.6 enabled dokku core enter plugin
git 0.14.6 enabled dokku core git plugin
logs 0.14.6 enabled dokku core logs plugin
named-containers 0.14.6 enabled dokku core named containers plugin
network 0.14.6 enabled dokku core network plugin
nginx-vhosts 0.14.6 enabled dokku core nginx-vhosts plugin
plugin 0.14.6 enabled dokku core plugin plugin
proxy 0.14.6 enabled dokku core proxy plugin
ps 0.14.6 enabled dokku core ps plugin
repo 0.14.6 enabled dokku core repo plugin
shell 0.14.6 enabled dokku core shell plugin
ssh-keys 0.14.6 enabled dokku core ssh-keys plugin
storage 0.14.6 enabled dokku core storage plugin
tags 0.14.6 enabled dokku core tags plugin
tar 0.14.6 enabled dokku core tar plugin
00_dokku-standard 0.15.4 enabled dokku core standard plugin
20_events 0.15.4 enabled dokku core events logging plugin
apps 0.15.4 enabled dokku core apps plugin
build-env 0.15.4 enabled dokku core build-env plugin
certs 0.15.4 enabled dokku core certificate management plugin
checks 0.15.4 enabled dokku core checks plugin
common 0.15.4 enabled dokku core common plugin
config 0.15.4 enabled dokku core config plugin
docker-options 0.15.4 enabled dokku core docker-options plugin
domains 0.15.4 enabled dokku core domains plugin
enter 0.15.4 enabled dokku core enter plugin
git 0.15.4 enabled dokku core git plugin
logs 0.15.4 enabled dokku core logs plugin
named-containers 0.15.4 enabled dokku core named containers plugin
network 0.15.4 enabled dokku core network plugin
nginx-vhosts 0.15.4 enabled dokku core nginx-vhosts plugin
plugin 0.15.4 enabled dokku core plugin plugin
proxy 0.15.4 enabled dokku core proxy plugin
ps 0.15.4 enabled dokku core ps plugin
repo 0.15.4 enabled dokku core repo plugin
shell 0.15.4 enabled dokku core shell plugin
ssh-keys 0.15.4 enabled dokku core ssh-keys plugin
storage 0.15.4 enabled dokku core storage plugin
tags 0.15.4 enabled dokku core tags plugin
tar 0.15.4 enabled dokku core tar plugin
```
Installing a plugin is easy as well using the `plugin:install` command. This command will also trigger the `install` pluginhook on all existing plugins.

View File

@@ -0,0 +1,381 @@
# Resource Management
> New as of 0.15.0
```
resource:limit [--process-type <process-type>] [RESOURCE_OPTS...] <app> # Limit resources for a given app/process-type combination
resource:limit-clear [--process-type <process-type>] <app> # Limit resources for a given app/process-type combination
resource:report [<app>] [<flag>] # Displays a resource report for one or more apps
resource:reserve [--process-type <process-type>] [RESOURCE_OPTS...] <app> # Reserve resources for a given app/process-type combination
resource:reserve-clear [--process-type <process-type>] <app> # Reserve resources for a given app/process-type combination
```
The resource plugin is meant to allow users to limit or reserve resources for a given app/process-type combination.
## Usage
By default, Dokku allows unlimited resource access to apps deployed on a server. In some cases, it may be desirable to limit this on a per-app or per-process-type basis. The `resource` plugin allows management of both resource "limits" and resource "reservations", where each resource request type has specific meaning to the scheduler in use for a given app.
> The meaning of a values and it's units are specific to the scheduler in use for a given app. If a scheduler does not support a given resource type combination, it will be ignored. All resource commands require an app rebuild or deploy in order to take effect.
Valid resource options include:
- `--cpu`
- `--memory`
- `--memory-swap`
- `--network`
- `--network-ingress`
- `--network-egress`
Resource limits and reservations are applied only during the `run` and `deploy` phases of an application, and will not impact the `build` phase of an application.
### Resource Limits
When specified and supported, a resource limit will ensure that your app does not go _over_ the specified value. If this occurs, the underlying scheduler may either cap resource utilization, or it may decide to terminate and reschedule your process.
Resource limits may be set via the `resource:limit` command:
```shell
dokku resource:limit --memory 100 node-js-app
```
```
=====> Setting resource limits for node-js-app
memory: 100
```
Multiple resources can be limited in a single call:
```shell
dokku resource:limit --cpu 100 --memory 100 node-js-app
```
```
=====> Setting resource limits for node-js-app
cpu: 100
memory: 100
```
Resources can also be limited on a per-process type basis. If specified, this will override any generic limits set for the app.
```shell
dokku resource:limit --cpu 100 --memory 100 --process-type worker node-js-app
```
```
=====> Setting resource limits for node-js-app (worker)
cpu: 100
memory: 100
```
#### Displaying Resource Limits
Running the `resource:limits` command without any flags will display the currently configured app reservation.
```shell
dokku resource:limits node-js-app
=====> resource limits node-js-app information
cpu: 100
memory: 100
memory-swap:
network:
network-ingress:
network-egress:
```
#### Global Resource Limits
By default, Dokku does not limit any resources, though these can be specified at the server level via the `--global` flag on the `resource:limit` command.
```shell
dokku resource:limit --global --memory 200
```
```
=====> Setting default resource limits
memory: 200
```
This may also be combined with the `--process-type` flag to set global limits on a process-type level:
```shell
dokku resource:limit --global --memory 150 --process-type web node-js-app
```
```
=====> Setting default resource limits (web)
memory: 150
```
#### Displaying Global Resource Limits
Running the `resource:limit` command with only the `--global` flag will display the currently configured default limits.
```shell
dokku resource:limit --global
```
```
=====> resource limits default information
cpu:
memory: 200
memory-swap:
network:
network-ingress:
network-egress:
```
This may also be combined with the `--process-type` flag to see global limits on a process-type level:
```shell
dokku resource:limit --global --process-type web
```
```
=====> resource limits default information (web)
cpu:
memory-swap:
memory: 150
network-egress:
network-ingress:
network:
```
#### Clearing Resource Limits
In cases where the values are incorrect - or there is no desire to limit resources - resource limits may be cleared using the `resource:limit-clear` command.
```shell
dokku resource:limit-clear node-js-app
```
```
-----> Clearing resource limit for node-js-app
```
Defaults can also be cleared by leaving the app unspecified.
```shell
dokku resource:limit-clear
```
```
-----> Clearing default resource limits
```
### Resource Reservations
When specified and supported, a resource reservation will ensure that your server has _at least_ the specified resources before placing a given app's process. If there a resource exhaustion, future rebuilds and deploys may fail.
Resource reservations may be set via the `resource:reserve` command:
```shell
dokku resource:reserve --memory 100 node-js-app
```
```
=====> Setting resource reservation for node-js-app
memory: 100
```
Multiple resources can be limited in a single call:
```shell
dokku resource:reserve --cpu 100 --memory 100 node-js-app
```
```
=====> Setting resource reservation for node-js-app
cpu: 100
memory: 100
```
Resources can also be limited on a per-process type basis. If specified, this will override any generic limits set for the app.
```shell
dokku resource:reserve --cpu 100 --memory 100 --process-type worker node-js-app
```
```
=====> Setting resource reservation for node-js-app (worker)
cpu: 100
memory: 100
```
#### Displaying Resource Reservations
Running the `resource:reserve` command without any flags will display the currently configured app reservation.
```shell
dokku resource:reserve node-js-app
=====> resource reservation node-js-app information
cpu: 100
memory: 100
memory-swap:
network:
network-ingress:
network-egress:
```
#### Global Resource Reservations
By default, Dokku does not reserve any resources, though these can be specified at the server level via the `--global` flag on the `resource:reserve` command.
```shell
dokku resource:reserve --global --memory 200
```
```
=====> Setting default resource reservation
memory: 200
```
This may also be combined with the `--process-type` flag to set global reservations on a process-type level:
```shell
dokku resource:reserve --global --memory 150 --process-type web node-js-app
```
```
=====> Setting default resource reservation (web)
memory: 150
```
#### Displaying Global Resource Reservations
Running the `resource:reserve` command with only the `--global` flag will display the currently configured default reservation.
```shell
dokku resource:reserve --global
```
```
=====> resource reservation default information
cpu:
memory: 200
memory-swap:
network:
network-ingress:
network-egress:
```
This may also be combined with the `--process-type` flag to see global reservations on a process-type level:
```shell
dokku resource:reserve --global --process-type web
```
```
=====> resource reservation default information (web)
cpu:
memory-swap:
memory: 150
network-egress:
network-ingress:
network:
```
#### Clearing Resource Reservations
In cases where the values are incorrect - or there is no desire to reserve resources - resource reservations may be cleared using the `resource:reserve-clear` command.
```shell
dokku resource:reserve-clear node-js-app
```
```
-----> Clearing resource reservation for node-js-app
```
Defaults can also be cleared by leaving the app unspecified.
```shell
dokku resource:reserve-clear
```
```
-----> Clearing default resource reservation
```
### Displaying resource reports for an app
You can get a report about the app's resource status using the `resource:report` command:
```shell
dokku resource:report
```
```
=====> node-js-app resource information
web limit cpu:
web limit memory: 1024
web limit memory swap: 0
web limit network: 10
web limit network ingress:
web limit network egress:
web reservation cpu:
web reservation memory: 512
web reservation memory swap:
web reservation network: 8
web reservation network ingress:
web reservation network egress:
=====> python-sample resource information
web limit cpu:
web limit memory:
web limit memory swap:
web limit network:
web limit network ingress:
web limit network egress:
web reservation cpu:
web reservation memory:
web reservation memory swap:
web reservation network:
web reservation network ingress:
web reservation network egress:
=====> ruby-sample resource information
web limit cpu:
web limit memory:
web limit memory swap:
web limit network:
web limit network ingress:
web limit network egress:
web reservation cpu:
web reservation memory:
web reservation memory swap:
web reservation network:
web reservation network ingress:
web reservation network egress:
```
You can run the command for a specific app also.
```shell
dokku resource:report node-js-app
```
```
=====> node-js-app resource information
web limit cpu:
web limit memory: 1024
web limit memory swap: 0
web limit network: 10
web limit network ingress:
web limit network egress:
web reservation cpu:
web reservation memory: 512
web reservation memory swap:
web reservation network: 8
web reservation network ingress:
web reservation network egress:
```
You can pass flags which will output only the value of the specific information you want. For example:
```shell
# Note the periods in the flag name
dokku resource:report node-js-app --resource-web.limit.memory
```
```
1024
```

View File

@@ -43,13 +43,32 @@ This plugin implements various functionality through `plugn` triggers to integra
- `check-deploy`
- `core-post-deploy`
- `post-app-clone-setup`
- `post-create`
- `post-delete`
- `pre-deploy`
- `pre-restore`
- `scheduler-deploy`
- `scheduler-docker-cleanup`
- `scheduler-inspect`
- `scheduler-logs-failed`
- `scheduler-logs`
- `scheduler-retire`
- `scheduler-run`
- `scheduler-stop`
- `scheduler-tags-create`
- `scheduler-tags-destroy`
## Supported Resource Management Properties
The `docker-local` scheduler supports a minimal list of resource _limits_ and _reservations_. The following properties are supported:
### Resource Limits
- cpu: (docker option: `--cpus`), and is specified in number of CPUs a process can access.
- memory: (docker option: `--memory`) and should be specified with a suffix of `b` (bytes), `k` (kilobytes), `m` (megabytes), `g` (gigabytes)
- memory-swap: (docker option: `--memory-swap`) and should be specified with a suffix of `b` (bytes), `k` (kilobytes), `m` (megabytes), `g` (gigabytes)
### Resource Reservations
- memory: (docker option: `--memory-reservation`) and should be specified with a suffix of `b` (bytes), `k` (kilobytes), `m` (megabytes), `g` (gigabytes)

View File

@@ -2,10 +2,10 @@
<browserconfig>
<msapplication>
<tile>
<square70x70logo src="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.14.6/docs/assets/favicons/mstile-70x70.png"/>
<square150x150logo src="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.14.6/docs/assets/favicons/mstile-150x150.png"/>
<square310x310logo src="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.14.6/docs/assets/favicons/mstile-310x310.png"/>
<wide310x150logo src="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.14.6/docs/assets/favicons/mstile-310x150.png"/>
<square70x70logo src="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.15.4/docs/assets/favicons/mstile-70x70.png"/>
<square150x150logo src="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.15.4/docs/assets/favicons/mstile-150x150.png"/>
<square310x310logo src="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.15.4/docs/assets/favicons/mstile-310x310.png"/>
<wide310x150logo src="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.15.4/docs/assets/favicons/mstile-310x150.png"/>
<TileColor>#da532c</TileColor>
</tile>
</msapplication>

View File

@@ -2,37 +2,37 @@
"name": "Dokku",
"icons": [
{
"src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.14.6\/docs\/assets\/favicons\/android-chrome-36x36.png",
"src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.15.4\/docs\/assets\/favicons\/android-chrome-36x36.png",
"sizes": "36x36",
"type": "image\/png",
"density": "0.75"
},
{
"src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.14.6\/docs\/assets\/favicons\/android-chrome-48x48.png",
"src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.15.4\/docs\/assets\/favicons\/android-chrome-48x48.png",
"sizes": "48x48",
"type": "image\/png",
"density": "1.0"
},
{
"src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.14.6\/docs\/assets\/favicons\/android-chrome-72x72.png",
"src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.15.4\/docs\/assets\/favicons\/android-chrome-72x72.png",
"sizes": "72x72",
"type": "image\/png",
"density": "1.5"
},
{
"src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.14.6\/docs\/assets\/favicons\/android-chrome-96x96.png",
"src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.15.4\/docs\/assets\/favicons\/android-chrome-96x96.png",
"sizes": "96x96",
"type": "image\/png",
"density": "2.0"
},
{
"src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.14.6\/docs\/assets\/favicons\/android-chrome-144x144.png",
"src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.15.4\/docs\/assets\/favicons\/android-chrome-144x144.png",
"sizes": "144x144",
"type": "image\/png",
"density": "3.0"
},
{
"src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.14.6\/docs\/assets\/favicons\/android-chrome-192x192.png",
"src": "https:\/\/cdn.rawgit.com\/progrium\/dokku\/v0.15.4\/docs\/assets\/favicons\/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image\/png",
"density": "4.0"

View File

@@ -39,13 +39,13 @@ h1 {
font-size: 1.6em;
}
.header .navbar-brand a {
background-image: url(https://cdn.jsdelivr.net/gh/dokku/dokku@v0.14.6/docs/assets/dokku.png);
background-image: url(https://cdn.jsdelivr.net/gh/dokku/dokku@v0.15.4/docs/assets/dokku.png);
text-indent: 40px;
}
.blurb {
color: #424242;
background-color: #ededed;
background-image: url(https://cdn.jsdelivr.net/gh/dokku/dokku@v0.14.6/docs/assets/gplaypattern.png);
background-image: url(https://cdn.jsdelivr.net/gh/dokku/dokku@v0.15.4/docs/assets/gplaypattern.png);
padding: 45px 0;
text-align: center;
}

View File

@@ -1,16 +1,17 @@
{
"max-versions": [
"0.3.26",
"0.4.14",
"0.5.8",
"0.6.5",
"0.7.2",
"0.8.2",
"0.9.4",
"0.10.5",
"0.11.6",
"0.12.13",
"0.13.4",
"0.14.6"
"0.3.26",
"0.4.14",
"0.5.8",
"0.6.5",
"0.7.2",
"0.8.2",
"0.9.4",
"0.10.5",
"0.11.6",
"0.12.13",
"0.13.4",
"0.14.6",
"0.15.4"
]
}

View File

@@ -127,6 +127,7 @@ The following plugins are available and provided by Dokku maintainers. Where not
[fteychene]: https://github.com/fteychene
[sarendsen]: https://github.com/sarendsen
[baikunz]: https://github.com/baikunz
[lazyatom]: https://github.com/lazyatom
### Datastores
@@ -166,6 +167,7 @@ The following plugins are available and provided by Dokku maintainers. Where not
| [FakeSNS](https://github.com/cu12/dokku-fake_sns) | [cu12][] | 0.5.0+ |
| [InfluxDB](https://github.com/basgys/dokku-influxdb) | [basgys][] | 0.4.x |
| [RethinkDB](https://github.com/stuartpb/dokku-rethinkdb-plugin) | [stuartpb][] | 0.3.x |
| [Headless Chrome](https://github.com/lazyatom/dokku-chrome) | [lazyatom][] | 0.8.1+ |
[dccee02]: https://github.com/jeffutter/dokku-riakcs-plugin/commit/dccee02702e7001851917b7814e78a99148fb709
[c77cbf1]: https://github.com/dokku/dokku/commit/c77cbf1d3ae07f0eafb85082ed7edcae9e836147

View File

@@ -10,7 +10,7 @@ domains:disable <app> # Disable VHOST support
domains:enable <app> # Enable VHOST support
domains:remove <app> <domain> [<domain> ...] # Remove domains from app
domains:remove-global <domain> [<domain> ...] # Remove global domain names
domains:report [<app>] [<flag>] # Displays a domains report for one or more apps
domains:report [<app>|--global] [<flag>] # Displays a domains report for one or more apps
domains:set <app> <domain> [<domain> ...] # Set domains for app
domains:set-global <domain> [<domain> ...] # Set global domain names
```
@@ -75,7 +75,7 @@ dokku domains:remove node-js-app dokku.me
dokku domains:set node-js-app dokku.me dokku.org
```
## Displaying domains reports about an app
## Displaying domains reports for an app
> New as of 0.8.1

View File

@@ -56,7 +56,7 @@ If you decide to obtain a CA signed certificate, you can import that certificate
The `certs:remove` command only works on app-specific certificates. It will `rm` the app-specific tls directory, rebuild the nginx configuration, and reload nginx.
### Displaying certificate reports about an app
### Displaying certificate reports for an app
> New as of 0.8.1

View File

@@ -32,8 +32,8 @@ When you create a new app, Dokku by default *does not* provide any datastores su
# plugin installation requires root, hence the user change
sudo dokku plugin:install https://github.com/dokku/dokku-postgres.git
# create a postgres service with the name rails-database
dokku postgres:create rails-database
# create a postgres service with the name railsdatabase
dokku postgres:create railsdatabase
```
> Each service may take a few moments to create.
@@ -45,7 +45,7 @@ Once the service creation is complete, set the `DATABASE_URL` environment variab
```shell
# on the Dokku host
# each official datastore offers a `link` method to link a service to any application
dokku postgres:link rails-database ruby-rails-sample
dokku postgres:link railsdatabase ruby-rails-sample
```
> You can link a single service to multiple applications or use one service per application.

View File

@@ -217,7 +217,7 @@ dokku apps:locked node-js-app
Deploy lock does not exist
```
### Displaying reports about an app
### Displaying reports for an app
> New as of 0.8.1

View File

@@ -1,13 +1,165 @@
# Buildpack Deployment
> Subcommands new as of 0.15.0
```
buildpacks:add [--index 1] <app> <buildpack> # Add new app buildpack while inserting into list of buildpacks if necessary
buildpacks:clear <app> # Clear all buildpacks set on the app
buildpacks:list <app> # List all buildpacks for an app
buildpacks:remove <app> <buildpack> # Remove a buildpack set on the app
buildpacks:report [<app>] [<flag>] # Displays a buildpack report for one or more apps
buildpacks:set [--index 1] <app> <buildpack> # Set new app buildpack at a given position defaulting to the first buildpack if no index is specified
```
> Warning: If using the `buildpacks` plugin, be sure to unset any `BUILDPACK_URL` and remove any such entries from a committed `.env` file. A specified `BUILDPACK_URL` will always override a `.buildpacks` file or the buildpacks plugin.
Dokku normally defaults to using [Heroku buildpacks](https://devcenter.heroku.com/articles/buildpacks) for deployment, though this may be overridden by committing a valid `Dockerfile` to the root of your repository and pushing the repository to your Dokku installation. To avoid this automatic `Dockerfile` deployment detection, you may do one of the following:
- Use `dokku config:set` to set the `BUILDPACK_URL` environment variable.
- Add `BUILDPACK_URL` to a committed `.env` file in the root of your repository.
- See the [environment variable documentation](/docs/configuration/environment-variables.md) for more details.
- Set a `BUILDPACK_URL` environment variable
- This can be done via `dokku config:set` or via a committed `.env` file in the root of the repository. See the [environment variable documentation](/docs/configuration/environment-variables.md) for more details.
- Create a `.buildpacks` file in the root of your repository.
- This can be via a committed `.buildpacks` file or managed via the `buildpacks` plugin commands.
## Switching from Dockerfile deployments
This page will cover usage of the `buildpacks` plugin.
## Usage
### Listing Buildpacks in Use
The `buildpacks:list` command can be used to show buildpacks that have been set for an app. This will omit any auto-detected buildpacks.
```shell
# running for an app with no buildpacks specified
dokku buildpacks:list node-js-app
```
```
-----> test buildpack urls
```
```shell
# running for an app with two buildpacks specified
dokku buildpacks:list node-js-app
```
```
-----> test buildpack urls
https://github.com/heroku/heroku-buildpack-python.git
https://github.com/heroku/heroku-buildpack-nodejs.git
```
### Adding custom buildpacks
> Please check the documentation for your particular buildpack as you may need to include configuration files (such as a Procfile) in your project root.
To add a custom buildpack, use the `buildpacks:add` command:
```shell
dokku buildpacks:add node-js-app https://github.com/heroku/heroku-buildpack-nodejs.git
```
When no buildpacks are currently specified, the specified buildpack will be the only one executed for detection and compilation.
Multiple buildpacks may be specified by using the `buildpacks:add` command multiple times.
```shell
dokku buildpacks:add node-js-app https://github.com/heroku/heroku-buildpack-ruby.git
dokku buildpacks:add node-js-app https://github.com/heroku/heroku-buildpack-nodejs.git
```
Buildpacks are executed in order, may be inserted at a specified index via the `--index` flag. This flag is specified starting at a 1-index value.
```shell
# will add the golang buildpack at the second position, bumping all proceeding ones by 1 position
dokku buildpacks:add --index 2 node-js-app https://github.com/heroku/heroku-buildpack-golang.git
```
### Overwriting a buildpack position
In some cases, it may be necessary to swap out a given buildpack. Rather than needing to re-specify each buildpack, the `buildpacks:set` command can be used to overwrite a buildpack at a given position.
```shell
dokku buildpacks:set node-js-app https://github.com/heroku/heroku-buildpack-ruby.git
```
By default, this will overwrite the _first_ buildpack specified. To specify an index, the `--index` flag may be used. This flag is specified starting at a 1-index value, and defaults to `1`.
```shell
# the following are equivalent commands
dokku buildpacks:set node-js-app https://github.com/heroku/heroku-buildpack-ruby.git
dokku buildpacks:set --index 1 node-js-app https://github.com/heroku/heroku-buildpack-ruby.git
```
If the index specified is larger than the number of buildpacks currently configured, the buildpack will be appended to the end of the list.
```shell
dokku buildpacks:set --index 99 node-js-app https://github.com/heroku/heroku-buildpack-ruby.git
```
### Removing a buildpack
> At least one of a buildpack or index must be specified
A single buildpack can be removed by name via the `buildpacks:remove` command.
```shell
dokku buildpacks:remove node-js-app https://github.com/heroku/heroku-buildpack-ruby.git
```
Buildpacks can also be removed by index via the `--index` flag. This flag is specified starting at a 1-index value.
```shell
dokku buildpacks:remove node-js-app --index 1
```
### Clearing all buildpacks
> This does not affect automatically detected buildpacks, nor does it impact any specified `BUILDPACK_URL` environment variable.
The `buildpacks:clear` command can be used to clear all configured buildpacks for a specified app.
```shell
dokku buildpacks:clear node-js-app
```
### Displaying buildpack reports for an app
You can get a report about the app's buildpacks status using the `buildpacks:report` command:
```shell
dokku buildpacks:report
```
```
=====> node-js-app buildpacks information
Buildpacks list: https://github.com/heroku/heroku-buildpack-nodejs.git
=====> python-sample buildpacks information
Buildpacks list: https://github.com/heroku/heroku-buildpack-nodejs.git,https://github.com/heroku/heroku-buildpack-python.git
=====> ruby-sample buildpacks information
Buildpacks list:
```
You can run the command for a specific app also.
```shell
dokku buildpacks:report node-js-app
```
```
=====> node-js-app buildpacks information
Buildpacks list: https://github.com/heroku/heroku-buildpack-nodejs.git
```
You can pass flags which will output only the value of the specific information you want. For example:
```shell
dokku buildpacks:report node-js-app --buildpacks-list
```
## Errata
### Switching from Dockerfile deployments
If an application was previously deployed via Dockerfile, the following commands should be run before a buildpack deploy will succeed:
@@ -15,54 +167,25 @@ If an application was previously deployed via Dockerfile, the following commands
dokku config:unset --no-restart node-js-app DOKKU_DOCKERFILE_CMD DOKKU_DOCKERFILE_ENTRYPOINT DOKKU_PROXY_PORT_MAP
```
## Specifying a custom buildpack
In certain cases you may want to specify a custom buildpack. While Dokku uses Herokuish to support all the [official Heroku buildpacks](https://github.com/gliderlabs/herokuish#buildpacks), it is possible that the buildpack detection does not work well for your application. As well, you may wish to use a custom buildpack to handle specific application logic.
To use a specific buildpack, you can run the following Dokku command:
```shell
# replace REPOSITORY_URL with your buildpack's url
dokku config:set node-js-app BUILDPACK_URL=REPOSITORY_URL
# example: using a specific ruby buildpack version
dokku config:set node-js-app BUILDPACK_URL=https://github.com/heroku/heroku-buildpack-ruby.git#v142
```
Please check the documentation for your particular buildpack as you may need to include configuration files (such as a Procfile) in your project root.
## Using multiple buildpacks
You can only set a single buildpack using the `BUILDPACK_URL`, though there may be times when you wish to use multiple buildpacks. To do so, simply create a `.buildpacks` file in the base of your repository. This file should list all the buildpacks, one-per-line. For instance, if you wish to use both the `nodejs` and `ruby` buildpacks, your `.buildpacks` file should contain the following:
```shell
https://github.com/heroku/heroku-buildpack-nodejs.git#v87
https://github.com/heroku/heroku-buildpack-ruby.git#v142
```
### Using a specific buildpack version
> Always remember to pin your buildpack versions when using the multi-buildpacks method, or you may find deploys changing your deployed environment.
You may also choose to set just a single buildpack in this file, though that is up to you.
Please check the documentation for your particular buildpack(s) as you may need to include configuration files (such as a Procfile) in your project root.
## Using a specific buildpack version
As Dokku pins all buildpacks via Herokuish releases, there may be occasions where a local buildpack version is out of date. If you wish to use a more recent version of the buildpack, you may use any of the above methods to specify a buildpack *without* the Git SHA attached like so:
By default, Dokku uses the [gliderlabs/herokuish](https://github.com/gliderlabs/herokuish/) project, which pins all of it's vendored buildpacks. There may be occasions where the pinned version results in a broken deploy, or does not have a particular feature that is required to build your project. To use a more recent version of a given buildpack, the buildpack may be specified *without* a Git commit SHA like so:
```shell
# using the latest nodejs buildpack
dokku config:set node-js-app BUILDPACK_URL=https://github.com/heroku/heroku-buildpack-nodejs
dokku buildpacks:set node-js-app https://github.com/heroku/heroku-buildpack-nodejs
```
You may also wish to use a *specific* version of a buildpack, which is also simple
This will use the latest commit on the `master` branch of the specified buildpack. To pin to a newer version of a buildpack, a sha may also be specified by using the form `REPOSITORY_URL#COMMIT_SHA`, where `COMMIT_SHA` is any tree-ish git object - usually a git tag.
```shell
# using v87 of the nodejs buildpack
dokku config:set node-js-app BUILDPACK_URL=https://github.com/heroku/heroku-buildpack-nodejs#v87
dokku buildpacks:set node-js-app https://github.com/heroku/heroku-buildpack-nodejs#v87
```
## Specifying commands via Procfile
### Specifying commands via Procfile
While many buildpacks have a default command that is run when a detected repository is pushed, it is possible to override this command via a Procfile. A Procfile can also be used to specify multiple commands, each of which is subject to process scaling. See the [process scaling documentation](/docs/deployment/process-management.md) for more details around scaling individual processes.
@@ -87,17 +210,18 @@ importantworker: env QUEUE=important bundle exec rake resque:work
The `web` process type holds some significance in that it is the only process type that is automatically scaled to `1` on the initial application deploy. See the [process scaling documentation](/docs/deployment/process-management.md) for more details around scaling individual processes.
## cURL build timeouts
Certain buildpacks may time out in retrieving dependencies via cURL. This can happen when your network connection is poor or if there is significant network congestion. You may see a message similar to `gzip: stdin: unexpected end of file` after a cURL command.
### `curl` build timeouts
If you see output similar this when deploying , you may need to override the cURL timeouts to increase the length of time allotted to those tasks. You can do so via the `config` plugin:
Certain buildpacks may time out in retrieving dependencies via `curl`. This can happen when your network connection is poor or if there is significant network congestion. You may see a message similar to `gzip: stdin: unexpected end of file` after a `curl` command.
If you see output similar this when deploying , you may need to override the `curl` timeouts to increase the length of time allotted to those tasks. You can do so via the `config` plugin:
```shell
dokku config:set --global CURL_TIMEOUT=1200
dokku config:set --global CURL_CONNECT_TIMEOUT=180
```
## Clearing buildpack cache
### Clearing buildpack cache
See the [repository management documentation](/docs/advanced-usage/repository-management.md#clearing-app-cache).

View File

@@ -70,7 +70,7 @@ dokku checks:disable node-js-app worker
DOKKU_CHECKS_SKIPPED: web
```
### Displaying checks reports about an app
### Displaying checks reports for an app
> New as of 0.8.1

View File

@@ -1,37 +1,37 @@
# Plugin Creation
# Plugin creation
Plugins can simply be implementations of [triggers](/docs/development/plugin-triggers.md) or they may implement a command structure of their own. Dokku has no restrictions on the language in which a plugin is implemented, it only cares that the plugin implements the appropriate [commands](/docs/development/plugin-creation.md#command-api) or [triggers](/docs/development/plugin-triggers.md) API. NOTE: all files that implement the triggers or commands API must be executable.
A plugin can be a simple implementation of [triggers](/docs/development/plugin-triggers.md) or can implement a command structure of its own. Dokku has no restrictions on the language in which a plugin is implemented; it only cares that the plugin implements the appropriate [commands](/docs/development/plugin-creation.md#command-api) or [triggers](/docs/development/plugin-triggers.md) for the API. **NOTE:** any file that implements triggers or uses the command API must be executable.
If you create your own plugin:
1. Take a look at the plugins shipped with Dokku and hack away!
2. Check out the [list of triggers](/docs/development/plugin-triggers.md) your plugin can implement.
3. Upload your plugin to github with a repository name in form of `dokku-<name>` (e.g. `dokku-mariadb`)
4. Edit [this page](/docs/community/plugins.md) and add a link to it.
1. Take a look at [the plugins shipped with Dokku](/docs/community/plugins.md) and hack away!
2. Check out the [list of triggers](/docs/development/plugin-triggers.md) your plugin can implement
3. Upload your plugin to GitHub with a repository name following the `dokku-<name>` convention (e.g. `dokku-mariadb`)
4. Edit [this page](/docs/community/plugins.md) and add a link to your plugin
5. Subscribe to the [dokku development blog](http://progrium.com) to be notified about API changes and releases
### Compilable Plugins (i.e. golang, java(?), c, etc.)
The plugin developer is required to implement the `install` trigger such that it will output your built executable(s) in the correct directory structure to implement the plugin's desired command and/or trigger API. See [smoke-test-plugin](https://github.com/dokku/smoke-test-plugin) for an example.
## Compilable plugins (Golang, Java(?), C, etc.)
When developing a plugin, you must implement the `install` trigger such that it outputs the built executable(s) using a directory structure that implements the plugin's desired command and/or triggers the API. See the [smoke-test-plugin](https://github.com/dokku/smoke-test-plugin) for an example.
### Command API
There are 3 main implementation points: `commands`, `subcommands/default`, and `subcommands/<command-name>`
## Command API
There are 3 main integration points: `commands`, `subcommands/default`, and `subcommands/<command-name>`.
#### commands
Primarily used to supply the plugin's usage/help output. (i.e. [plugin help](https://github.com/dokku/dokku/tree/master/plugins/plugin/commands))
### `commands`
Primarily used to supply the plugin's usage/help output. (i.e. [plugin help](https://github.com/dokku/dokku/tree/master/plugins/plugin/commands)).
#### subcommands/default
Implements the plugin's default command behavior. (i.e. [`dokku plugin`](https://github.com/dokku/dokku/tree/master/plugins/plugin/subcommands/default))
### `subcommands/default`
Implements the plugin's default command behavior. (i.e. [`dokku plugin`](https://github.com/dokku/dokku/tree/master/plugins/plugin/subcommands/default)).
#### subcommands/<command-name>
Implements the additional command interface and will translate to `dokku plugin:cmd` on the command line. (i.e. [`dokku plugin:install`](https://github.com/dokku/dokku/tree/master/plugins/plugin/subcommands/install))
### `subcommands/<command-name>`
Implements the additional command interface and will translate to `dokku plugin:cmd` on the command line. (i.e. [`dokku plugin:install`](https://github.com/dokku/dokku/tree/master/plugins/plugin/subcommands/install)).
### Sample plugin
# Sample plugin
The below plugin is a dummy `dokku hello` plugin.
hello/subcommands/default
`hello/subcommands/default`
```shell
#!/usr/bin/env bash
@@ -59,7 +59,7 @@ hello_main_cmd() {
hello_main_cmd "$@"
```
hello/subcommands/world
`hello/subcommands/world`
```shell
#!/usr/bin/env bash
@@ -87,7 +87,7 @@ hello_world_cmd() {
hello_world_cmd "$@"
```
hello/commands
`hello/commands`
```shell
#!/usr/bin/env bash
@@ -136,15 +136,15 @@ version = "0.1.0"
[plugin.config]
```
A few notes:
# A few notes:
- Don't forget to `chmod +x` your executable files.
- You should always support `DOKKU_TRACE` as specified on the 2nd line of the plugin.
- If your command requires that an application exists, ensure you check for it's existence in the manner prescribed above.
- A `help` command is required, though it is allowed to be empty. Also, the command syntax will need to separated by `, ` in order to maintain columnar output alignment.
- Commands *should* be namespaced.
- As of 0.3.3, a catch-all should be implemented which exits with a `DOKKU_NOT_IMPLEMENTED_EXIT` code. This allows Dokku to output a `command not found` message.
- Be sure you want the "set -eo pipefail" option. Look at the following example :
- Remember to `chmod +x` your executable files
- Always support `DOKKU_TRACE` as per the 2nd line of the above example
- If your command depends on an application, include a check for whether that application exists (see the above example)
- You must implement a `help` command, though you may leave it empty. Also, you must use commas (`,`) in the command syntax to support output in columns
- Commands **should** be namespaced
- As of 0.3.3, a catch-all should be implemented that exits with a `DOKKU_NOT_IMPLEMENTED_EXIT` code. This allows Dokku to output a `command not found` message.
- Consider whether you want to include the `set -eo pipefail` option. Look at the following example :
```shell
IMAGE=$(docker images | grep "user/repo" | awk '{print $3}')
@@ -153,10 +153,9 @@ A few notes:
fi
```
In the case where the "user/repo" is not installed, Dokku exits just before the awk command,
you will never see the message printed with echo. You just want "set -e" in this case.
If `user/repo` doesn't exist, Dokku exits just before the `awk` command and the `dokku_log_fail` message will never go to `STDOUT`. printed with echo. You would want to use `set -e` in this case.
Here is the documentation of the 'set -eo pipefail' option:
Here is the `help` entry for `set`:
```
help set
Options:
@@ -166,13 +165,19 @@ A few notes:
the last command to exit with a non-zero status,
or zero if no command exited with a non-zero status
```
- As some plugins require access to set app config settings and do not want/require the default Heroku-style behavior of a restart, we have the following "internal" commands that provide this functionality :
- In the case that your plugin needs to set application configuration settings and you want to avoid having to restart (default Heroku-style behavior) these "internal" commands provide this functionality:
```shell
dokku config:set --no-restart node-js-app KEY1=VALUE1 [KEY2=VALUE2 ...]
dokku config:unset --no-restart node-js-app KEY1 [KEY2 ...]
```
- From time to time you may want to allow other plugins access to (some of) your plugin's functionality. You can expose this by including a `functions` file in your plugin for others to source. Consider all functions in that file to be publicly accessible by other plugins. Any functions not wished to be made "public" should reside within your plugin trigger or commands files.
- As of 0.4.0, we allow image tagging and deployment of said tagged images. Therefore, hard-coding of `$IMAGE` as `dokku/$APP` is no longer sufficient. Instead, for non `pre/post-build-*` plugins, use `get_running_image_tag()` & `get_app_image_name()` as sourced from common/functions. See the [plugin triggers](/docs/development/plugin-triggers.md) doc for examples.
- As of 0.5.0, we use container labels to help cleanup intermediate containers with `dokku cleanup`. If manually calling `docker run`, include `$DOKKU_GLOBAL_RUN_ARGS`. This will ensure you intermediate containers labeled correctly.
- As of 0.6.0, we advise you to *not* call the `dokku` binary directly from within plugins. Clients using the `--app` argument are potentially broken, amongst other issues, when doing so. Instead, please source the `functions` file for a given plugin when attempting to call Dokku internal functions
- If you want to allow other plugins access to (some of) your plugin's functionality, you can expose this by including a `functions` file in your plugin for others to source
- You should consider all functions in that file to be publicly accessible by other plugins
- Any functions you want to keep private should reside in your plugin's `trigger/` or `commands/` directories
- As of 0.4.0, Dokku allows image tagging and deployment of tagged images
- This means hard-coding the `$IMAGE` as `dokku/$APP` is no longer sufficient
- You should now use `get_running_image_tag()` and `get_app_image_name()` as sourced from `common/functions` (see the [plugin triggers](/docs/development/plugin-triggers.md) doc for examples). **Note:** This is only for plugins that are not `pre/post-build-*` plugins
- As of 0.5.0, we use container labels to help cleanup intermediate containers with `dokku cleanup
- This means that if you manually call `docker run`, you should include `$DOKKU_GLOBAL_RUN_ARGS` to ensure your intermediate containers are labeled correctly
- As of 0.6.0, you should not **not** call the `dokku` binary directly from within plugins because clients using the `--app` argument are potentially broken when doing so (as well as other issues)
- You should instead source the `functions` file for a given plugin when attempting to call Dokku internal functions

View File

@@ -248,6 +248,8 @@ echo 'derp.dkr.ecr.us-east-1.amazonaws.com'
### `docker-args-build`
> Warning: Deprecated, please use `docker-args-process-build` instead
- Description:
- Invoked by: `internal function dokku_build() (build phase)`
- Arguments: `$APP $IMAGE_SOURCE_TYPE`
@@ -271,6 +273,8 @@ echo -n "$STDIN$output"
### `docker-args-deploy`
> Warning: Deprecated, please use `docker-args-process-deploy` instead
- Description:
- Invoked by: `dokku deploy`
- Arguments: `$APP $IMAGE_TAG [$PROC_TYPE $CONTAINER_INDEX]`
@@ -289,6 +293,8 @@ verify_app_name "$APP"
### `docker-args-run`
> Warning: Deprecated, please use `docker-args-process-run` instead
- Description:
- Invoked by: `dokku run`
- Arguments: `$APP $IMAGE_TAG`
@@ -305,6 +311,42 @@ verify_app_name "$APP"
# TODO
```
### `docker-args-process-deploy`
- Description: `$PROC_TYPE` may be set to magic `_all_` process type to signify global docker deploy options.
- Invoked by: `dokku deploy`
- Arguments: `$APP $IMAGE_TAG $IMAGE_SOURCE_TYPE [$PROC_TYPE $CONTAINER_INDEX]`
- Example:
```shell
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
APP="$1"; IMAGE_TAG="$2"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG)
verify_app_name "$APP"
# TODO
```
### `docker-args-process-run`
- Description: `$PROC_TYPE` may be set to magic `_all_` process type to signify global docker run options.
- Invoked by: `dokku run`
- Arguments: `$APP $IMAGE_TAG $IMAGE_SOURCE_TYPE [$PROC_TYPE $CONTAINER_INDEX]`
- Example:
```shell
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
APP="$1"; IMAGE_TAG="$2"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG)
verify_app_name "$APP"
# TODO
```
### `git-post-pull`
- Description:
@@ -339,6 +381,21 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
since it does not get called for commands that use `git-upload-archive` such
as `git archive`. Instead, use the [`user-auth`](#user-auth) trigger.
### `git-revision`
- Description: Allows you to fetch the current git revision for a given application
- Invoked by:
- Arguments: `$APP`
- Example:
```shell
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
# TODO
```
### `install`
- Description: Used to setup any files/configuration for a plugin.
@@ -1157,6 +1214,22 @@ fi
plugn trigger receive-app $APP $newrev
```
### `resource-get-property`
- Description: Fetches a given resource property value
- Invoked by:
- Arguments: `$APP` `$PROC_TYPE` `$RESOURCE_TYPE` `$PROPERTY`
- Example:
```shell
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
APP="$1"; PROC_TYPE="$2" RESOURCE_TYPE="$3" PROPERTY="$4"
# TODO
```
### `retire-container-failed`
- Description: Allows you to run commands if/when retiring old containers has failed
@@ -1247,6 +1320,25 @@ DOKKU_SCHEDULER="$1"; APP="$2";
# TODO
```
### `scheduler-logs`
> Warning: The scheduler plugin trigger apis are under development and may change
> between minor releases until the 1.0 release.
- Description: Allows you to run scheduler commands when retrieving container logs
- Invoked by: `dokku logs:failed`
- Arguments: `$DOKKU_SCHEDULER $APP $PROCESS_TYPE $TAIL $PRETTY_PRINT $NUM`
- Example:
```shell
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
DOKKU_SCHEDULER="$1"; APP="$2"; PROCESS_TYPE="$3"; TAIL="$4"; PRETTY_PRINT="$5"; NUM="$6"
# TODO
```
### `scheduler-logs-failed`
> Warning: The scheduler plugin trigger apis are under development and may change
@@ -1261,7 +1353,26 @@ DOKKU_SCHEDULER="$1"; APP="$2";
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
DOKKU_SCHEDULER="$1"; APP="$2"; ARGS="${@:3}";
DOKKU_SCHEDULER="$1"; APP="$2";
# TODO
```
### `scheduler-retire`
> Warning: The scheduler plugin trigger apis are under development and may change
> between minor releases until the 1.0 release.
- Description: Allows you to run scheduler commands when containers should be force retired from the system
- Invoked by: `dokku run`
- Arguments: `$DOKKU_SCHEDULER`
- Example:
```shell
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
DOKKU_SCHEDULER="$1";
# TODO
```

View File

@@ -29,7 +29,7 @@ The workflow looks like this:
```shell
# having dokku-arch in ../dokku-arch
vagrant up build-arch
# wait for "==> build-arch: ==> Finished making: dokku 0.14.6-2 (Mon Feb 22 23:20:37 CET 2016)"
# wait for "==> build-arch: ==> Finished making: dokku 0.15.4-2 (Mon Feb 22 23:20:37 CET 2016)"
cd ../dokku-arch
git add PKGBUILD .SRCINFO
git commit -m 'Update to dokku 0.9.9'

View File

@@ -21,8 +21,8 @@ To install the latest stable version of Dokku, you can run the following shell c
```shell
# for debian systems, installs Dokku via apt-get
wget https://raw.githubusercontent.com/dokku/dokku/v0.14.6/bootstrap.sh;
sudo DOKKU_TAG=v0.14.6 bash bootstrap.sh
wget https://raw.githubusercontent.com/dokku/dokku/v0.15.4/bootstrap.sh;
sudo DOKKU_TAG=v0.15.4 bash bootstrap.sh
```
The installation process takes about 5-10 minutes, depending upon internet connection speed.

View File

@@ -10,30 +10,30 @@
<link href="https://fonts.googleapis.com/css?family=Montserrat:400,700" rel="stylesheet" type="text/css">
<title>Dokku - The smallest PaaS implementation you've ever seen</title>
<link rel="apple-touch-icon" sizes="57x57" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.14.6/docs/assets/favicons/apple-touch-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.14.6/docs/assets/favicons/apple-touch-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.14.6/docs/assets/favicons/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.14.6/docs/assets/favicons/apple-touch-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.14.6/docs/assets/favicons/apple-touch-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.14.6/docs/assets/favicons/apple-touch-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.14.6/docs/assets/favicons/apple-touch-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.14.6/docs/assets/favicons/apple-touch-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.14.6/docs/assets/favicons/apple-touch-icon-180x180.png">
<link rel="icon" type="image/png" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.14.6/docs/assets/favicons/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.14.6/docs/assets/favicons/android-chrome-192x192.png" sizes="192x192">
<link rel="icon" type="image/png" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.14.6/docs/assets/favicons/favicon-96x96.png" sizes="96x96">
<link rel="icon" type="image/png" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.14.6/docs/assets/favicons/favicon-16x16.png" sizes="16x16">
<link rel="manifest" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.14.6/docs/assets/favicons/manifest.json">
<link rel="shortcut icon" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.14.6/docs/assets/favicons/favicon.ico">
<link rel="apple-touch-icon" sizes="57x57" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.15.4/docs/assets/favicons/apple-touch-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.15.4/docs/assets/favicons/apple-touch-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.15.4/docs/assets/favicons/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.15.4/docs/assets/favicons/apple-touch-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.15.4/docs/assets/favicons/apple-touch-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.15.4/docs/assets/favicons/apple-touch-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.15.4/docs/assets/favicons/apple-touch-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.15.4/docs/assets/favicons/apple-touch-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.15.4/docs/assets/favicons/apple-touch-icon-180x180.png">
<link rel="icon" type="image/png" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.15.4/docs/assets/favicons/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.15.4/docs/assets/favicons/android-chrome-192x192.png" sizes="192x192">
<link rel="icon" type="image/png" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.15.4/docs/assets/favicons/favicon-96x96.png" sizes="96x96">
<link rel="icon" type="image/png" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.15.4/docs/assets/favicons/favicon-16x16.png" sizes="16x16">
<link rel="manifest" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.15.4/docs/assets/favicons/manifest.json">
<link rel="shortcut icon" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.15.4/docs/assets/favicons/favicon.ico">
<meta name="apple-mobile-web-app-title" content="Dokku">
<meta name="application-name" content="Dokku">
<meta name="msapplication-TileColor" content="#da532c">
<meta name="msapplication-TileImage" content="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.14.6/docs/assets/favicons/mstile-144x144.png">
<meta name="msapplication-config" content="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.14.6/docs/assets/favicons/browserconfig.xml">
<meta name="msapplication-TileImage" content="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.15.4/docs/assets/favicons/mstile-144x144.png">
<meta name="msapplication-config" content="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.15.4/docs/assets/favicons/browserconfig.xml">
<meta name="theme-color" content="#ffffff">
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.2/css/bootstrap.min.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.14.6/docs/assets/style.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.15.4/docs/assets/style.css" rel="stylesheet">
<!-- <link href="/dokku/docs/assets/style.css" rel="stylesheet"> -->
<style>
.sponsors {
@@ -127,12 +127,12 @@
<p class="line">
<span class="path"></span>
<span class="prompt">$</span>
<span class="command">wget https://raw.githubusercontent.com/dokku/dokku/v0.14.6/bootstrap.sh</span>
<span class="command">wget https://raw.githubusercontent.com/dokku/dokku/v0.15.4/bootstrap.sh</span>
</p>
<p class="line">
<span class="path"></span>
<span class="prompt">$</span>
<span class="command">sudo DOKKU_TAG=v0.14.6 bash bootstrap.sh</span>
<span class="command">sudo DOKKU_TAG=v0.15.4 bash bootstrap.sh</span>
</p>
<p class="line">
<span class="output">&nbsp;# go to your server's IP and follow the web installer</span>

View File

@@ -85,7 +85,7 @@ CONTAINER ID IMAGE COMMAND CREATED
d6499edb0edb dokku/node-js-app:latest "/bin/bash -c '/star About a minute ago Up About a minute 0.0.0.0:49153->5000/tcp node-js-app.web.1
```
### Displaying network reports about an app
### Displaying network reports for an app
You can get a report about the app's network status using the `network:report` command:

View File

@@ -19,7 +19,7 @@ In Dokku 0.5.0, port proxying was decoupled from the `nginx-vhosts` plugin into
From Dokku versions `0.5.0` until `0.11.0`, enabling or disabling an application's proxy would **also** control whether or not the application was bound to all interfaces - e.g. `0.0.0.0`. As of `0.11.0`, this is now controlled by the network plugin. Please see the [network documentation](/docs/networking/network.md#container-network-interface-binding) for more information.
### Displaying proxy reports about an app
### Displaying proxy reports for an app
> New as of 0.8.1

View File

@@ -9,26 +9,26 @@
<meta name="author" content="">
<title>Dokku - The smallest PaaS implementation you've ever seen</title>
<link rel="apple-touch-icon" sizes="57x57" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.14.6/docs/assets/favicons/apple-touch-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.14.6/docs/assets/favicons/apple-touch-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.14.6/docs/assets/favicons/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.14.6/docs/assets/favicons/apple-touch-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.14.6/docs/assets/favicons/apple-touch-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.14.6/docs/assets/favicons/apple-touch-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.14.6/docs/assets/favicons/apple-touch-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.14.6/docs/assets/favicons/apple-touch-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.14.6/docs/assets/favicons/apple-touch-icon-180x180.png">
<link rel="icon" type="image/png" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.14.6/docs/assets/favicons/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.14.6/docs/assets/favicons/android-chrome-192x192.png" sizes="192x192">
<link rel="icon" type="image/png" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.14.6/docs/assets/favicons/favicon-96x96.png" sizes="96x96">
<link rel="icon" type="image/png" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.14.6/docs/assets/favicons/favicon-16x16.png" sizes="16x16">
<link rel="manifest" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.14.6/docs/assets/favicons/manifest.json">
<link rel="shortcut icon" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.14.6/docs/assets/favicons/favicon.ico">
<link rel="apple-touch-icon" sizes="57x57" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.15.4/docs/assets/favicons/apple-touch-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.15.4/docs/assets/favicons/apple-touch-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.15.4/docs/assets/favicons/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.15.4/docs/assets/favicons/apple-touch-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.15.4/docs/assets/favicons/apple-touch-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.15.4/docs/assets/favicons/apple-touch-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.15.4/docs/assets/favicons/apple-touch-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.15.4/docs/assets/favicons/apple-touch-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.15.4/docs/assets/favicons/apple-touch-icon-180x180.png">
<link rel="icon" type="image/png" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.15.4/docs/assets/favicons/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.15.4/docs/assets/favicons/android-chrome-192x192.png" sizes="192x192">
<link rel="icon" type="image/png" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.15.4/docs/assets/favicons/favicon-96x96.png" sizes="96x96">
<link rel="icon" type="image/png" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.15.4/docs/assets/favicons/favicon-16x16.png" sizes="16x16">
<link rel="manifest" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.15.4/docs/assets/favicons/manifest.json">
<link rel="shortcut icon" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.15.4/docs/assets/favicons/favicon.ico">
<meta name="apple-mobile-web-app-title" content="Dokku">
<meta name="application-name" content="Dokku">
<meta name="msapplication-TileColor" content="#da532c">
<meta name="msapplication-TileImage" content="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.14.6/docs/assets/favicons/mstile-144x144.png">
<meta name="msapplication-config" content="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.14.6/docs/assets/favicons/browserconfig.xml">
<meta name="msapplication-TileImage" content="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.15.4/docs/assets/favicons/mstile-144x144.png">
<meta name="msapplication-config" content="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.15.4/docs/assets/favicons/browserconfig.xml">
<meta name="theme-color" content="#ffffff">
<script>
@@ -42,7 +42,7 @@
</script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.2/css/bootstrap.min.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.14.6/docs/assets/style.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.15.4/docs/assets/style.css" rel="stylesheet">
<!-- <link href="/dokku/docs/assets/style.css" rel="stylesheet"> -->
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.5.0/css/font-awesome.min.css" rel="stylesheet">
<style>
@@ -157,6 +157,7 @@
<a href="/{{NAME}}/advanced-usage/persistent-storage/" class="list-group-item">Persistent Storage</a>
<a href="/{{NAME}}/advanced-usage/plugin-management/" class="list-group-item">Plugin Management</a>
<a href="/{{NAME}}/advanced-usage/repository-management/" class="list-group-item">Repository Management</a>
<a href="/{{NAME}}/advanced-usage/resource-management/" class="list-group-item">Resource Management</a>
<a href="#" class="list-group-item disabled">Schedulers</a>

11
dokku
View File

@@ -66,6 +66,9 @@ skip_arg=false
if [[ "${args[0]}" =~ ^--.* ]]; then
for arg in "$@"; do
$skip_arg && skip_arg=false && continue
if [[ "$arg" == "--version" ]]; then
continue
fi
if [[ "$arg" == "--app" ]]; then
shift 2 && skip_arg=true
elif [[ "$arg" =~ ^--.* ]]; then
@@ -129,7 +132,7 @@ execute_dokku_cmd() {
deploy | delete | ls | run | cleanup)
local PLUGIN_NAME="00_dokku-standard"
;;
trace | url | urls | report | version)
trace | url | urls | report)
local PLUGIN_NAME="00_dokku-standard"
;;
esac
@@ -233,6 +236,12 @@ case "$1" in
fi
;;
version | -v | --version)
test -f "$DOKKU_ROOT/VERSION" || dokku_log_fail "Unable to determine dokku's version"
DOKKU_VERSION=$(cat "${DOKKU_ROOT}/VERSION")
echo "dokku version ${DOKKU_VERSION}"
;;
*)
execute_dokku_cmd "$@"
;;

35
package.mk Normal file
View File

@@ -0,0 +1,35 @@
/tmp/build-dokku/var/lib/dokku/GIT_REV:
mkdir -p /tmp/build-dokku
mkdir -p /tmp/build-dokku/usr/share/bash-completion/completions
mkdir -p /tmp/build-dokku/usr/bin
mkdir -p /tmp/build-dokku/usr/share/doc/dokku
mkdir -p /tmp/build-dokku/usr/share/dokku/contrib
mkdir -p /tmp/build-dokku/usr/share/lintian/overrides
mkdir -p /tmp/build-dokku/usr/share/man/man1
mkdir -p /tmp/build-dokku/var/lib/dokku/core-plugins/available
cp dokku /tmp/build-dokku/usr/bin
cp LICENSE /tmp/build-dokku/usr/share/doc/dokku/copyright
cp contrib/bash-completion /tmp/build-dokku/usr/share/bash-completion/completions/dokku
find . -name ".DS_Store" -depth -exec rm {} \;
$(MAKE) go-build
cp common.mk /tmp/build-dokku/var/lib/dokku/core-plugins/common.mk
cp -r plugins/* /tmp/build-dokku/var/lib/dokku/core-plugins/available
find plugins/ -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | while read plugin; do cd /tmp/build-dokku/var/lib/dokku/core-plugins/available/$$plugin && if [ -e Makefile ]; then $(MAKE) src-clean; fi; done
find plugins/ -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | while read plugin; do touch /tmp/build-dokku/var/lib/dokku/core-plugins/available/$$plugin/.core; done
rm /tmp/build-dokku/var/lib/dokku/core-plugins/common.mk
$(MAKE) help2man
$(MAKE) addman
cp /usr/local/share/man/man1/dokku.1 /tmp/build-dokku/usr/share/man/man1/dokku.1
gzip -9 /tmp/build-dokku/usr/share/man/man1/dokku.1
cp contrib/dokku-installer.py /tmp/build-dokku/usr/share/dokku/contrib
ifeq ($(DOKKU_VERSION),master)
git describe --tags > /tmp/build-dokku/var/lib/dokku/VERSION
else
echo $(DOKKU_VERSION) > /tmp/build-dokku/var/lib/dokku/VERSION
endif
ifdef DOKKU_GIT_REV
echo "$(DOKKU_GIT_REV)" > /tmp/build-dokku/var/lib/dokku/GIT_REV
else
git rev-parse HEAD > /tmp/build-dokku/var/lib/dokku/GIT_REV
endif

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core standard plugin"
version = "0.14.6"
version = "0.15.4"
[plugin.config]

View File

@@ -1,12 +0,0 @@
#!/usr/bin/env bash
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
dokku_version_cmd() {
declare desc="prints dokku version"
local cmd="version"
cat "$DOKKU_ROOT/VERSION" || dokku_log_fail "Unable to determine dokku's version"
}
dokku_version_cmd "$@"

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core events logging plugin"
version = "0.14.6"
version = "0.15.4"
[plugin.config]

View File

@@ -38,7 +38,7 @@ execute_script() {
IMAGE=$(get_deploying_app_image_name "$APP" "$IMAGE_TAG")
if [[ "$PHASE_SCRIPT_KEY" == "release" ]]; then
SCRIPT_CMD=$(get_release_cmd "$APP" "$IMAGE" 2>/dev/null || true)
SCRIPT_CMD=$(get_release_cmd "$APP" "$IMAGE_TAG" 2>/dev/null || true)
else
SCRIPT_CMD=$(get_phase_script "$IMAGE" "$PHASE_SCRIPT_KEY" 2>/dev/null || true)
fi
@@ -47,7 +47,7 @@ execute_script() {
return
fi
dokku_log_info1 "Running '$SCRIPT_CMD' in app container"
dokku_log_exclaim "${PHASE_SCRIPT_KEY^} command declared: '$SCRIPT_CMD'"
local COMMAND
COMMAND="set -eo pipefail; [[ \$DOKKU_TRACE ]] && set -x ; "
COMMAND+=" if [[ -d '/app' ]]; then "
@@ -58,7 +58,6 @@ execute_script() {
COMMAND+=" for file in /app/.profile.d/*; do source \$file; done ; "
COMMAND+=" fi ; "
COMMAND+=" if [[ -d '/cache' ]]; then "
COMMAND+=" echo restoring installation cache... ; "
COMMAND+=" rm -rf /tmp/cache ; "
COMMAND+=" ln -sf /cache /tmp/cache ; "
COMMAND+=" fi ; "
@@ -73,7 +72,6 @@ execute_script() {
COMMAND+=" $SCRIPT_CMD || exit 1;"
COMMAND+=" if [[ -d '/cache' ]]; then "
COMMAND+=" echo removing installation cache... ; "
COMMAND+=" rm -f /tmp/cache ; "
COMMAND+=" fi ; "
@@ -85,6 +83,10 @@ execute_script() {
# strip --restart args from DOCKER_ARGS
local DOCKER_ARGS=$(sed -e "s/--restart=[[:graph:]]\+[[:blank:]]\?//g" <<<"$DOCKER_ARGS")
local IMAGE_SOURCE_TYPE="dockerfile"
is_image_herokuish_based "$IMAGE" && IMAGE_SOURCE_TYPE="herokuish"
DOCKER_ARGS+=$(: | plugn trigger docker-args-process-deploy "$APP" "$IMAGE_TAG" "$IMAGE_SOURCE_TYPE" "$PHASE_SCRIPT_KEY")
# eval args as array to respect escapes
declare -a ARG_ARRAY
eval "ARG_ARRAY=($DOCKER_ARGS)"

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core app-json plugin"
version = "0.14.6"
version = "0.15.4"
[plugin.config]

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core apps plugin"
version = "0.14.6"
version = "0.15.4"
[plugin.config]

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core build-env plugin"
version = "0.14.6"
version = "0.15.4"
[plugin.config]

7
plugins/buildpacks/.gitignore vendored Normal file
View File

@@ -0,0 +1,7 @@
/commands
/subcommands/*
/triggers/*
/install
/post-delete
/post-extract
/report

View File

@@ -0,0 +1,37 @@
include ../../common.mk
GO_ARGS ?= -a
SUBCOMMANDS = subcommands/add subcommands/clear subcommands/list subcommands/remove subcommands/report subcommands/set
TRIGGERS = triggers/install triggers/post-delete triggers/post-extract triggers/report
build-in-docker: clean
docker run --rm \
-v $$PWD/../..:$(GO_REPO_ROOT) \
-w $(GO_REPO_ROOT)/plugins/buildpacks \
$(BUILD_IMAGE) \
bash -c "GO_ARGS='$(GO_ARGS)' make -j4 build" || exit $$?
build: commands subcommands triggers
$(MAKE) triggers-copy
commands: **/**/commands.go
go build $(GO_ARGS) -o commands src/commands/commands.go
subcommands: $(SUBCOMMANDS)
subcommands/%: src/subcommands/*/%.go
go build $(GO_ARGS) -o $@ $<
clean:
rm -rf commands subcommands triggers install post-delete post-extract report
src-clean:
rm -rf .gitignore src triggers vendor Makefile *.go glide.*
triggers: $(TRIGGERS)
triggers/%: src/triggers/*/%.go
go build $(GO_ARGS) -o $@ $<
triggers-copy:
cp triggers/* .

View File

@@ -0,0 +1,61 @@
package buildpacks
import (
"fmt"
"os"
"reflect"
"strings"
"github.com/dokku/dokku/plugins/common"
)
// ReportSingleApp is an internal function that displays the app report for one or more apps
func ReportSingleApp(appName, infoFlag string) {
if err := common.VerifyAppName(appName); err != nil {
common.LogFail(err.Error())
}
buildpacks, err := common.PropertyListGet("buildpacks", appName, "buildpacks")
if err != nil {
common.LogFail(err.Error())
}
infoFlags := map[string]string{
"--buildpacks-list": strings.Join(buildpacks, ","),
}
if len(infoFlag) == 0 {
common.LogInfo2Quiet(fmt.Sprintf("%s buildpacks information", appName))
for k, v := range infoFlags {
key := common.UcFirst(strings.Replace(strings.TrimPrefix(k, "--"), "-", " ", -1))
common.LogVerbose(fmt.Sprintf("%s%s", Right(fmt.Sprintf("%s:", key), 31, " "), v))
}
return
}
for k, v := range infoFlags {
if infoFlag == k {
fmt.Fprintln(os.Stdout, v)
return
}
}
keys := reflect.ValueOf(infoFlags).MapKeys()
strkeys := make([]string, len(keys))
for i := 0; i < len(keys); i++ {
strkeys[i] = keys[i].String()
}
common.LogFail(fmt.Sprintf("Invalid flag passed, valid flags: %s", strings.Join(strkeys, ", ")))
}
func times(str string, n int) (out string) {
for i := 0; i < n; i++ {
out += str
}
return
}
// Right right-pads the string with pad up to len runes
func Right(str string, length int, pad string) string {
return str + times(pad, length-len(str))
}

View File

@@ -0,0 +1,3 @@
package: .
import:
- package: github.com/ryanuber/columnize

View File

@@ -0,0 +1,4 @@
[plugin]
description = "dokku core buildpacks plugin"
version = "0.15.4"
[plugin.config]

View File

@@ -0,0 +1,67 @@
package main
import (
"flag"
"fmt"
"os"
"strconv"
"strings"
"github.com/dokku/dokku/plugins/common"
columnize "github.com/ryanuber/columnize"
)
const (
helpHeader = `Usage: dokku buildpacks[:COMMAND]
Manages buildpacks settings for an app
Additional commands:`
helpContent = `
buildpacks:add [--index 1] <app> <buildpack>, Add new app buildpack while inserting into list of buildpacks if necessary
buildpacks:clear <app>, Clear all buildpacks set on the app
buildpacks:list <app>, List all buildpacks for an app
buildpacks:remove <app> <buildpack>, Remove a buildpack set on the app
buildpacks:report [<app>] [<flag>], Displays a buildpack report for one or more apps
buildpacks:set [--index 1] <app> <buildpack>, Set new app buildpack at a given position defaulting to the first buildpack if no index is specified
`
)
func main() {
flag.Usage = usage
flag.Parse()
cmd := flag.Arg(0)
switch cmd {
case "buildpacks", "buildpacks:help":
usage()
case "help":
command := common.NewShellCmd(fmt.Sprintf("ps -o command= %d", os.Getppid()))
command.ShowOutput = false
output, err := command.Output()
if err == nil && strings.Contains(string(output), "--all") {
fmt.Println(helpContent)
} else {
fmt.Print("\n buildpacks, Manages buildpack settings for an app\n")
}
default:
dokkuNotImplementExitCode, err := strconv.Atoi(os.Getenv("DOKKU_NOT_IMPLEMENTED_EXIT"))
if err != nil {
fmt.Println("failed to retrieve DOKKU_NOT_IMPLEMENTED_EXIT environment variable")
dokkuNotImplementExitCode = 10
}
os.Exit(dokkuNotImplementExitCode)
}
}
func usage() {
config := columnize.DefaultConfig()
config.Delim = ","
config.Prefix = " "
config.Empty = ""
content := strings.Split(helpContent, "\n")[1:]
fmt.Println(helpHeader)
fmt.Println(columnize.Format(content, config))
}

6
plugins/buildpacks/src/glide.lock generated Normal file
View File

@@ -0,0 +1,6 @@
hash: 1ddab5de41d1514c2722bd7e24758ad4b60bf6956eb5b9b925fa071a1427f149
updated: 2017-01-03T17:16:50.97156327-08:00
imports:
- name: github.com/ryanuber/columnize
version: 0fbbb3f0e3fbdc5bae7c6cd5f6c1887ebfb76360
testImports: []

View File

@@ -0,0 +1,3 @@
package: .
import:
- package: github.com/ryanuber/columnize

View File

@@ -0,0 +1,19 @@
package main
import (
"flag"
"os"
"github.com/dokku/dokku/plugins/buildpacks"
"github.com/dokku/dokku/plugins/common"
)
func main() {
args := flag.NewFlagSet("buildpacks:add", flag.ExitOnError)
index := args.Int("index", 0, "--index: the 1-based index of the URL in the list of URLs")
args.Parse(os.Args[2:])
err := buildpacks.CommandAdd(args.Args(), *index)
if err != nil {
common.LogFail(err.Error())
}
}

View File

@@ -0,0 +1,18 @@
package main
import (
"flag"
"os"
"github.com/dokku/dokku/plugins/buildpacks"
"github.com/dokku/dokku/plugins/common"
)
func main() {
args := flag.NewFlagSet("buildpacks:clear", flag.ExitOnError)
args.Parse(os.Args[2:])
err := buildpacks.CommandClear(args.Args())
if err != nil {
common.LogFail(err.Error())
}
}

View File

@@ -0,0 +1,14 @@
package main
import (
"flag"
"os"
"github.com/dokku/dokku/plugins/buildpacks"
)
func main() {
args := flag.NewFlagSet("buildpacks:list", flag.ExitOnError)
args.Parse(os.Args[2:])
buildpacks.CommandList(args.Args())
}

View File

@@ -0,0 +1,19 @@
package main
import (
"flag"
"os"
"github.com/dokku/dokku/plugins/buildpacks"
"github.com/dokku/dokku/plugins/common"
)
func main() {
args := flag.NewFlagSet("buildpacks:remove", flag.ExitOnError)
index := args.Int("index", 0, "--index: the 1-based index of the URL in the list of URLs")
args.Parse(os.Args[2:])
err := buildpacks.CommandRemove(args.Args(), *index)
if err != nil {
common.LogFail(err.Error())
}
}

View File

@@ -0,0 +1,34 @@
package main
import (
"flag"
"strings"
"github.com/dokku/dokku/plugins/buildpacks"
"github.com/dokku/dokku/plugins/common"
)
// displays a buildpacks report for one or more apps
func main() {
flag.Parse()
appName := flag.Arg(1)
infoFlag := flag.Arg(2)
if strings.HasPrefix(appName, "--") {
infoFlag = appName
appName = ""
}
if len(appName) == 0 {
apps, err := common.DokkuApps()
if err != nil {
return
}
for _, appName := range apps {
buildpacks.ReportSingleApp(appName, infoFlag)
}
return
}
buildpacks.ReportSingleApp(appName, infoFlag)
}

View File

@@ -0,0 +1,19 @@
package main
import (
"flag"
"os"
"github.com/dokku/dokku/plugins/buildpacks"
"github.com/dokku/dokku/plugins/common"
)
func main() {
args := flag.NewFlagSet("buildpacks:set", flag.ExitOnError)
index := args.Int("index", 0, "--index: the 1-based index of the URL in the list of URLs")
args.Parse(os.Args[2:])
err := buildpacks.CommandSet(args.Args(), *index)
if err != nil {
common.LogFail(err.Error())
}
}

View File

@@ -0,0 +1,14 @@
package main
import (
"fmt"
"github.com/dokku/dokku/plugins/common"
)
// runs the install step for the buildpacks plugin
func main() {
if err := common.PropertySetup("buildpacks"); err != nil {
common.LogFail(fmt.Sprintf("Unable to install the buildpacks plugin: %s", err.Error()))
}
}

View File

@@ -0,0 +1,18 @@
package main
import (
"flag"
"github.com/dokku/dokku/plugins/common"
)
// destroys the buildpacks property for a given app container
func main() {
flag.Parse()
appName := flag.Arg(0)
err := common.PropertyDestroy("buildpacks", appName)
if err != nil {
common.LogFail(err.Error())
}
}

View File

@@ -0,0 +1,45 @@
package main
import (
"bufio"
"flag"
"fmt"
"os"
"path"
"github.com/dokku/dokku/plugins/common"
)
// writes a .buildpacks file into the app
func main() {
flag.Parse()
appName := flag.Arg(0)
tmpWorkDir := flag.Arg(1)
buildpacks, err := common.PropertyListGet("buildpacks", appName, "buildpacks")
if err != nil {
return
}
if len(buildpacks) == 0 {
return
}
buildpacksPath := path.Join(tmpWorkDir, ".buildpacks")
file, err := os.OpenFile(buildpacksPath, os.O_RDWR|os.O_TRUNC|os.O_CREATE, 0600)
if err != nil {
common.LogFail(fmt.Sprintf("Error writing .buildpacks file: %s", err.Error()))
return
}
w := bufio.NewWriter(file)
for _, buildpack := range buildpacks {
fmt.Fprintln(w, buildpack)
}
if err = w.Flush(); err != nil {
common.LogFail(fmt.Sprintf("Error writing .buildpacks file: %s", err.Error()))
return
}
file.Chmod(0600)
}

View File

@@ -0,0 +1,15 @@
package main
import (
"flag"
"github.com/dokku/dokku/plugins/buildpacks"
)
// displays a buildpacks report for one or more apps
func main() {
flag.Parse()
appName := flag.Arg(0)
buildpacks.ReportSingleApp(appName, "")
}

View File

@@ -0,0 +1,3 @@
language: go
go:
- tip

View File

@@ -0,0 +1,20 @@
Copyright (c) 2016 Ryan Uber
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -0,0 +1,69 @@
Columnize
=========
Easy column-formatted output for golang
[![Build Status](https://travis-ci.org/ryanuber/columnize.svg)](https://travis-ci.org/ryanuber/columnize)
[![GoDoc](https://godoc.org/github.com/ryanuber/columnize?status.svg)](https://godoc.org/github.com/ryanuber/columnize)
Columnize is a really small Go package that makes building CLI's a little bit
easier. In some CLI designs, you want to output a number similar items in a
human-readable way with nicely aligned columns. However, figuring out how wide
to make each column is a boring problem to solve and eats your valuable time.
Here is an example:
```go
package main
import (
"fmt"
"github.com/ryanuber/columnize"
)
func main() {
output := []string{
"Name | Gender | Age",
"Bob | Male | 38",
"Sally | Female | 26",
}
result := columnize.SimpleFormat(output)
fmt.Println(result)
}
```
As you can see, you just pass in a list of strings. And the result:
```
Name Gender Age
Bob Male 38
Sally Female 26
```
Columnize is tolerant of missing or empty fields, or even empty lines, so
passing in extra lines for spacing should show up as you would expect.
Configuration
=============
Columnize is configured using a `Config`, which can be obtained by calling the
`DefaultConfig()` method. You can then tweak the settings in the resulting
`Config`:
```
config := columnize.DefaultConfig()
config.Delim = "|"
config.Glue = " "
config.Prefix = ""
config.Empty = ""
```
* `Delim` is the string by which columns of **input** are delimited
* `Glue` is the string by which columns of **output** are delimited
* `Prefix` is a string by which each line of **output** is prefixed
* `Empty` is a string used to replace blank values found in output
You can then pass the `Config` in using the `Format` method (signature below) to
have text formatted to your liking.
See the [godoc](https://godoc.org/github.com/ryanuber/columnize) page for usage.

View File

@@ -0,0 +1,178 @@
package columnize
import (
"bytes"
"fmt"
"strings"
)
// Config can be used to tune certain parameters which affect the way
// in which Columnize will format output text.
type Config struct {
// The string by which the lines of input will be split.
Delim string
// The string by which columns of output will be separated.
Glue string
// The string by which columns of output will be prefixed.
Prefix string
// A replacement string to replace empty fields
Empty string
}
// DefaultConfig returns a *Config with default values.
func DefaultConfig() *Config {
return &Config{
Delim: "|",
Glue: " ",
Prefix: "",
Empty: "",
}
}
// MergeConfig merges two config objects together and returns the resulting
// configuration. Values from the right take precedence over the left side.
func MergeConfig(a, b *Config) *Config {
var result Config = *a
// Return quickly if either side was nil
if a == nil || b == nil {
return &result
}
if b.Delim != "" {
result.Delim = b.Delim
}
if b.Glue != "" {
result.Glue = b.Glue
}
if b.Prefix != "" {
result.Prefix = b.Prefix
}
if b.Empty != "" {
result.Empty = b.Empty
}
return &result
}
// stringFormat, given a set of column widths and the number of columns in
// the current line, returns a sprintf-style format string which can be used
// to print output aligned properly with other lines using the same widths set.
func stringFormat(c *Config, widths []int, columns int) string {
// Create the buffer with an estimate of the length
buf := bytes.NewBuffer(make([]byte, 0, (6+len(c.Glue))*columns))
// Start with the prefix, if any was given. The buffer will not return an
// error so it does not need to be handled
buf.WriteString(c.Prefix)
// Create the format string from the discovered widths
for i := 0; i < columns && i < len(widths); i++ {
if i == columns-1 {
buf.WriteString("%s\n")
} else {
fmt.Fprintf(buf, "%%-%ds%s", widths[i], c.Glue)
}
}
return buf.String()
}
// elementsFromLine returns a list of elements, each representing a single
// item which will belong to a column of output.
func elementsFromLine(config *Config, line string) []interface{} {
seperated := strings.Split(line, config.Delim)
elements := make([]interface{}, len(seperated))
for i, field := range seperated {
value := strings.TrimSpace(field)
// Apply the empty value, if configured.
if value == "" && config.Empty != "" {
value = config.Empty
}
elements[i] = value
}
return elements
}
// runeLen calculates the number of visible "characters" in a string
func runeLen(s string) int {
l := 0
for _ = range s {
l++
}
return l
}
// widthsFromLines examines a list of strings and determines how wide each
// column should be considering all of the elements that need to be printed
// within it.
func widthsFromLines(config *Config, lines []string) []int {
widths := make([]int, 0, 8)
for _, line := range lines {
elems := elementsFromLine(config, line)
for i := 0; i < len(elems); i++ {
l := runeLen(elems[i].(string))
if len(widths) <= i {
widths = append(widths, l)
} else if widths[i] < l {
widths[i] = l
}
}
}
return widths
}
// Format is the public-facing interface that takes a list of strings and
// returns nicely aligned column-formatted text.
func Format(lines []string, config *Config) string {
conf := MergeConfig(DefaultConfig(), config)
widths := widthsFromLines(conf, lines)
// Estimate the buffer size
glueSize := len(conf.Glue)
var size int
for _, w := range widths {
size += w + glueSize
}
size *= len(lines)
// Create the buffer
buf := bytes.NewBuffer(make([]byte, 0, size))
// Create a cache for the string formats
fmtCache := make(map[int]string, 16)
// Create the formatted output using the format string
for _, line := range lines {
elems := elementsFromLine(conf, line)
// Get the string format using cache
numElems := len(elems)
stringfmt, ok := fmtCache[numElems]
if !ok {
stringfmt = stringFormat(conf, widths, numElems)
fmtCache[numElems] = stringfmt
}
fmt.Fprintf(buf, stringfmt, elems...)
}
// Get the string result
result := buf.String()
// Remove trailing newline without removing leading/trailing space
if n := len(result); n > 0 && result[n-1] == '\n' {
result = result[:n-1]
}
return result
}
// SimpleFormat is a convenience function to format text with the defaults.
func SimpleFormat(lines []string) string {
return Format(lines, nil)
}

View File

@@ -0,0 +1,306 @@
package columnize
import (
"fmt"
"testing"
crand "crypto/rand"
)
func TestListOfStringsInput(t *testing.T) {
input := []string{
"Column A | Column B | Column C",
"x | y | z",
}
config := DefaultConfig()
output := Format(input, config)
expected := "Column A Column B Column C\n"
expected += "x y z"
if output != expected {
t.Fatalf("\nexpected:\n%s\n\ngot:\n%s", expected, output)
}
}
func TestEmptyLinesOutput(t *testing.T) {
input := []string{
"Column A | Column B | Column C",
"",
"x | y | z",
}
config := DefaultConfig()
output := Format(input, config)
expected := "Column A Column B Column C\n"
expected += "\n"
expected += "x y z"
if output != expected {
t.Fatalf("\nexpected:\n%s\n\ngot:\n%s", expected, output)
}
}
func TestLeadingSpacePreserved(t *testing.T) {
input := []string{
"| Column B | Column C",
"x | y | z",
}
config := DefaultConfig()
output := Format(input, config)
expected := " Column B Column C\n"
expected += "x y z"
if output != expected {
t.Fatalf("\nexpected:\n%s\n\ngot:\n%s", expected, output)
}
}
func TestColumnWidthCalculator(t *testing.T) {
input := []string{
"Column A | Column B | Column C",
"Longer than A | Longer than B | Longer than C",
"short | short | short",
}
config := DefaultConfig()
output := Format(input, config)
expected := "Column A Column B Column C\n"
expected += "Longer than A Longer than B Longer than C\n"
expected += "short short short"
if output != expected {
printableProof := fmt.Sprintf("\nGot: %+q", output)
printableProof += fmt.Sprintf("\nExpected: %+q", expected)
t.Fatalf("\n%s", printableProof)
}
}
func TestColumnWidthCalculatorNonASCII(t *testing.T) {
input := []string{
"Column A | Column B | Column C",
"⌘⌘⌘⌘⌘⌘⌘⌘ | Longer than B | Longer than C",
"short | short | short",
}
config := DefaultConfig()
output := Format(input, config)
expected := "Column A Column B Column C\n"
expected += "⌘⌘⌘⌘⌘⌘⌘⌘ Longer than B Longer than C\n"
expected += "short short short"
if output != expected {
printableProof := fmt.Sprintf("\nGot: %+q", output)
printableProof += fmt.Sprintf("\nExpected: %+q", expected)
t.Fatalf("\n%s", printableProof)
}
}
func BenchmarkColumnWidthCalculator(b *testing.B) {
// Generate the input
input := []string{
"UUID A | UUID B | UUID C | Column D | Column E",
}
format := "%s|%s|%s|%s"
short := "short"
uuid := func() string {
buf := make([]byte, 16)
if _, err := crand.Read(buf); err != nil {
panic(fmt.Errorf("failed to read random bytes: %v", err))
}
return fmt.Sprintf("%08x-%04x-%04x-%04x-%12x",
buf[0:4],
buf[4:6],
buf[6:8],
buf[8:10],
buf[10:16])
}
for i := 0; i < 1000; i++ {
l := fmt.Sprintf(format, uuid()[:8], uuid()[:12], uuid(), short, short)
input = append(input, l)
}
config := DefaultConfig()
b.ResetTimer()
for i := 0; i < b.N; i++ {
Format(input, config)
}
}
func TestVariedInputSpacing(t *testing.T) {
input := []string{
"Column A |Column B| Column C",
"x|y| z",
}
config := DefaultConfig()
output := Format(input, config)
expected := "Column A Column B Column C\n"
expected += "x y z"
if output != expected {
t.Fatalf("\nexpected:\n%s\n\ngot:\n%s", expected, output)
}
}
func TestUnmatchedColumnCounts(t *testing.T) {
input := []string{
"Column A | Column B | Column C",
"Value A | Value B",
"Value A | Value B | Value C | Value D",
}
config := DefaultConfig()
output := Format(input, config)
expected := "Column A Column B Column C\n"
expected += "Value A Value B\n"
expected += "Value A Value B Value C Value D"
if output != expected {
t.Fatalf("\nexpected:\n%s\n\ngot:\n%s", expected, output)
}
}
func TestAlternateDelimiter(t *testing.T) {
input := []string{
"Column | A % Column | B % Column | C",
"Value A % Value B % Value C",
}
config := DefaultConfig()
config.Delim = "%"
output := Format(input, config)
expected := "Column | A Column | B Column | C\n"
expected += "Value A Value B Value C"
if output != expected {
t.Fatalf("\nexpected:\n%s\n\ngot:\n%s", expected, output)
}
}
func TestAlternateSpacingString(t *testing.T) {
input := []string{
"Column A | Column B | Column C",
"x | y | z",
}
config := DefaultConfig()
config.Glue = " "
output := Format(input, config)
expected := "Column A Column B Column C\n"
expected += "x y z"
if output != expected {
t.Fatalf("\nexpected:\n%s\n\ngot:\n%s", expected, output)
}
}
func TestSimpleFormat(t *testing.T) {
input := []string{
"Column A | Column B | Column C",
"x | y | z",
}
output := SimpleFormat(input)
expected := "Column A Column B Column C\n"
expected += "x y z"
if output != expected {
t.Fatalf("\nexpected:\n%s\n\ngot:\n%s", expected, output)
}
}
func TestAlternatePrefixString(t *testing.T) {
input := []string{
"Column A | Column B | Column C",
"x | y | z",
}
config := DefaultConfig()
config.Prefix = " "
output := Format(input, config)
expected := " Column A Column B Column C\n"
expected += " x y z"
if output != expected {
t.Fatalf("\nexpected:\n%s\n\ngot:\n%s", expected, output)
}
}
func TestEmptyFieldReplacement(t *testing.T) {
input := []string{
"Column A | Column B | Column C",
"x | | z",
}
config := DefaultConfig()
config.Empty = "<none>"
output := Format(input, config)
expected := "Column A Column B Column C\n"
expected += "x <none> z"
if output != expected {
t.Fatalf("\nexpected:\n%s\n\ngot:\n%s", expected, output)
}
}
func TestEmptyConfigValues(t *testing.T) {
input := []string{
"Column A | Column B | Column C",
"x | y | z",
}
config := Config{}
output := Format(input, &config)
expected := "Column A Column B Column C\n"
expected += "x y z"
if output != expected {
t.Fatalf("\nexpected:\n%s\n\ngot:\n%s", expected, output)
}
}
func TestMergeConfig(t *testing.T) {
conf1 := &Config{Delim: "a", Glue: "a", Prefix: "a", Empty: "a"}
conf2 := &Config{Delim: "b", Glue: "b", Prefix: "b", Empty: "b"}
conf3 := &Config{Delim: "c", Prefix: "c"}
m := MergeConfig(conf1, conf2)
if m.Delim != "b" || m.Glue != "b" || m.Prefix != "b" || m.Empty != "b" {
t.Fatalf("bad: %#v", m)
}
m = MergeConfig(conf1, conf3)
if m.Delim != "c" || m.Glue != "a" || m.Prefix != "c" || m.Empty != "a" {
t.Fatalf("bad: %#v", m)
}
m = MergeConfig(conf1, nil)
if m.Delim != "a" || m.Glue != "a" || m.Prefix != "a" || m.Empty != "a" {
t.Fatalf("bad: %#v", m)
}
m = MergeConfig(conf1, &Config{})
if m.Delim != "a" || m.Glue != "a" || m.Prefix != "a" || m.Empty != "a" {
t.Fatalf("bad: %#v", m)
}
}

View File

@@ -0,0 +1,154 @@
package buildpacks
import (
"errors"
"fmt"
"github.com/dokku/dokku/plugins/common"
)
// CommandAdd implements buildpacks:add
func CommandAdd(args []string, index int) (err error) {
var appName string
appName, err = getAppName(args)
if err != nil {
return
}
buildpack := ""
if len(args) >= 2 {
buildpack = args[1]
}
if buildpack == "" {
return errors.New("Must specify a buildpack to add")
}
err = common.PropertyListAdd("buildpacks", appName, "buildpacks", buildpack, index)
return
}
// CommandClear implements buildpacks:clear
func CommandClear(args []string) (err error) {
var appName string
appName, err = getAppName(args)
if err != nil {
return
}
common.PropertyDelete("buildpacks", appName, "buildpacks")
return
}
// CommandList implements buildpacks:list
func CommandList(args []string) (err error) {
var appName string
appName, err = getAppName(args)
if err != nil {
return
}
buildpacks, err := common.PropertyListGet("buildpacks", appName, "buildpacks")
if err != nil {
return
}
common.LogInfo1Quiet(fmt.Sprintf("%s buildpack urls", appName))
for _, buildpack := range buildpacks {
common.LogVerbose(buildpack)
}
return nil
}
// CommandRemove implements buildpacks:remove
func CommandRemove(args []string, index int) (err error) {
var appName string
appName, err = getAppName(args)
if err != nil {
return
}
buildpack := ""
if len(args) >= 2 {
buildpack = args[1]
}
if index != 0 && buildpack != "" {
err = errors.New("Please choose either index or Buildpack, but not both")
return
}
if index == 0 && buildpack == "" {
err = errors.New("Must specify a buildpack to remove, either by index or URL")
return
}
var buildpacks []string
buildpacks, err = common.PropertyListGet("buildpacks", appName, "buildpacks")
if err != nil {
return
}
if len(buildpacks) == 0 {
err = fmt.Errorf("No buildpacks were found, next release on %s will detect buildpack normally", appName)
return
}
if index != 0 {
var value string
value, err = common.PropertyListGetByIndex("buildpacks", appName, "buildpacks", index-1)
if err != nil {
return
}
buildpack = value
} else {
_, err = common.PropertyListGetByValue("buildpacks", appName, "buildpacks", buildpack)
if err != nil {
return
}
}
common.LogInfo1Quiet(fmt.Sprintf("Removing %s", buildpack))
err = common.PropertyListRemove("buildpacks", appName, "buildpacks", buildpack)
if err != nil {
return
}
return
}
// CommandSet implements buildpacks:set
func CommandSet(args []string, index int) (err error) {
var appName string
appName, err = getAppName(args)
if err != nil {
return
}
buildpack := ""
if len(args) >= 2 {
buildpack = args[1]
}
if buildpack == "" {
return errors.New("Must specify a buildpack to add")
}
if index > 0 {
index--
}
err = common.PropertyListSet("buildpacks", appName, "buildpacks", buildpack, index)
if err != nil {
return
}
return
}
func getAppName(args []string) (appName string, err error) {
if len(args) >= 1 {
appName = args[0]
} else {
err = errors.New("Please specify an app to run the command on")
}
return
}

View File

@@ -0,0 +1,3 @@
language: go
go:
- tip

View File

@@ -0,0 +1,20 @@
Copyright (c) 2016 Ryan Uber
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -0,0 +1,69 @@
Columnize
=========
Easy column-formatted output for golang
[![Build Status](https://travis-ci.org/ryanuber/columnize.svg)](https://travis-ci.org/ryanuber/columnize)
[![GoDoc](https://godoc.org/github.com/ryanuber/columnize?status.svg)](https://godoc.org/github.com/ryanuber/columnize)
Columnize is a really small Go package that makes building CLI's a little bit
easier. In some CLI designs, you want to output a number similar items in a
human-readable way with nicely aligned columns. However, figuring out how wide
to make each column is a boring problem to solve and eats your valuable time.
Here is an example:
```go
package main
import (
"fmt"
"github.com/ryanuber/columnize"
)
func main() {
output := []string{
"Name | Gender | Age",
"Bob | Male | 38",
"Sally | Female | 26",
}
result := columnize.SimpleFormat(output)
fmt.Println(result)
}
```
As you can see, you just pass in a list of strings. And the result:
```
Name Gender Age
Bob Male 38
Sally Female 26
```
Columnize is tolerant of missing or empty fields, or even empty lines, so
passing in extra lines for spacing should show up as you would expect.
Configuration
=============
Columnize is configured using a `Config`, which can be obtained by calling the
`DefaultConfig()` method. You can then tweak the settings in the resulting
`Config`:
```
config := columnize.DefaultConfig()
config.Delim = "|"
config.Glue = " "
config.Prefix = ""
config.Empty = ""
```
* `Delim` is the string by which columns of **input** are delimited
* `Glue` is the string by which columns of **output** are delimited
* `Prefix` is a string by which each line of **output** is prefixed
* `Empty` is a string used to replace blank values found in output
You can then pass the `Config` in using the `Format` method (signature below) to
have text formatted to your liking.
See the [godoc](https://godoc.org/github.com/ryanuber/columnize) page for usage.

View File

@@ -0,0 +1,178 @@
package columnize
import (
"bytes"
"fmt"
"strings"
)
// Config can be used to tune certain parameters which affect the way
// in which Columnize will format output text.
type Config struct {
// The string by which the lines of input will be split.
Delim string
// The string by which columns of output will be separated.
Glue string
// The string by which columns of output will be prefixed.
Prefix string
// A replacement string to replace empty fields
Empty string
}
// DefaultConfig returns a *Config with default values.
func DefaultConfig() *Config {
return &Config{
Delim: "|",
Glue: " ",
Prefix: "",
Empty: "",
}
}
// MergeConfig merges two config objects together and returns the resulting
// configuration. Values from the right take precedence over the left side.
func MergeConfig(a, b *Config) *Config {
var result Config = *a
// Return quickly if either side was nil
if a == nil || b == nil {
return &result
}
if b.Delim != "" {
result.Delim = b.Delim
}
if b.Glue != "" {
result.Glue = b.Glue
}
if b.Prefix != "" {
result.Prefix = b.Prefix
}
if b.Empty != "" {
result.Empty = b.Empty
}
return &result
}
// stringFormat, given a set of column widths and the number of columns in
// the current line, returns a sprintf-style format string which can be used
// to print output aligned properly with other lines using the same widths set.
func stringFormat(c *Config, widths []int, columns int) string {
// Create the buffer with an estimate of the length
buf := bytes.NewBuffer(make([]byte, 0, (6+len(c.Glue))*columns))
// Start with the prefix, if any was given. The buffer will not return an
// error so it does not need to be handled
buf.WriteString(c.Prefix)
// Create the format string from the discovered widths
for i := 0; i < columns && i < len(widths); i++ {
if i == columns-1 {
buf.WriteString("%s\n")
} else {
fmt.Fprintf(buf, "%%-%ds%s", widths[i], c.Glue)
}
}
return buf.String()
}
// elementsFromLine returns a list of elements, each representing a single
// item which will belong to a column of output.
func elementsFromLine(config *Config, line string) []interface{} {
seperated := strings.Split(line, config.Delim)
elements := make([]interface{}, len(seperated))
for i, field := range seperated {
value := strings.TrimSpace(field)
// Apply the empty value, if configured.
if value == "" && config.Empty != "" {
value = config.Empty
}
elements[i] = value
}
return elements
}
// runeLen calculates the number of visible "characters" in a string
func runeLen(s string) int {
l := 0
for _ = range s {
l++
}
return l
}
// widthsFromLines examines a list of strings and determines how wide each
// column should be considering all of the elements that need to be printed
// within it.
func widthsFromLines(config *Config, lines []string) []int {
widths := make([]int, 0, 8)
for _, line := range lines {
elems := elementsFromLine(config, line)
for i := 0; i < len(elems); i++ {
l := runeLen(elems[i].(string))
if len(widths) <= i {
widths = append(widths, l)
} else if widths[i] < l {
widths[i] = l
}
}
}
return widths
}
// Format is the public-facing interface that takes a list of strings and
// returns nicely aligned column-formatted text.
func Format(lines []string, config *Config) string {
conf := MergeConfig(DefaultConfig(), config)
widths := widthsFromLines(conf, lines)
// Estimate the buffer size
glueSize := len(conf.Glue)
var size int
for _, w := range widths {
size += w + glueSize
}
size *= len(lines)
// Create the buffer
buf := bytes.NewBuffer(make([]byte, 0, size))
// Create a cache for the string formats
fmtCache := make(map[int]string, 16)
// Create the formatted output using the format string
for _, line := range lines {
elems := elementsFromLine(conf, line)
// Get the string format using cache
numElems := len(elems)
stringfmt, ok := fmtCache[numElems]
if !ok {
stringfmt = stringFormat(conf, widths, numElems)
fmtCache[numElems] = stringfmt
}
fmt.Fprintf(buf, stringfmt, elems...)
}
// Get the string result
result := buf.String()
// Remove trailing newline without removing leading/trailing space
if n := len(result); n > 0 && result[n-1] == '\n' {
result = result[:n-1]
}
return result
}
// SimpleFormat is a convenience function to format text with the defaults.
func SimpleFormat(lines []string) string {
return Format(lines, nil)
}

View File

@@ -0,0 +1,306 @@
package columnize
import (
"fmt"
"testing"
crand "crypto/rand"
)
func TestListOfStringsInput(t *testing.T) {
input := []string{
"Column A | Column B | Column C",
"x | y | z",
}
config := DefaultConfig()
output := Format(input, config)
expected := "Column A Column B Column C\n"
expected += "x y z"
if output != expected {
t.Fatalf("\nexpected:\n%s\n\ngot:\n%s", expected, output)
}
}
func TestEmptyLinesOutput(t *testing.T) {
input := []string{
"Column A | Column B | Column C",
"",
"x | y | z",
}
config := DefaultConfig()
output := Format(input, config)
expected := "Column A Column B Column C\n"
expected += "\n"
expected += "x y z"
if output != expected {
t.Fatalf("\nexpected:\n%s\n\ngot:\n%s", expected, output)
}
}
func TestLeadingSpacePreserved(t *testing.T) {
input := []string{
"| Column B | Column C",
"x | y | z",
}
config := DefaultConfig()
output := Format(input, config)
expected := " Column B Column C\n"
expected += "x y z"
if output != expected {
t.Fatalf("\nexpected:\n%s\n\ngot:\n%s", expected, output)
}
}
func TestColumnWidthCalculator(t *testing.T) {
input := []string{
"Column A | Column B | Column C",
"Longer than A | Longer than B | Longer than C",
"short | short | short",
}
config := DefaultConfig()
output := Format(input, config)
expected := "Column A Column B Column C\n"
expected += "Longer than A Longer than B Longer than C\n"
expected += "short short short"
if output != expected {
printableProof := fmt.Sprintf("\nGot: %+q", output)
printableProof += fmt.Sprintf("\nExpected: %+q", expected)
t.Fatalf("\n%s", printableProof)
}
}
func TestColumnWidthCalculatorNonASCII(t *testing.T) {
input := []string{
"Column A | Column B | Column C",
"⌘⌘⌘⌘⌘⌘⌘⌘ | Longer than B | Longer than C",
"short | short | short",
}
config := DefaultConfig()
output := Format(input, config)
expected := "Column A Column B Column C\n"
expected += "⌘⌘⌘⌘⌘⌘⌘⌘ Longer than B Longer than C\n"
expected += "short short short"
if output != expected {
printableProof := fmt.Sprintf("\nGot: %+q", output)
printableProof += fmt.Sprintf("\nExpected: %+q", expected)
t.Fatalf("\n%s", printableProof)
}
}
func BenchmarkColumnWidthCalculator(b *testing.B) {
// Generate the input
input := []string{
"UUID A | UUID B | UUID C | Column D | Column E",
}
format := "%s|%s|%s|%s"
short := "short"
uuid := func() string {
buf := make([]byte, 16)
if _, err := crand.Read(buf); err != nil {
panic(fmt.Errorf("failed to read random bytes: %v", err))
}
return fmt.Sprintf("%08x-%04x-%04x-%04x-%12x",
buf[0:4],
buf[4:6],
buf[6:8],
buf[8:10],
buf[10:16])
}
for i := 0; i < 1000; i++ {
l := fmt.Sprintf(format, uuid()[:8], uuid()[:12], uuid(), short, short)
input = append(input, l)
}
config := DefaultConfig()
b.ResetTimer()
for i := 0; i < b.N; i++ {
Format(input, config)
}
}
func TestVariedInputSpacing(t *testing.T) {
input := []string{
"Column A |Column B| Column C",
"x|y| z",
}
config := DefaultConfig()
output := Format(input, config)
expected := "Column A Column B Column C\n"
expected += "x y z"
if output != expected {
t.Fatalf("\nexpected:\n%s\n\ngot:\n%s", expected, output)
}
}
func TestUnmatchedColumnCounts(t *testing.T) {
input := []string{
"Column A | Column B | Column C",
"Value A | Value B",
"Value A | Value B | Value C | Value D",
}
config := DefaultConfig()
output := Format(input, config)
expected := "Column A Column B Column C\n"
expected += "Value A Value B\n"
expected += "Value A Value B Value C Value D"
if output != expected {
t.Fatalf("\nexpected:\n%s\n\ngot:\n%s", expected, output)
}
}
func TestAlternateDelimiter(t *testing.T) {
input := []string{
"Column | A % Column | B % Column | C",
"Value A % Value B % Value C",
}
config := DefaultConfig()
config.Delim = "%"
output := Format(input, config)
expected := "Column | A Column | B Column | C\n"
expected += "Value A Value B Value C"
if output != expected {
t.Fatalf("\nexpected:\n%s\n\ngot:\n%s", expected, output)
}
}
func TestAlternateSpacingString(t *testing.T) {
input := []string{
"Column A | Column B | Column C",
"x | y | z",
}
config := DefaultConfig()
config.Glue = " "
output := Format(input, config)
expected := "Column A Column B Column C\n"
expected += "x y z"
if output != expected {
t.Fatalf("\nexpected:\n%s\n\ngot:\n%s", expected, output)
}
}
func TestSimpleFormat(t *testing.T) {
input := []string{
"Column A | Column B | Column C",
"x | y | z",
}
output := SimpleFormat(input)
expected := "Column A Column B Column C\n"
expected += "x y z"
if output != expected {
t.Fatalf("\nexpected:\n%s\n\ngot:\n%s", expected, output)
}
}
func TestAlternatePrefixString(t *testing.T) {
input := []string{
"Column A | Column B | Column C",
"x | y | z",
}
config := DefaultConfig()
config.Prefix = " "
output := Format(input, config)
expected := " Column A Column B Column C\n"
expected += " x y z"
if output != expected {
t.Fatalf("\nexpected:\n%s\n\ngot:\n%s", expected, output)
}
}
func TestEmptyFieldReplacement(t *testing.T) {
input := []string{
"Column A | Column B | Column C",
"x | | z",
}
config := DefaultConfig()
config.Empty = "<none>"
output := Format(input, config)
expected := "Column A Column B Column C\n"
expected += "x <none> z"
if output != expected {
t.Fatalf("\nexpected:\n%s\n\ngot:\n%s", expected, output)
}
}
func TestEmptyConfigValues(t *testing.T) {
input := []string{
"Column A | Column B | Column C",
"x | y | z",
}
config := Config{}
output := Format(input, &config)
expected := "Column A Column B Column C\n"
expected += "x y z"
if output != expected {
t.Fatalf("\nexpected:\n%s\n\ngot:\n%s", expected, output)
}
}
func TestMergeConfig(t *testing.T) {
conf1 := &Config{Delim: "a", Glue: "a", Prefix: "a", Empty: "a"}
conf2 := &Config{Delim: "b", Glue: "b", Prefix: "b", Empty: "b"}
conf3 := &Config{Delim: "c", Prefix: "c"}
m := MergeConfig(conf1, conf2)
if m.Delim != "b" || m.Glue != "b" || m.Prefix != "b" || m.Empty != "b" {
t.Fatalf("bad: %#v", m)
}
m = MergeConfig(conf1, conf3)
if m.Delim != "c" || m.Glue != "a" || m.Prefix != "c" || m.Empty != "a" {
t.Fatalf("bad: %#v", m)
}
m = MergeConfig(conf1, nil)
if m.Delim != "a" || m.Glue != "a" || m.Prefix != "a" || m.Empty != "a" {
t.Fatalf("bad: %#v", m)
}
m = MergeConfig(conf1, &Config{})
if m.Delim != "a" || m.Glue != "a" || m.Prefix != "a" || m.Empty != "a" {
t.Fatalf("bad: %#v", m)
}
}

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core certificate management plugin"
version = "0.14.6"
version = "0.15.4"
[plugin.config]

View File

@@ -22,16 +22,16 @@ migrate_checks_vars_0_5_0() {
dokku_log_info2 "Please use dokku checks:[disable|enable] <app> to control zero downtime functionality"
dokku_log_info2 ""
dokku_log_info2 "zero downtime checks disabled for app ($app)"
config_set --no-restart "$app" DOKKU_CHECKS_ENABLED=0
DOKKU_QUIET_OUTPUT=1 config_set --no-restart "$app" DOKKU_CHECKS_ENABLED=0
fi
if [[ -n "$APP_SKIP_ALL_CHECKS" ]] || [[ -n "$APP_SKIP_DEFAULT_CHECKS" ]]; then
config_unset --no-restart "$app" DOKKU_SKIP_ALL_CHECKS DOKKU_SKIP_DEFAULT_CHECKS
DOKKU_QUIET_OUTPUT=1 config_unset --no-restart "$app" DOKKU_SKIP_ALL_CHECKS DOKKU_SKIP_DEFAULT_CHECKS
fi
done
if [[ -n "$GLOBAL_SKIP_ALL_CHECKS" ]] || [[ -n "$GLOBAL_SKIP_DEFAULT_CHECKS" ]]; then
dokku_log_info1 "Removing global zero downtime settings"
config_unset --global DOKKU_SKIP_ALL_CHECKS DOKKU_SKIP_DEFAULT_CHECKS
DOKKU_QUIET_OUTPUT=1 config_unset --global DOKKU_SKIP_ALL_CHECKS DOKKU_SKIP_DEFAULT_CHECKS
fi
}
@@ -49,9 +49,9 @@ migrate_checks_vars_0_6_0() {
if [[ "$APP_DOKKU_CHECKS_ENABLED" == "0" ]]; then
dokku_log_info2 ""
dokku_log_info2 "zero downtime checks disabled for app ($app)"
config_set --no-restart "$app" DOKKU_CHECKS_SKIPPED="_all_"
DOKKU_QUIET_OUTPUT=1 config_set --no-restart "$app" DOKKU_CHECKS_SKIPPED="_all_"
fi
config_unset --no-restart "$app" DOKKU_CHECKS_ENABLED || true
DOKKU_QUIET_OUTPUT=1 config_unset --no-restart "$app" DOKKU_CHECKS_ENABLED || true
fi
done
}

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core checks plugin"
version = "0.14.6"
version = "0.15.4"
[plugin.config]

View File

@@ -16,8 +16,8 @@ checks_disable_cmd() {
if [[ "$PROCTYPES" == "_all_" ]]; then
dokku_log_info1 "Disabling zero downtime for app ($APP)"
config_set --no-restart "$APP" DOKKU_CHECKS_DISABLED="$PROCTYPES"
config_unset --no-restart "$APP" DOKKU_CHECKS_SKIPPED
DOKKU_QUIET_OUTPUT=1 config_set --no-restart "$APP" DOKKU_CHECKS_DISABLED="$PROCTYPES"
DOKKU_QUIET_OUTPUT=1 config_unset --no-restart "$APP" DOKKU_CHECKS_SKIPPED
else
dokku_log_info1 "Disabling zero downtime for app's ($APP) proctypes ($PROCTYPES)"
local PROCTYPE OIFS="$IFS" IFS=,
@@ -30,15 +30,15 @@ checks_disable_cmd() {
done
DOKKU_CHECKS_DISABLED="$(remove_val_from_list "_all_" "$DOKKU_CHECKS_DISABLED")"
if [[ -z "$DOKKU_CHECKS_DISABLED" ]]; then
config_unset --no-restart "$APP" DOKKU_CHECKS_DISABLED
DOKKU_QUIET_OUTPUT=1 config_unset --no-restart "$APP" DOKKU_CHECKS_DISABLED
else
config_set --no-restart "$APP" DOKKU_CHECKS_DISABLED="$DOKKU_CHECKS_DISABLED"
DOKKU_QUIET_OUTPUT=1 config_set --no-restart "$APP" DOKKU_CHECKS_DISABLED="$DOKKU_CHECKS_DISABLED"
fi
if [[ -z "$DOKKU_CHECKS_SKIPPED" ]]; then
config_unset --no-restart "$APP" DOKKU_CHECKS_SKIPPED
DOKKU_QUIET_OUTPUT=1 config_unset --no-restart "$APP" DOKKU_CHECKS_SKIPPED
else
config_set --no-restart "$APP" DOKKU_CHECKS_SKIPPED="$DOKKU_CHECKS_SKIPPED"
DOKKU_QUIET_OUTPUT=1 config_set --no-restart "$APP" DOKKU_CHECKS_SKIPPED="$DOKKU_CHECKS_SKIPPED"
fi
fi
}

View File

@@ -17,8 +17,8 @@ checks_enable_cmd() {
if [[ "$PROCTYPES" == "_all_" ]]; then
dokku_log_info1 "Enabling zero downtime for app's ($APP)"
config_unset --no-restart "$APP" DOKKU_CHECKS_DISABLED
config_unset --no-restart "$APP" DOKKU_CHECKS_SKIPPED
DOKKU_QUIET_OUTPUT=1 config_unset --no-restart "$APP" DOKKU_CHECKS_DISABLED
DOKKU_QUIET_OUTPUT=1 config_unset --no-restart "$APP" DOKKU_CHECKS_SKIPPED
else
dokku_log_info1 "Enabling zero downtime for app's ($APP) proctypes ($PROCTYPES)"
local PROCTYPE OIFS="$IFS" IFS=,
@@ -29,15 +29,15 @@ checks_enable_cmd() {
IFS="$OIFS"
if [[ -z "$DOKKU_CHECKS_DISABLED" ]]; then
config_unset --no-restart "$APP" DOKKU_CHECKS_DISABLED
DOKKU_QUIET_OUTPUT=1 config_unset --no-restart "$APP" DOKKU_CHECKS_DISABLED
else
config_set --no-restart "$APP" DOKKU_CHECKS_DISABLED="$DOKKU_CHECKS_DISABLED"
DOKKU_QUIET_OUTPUT=1 config_set --no-restart "$APP" DOKKU_CHECKS_DISABLED="$DOKKU_CHECKS_DISABLED"
fi
if [[ -z "$DOKKU_CHECKS_SKIPPED" ]]; then
config_unset --no-restart "$APP" DOKKU_CHECKS_SKIPPED
DOKKU_QUIET_OUTPUT=1 config_unset --no-restart "$APP" DOKKU_CHECKS_SKIPPED
else
config_set --no-restart "$APP" DOKKU_CHECKS_SKIPPED="$DOKKU_CHECKS_SKIPPED"
DOKKU_QUIET_OUTPUT=1 config_set --no-restart "$APP" DOKKU_CHECKS_SKIPPED="$DOKKU_CHECKS_SKIPPED"
fi
fi
}

View File

@@ -16,8 +16,8 @@ checks_skip_cmd() {
if [[ "$PROCTYPES" == "_all_" ]]; then
dokku_log_info1 "Skipping zero downtime for app ($APP)"
config_set --no-restart "$APP" DOKKU_CHECKS_SKIPPED="$PROCTYPES"
config_unset --no-restart "$APP" DOKKU_CHECKS_DISABLED
DOKKU_QUIET_OUTPUT=1 config_set --no-restart "$APP" DOKKU_CHECKS_SKIPPED="$PROCTYPES"
DOKKU_QUIET_OUTPUT=1 config_unset --no-restart "$APP" DOKKU_CHECKS_DISABLED
else
dokku_log_info1 "Skipping zero downtime for app's ($APP) proctypes ($PROCTYPES)"
local PROCTYPE OIFS="$IFS" IFS=,
@@ -30,15 +30,15 @@ checks_skip_cmd() {
done
DOKKU_CHECKS_SKIPPED="$(remove_val_from_list "_all_" "$DOKKU_CHECKS_SKIPPED")"
if [[ -z "$DOKKU_CHECKS_DISABLED" ]]; then
config_unset --no-restart "$APP" DOKKU_CHECKS_DISABLED
DOKKU_QUIET_OUTPUT=1 config_unset --no-restart "$APP" DOKKU_CHECKS_DISABLED
else
config_set --no-restart "$APP" DOKKU_CHECKS_DISABLED="$DOKKU_CHECKS_DISABLED"
DOKKU_QUIET_OUTPUT=1 config_set --no-restart "$APP" DOKKU_CHECKS_DISABLED="$DOKKU_CHECKS_DISABLED"
fi
if [[ -z "$DOKKU_CHECKS_SKIPPED" ]]; then
config_unset --no-restart "$APP" DOKKU_CHECKS_SKIPPED
DOKKU_QUIET_OUTPUT=1 config_unset --no-restart "$APP" DOKKU_CHECKS_SKIPPED
else
config_set --no-restart "$APP" DOKKU_CHECKS_SKIPPED="$DOKKU_CHECKS_SKIPPED"
DOKKU_QUIET_OUTPUT=1 config_set --no-restart "$APP" DOKKU_CHECKS_SKIPPED="$DOKKU_CHECKS_SKIPPED"
fi
fi
}

View File

@@ -328,7 +328,7 @@ func VerifyAppName(appName string) (err error) {
dokkuRoot := MustGetEnv("DOKKU_ROOT")
appRoot := strings.Join([]string{dokkuRoot, appName}, "/")
if !DirectoryExists(appRoot) {
return fmt.Errorf("app %s does not exist: %v", appName, err)
return fmt.Errorf("app %s does not exist", appName)
}
r, _ := regexp.Compile("^[a-z0-9].*")
if !r.MatchString(appName) {

View File

@@ -96,6 +96,18 @@ dokku_log_verbose() {
echo " $*"
}
dokku_log_exclaim_quiet() {
declare desc="log exclaim formatter"
if [[ -z "$DOKKU_QUIET_OUTPUT" ]]; then
echo " ! $*"
fi
}
dokku_log_exclaim() {
declare desc="log exclaim formatter"
echo " ! $*"
}
dokku_log_warn_quiet() {
declare desc="log warning formatter"
if [[ -z "$DOKKU_QUIET_OUTPUT" ]]; then
@@ -252,6 +264,7 @@ get_app_scheduler() {
declare APP="$1"
local DOKKU_APP_SCHEDULER DOKKU_GLOBAL_SCHEDULER DOKKU_SCHEDULER
source "$PLUGIN_AVAILABLE_PATH/config/functions"
[[ -n "$APP" ]] && DOKKU_APP_SCHEDULER="$(config_get "$APP" DOKKU_SCHEDULER || true)"
DOKKU_GLOBAL_SCHEDULER="$(config_get --global DOKKU_SCHEDULER || true)"
@@ -275,9 +288,13 @@ get_running_image_tag() {
is_image_herokuish_based() {
declare desc="returns true if app image is based on herokuish"
# circleci can't support --rm as they run lxc in lxc
[[ ! -f "/home/ubuntu/.circlerc" ]] && local DOCKER_ARGS="--rm"
docker run "$DOKKU_GLOBAL_RUN_ARGS" --entrypoint="/bin/sh" $DOCKER_ARGS "$@" -c "test -f /exec" &>/dev/null
declare IMAGE="$1"
local USER_VALUE
# due to how the build process works, all herokuish images have the Environment variable USER=herokuishuser
USER_VALUE="$(docker inspect -f '{{range .Config.Env}}{{if eq . "USER=herokuishuser" }}{{println .}}{{end}}{{end}}' "$IMAGE")"
[[ "$USER_VALUE" == "" ]] && return 1
return 0
}
get_docker_version() {
@@ -346,16 +363,21 @@ parse_args() {
copy_from_image() {
declare desc="copy file from named image to destination"
local IMAGE="$1"
local SRC_FILE="$2"
local DST_DIR="$3"
declare IMAGE="$1" SRC_FILE="$2" DST_DIR="$3"
local WORK_DIR=""
verify_app_name "$APP"
if verify_image "$IMAGE"; then
if ! is_abs_path "$SRC_FILE"; then
local WORKDIR=$(docker inspect -f '{{.Config.WorkingDir}}' "$IMAGE")
[[ -z "$WORKDIR" ]] && local WORKDIR=/app
local SRC_FILE="$WORKDIR/$SRC_FILE"
if is_image_herokuish_based "$IMAGE"; then
WORKDIR="/app"
else
WORKDIR="$(docker inspect -f '{{.Config.WorkingDir}}' "$IMAGE")"
fi
if [[ -n "$WORKDIR" ]]; then
SRC_FILE="${WORKDIR}/${SRC_FILE}"
fi
fi
local CID=$(docker create "$DOKKU_GLOBAL_RUN_ARGS" "$IMAGE")
docker cp "$CID:$SRC_FILE" "$DST_DIR"
@@ -512,6 +534,9 @@ dokku_build() {
local DOCKER_ARGS=$(: | plugn trigger docker-args-build "$APP" "$IMAGE_SOURCE_TYPE")
[[ "$DOKKU_TRACE" ]] && DOCKER_ARGS+=" -e TRACE=true "
local IMAGE_SOURCE_TYPE="herokuish"
DOCKER_ARGS+=$(: | plugn trigger docker-args-process-run "$APP" "$IMAGE_TAG" "$IMAGE_SOURCE_TYPE" "$PHASE_SCRIPT_KEY")
declare -a ARG_ARRAY
eval "ARG_ARRAY=($DOCKER_ARGS)"
# shellcheck disable=SC2086
@@ -537,6 +562,9 @@ dokku_build() {
[[ "$DOKKU_DOCKERFILE_CACHE_BUILD" == "false" ]] && DOKKU_DOCKER_BUILD_OPTS="$DOKKU_DOCKER_BUILD_OPTS --no-cache"
local DOCKER_ARGS=$(: | plugn trigger docker-args-build "$APP" "$IMAGE_SOURCE_TYPE")
local IMAGE_SOURCE_TYPE="dockerfile"
DOCKER_ARGS+=$(: | plugn trigger docker-args-process-run "$APP" "$IMAGE_TAG" "$IMAGE_SOURCE_TYPE" "$PHASE_SCRIPT_KEY")
# strip --volume and -v args from DOCKER_ARGS
local DOCKER_ARGS=$(sed -e "s/--volume=[[:graph:]]\+[[:blank:]]\?//g" -e "s/-v[[:blank:]]\?[[:graph:]]\+[[:blank:]]\?//g" <<<"$DOCKER_ARGS")
declare -a ARG_ARRAY
@@ -657,7 +685,7 @@ dokku_receive() {
local DOKKU_SKIP_CLEANUP="$(config_get "$APP" DOKKU_SKIP_CLEANUP || true)"
docker_cleanup "$APP"
dokku_log_info1 "Building $APP from $IMAGE_SOURCE_TYPE..."
config_set --no-restart "$APP" DOKKU_APP_TYPE="$IMAGE_SOURCE_TYPE" &>/dev/null
DOKKU_QUIET_OUTPUT=1 config_set --no-restart "$APP" DOKKU_APP_TYPE="$IMAGE_SOURCE_TYPE"
dokku_build "$APP" "$IMAGE_SOURCE_TYPE" "$TMP_WORK_DIR"
release_and_deploy "$APP"
}

View File

@@ -19,7 +19,7 @@ func LogInfo1(text string) {
// LogInfo1Quiet is the info1 header formatter (with quiet option)
func LogInfo1Quiet(text string) {
if os.Getenv("DOKKU_QUIET_OUTPUT") != "" {
if os.Getenv("DOKKU_QUIET_OUTPUT") == "" {
LogInfo1(text)
}
}
@@ -45,7 +45,7 @@ func LogVerbose(text string) {
// LogVerboseQuiet is the verbose log formatter
// prints indented text to stdout (with quiet option)
func LogVerboseQuiet(text string) {
if os.Getenv("DOKKU_QUIET_OUTPUT") != "" {
if os.Getenv("DOKKU_QUIET_OUTPUT") == "" {
LogVerbose(text)
}
}

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core common plugin"
version = "0.14.6"
version = "0.15.4"
[plugin.config]

View File

@@ -1,10 +1,13 @@
package common
import (
"bufio"
"errors"
"fmt"
"io/ioutil"
"os"
"os/user"
"path"
"reflect"
"strconv"
"strings"
@@ -34,34 +37,37 @@ func CommandPropertySet(pluginName, appName, property, value string, properties
PropertyWrite(pluginName, appName, property, value)
} else {
LogInfo2Quiet(fmt.Sprintf("Unsetting %s", property))
PropertyDelete(pluginName, appName, property)
err := PropertyDelete(pluginName, appName, property)
if err != nil {
LogFail(err.Error())
}
}
}
// PropertyDelete deletes a property from the plugin properties for an app
func PropertyDelete(pluginName string, appName string, property string) {
pluginAppConfigRoot := getPluginAppPropertyPath(pluginName, appName)
propertyPath := strings.Join([]string{pluginAppConfigRoot, property}, "/")
func PropertyDelete(pluginName string, appName string, property string) error {
propertyPath := getPropertyPath(pluginName, appName, property)
if err := os.Remove(propertyPath); err != nil {
LogFail(fmt.Sprintf("Unable to remove %s property %s.%s", pluginName, appName, property))
return fmt.Errorf("Unable to remove %s property %s.%s", pluginName, appName, property)
}
return nil
}
// PropertyDestroy destroys the plugin properties for an app
func PropertyDestroy(pluginName string, appName string) {
func PropertyDestroy(pluginName string, appName string) error {
if appName == "_all_" {
pluginConfigPath := getPluginConfigPath(pluginName)
os.RemoveAll(pluginConfigPath)
} else {
pluginAppConfigRoot := getPluginAppPropertyPath(pluginName, appName)
os.RemoveAll(pluginAppConfigRoot)
return os.RemoveAll(pluginConfigPath)
}
pluginAppConfigRoot := getPluginAppPropertyPath(pluginName, appName)
return os.RemoveAll(pluginAppConfigRoot)
}
// PropertyExists returns whether a property exists or not
func PropertyExists(pluginName string, appName string, property string) bool {
pluginAppConfigRoot := getPluginAppPropertyPath(pluginName, appName)
propertyPath := strings.Join([]string{pluginAppConfigRoot, property}, "/")
propertyPath := getPropertyPath(pluginName, appName, property)
_, err := os.Stat(propertyPath)
return !os.IsNotExist(err)
}
@@ -71,15 +77,33 @@ func PropertyGet(pluginName string, appName string, property string) string {
return PropertyGetDefault(pluginName, appName, property, "")
}
// PropertyGetAll returns a map of all properties for a given app
func PropertyGetAll(pluginName string, appName string) (map[string]string, error) {
properties := make(map[string]string)
pluginAppConfigRoot := getPluginAppPropertyPath(pluginName, appName)
files, err := ioutil.ReadDir(pluginAppConfigRoot)
if err != nil {
return properties, err
}
for _, file := range files {
if file.IsDir() {
continue
}
property := file.Name()
properties[property] = PropertyGet(pluginName, appName, property)
}
return properties, nil
}
// PropertyGetDefault returns the value for a given property with a specified default value
func PropertyGetDefault(pluginName, appName, property, defaultValue string) (val string) {
if !PropertyExists(pluginName, appName, property) {
return
}
pluginAppConfigRoot := getPluginAppPropertyPath(pluginName, appName)
propertyPath := strings.Join([]string{pluginAppConfigRoot, property}, "/")
propertyPath := getPropertyPath(pluginName, appName, property)
b, err := ioutil.ReadFile(propertyPath)
if err != nil {
LogWarn(fmt.Sprintf("Unable to read %s property %s.%s", pluginName, appName, property))
@@ -89,23 +113,240 @@ func PropertyGetDefault(pluginName, appName, property, defaultValue string) (val
return
}
// PropertyWrite writes a value for a given application property
func PropertyWrite(pluginName string, appName string, property string, value string) {
if err := makePropertyPath(pluginName, appName); err != nil {
LogFail(fmt.Sprintf("Unable to create %s config directory for %s: %s", pluginName, appName, err.Error()))
// PropertyListAdd adds a property to a list at an optionally specified index
func PropertyListAdd(pluginName string, appName string, property string, value string, index int) error {
if err := PropertyTouch(pluginName, appName, property); err != nil {
return err
}
scannedLines, err := PropertyListGet(pluginName, appName, property)
if err != nil {
return err
}
value = strings.TrimSpace(value)
var lines []string
for i, line := range scannedLines {
if index != 0 && i == (index-1) {
lines = append(lines, value)
}
lines = append(lines, line)
}
if index == 0 || index > len(scannedLines) {
lines = append(lines, value)
}
propertyPath := getPropertyPath(pluginName, appName, property)
file, err := os.OpenFile(propertyPath, os.O_RDWR|os.O_TRUNC, 0600)
if err != nil {
return err
}
w := bufio.NewWriter(file)
for _, line := range lines {
fmt.Fprintln(w, line)
}
if err = w.Flush(); err != nil {
return fmt.Errorf("Unable to write %s config value %s.%s: %s", pluginName, appName, property, err.Error())
}
file.Chmod(0600)
setPermissions(propertyPath, 0600)
return nil
}
// PropertyListGet returns a property list
func PropertyListGet(pluginName string, appName string, property string) (lines []string, err error) {
if !PropertyExists(pluginName, appName, property) {
return lines, nil
}
propertyPath := getPropertyPath(pluginName, appName, property)
file, err := os.Open(propertyPath)
if err != nil {
return lines, err
}
defer file.Close()
scanner := bufio.NewScanner(file)
for scanner.Scan() {
lines = append(lines, scanner.Text())
}
if err = scanner.Err(); err != nil {
return lines, fmt.Errorf("Unable to read %s config value for %s.%s: %s", pluginName, appName, property, err.Error())
}
return lines, nil
}
// PropertyListGetByIndex returns an entry within property list by index
func PropertyListGetByIndex(pluginName string, appName string, property string, index int) (propertyValue string, err error) {
lines, err := PropertyListGet(pluginName, appName, property)
if err != nil {
return
}
found := false
for i, line := range lines {
if i == index {
propertyValue = line
found = true
}
}
if !found {
err = errors.New("Index not found")
}
return
}
// PropertyListGetByValue returns an entry within property list by value
func PropertyListGetByValue(pluginName string, appName string, property string, value string) (propertyValue string, err error) {
lines, err := PropertyListGet(pluginName, appName, property)
if err != nil {
return
}
found := false
for _, line := range lines {
if line == value {
propertyValue = line
found = true
}
}
if !found {
err = errors.New("Value not found")
}
return
}
// PropertyListRemove removes a value from a property list
func PropertyListRemove(pluginName string, appName string, property string, value string) error {
lines, err := PropertyListGet(pluginName, appName, property)
if err != nil {
return err
}
propertyPath := getPropertyPath(pluginName, appName, property)
file, err := os.OpenFile(propertyPath, os.O_RDWR|os.O_TRUNC, 0600)
if err != nil {
return err
}
found := false
w := bufio.NewWriter(file)
for _, line := range lines {
if line == value {
found = true
continue
}
fmt.Fprintln(w, line)
}
if err = w.Flush(); err != nil {
return fmt.Errorf("Unable to write %s config value %s.%s: %s", pluginName, appName, property, err.Error())
}
file.Chmod(0600)
setPermissions(propertyPath, 0600)
if !found {
return errors.New("Property not found, nothing was removed")
}
return nil
}
// PropertyListSet sets a value within a property list at a specified index
func PropertyListSet(pluginName string, appName string, property string, value string, index int) error {
if err := PropertyTouch(pluginName, appName, property); err != nil {
return err
}
scannedLines, err := PropertyListGet(pluginName, appName, property)
if err != nil {
return err
}
value = strings.TrimSpace(value)
var lines []string
if index >= len(scannedLines) {
for _, line := range scannedLines {
lines = append(lines, line)
}
lines = append(lines, value)
} else {
for i, line := range scannedLines {
if i == index {
lines = append(lines, value)
} else {
lines = append(lines, line)
}
}
}
propertyPath := getPropertyPath(pluginName, appName, property)
file, err := os.OpenFile(propertyPath, os.O_RDWR|os.O_TRUNC, 0600)
if err != nil {
return err
}
w := bufio.NewWriter(file)
for _, line := range lines {
fmt.Fprintln(w, line)
}
if err = w.Flush(); err != nil {
return fmt.Errorf("Unable to write %s config value %s.%s: %s", pluginName, appName, property, err.Error())
}
file.Chmod(0600)
setPermissions(propertyPath, 0600)
return nil
}
// PropertyTouch ensures a given application property file exists
func PropertyTouch(pluginName string, appName string, property string) error {
if err := makePluginAppPropertyPath(pluginName, appName); err != nil {
return fmt.Errorf("Unable to create %s config directory for %s: %s", pluginName, appName, err.Error())
}
propertyPath := getPropertyPath(pluginName, appName, property)
if PropertyExists(pluginName, appName, property) {
return nil
}
pluginAppConfigRoot := getPluginAppPropertyPath(pluginName, appName)
propertyPath := strings.Join([]string{pluginAppConfigRoot, property}, "/")
file, err := os.Create(propertyPath)
if err != nil {
LogFail(fmt.Sprintf("Unable to write %s config value %s.%s: %s", pluginName, appName, property, err.Error()))
return fmt.Errorf("Unable to write %s config value %s.%s: %s", pluginName, appName, property, err.Error())
}
defer file.Close()
return nil
}
// PropertyWrite writes a value for a given application property
func PropertyWrite(pluginName string, appName string, property string, value string) error {
if err := PropertyTouch(pluginName, appName, property); err != nil {
return err
}
propertyPath := getPropertyPath(pluginName, appName, property)
file, err := os.Create(propertyPath)
if err != nil {
return fmt.Errorf("Unable to write %s config value %s.%s: %s", pluginName, appName, property, err.Error())
}
defer file.Close()
fmt.Fprintf(file, value)
file.Chmod(0600)
setPermissions(propertyPath, 0600)
return nil
}
// PropertySetup creates the plugin config root
@@ -117,18 +358,23 @@ func PropertySetup(pluginName string) (err error) {
return setPermissions(pluginConfigRoot, 0755)
}
func getPropertyPath(pluginName string, appName string, property string) string {
pluginAppConfigRoot := getPluginAppPropertyPath(pluginName, appName)
return path.Join(pluginAppConfigRoot, property)
}
// getPluginAppPropertyPath returns the plugin property path for a given plugin/app combination
func getPluginAppPropertyPath(pluginName string, appName string) string {
return strings.Join([]string{getPluginConfigPath(pluginName), appName}, "/")
return path.Join(getPluginConfigPath(pluginName), appName)
}
// getPluginConfigPath returns the plugin property path for a given plugin
func getPluginConfigPath(pluginName string) string {
return strings.Join([]string{MustGetEnv("DOKKU_LIB_ROOT"), "config", pluginName}, "/")
return path.Join(MustGetEnv("DOKKU_LIB_ROOT"), "config", pluginName)
}
// makePropertyPath ensures that a property path exists
func makePropertyPath(pluginName string, appName string) (err error) {
// makePluginAppPropertyPath ensures that a property path exists
func makePluginAppPropertyPath(pluginName string, appName string) (err error) {
pluginAppConfigRoot := getPluginAppPropertyPath(pluginName, appName)
if err = os.MkdirAll(pluginAppConfigRoot, 0755); err != nil {
return

View File

@@ -25,4 +25,4 @@ clean:
rm -rf commands subcommands
src-clean:
rm -rf .gitignore src triggers vendor Makefile *.go
rm -rf .gitignore src triggers vendor Makefile *.go glide.*

View File

@@ -2,6 +2,7 @@ package config
import (
"fmt"
"os"
"regexp"
"github.com/dokku/dokku/plugins/common"
@@ -46,8 +47,10 @@ func SetMany(appName string, entries map[string]string, restart bool) (err error
keys = append(keys, k)
}
if len(entries) != 0 {
common.LogInfo1("Setting config vars")
fmt.Println(prettyPrintEnvEntries(" ", entries))
common.LogInfo1Quiet("Setting config vars")
if os.Getenv("DOKKU_QUIET_OUTPUT") == "" {
fmt.Println(prettyPrintEnvEntries(" ", entries))
}
env.Write()
triggerUpdate(appName, "set", keys)
}
@@ -72,11 +75,11 @@ func UnsetMany(appName string, keys []string, restart bool) (err error) {
}
for _, k := range keys {
if _, hasKey := env.Map()[k]; hasKey {
common.LogInfo1(fmt.Sprintf("Unsetting %s", k))
common.LogInfo1Quiet(fmt.Sprintf("Unsetting %s", k))
env.Unset(k)
changed = true
} else {
common.LogInfo1(fmt.Sprintf("Skipping %s, it is not set in the environment", k))
common.LogInfo1Quiet(fmt.Sprintf("Skipping %s, it is not set in the environment", k))
}
}
if changed {

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core config plugin"
version = "0.14.6"
version = "0.15.4"
[plugin.config]

View File

@@ -67,11 +67,11 @@ func main() {
}
func usage() {
fmt.Println(helpHeader)
config := columnize.DefaultConfig()
config.Delim = ","
config.Prefix = " "
config.Empty = ""
content := strings.Split(helpContent, "\n")[1:]
fmt.Println(helpHeader)
fmt.Println(columnize.Format(content, config))
}

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core docker-options plugin"
version = "0.14.6"
version = "0.15.4"
[plugin.config]

View File

@@ -24,7 +24,7 @@ disable_app_vhost() {
[[ "$2" == "--no-restart" ]] && local CONFIG_SET_ARGS=$2
# shellcheck disable=SC2086
config_set $CONFIG_SET_ARGS $APP NO_VHOST=1
DOKKU_QUIET_OUTPUT=1 config_set $CONFIG_SET_ARGS $APP NO_VHOST=1
}
domains_setup() {
@@ -212,7 +212,7 @@ enable_app_vhost() {
plugn trigger pre-enable-vhost "$APP"
[[ "$2" == "--no-restart" ]] && local CONFIG_SET_ARGS=$2
# shellcheck disable=SC2086
config_set $CONFIG_SET_ARGS "$APP" NO_VHOST=0
DOKKU_QUIET_OUTPUT=1 config_set $CONFIG_SET_ARGS "$APP" NO_VHOST=0
}
get_app_domains() {

View File

@@ -10,6 +10,11 @@ cmd-domains-report() {
local INSTALLED_APPS=$(dokku_apps)
local APP="$2" INFO_FLAG="$3"
if [[ "$APP" == "--global" ]]; then
cmd-domains-report-single "$APP" "$INFO_FLAG"
return
fi
if [[ -n "$APP" ]] && [[ "$APP" == --* ]]; then
INFO_FLAG="$APP"
APP=""
@@ -33,16 +38,29 @@ cmd-domains-report-single() {
if [[ "$INFO_FLAG" == "true" ]]; then
INFO_FLAG=""
fi
verify_app_name "$APP"
local flag_map=(
"--domains-app-enabled: $(fn-domains-app-enabled "$APP")"
"--domains-app-vhosts: $(fn-domains-app-vhosts "$APP")"
local flag_map=() app_flags=() global_flags=()
if [[ "$APP" != "--global" ]]; then
verify_app_name "$APP"
app_flags=(
"--domains-app-enabled: $(fn-domains-app-enabled "$APP")"
"--domains-app-vhosts: $(fn-domains-app-vhosts "$APP")"
)
fi
global_flags=(
"--domains-global-enabled: $(fn-domains-global-enabled)"
"--domains-global-vhosts: $(fn-domains-global-vhosts)"
)
flag_map=("${app_flags[@]}" "${global_flags[@]}")
if [[ -z "$INFO_FLAG" ]]; then
dokku_log_info2_quiet "$APP domains information"
if [[ "$APP" == "--global" ]]; then
dokku_log_info2_quiet "Global domains information"
else
dokku_log_info2_quiet "$APP domains information"
fi
for flag in "${flag_map[@]}"; do
key="$(echo "${flag#--}" | cut -f1 -d' ' | tr - ' ')"
dokku_log_verbose "$(printf "%-30s %-25s" "${key^}" "${flag#*: }")"
@@ -63,7 +81,6 @@ cmd-domains-report-single() {
fi
done
[[ "$match" == "true" ]] || dokku_log_fail "Invalid flag passed, valid flags:${valid_flags}"
[[ "$value_exists" == "true" ]] || dokku_log_fail "not deployed"
fi
}
@@ -78,7 +95,7 @@ domains_help_content_func() {
domains:enable <app>, Enable VHOST support
domains:remove <app> <domain> [<domain> ...], Remove domains from app
domains:remove-global <domain> [<domain> ...], Remove global domain names
domains:report [<app>] [<flag>], Displays a domains report for one or more apps
domains:report [<app>|--global] [<flag>], Displays a domains report for one or more apps
domains:set <app> <domain> [<domain> ...], Set domains for app
domains:set-global <domain> [<domain> ...], Set global domain names
help_content

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core domains plugin"
version = "0.14.6"
version = "0.15.4"
[plugin.config]

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core enter plugin"
version = "0.14.6"
version = "0.15.4"
[plugin.config]

View File

@@ -165,7 +165,7 @@ git_build() {
fi
if [[ -n "$ENV_VAR_NAME" ]]; then
config_set --no-restart "$APP" "${ENV_VAR_NAME}=${REV}" >/dev/null
DOKKU_QUIET_OUTPUT=1 config_set --no-restart "$APP" "${ENV_VAR_NAME}=${REV}"
fi
local REF="$REV"
else

23
plugins/git/git-revision Executable file
View File

@@ -0,0 +1,23 @@
#!/usr/bin/env bash
source "$PLUGIN_CORE_AVAILABLE_PATH/common/property-functions"
source "$PLUGIN_AVAILABLE_PATH/config/functions"
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x
trigger-git-git-revision() {
declare desc="fetches the current git revision value for an application"
declare APP="$1"
ENV_VAR_NAME="$(fn-plugin-property-get "git" "$APP" "rev-env-var")"
if [[ -z "$ENV_VAR_NAME" ]] && ! fn-plugin-property-exists "git" "$APP" "rev-env-var"; then
ENV_VAR_NAME="GIT_REV"
fi
if [[ -z "$ENV_VAR_NAME" ]]; then
return
fi
config_get "$APP" "$ENV_VAR_NAME" || true
}
trigger-git-git-revision "$@"

View File

@@ -18,14 +18,14 @@ migrate_git_vars_0_12_0() {
DOKKU_DEPLOY_BRANCH=$(config_get --global DOKKU_DEPLOY_BRANCH || true)
if [[ -n "$DOKKU_DEPLOY_BRANCH" ]]; then
fn-plugin-property-write "git" --global "deploy-branch" "$DOKKU_DEPLOY_BRANCH"
config_unset --global DOKKU_DEPLOY_BRANCH || true
DOKKU_QUIET_OUTPUT=1 config_unset --global DOKKU_DEPLOY_BRANCH || true
fi
for app in $APPS; do
DOKKU_DEPLOY_BRANCH=$(config_get "$app" DOKKU_DEPLOY_BRANCH || true)
if [[ -n "$DOKKU_DEPLOY_BRANCH" ]]; then
fn-plugin-property-write "git" "$app" "deploy-branch" "$DOKKU_DEPLOY_BRANCH"
config_unset --no-restart "$app" DOKKU_DEPLOY_BRANCH || true
DOKKU_QUIET_OUTPUT=1 config_unset --no-restart "$app" DOKKU_DEPLOY_BRANCH || true
fi
done
}

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core git plugin"
version = "0.14.6"
version = "0.15.4"
[plugin.config]

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core logs plugin"
version = "0.14.6"
version = "0.15.4"
[plugin.config]

View File

@@ -10,8 +10,6 @@ logs_default_cmd() {
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
local APP="$2"
verify_app_name "$2"
local APP_ROOT="$DOKKU_ROOT/$APP"
local COLORS=(36 33 32 35 31)
! (is_deployed "$APP") && dokku_log_fail "App $APP has not been deployed"
@@ -24,23 +22,23 @@ logs_default_cmd() {
fi
eval set -- "$TEMP"
local DOKKU_LOGS_LINE_NUMBERS="100"
local NUM="100"
while true; do
case "$1" in
-t | --tail)
local DOKKU_LOGS_ARGS+="--follow "
local TAIL=true
shift
;;
-n | --num)
local DOKKU_LOGS_LINE_NUMBERS="$2"
local NUM="$2"
shift 2
;;
-p | --ps)
local DOKKU_LOGS_ONLY_PROCESS="$2"
local PROCESS_TYPE="$2"
shift 2
;;
-q | --quiet)
local DOKKU_LOGS_NO_PRETTY_PRINT="true"
local PRETTY_PRINT=true
shift
;;
--)
@@ -51,32 +49,8 @@ logs_default_cmd() {
esac
done
if [[ -n $DOKKU_LOGS_ONLY_PROCESS ]]; then
local CONTAINERS=("$APP_ROOT/CONTAINER.$DOKKU_LOGS_ONLY_PROCESS".*)
else
local CONTAINERS=("$APP_ROOT"/CONTAINER.*)
fi
[[ -z $(stat -t "${CONTAINERS[0]}" 2>/dev/null) ]] && exit 0
local DOKKU_LOGS_ARGS+="--tail $DOKKU_LOGS_LINE_NUMBERS"
((MAX_INDEX = ${#CONTAINERS[*]} - 1)) || true
for i in ${!CONTAINERS[*]}; do
local DYNO=$(echo "${CONTAINERS[i]}" | sed -r 's/.*CONTAINER\.(.*)/\1/')
local CID=$(<"${CONTAINERS[i]}")
local COLOR=${COLORS[i % ${#COLORS[*]}]}
if [[ $DOKKU_LOGS_NO_PRETTY_PRINT == "true" ]]; then
local DOKKU_LOGS_CMD+="(docker logs $DOKKU_LOGS_ARGS $CID 2>&1)"
else
local DOKKU_LOGS_PRETTY_PRINT_CMD="sed -r 's/^([^Z]+Z )/\x1b[${COLOR}m\1app[$DYNO]:\x1b[0m /gm'"
local DOKKU_LOGS_CMD+="(docker logs -t $DOKKU_LOGS_ARGS $CID 2>&1 | $DOKKU_LOGS_PRETTY_PRINT_CMD)"
fi
if [[ $i != "$MAX_INDEX" ]]; then
local DOKKU_LOGS_CMD+="& "
else
local DOKKU_LOGS_CMD+="; "
fi
done
bash -c "($DOKKU_LOGS_CMD)"
DOKKU_SCHEDULER=$(get_app_scheduler "$APP")
plugn trigger scheduler-logs "$DOKKU_SCHEDULER" "$APP" "$PROCESS_TYPE" "$TAIL" "$PRETTY_PRINT" "$NUM"
}
logs_default_cmd "$@"

View File

@@ -26,7 +26,7 @@ clean:
rm -rf commands subcommands triggers network-* install post-app-clone-setup post-create post-delete report
src-clean:
rm -rf .gitignore src triggers vendor Makefile *.go
rm -rf .gitignore src triggers vendor Makefile *.go glide.*
triggers: $(TRIGGERS)

Some files were not shown because too many files have changed in this diff Show More