Compare commits

...

86 Commits

Author SHA1 Message Date
Jose Diaz-Gonzalez
652b90a074 Release 0.22.8
Some checks failed
bump-formula / bump-formula (push) Has been cancelled
# History

## 0.22.8

Install/update via the bootstrap script:

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

### Bug Fixes

- #4309: @josegonzalez Correct issue where verifying an app name would bail early

### Documentation

- #4307: @josegonzalez Specify that the dokku logo is for non-commercial use
2021-01-09 16:33:55 -05:00
Jose Diaz-Gonzalez
bdd7c58a62 Merge pull request #4309 from dokku/4308-app-name-validation
Correct issue where verifying an app name would bail early
2021-01-09 14:28:40 -05:00
Jose Diaz-Gonzalez
3419f18c9f fix: correct issue where verifying an app name would bail early
Refs #4308
2021-01-09 07:40:45 -05:00
Jose Diaz-Gonzalez
87ce52ded1 Merge pull request #4307 from dokku/josegonzalez-patch-1
Specify that the dokku logo is for non-commercial use
2021-01-08 02:47:01 -05:00
Jose Diaz-Gonzalez
1db1411331 docs: specify that the dokku logo is for non-commercial use
There is still no explicit license on the logo, but its certainly not for external commercial use. Please respect that decision.

[ci skip]
2021-01-08 02:14:25 -05:00
Jose Diaz-Gonzalez
e435d01258 Release 0.22.7
Some checks failed
bump-formula / bump-formula (push) Has been cancelled
# History

## 0.22.7

Install/update via the bootstrap script:

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

### Bug Fixes

- #4301: @josegonzalez Ensure vector container starts correctly
2021-01-07 03:07:57 -05:00
Jose Diaz-Gonzalez
793e9d377e Merge pull request #4301 from dokku/4299-vector-fixes
Ensure vector container starts correctly
2021-01-07 03:07:40 -05:00
Jose Diaz-Gonzalez
a57680fbbf feat: test vector commands 2021-01-07 01:54:04 -05:00
Jose Diaz-Gonzalez
eda71e3ffe feat: mirror log tailing support for logs:vector-logs command 2021-01-07 01:43:55 -05:00
Jose Diaz-Gonzalez
b186d9d66c docs: fix help output 2021-01-07 01:42:51 -05:00
Jose Diaz-Gonzalez
f16a211b48 feat: add more tests for the logs plugin 2021-01-07 01:34:19 -05:00
Jose Diaz-Gonzalez
d70a9be97e fix: correct issue where all flags were not shown if an invalid flag was specified 2021-01-07 01:34:05 -05:00
Jose Diaz-Gonzalez
666bb9dfee fix: unscope err for report subcommands 2021-01-07 01:12:50 -05:00
Jose Diaz-Gonzalez
081a44755e docs: fix examples to use correct property key 2021-01-07 01:07:20 -05:00
Jose Diaz-Gonzalez
2eae6c25af tests: add test for logs:help 2021-01-07 00:14:43 -05:00
Jose Diaz-Gonzalez
4bbee232d8 fix: handle error cases in starting a new vector container 2021-01-07 00:12:44 -05:00
Jose Diaz-Gonzalez
441f7ab22a fix: pass 1 to --watch-config flag
Apparently this needs a value...
2021-01-07 00:12:23 -05:00
Jose Diaz-Gonzalez
714b27f8a4 chore: quiet output of starting container
We check if the container is running later, so there isn't a need for us to see the containerID here
2021-01-07 00:08:05 -05:00
Jose Diaz-Gonzalez
2d841f47eb fix: handle case where there are no apps 2021-01-06 22:45:47 -05:00
Jose Diaz-Gonzalez
4c98cd922f Release 0.22.6
Some checks failed
bump-formula / bump-formula (push) Has been cancelled
# History

## 0.22.6

Install/update via the bootstrap script:

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

### Bug Fixes

- #4295: @josegonzalez Update ps subcommands and triggers

### New Features

- #4286: @josegonzalez Add support for templated CHECKS files
- #4294: @josegonzalez Enhance ssh client logging output
- #4291: @josegonzalez Add log aggregation support via Vector
- #4288: @josegonzalez Add the pid of the dokku process to event logs
- #4289: @josegonzalez Clean precheck tmp file on exit

### Refactors

- #4287: @josegonzalez Refactor parallelized goroutines to use error groups

### Documentation

- #4292: @thomasfedb Update docs to note support for Ubuntu 20.04
- #4293: @ltalirz Fix path in persistent storage docs

### Other

- #4290: @josegonzalez Add support for debug logging plugin trigger stderr and stdout
2021-01-05 09:50:19 -05:00
Jose Diaz-Gonzalez
1c3c712629 Merge pull request #4295 from dokku/fix-triggers
Update ps subcommands and triggers
2021-01-05 09:45:59 -05:00
Jose Diaz-Gonzalez
84ec74e97f fix: update ps subcommands and triggers
- There were missing trigger symlinks due to the the rewrite omitting them
- There was an extra symlink for a subcommand that was removed
2021-01-05 03:50:52 -05:00
Jose Diaz-Gonzalez
57cc1c7f8e Merge pull request #4286 from dokku/3974-templated-checks
Add support for templated CHECKS files
2021-01-05 03:15:36 -05:00
Jose Diaz-Gonzalez
0e67ffc41e Merge pull request #4294 from dokku/4278-better-client-logging
Enhance ssh client logging output
2021-01-05 02:21:34 -05:00
Jose Diaz-Gonzalez
f4e0d19d43 fix: correct path for templated checks file 2021-01-05 01:02:39 -05:00
Jose Diaz-Gonzalez
07e7988cdf feat: add sigil templating to CHECKS files
This enables general templating capabilities, in addition to environment variable access.

Closes #3974.
2021-01-05 00:16:55 -05:00
Jose Diaz-Gonzalez
d21aca2c59 chore: remove unnecessary extra logic
This is now performed in copy_from_image for all files.
2021-01-05 00:16:55 -05:00
Jose Diaz-Gonzalez
540e066acf fix: return the failed exit code 2021-01-05 00:10:54 -05:00
Jose Diaz-Gonzalez
a49de4e473 docs: make the header more clear
[ci skip]
2021-01-04 23:00:58 -05:00
Jose Diaz-Gonzalez
4c28ae2630 Merge pull request #4291 from dokku/2268-vector-logging
Add log aggregation support via Vector
2021-01-04 22:56:25 -05:00
Jose Diaz-Gonzalez
2d07d89d60 docs: add new as of banner
[ci skip]
2021-01-04 22:56:03 -05:00
Jose Diaz-Gonzalez
83d8c8448b feat: remind users to check their ssh config in cases of ssh error
Closes #4278
2021-01-04 22:41:04 -05:00
Jose Diaz-Gonzalez
8eccd50ecb chore: standardize logging output
- send errors to stderr
- use proper prefixes on errors
- use correct prefixes on stdout
2021-01-04 22:38:28 -05:00
Jose Diaz-Gonzalez
09ed45534d refactor: always write out the vector configuration 2021-01-04 21:48:38 -05:00
Jose Diaz-Gonzalez
711945147b refactor: use --watch-config instead of signaling the container to reload config 2021-01-04 21:48:28 -05:00
Jose Diaz-Gonzalez
0b3a6687f6 feat: actually mount the apps log dir
Also fix it so that the log directory is mountable from a custom path on the host if running dokku within a container.
2021-01-04 21:45:26 -05:00
Jose Diaz-Gonzalez
1aec869f9e fix: do not delete apps log subdir
This is a new directory introduced for vector logging should not be deleted so vector logging still works.
2021-01-04 21:40:51 -05:00
Jose Diaz-Gonzalez
6f9a6eb294 fix: only check for global properties when appName is --global 2021-01-04 12:43:15 -05:00
Jose Diaz-Gonzalez
96ed840d17 Merge pull request #4292 from thomasfedb/patch-1
Update docs to note support for Ubuntu 20.04
2021-01-04 12:19:39 -05:00
Jose Diaz-Gonzalez
5acdf4a43c Merge pull request #4293 from ltalirz/patch-2
Update persistent-storage.md
2021-01-04 12:19:05 -05:00
Leopold Talirz
6b4c545592 Update persistent-storage.md
add directory to complete path
2021-01-04 16:17:54 +01:00
Thomas Drake-Brockman
dd6cbcf242 Update docs to note support for Ubuntu 20.04 2021-01-04 21:50:02 +08:00
Jose Diaz-Gonzalez
d6acf5530e fix: add some comments 2021-01-04 01:14:40 -05:00
Jose Diaz-Gonzalez
94696e81fa fix: ensure the vector container does not exit when no configured sinks are in place 2021-01-04 01:12:25 -05:00
Jose Diaz-Gonzalez
43d6a2ad94 feat: add ability to set a global vector sink 2021-01-04 01:11:49 -05:00
Jose Diaz-Gonzalez
e1425a85e4 feat: add ability to set global properties
Not all properties can be set globally, and the "appName" in the global case is currently defaulted to `--global`. This is okay because domain label names cannot start with hyphens, and all app names must be valid domain label names.
2021-01-04 00:50:14 -05:00
Jose Diaz-Gonzalez
f5fa94cc9c chore: remove dburl usage
dburl adds aliases for everything, which breaks if two schemes are similar enough (anything with `aws_` as a prefix broke scheme registration). It does not appear to add anything, so we'll drop that dependency.

Also remove go-jsonmerge, as this was refactored to use structs instead of byte manipulation...
2021-01-04 00:42:13 -05:00
Jose Diaz-Gonzalez
fd85b1f605 feat: add vector integration
This currently is missing a few features:

- global sinks
- logrotation

But works fairly well otherwise.
2021-01-04 00:30:22 -05:00
Jose Diaz-Gonzalez
b386783ec8 Merge pull request #4287 from dokku/parallelize-refactor
Refactor parallelized goroutines to use error groups
2021-01-02 23:53:11 -05:00
Jose Diaz-Gonzalez
3b76b81edf fix: set correct variable for app image repo 2021-01-02 18:47:48 -05:00
Jose Diaz-Gonzalez
2eb159b0c3 refactor: use error group for fetching the app shell to use for app-json tasks 2021-01-02 18:45:30 -05:00
Jose Diaz-Gonzalez
596e7b6f24 feat: use error group to fetch the deploying app image
This is a fairly slow operation currently done serially, making ps:scale output brutally slow. Using an error group to parallelize the output is also pleasing to the eyes :)
2021-01-02 18:45:30 -05:00
Jose Diaz-Gonzalez
aa0437bb23 refactor: use an error group to simplify parallel retrieval of scheduler
This makes the code a bit simpler to read and more idiomatic
2021-01-02 18:45:30 -05:00
Jose Diaz-Gonzalez
a6c22a292d Merge pull request #4288 from dokku/pid-log
Add the pid of the dokku process to event logs
2021-01-02 18:40:30 -05:00
Jose Diaz-Gonzalez
0635edba17 Merge pull request #4289 from dokku/clean-on-exit
Clean precheck tmp file on exit
2021-01-02 18:40:23 -05:00
Jose Diaz-Gonzalez
a0491a5ef2 Merge pull request #4290 from dokku/debug-output
Add support for debug logging plugin trigger stderr and stdout
2021-01-02 18:40:15 -05:00
Jose Diaz-Gonzalez
38d172c477 refactor: add support for debug logging plugin trigger stderr and stdout
Previously, this could get a bit hazy when running the command within a goroutine. The new method creates pipes for writing stdout/stderr for each call to PluginTriggerOutput, then debug logs if if trace mode is on.

While it is a bit weird to read, it is more correct and should get rid of any parallel processing issues.
2021-01-02 06:13:48 -05:00
Jose Diaz-Gonzalez
5e4c918d40 feat: trim any extra debug log prefixes 2021-01-02 06:11:51 -05:00
Jose Diaz-Gonzalez
e8aaacff5e refactor: simplify code 2021-01-02 06:11:34 -05:00
Jose Diaz-Gonzalez
21d4d640c2 fix: clean precheck tmp file on exit 2021-01-02 05:23:52 -05:00
Jose Diaz-Gonzalez
b927c1b84d feat: add the pid of the dokku process to event logs 2021-01-02 05:23:12 -05:00
Jose Diaz-Gonzalez
d456a96cb5 Release 0.22.5
Some checks failed
bump-formula / bump-formula (push) Has been cancelled
# History

## 0.22.5

Install/update via the bootstrap script:

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

### Bug Fixes

- #4279: @josegonzalez Allow vmware-based vm to work on big sur

### Refactors

- #4282: @josegonzalez Cleanup brew-bump integration
- #4280: @josegonzalez Parallelize report and scheduler retrieval

### Documentation

- #4285: @josegonzalez Reference official gitlab-ci integration
- #4284: @josegonzalez Drop old doc link to gitlab ci docs
- #4283: @josegonzalez Add CI documentation section for Github Actions and Gitlab
- #4281: @josegonzalez Add forum link to documentation
2020-12-31 18:22:18 -05:00
Jose Diaz-Gonzalez
1964fc6b65 Merge pull request #4285 from dokku/4217-gitlab-ci
Reference official gitlab-ci integration
2020-12-30 04:29:15 -05:00
Jose Diaz-Gonzalez
26e270a49f docs: reference official gitlab-ci integration
Closes #4217
2020-12-30 04:28:45 -05:00
Jose Diaz-Gonzalez
3323623289 Merge pull request #4284 from dokku/josegonzalez-patch-1
Drop old doc link to gitlab ci docs
2020-12-30 03:41:35 -05:00
Jose Diaz-Gonzalez
7a43321d1c docs: drop old doc link to gitlab ci docs
[ci skip]
2020-12-30 03:41:18 -05:00
Jose Diaz-Gonzalez
4a5cc71c3e Merge pull request #4283 from dokku/4151-ci-docs
Add CI documentation section for Github Actions and Gitlab
2020-12-30 03:39:32 -05:00
Jose Diaz-Gonzalez
660ccf876e docs: add documentation for generic ci systems 2020-12-30 03:38:47 -05:00
Jose Diaz-Gonzalez
69dd81860f docs: add github actions documentation 2020-12-30 03:34:01 -05:00
Jose Diaz-Gonzalez
b1c2c026aa docs: split out initial ci section of docs 2020-12-30 03:25:22 -05:00
Jose Diaz-Gonzalez
b7fa97bf9e Merge pull request #4282 from dokku/brew-bump-automation
Cleanup brew-bump integration
2020-12-30 03:18:48 -05:00
Jose Diaz-Gonzalez
1bdaab6d72 Merge pull request #4281 from dokku/forum-link
Add forum link to documentation
2020-12-30 03:17:58 -05:00
Jose Diaz-Gonzalez
3edc14fc97 Merge pull request #4280 from dokku/parallelize-internals
Parallelize report and scheduler retrieval
2020-12-30 03:16:27 -05:00
Jose Diaz-Gonzalez
940d258c5e fix: use authentcated clone for tap url 2020-12-30 03:08:13 -05:00
Jose Diaz-Gonzalez
2500ca5106 chore: use https url brew tap clone 2020-12-30 03:06:16 -05:00
Jose Diaz-Gonzalez
c5a7fd6d43 chore: configure git user info 2020-12-30 03:05:54 -05:00
Jose Diaz-Gonzalez
d424af5b1e docs: add github discussions link and clarify what is monitored and what is not. 2020-12-30 02:50:03 -05:00
Jose Diaz-Gonzalez
ca383739ab docs: add github discussions link to header 2020-12-30 02:44:20 -05:00
Jose Diaz-Gonzalez
0176e888af refactor: only add status flags as necessary 2020-12-30 00:38:07 -05:00
Jose Diaz-Gonzalez
0e320d2832 feat: short-circuit report fetching if only retrieving a single value
This speeds up report output when specifying a flag as extra data that isn't used will not be fetched unnecessarily.
2020-12-30 00:37:43 -05:00
Jose Diaz-Gonzalez
38b96c1e27 fix: add comments 2020-12-30 00:28:59 -05:00
Jose Diaz-Gonzalez
5da5a6fe5f refactor: collect process status in parallel
This speeds up ps:report for apps that have more than 1 running container.
2020-12-30 00:21:09 -05:00
Jose Diaz-Gonzalez
28c9f42a25 refactor: parallelize report commands
This will make reports a bit faster to run, and is safe to do as reports should not change app state.
2020-12-29 23:56:10 -05:00
Jose Diaz-Gonzalez
44461e21df refactor: parallelize scheduler retrieval
In many cases, a user may only set a global scheduler, and as such we waste the initial call to get the app scheduler. Parallelizing the fetch increases the speed at which we can check for the scheduler.
2020-12-29 23:55:13 -05:00
Jose Diaz-Gonzalez
164c4eefa7 Merge pull request #4279 from dokku/vagrant-big-sur
Allow vmware-based vm to work on big sur
2020-12-29 16:27:58 -05:00
Jose Diaz-Gonzalez
ee6c034baa fix: allow vmware-based vm to work on big sur
There seems to be an issue in Vmware that causes SSH to fail for new VMs.

https://github.com/hashicorp/vagrant/issues/12045
2020-12-29 16:27:29 -05:00
117 changed files with 1832 additions and 457 deletions

View File

@@ -14,7 +14,10 @@ jobs:
run: echo ::set-output name=version::${GITHUB_REF/refs\/tags\//}
- name: Bump Brew
env:
HOMEBREW_GITHUB_USERNAME: ${{ secrets.HOMEBREW_GITHUB_USERNAME }}
HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.HOMEBREW_GITHUB_API_TOKEN }}
run: |
brew tap dokku/repo
git config --global user.name 'Dokku Bot'
git config --global user.email no-reply@dokku.com
brew tap dokku/repo "https://$HOMEBREW_GITHUB_USERNAME:$HOMEBREW_GITHUB_API_TOKEN@github.com/dokku/homebrew-repo.git"
brew bump-formula-pr -f --no-browse --no-audit --no-fork --url "https://github.com/dokku/dokku/archive/${{ steps.get_version.outputs.version }}.tar.gz" dokku/repo/dokku

View File

@@ -9,7 +9,7 @@ several ways to help out:
* Write patches for open bug/feature issues, preferably with test cases
included
* Contribute to the [documentation](http://dokku.viewdocs.io/dokku/)
* Come up with new ways to show off our [lovely logo](https://avatars1.githubusercontent.com/u/13455795)
* Come up with new ways, non-commercial to show off our [lovely logo](https://avatars1.githubusercontent.com/u/13455795)
* Blog about different ways you are using dokku
* Sponsor the Dokku project financially on [OpenCollective](https://opencollective.com/dokku#support) or [Patreon](https://www.patreon.com/dokku)

View File

@@ -53,4 +53,4 @@ RUN \
&& rm -f /etc/nginx/sites-enabled/default /usr/share/nginx/html/index.html /etc/my_init.d/10_syslog-ng.init \
&& rm -f /usr/local/openresty/nginx/conf/sites-enabled/default /usr/share/openresty/html/index.html \
&& sed -i '/imklog/d' /etc/rsyslog.conf \
&& rm -f /var/log/btmp /var/log/wtmp /var/log/*log /var/log/apt/* /var/log/dokku/* /var/log/nginx/* /var/log/openresty/*
&& rm -f /var/log/btmp /var/log/wtmp /var/log/*log /var/log/apt/* /var/log/dokku/*.log /var/log/nginx/* /var/log/openresty/*

View File

@@ -1,5 +1,94 @@
# History
## 0.22.8
Install/update via the bootstrap script:
```shell
wget https://raw.githubusercontent.com/dokku/dokku/v0.22.8/bootstrap.sh
sudo DOKKU_TAG=v0.22.8 bash bootstrap.sh
```
### Bug Fixes
- #4309: @josegonzalez Correct issue where verifying an app name would bail early
### Documentation
- #4307: @josegonzalez Specify that the dokku logo is for non-commercial use
## 0.22.7
Install/update via the bootstrap script:
```shell
wget https://raw.githubusercontent.com/dokku/dokku/v0.22.7/bootstrap.sh
sudo DOKKU_TAG=v0.22.7 bash bootstrap.sh
```
### Bug Fixes
- #4301: @josegonzalez Ensure vector container starts correctly
## 0.22.6
Install/update via the bootstrap script:
```shell
wget https://raw.githubusercontent.com/dokku/dokku/v0.22.6/bootstrap.sh
sudo DOKKU_TAG=v0.22.6 bash bootstrap.sh
```
### Bug Fixes
- #4295: @josegonzalez Update ps subcommands and triggers
### New Features
- #4286: @josegonzalez Add support for templated CHECKS files
- #4294: @josegonzalez Enhance ssh client logging output
- #4291: @josegonzalez Add log aggregation support via Vector
- #4288: @josegonzalez Add the pid of the dokku process to event logs
- #4289: @josegonzalez Clean precheck tmp file on exit
### Refactors
- #4287: @josegonzalez Refactor parallelized goroutines to use error groups
### Documentation
- #4292: @thomasfedb Update docs to note support for Ubuntu 20.04
- #4293: @ltalirz Fix path in persistent storage docs
### Other
- #4290: @josegonzalez Add support for debug logging plugin trigger stderr and stdout
## 0.22.5
Install/update via the bootstrap script:
```shell
wget https://raw.githubusercontent.com/dokku/dokku/v0.22.5/bootstrap.sh
sudo DOKKU_TAG=v0.22.5 bash bootstrap.sh
```
### Bug Fixes
- #4279: @josegonzalez Allow vmware-based vm to work on big sur
### Refactors
- #4282: @josegonzalez Cleanup brew-bump integration
- #4280: @josegonzalez Parallelize report and scheduler retrieval
### Documentation
- #4285: @josegonzalez Reference official gitlab-ci integration
- #4284: @josegonzalez Drop old doc link to gitlab ci docs
- #4283: @josegonzalez Add CI documentation section for Github Actions and Gitlab
- #4281: @josegonzalez Add forum link to documentation
## 0.22.4
Install/update via the bootstrap script:

View File

@@ -99,8 +99,8 @@ Otherwise, you will need to import the keypair manually after installation using
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.22.4/bootstrap.sh
sudo DOKKU_TAG=v0.22.4 bash bootstrap.sh
wget https://raw.githubusercontent.com/dokku/dokku/v0.22.8/bootstrap.sh
sudo DOKKU_TAG=v0.22.8 bash bootstrap.sh
```
You can then proceed to the ip address or domain name associated with your server to complete the web-based installation.

2
Vagrantfile vendored
View File

@@ -31,10 +31,12 @@ Vagrant::configure("2") do |config|
config.vm.provider :vmware_fusion do |v, override|
v.vmx["memsize"] = BOX_MEMORY
v.ssh_info_public = true
end
config.vm.provider :vmware_desktop do |v, override|
v.vmx["memsize"] = BOX_MEMORY
v.ssh_info_public = true
end
config.vm.define "empty", autostart: false

View File

@@ -15,7 +15,7 @@ import subprocess
import sys
import threading
VERSION = 'v0.22.4'
VERSION = 'v0.22.8'
def bytes_to_string(b):
if type(b) == bytes:

View File

@@ -32,8 +32,8 @@ fn-random-name() {
}
fn-client-help-msg() {
echo "==> Configure the DOKKU_HOST environment variable or run $0 from a repository with a git remote named dokku" 1>&2
echo "--> i.e. git remote add dokku dokku@<dokku-host>:<app-name>" 1>&2
echo "=====> Configure the DOKKU_HOST environment variable or run $0 from a repository with a git remote named dokku"
echo " i.e. git remote add dokku dokku@<dokku-host>:<app-name>"
exit 20 # exit with specific status. only used in units tests for now
}
@@ -107,7 +107,7 @@ main() {
APP=$(git remote -v 2>/dev/null | grep -Ei "dokku@$DOKKU_REMOTE_HOST" | head -n 1 | cut -f2 -d'@' | cut -f1 -d' ' | cut -f2 -d':' 2>/dev/null)
set -e
else
echo "This is not a git repository"
echo " ! This is not a git repository" 1>&2
fi
fi
@@ -118,7 +118,7 @@ main() {
counter=0
while ssh -p "$DOKKU_PORT" "dokku@$DOKKU_REMOTE_HOST" apps 2>/dev/null | grep -q "$APP"; do
if [[ $counter -ge 100 ]]; then
echo "Error: could not reasonably generate a new app name. try cleaning up some apps..."
echo " ! Could not reasonably generate a new app name. Try cleaning up some apps..." 1>&2
ssh -p "$DOKKU_PORT" "dokku@$DOKKU_REMOTE_HOST" apps
exit 1
else
@@ -133,7 +133,7 @@ main() {
echo "-----> Dokku remote added at ${DOKKU_REMOTE_HOST} called ${DOKKU_GIT_REMOTE}"
echo "-----> Application name is ${APP}"
else
echo "! Dokku remote not added! Do you already have a dokku remote?"
echo " ! Dokku remote not added! Do you already have a dokku remote?" 1>&2
return
fi
;;
@@ -149,7 +149,12 @@ main() {
[[ -n "$@" ]] && [[ -n "$APP" ]] && app_arg="--app $APP"
# echo "ssh -o LogLevel=QUIET -p $DOKKU_PORT -t dokku@$DOKKU_REMOTE_HOST -- $app_arg $@"
# shellcheck disable=SC2068,SC2086
ssh -o LogLevel=QUIET -p $DOKKU_PORT -t dokku@$DOKKU_REMOTE_HOST -- $app_arg $@
ssh -o LogLevel=QUIET -p $DOKKU_PORT -t dokku@$DOKKU_REMOTE_HOST -- $app_arg $@ || {
ssh_exit_code="$?"
echo " ! Failed to execute dokku command over ssh: exit code $?" 1>&2
echo " ! If there was no output from Dokku, ensure your configured SSH Key can connect to the remote server" 1>&2
return $ssh_exit_code
}
}
if [[ "$0" == "dokku" ]] || [[ "$0" == *dokku_client.sh ]] || [[ "$0" == $(which dokku) ]]; then

2
debian/control vendored
View File

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

View File

@@ -37,7 +37,7 @@ This example demonstrates how to mount the recommended directory to `/storage` i
dokku storage:mount node-js-app /var/lib/dokku/data/storage/node-js-app:/storage
```
Dokku will then mount the shared contents of `/var/lib/dokku/data/storage` to `/storage` inside the container.
Dokku will then mount the shared contents of `/var/lib/dokku/data/storage/node-js-app` to `/storage` inside the container.
Once you have mounted persistent storage, you will also need to restart the application. See the
[process scaling documentation](/docs/deployment/process-management.md) for more information.

View File

@@ -35,35 +35,35 @@ dokku plugin:list
```
plugn: dev
00_dokku-standard 0.22.4 enabled dokku core standard plugin
20_events 0.22.4 enabled dokku core events logging plugin
app-json 0.22.4 enabled dokku core app-json plugin
apps 0.22.4 enabled dokku core apps plugin
build-env 0.22.4 enabled dokku core build-env plugin
buildpacks 0.22.4 enabled dokku core buildpacks plugin
certs 0.22.4 enabled dokku core certificate management plugin
checks 0.22.4 enabled dokku core checks plugin
common 0.22.4 enabled dokku core common plugin
config 0.22.4 enabled dokku core config plugin
docker-options 0.22.4 enabled dokku core docker-options plugin
domains 0.22.4 enabled dokku core domains plugin
enter 0.22.4 enabled dokku core enter plugin
git 0.22.4 enabled dokku core git plugin
logs 0.22.4 enabled dokku core logs plugin
network 0.22.4 enabled dokku core network plugin
nginx-vhosts 0.22.4 enabled dokku core nginx-vhosts plugin
plugin 0.22.4 enabled dokku core plugin plugin
proxy 0.22.4 enabled dokku core proxy plugin
ps 0.22.4 enabled dokku core ps plugin
repo 0.22.4 enabled dokku core repo plugin
resource 0.22.4 enabled dokku core resource plugin
scheduler-docker-local 0.22.4 enabled dokku core scheduler-docker-local plugin
shell 0.22.4 enabled dokku core shell plugin
ssh-keys 0.22.4 enabled dokku core ssh-keys plugin
storage 0.22.4 enabled dokku core storage plugin
tags 0.22.4 enabled dokku core tags plugin
tar 0.22.4 enabled dokku core tar plugin
trace 0.22.4 enabled dokku core trace plugin
00_dokku-standard 0.22.8 enabled dokku core standard plugin
20_events 0.22.8 enabled dokku core events logging plugin
app-json 0.22.8 enabled dokku core app-json plugin
apps 0.22.8 enabled dokku core apps plugin
build-env 0.22.8 enabled dokku core build-env plugin
buildpacks 0.22.8 enabled dokku core buildpacks plugin
certs 0.22.8 enabled dokku core certificate management plugin
checks 0.22.8 enabled dokku core checks plugin
common 0.22.8 enabled dokku core common plugin
config 0.22.8 enabled dokku core config plugin
docker-options 0.22.8 enabled dokku core docker-options plugin
domains 0.22.8 enabled dokku core domains plugin
enter 0.22.8 enabled dokku core enter plugin
git 0.22.8 enabled dokku core git plugin
logs 0.22.8 enabled dokku core logs plugin
network 0.22.8 enabled dokku core network plugin
nginx-vhosts 0.22.8 enabled dokku core nginx-vhosts plugin
plugin 0.22.8 enabled dokku core plugin plugin
proxy 0.22.8 enabled dokku core proxy plugin
ps 0.22.8 enabled dokku core ps plugin
repo 0.22.8 enabled dokku core repo plugin
resource 0.22.8 enabled dokku core resource plugin
scheduler-docker-local 0.22.8 enabled dokku core scheduler-docker-local plugin
shell 0.22.8 enabled dokku core shell plugin
ssh-keys 0.22.8 enabled dokku core ssh-keys plugin
storage 0.22.8 enabled dokku core storage plugin
tags 0.22.8 enabled dokku core tags plugin
tar 0.22.8 enabled dokku core tar plugin
trace 0.22.8 enabled dokku core trace plugin
```
> Warning: All plugin commands other than `plugin:list` and `plugin:help` require sudo access and must be run directly from the Dokku server.

View File

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

View File

@@ -2,37 +2,37 @@
"name": "Dokku",
"icons": [
{
"src": "https:\/\/cdn.jsdelivr.net\/dokku\/dokku@v0.22.4\/docs\/assets\/favicons\/android-chrome-36x36.png",
"src": "https:\/\/cdn.jsdelivr.net\/dokku\/dokku@v0.22.8\/docs\/assets\/favicons\/android-chrome-36x36.png",
"sizes": "36x36",
"type": "image\/png",
"density": "0.75"
},
{
"src": "https:\/\/cdn.jsdelivr.net\/dokku\/dokku@v0.22.4\/docs\/assets\/favicons\/android-chrome-48x48.png",
"src": "https:\/\/cdn.jsdelivr.net\/dokku\/dokku@v0.22.8\/docs\/assets\/favicons\/android-chrome-48x48.png",
"sizes": "48x48",
"type": "image\/png",
"density": "1.0"
},
{
"src": "https:\/\/cdn.jsdelivr.net\/dokku\/dokku@v0.22.4\/docs\/assets\/favicons\/android-chrome-72x72.png",
"src": "https:\/\/cdn.jsdelivr.net\/dokku\/dokku@v0.22.8\/docs\/assets\/favicons\/android-chrome-72x72.png",
"sizes": "72x72",
"type": "image\/png",
"density": "1.5"
},
{
"src": "https:\/\/cdn.jsdelivr.net\/dokku\/dokku@v0.22.4\/docs\/assets\/favicons\/android-chrome-96x96.png",
"src": "https:\/\/cdn.jsdelivr.net\/dokku\/dokku@v0.22.8\/docs\/assets\/favicons\/android-chrome-96x96.png",
"sizes": "96x96",
"type": "image\/png",
"density": "2.0"
},
{
"src": "https:\/\/cdn.jsdelivr.net\/dokku\/dokku@v0.22.4\/docs\/assets\/favicons\/android-chrome-144x144.png",
"src": "https:\/\/cdn.jsdelivr.net\/dokku\/dokku@v0.22.8\/docs\/assets\/favicons\/android-chrome-144x144.png",
"sizes": "144x144",
"type": "image\/png",
"density": "3.0"
},
{
"src": "https:\/\/cdn.jsdelivr.net\/dokku\/dokku@v0.22.4\/docs\/assets\/favicons\/android-chrome-192x192.png",
"src": "https:\/\/cdn.jsdelivr.net\/dokku\/dokku@v0.22.8\/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.22.4/docs/assets/dokku.png);
background-image: url(https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.8/docs/assets/dokku.png);
text-indent: 40px;
}
.blurb {
color: #424242;
background-color: #ededed;
background-image: url(https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.4/docs/assets/gplaypattern.png);
background-image: url(https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.8/docs/assets/gplaypattern.png);
padding: 45px 0;
text-align: center;
}

View File

@@ -19,6 +19,6 @@
"0.19.13",
"0.20.4",
"0.21.4",
"0.22.4"
"0.22.8"
]
}

View File

@@ -1,108 +0,0 @@
# Deploying with Gitlab CI
Gitlab-CI can be used to automatically deploy a Dokku application using the [ilyasemenov/gitlab-ci-git-push image](https://github.com/IlyaSemenov/gitlab-ci-git-push) docker image.
## Prerequisites
Make sure you have a Gitlab account and a Dokku project hosted on Gitlab. This method works whether if you are using buildpacks or Dockerfile.
Make sure you have set up an app on the remote machine following [these instructions](http://dokku.viewdocs.io/dokku/deployment/application-deployment/) and can successfully deploy to it from the local machine.
## Deploy automatically to production
### Add a secret variable
Browse to the repository in question and visit the following path: `the Gitlab project > Settings > CI/CD.`
Click on `Secret variables > Expand` and fill in the blanks.
- Key: `SSH_PRIVATE_KEY`
- Value: paste in an SSH private key registered in Dokku:
-----BEGIN RSA PRIVATE KEY-----
...
-----END RSA PRIVATE KEY-----
- Environment scope: `production` (This make sure that `SSH_PRIVATE_KEY` is not available on merge requests or tests)
- Protected: Do not check this checkbox unless you know what you are doing
### Add CI script
Create a file named `.gitlab-ci.yml` at the root directory of the repository with the following contents:
```yaml
stages:
- deploy
variables:
APP_NAME: node-js-app
deploy:
image: ilyasemenov/gitlab-ci-git-push
stage: deploy
environment:
name: production
url: https://$APP_NAME.dokku.me/
only:
- master
script:
- git-push ssh://dokku@dokku.me:22/$APP_NAME
```
You will need to modify the `APP_NAME` variable to the correct value for your application name.
Running `git push origin master` will now trigger a gitlab-ci pipeline that will automatically deploy your application to your Dokku server. Go to your project on Gitlab and visit "Project > Pipelines" to see the deployment log.
## Review Applications
One useful feature of gitlab is to be able to create review applications for non-production branches. This allows teams to review changes _before_ they are pushed to production. First, recreate the `SSH_PRIVATE_KEY` secret - do not delete the existing secret - but scoped to the `review/*` environment. This will allow non-production gitlab environments access to the secret.
Next, we'll need to create the `review_app` gitlab job in our `.gitlab-ci.yaml`.
```yaml
review_app:
image: ilyasemenov/gitlab-ci-git-push
stage: deploy
environment:
name: review/$CI_COMMIT_REF_NAME
url: https://$CI_ENVIRONMENT_SLUG.dokku.me/
on_stop: stop_review_app
only:
- branches
except:
- master
script:
- mkdir -p ~/.ssh && echo "$SSH_PRIVATE_KEY" | tr -d '\r' > ~/.ssh/id_rsa && chmod 600 ~/.ssh/id_rsa
- ssh-keyscan -H 22 "dokku.me" >> ~/.ssh/known_hosts
- ssh -t dokku@dokku.me -- apps:clone --ignore-existing --skip-deploy "$APP_NAME" "$CI_ENVIRONMENT_SLUG"
- git-push ssh://dokku@dokku.me:22/$CI_ENVIRONMENT_SLUG
```
The first two lines ensure that Gitlab can talk to the Dokku server. Next, we take advantage of the `apps:clone` command, and clone the existing application and all of it's configuration to a new location. If the new application already exists, the third line of the `script` step will be ignored. We also ignore the first deploy script to speed up the cloning process. Finally, the fourth line of the `script` step will deploy the code as normal.
The above only runs for non-master branches, and will _also_ trigger an `on_stop` job called `stop_review_app`. When the branch is deleted or the code is merged, the `stop_review_app` job will be triggered.
```yaml
stop_review_app:
image: ilyasemenov/gitlab-ci-git-push
stage: deploy
variables:
GIT_STRATEGY: none
environment:
name: review/$CI_COMMIT_REF_NAME
action: stop
when: manual
script:
- mkdir -p ~/.ssh && echo "$SSH_PRIVATE_KEY" | tr -d '\r' > ~/.ssh/id_rsa && chmod 600 ~/.ssh/id_rsa
- ssh-keyscan -H 22 "dokku.me" >> ~/.ssh/known_hosts
- ssh -t dokku@dokku.me -- --force apps:destroy "$CI_ENVIRONMENT_SLUG"
```
The `stop_review_app` step will delete the temporary application, cleaning up now unused server resources.
Going further, the following modifications can be done:
- Notify via chat whenever a review application is created/destroyed.
- Push to a separate, staging server as opposed to a production server.
- Clone a "staging" application so that review applications do not affect production datasets.

View File

@@ -87,6 +87,7 @@ The following config variables have special meanings and can be set in a variety
| `PLUGIN_CORE_AVAILABLE_PATH` | `$PLUGIN_CORE_PATH/available"` | `/etc/environment` <br /> `~dokku/.dokkurc` <br /> `~dokku/.dokkurc/*` | The directory that stores all available core plugins. |
| `PLUGIN_CORE_ENABLED_PATH` | `$PLUGIN_CORE_PATH/enabled"` | `/etc/environment` <br /> `~dokku/.dokkurc` <br /> `~dokku/.dokkurc/*` | The directory that stores all enabled core plugins. |
| `DOKKU_LOGS_DIR` | `/var/log/dokku` | `/etc/environment` <br /> `~dokku/.dokkurc` <br /> `~dokku/.dokkurc/*` | Where dokku logs should be written to. |
| `DOKKU_LOGS_HOST_DIR` | `$DOKKU_LOGS_DIR` | `/etc/environment` <br /> `~dokku/.dokkurc` <br /> `~dokku/.dokkurc/*` | A path on the host that will be mounted into the vector logging container. |
| `DOKKU_EVENTS_LOGFILE` | `$DOKKU_LOGS_DIR/events.log` | `/etc/environment` <br /> `~dokku/.dokkurc` <br /> `~dokku/.dokkurc/*` | Where the events log file is written to. |
| `DOKKU_APP_NAME` | none | `--app APP` flag | Name of application to work on. Respected by core plugins. |
| `DOKKU_APPS_FORCE_DELETE` | none | `--force` flag | Whether to force delete an application. Also used by other plugins for destructive actions. |

View File

@@ -0,0 +1,25 @@
# Generic CI/CD Integration
In cases where there is no direct or documented integration available, the Dokku project provides an [Official Docker Image](https://github.com/dokku/ci-docker-image) for use in Continuous Integration/Continuous Deployment (CI/CD) systems.
Assuming a Docker image can be run as a CI task with environment variables injected, the following CI systems will have their variables automatically detected:
- [circleci](https://circleci.com/)
- [cloudbees](https://www.cloudbees.com/)
- [drone](https://www.drone.io/)
- [github actions](https://github.com/features/actions)
- [gitlab-ci](https://about.gitlab.com/stages-devops-lifecycle/continuous-integration/)
- [semaphoreci](https://semaphoreci.com/)
- [travisci](https://travis-ci.com/)
## Simple Usage
The simplest usage of the image is as follows.
```shell
# where the `.env` file contains `GIT_REMOTE_URL` and `SSH_PRIVATE_KEY`
docker run --rm -v="$PWD:/app" --env-file=.env dokku/ci-docker-image dokku-deploy
```
For more configuration examples and further documentation, see the [ci-docker-image](https://github.com/dokku/ci-docker-image) readme.

View File

@@ -0,0 +1,31 @@
# Github Actions
The Dokku project has an official Githb Action available on the [Github Marketplace](https://github.com/marketplace/actions/dokku). The simplest usage example is as follows:
```yaml
---
name: 'deploy'
on:
push:
branches:
- master
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Cloning repo
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Push to dokku
uses: dokku/github-action@v1
with:
git_remote_url: 'ssh://dokku@dokku.me:22/appname'
ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }}
```
For further usage documentation and other advanced examples, see the entry on the [Github Marketplace](https://github.com/marketplace/actions/dokku).

View File

@@ -0,0 +1,25 @@
# Gitlab CI
Gitlab-CI can be used to automatically deploy a Dokku application via the official the [dokku/ci-docker-image](https://github.com/dokku/ci-docker-image). The simplest example is as follows:
```
---
image: dokku/ci-docker-image
stages:
- deploy
variables:
GIT_DEPTH: 0
deploy:
stage: deploy
only:
- master
variables:
GIT_REMOTE_URL: ssh://dokku@dokku.me:22/appname
script: dokku-deploy
after_script: dokku-unlock
```
For further usage documentation and other advanced examples, see Dokku's [gitlab-ci](https://github.com/dokku/gitlab-ci) repository.

View File

@@ -2,7 +2,12 @@
```
logs <app> [-h] [-t] [-n num] [-q] [-p process] # Display recent log output
logs:failed [--parallel count] [--all|<app>] # Shows the last failed deploy logs
logs:failed [--all|<app>] # Shows the last failed deploy logs
logs:report [<app>] [<flag>] # Displays a logs report for one or more apps
logs:set [--global|<app>] <key> <value> # Set or clear a logs property for an app
logs:vector-logs [--num num] [--tail] # Display vector log output
logs:vector-start # Start the vector logging container
logs:vector-stop # Stop the vector logging container
```
## Usage
@@ -40,7 +45,7 @@ will show logs continually from the web process.
In some cases, it may be useful to retrieve the logs from a previously failed deploy.
You can retrieve these logs by using the `logs:failed` command
You can retrieve these logs by using the `logs:failed` command.
```shell
dokku logs:failed node-js-app
@@ -51,3 +56,94 @@ You may also fetch all failed app logs by using the `--all` flag.
```shell
dokku logs:failed --all
```
### Vector Logging Shipping
> New as of 0.22.6
Vector is an open-source, lightweight and ultra-fast tool for building observability pipelines. Dokku integrates with it for shipping container logs for the `docker-local` scheduler. Users may configure log-shipping on a per-app or global basis, neither of which interfere with the `dokku logs` commands.
#### Starting the Vector container
> Warning: While the default vector image may be updated over time, this will not impact running vector containers. Users are encouraged to view any Dokku and Vector changelogs to ensure their system will continue running as expected.
Vector may be started via the `logs:vector-start` command.
```shell
dokku logs:vector-start
```
This will start a new container named `vector` with Dokku's vector config mounted and ready for use. If a running container already exists, this command will do nothing. Additionally, if a container exists but is not running, this command will attempt to start the container.
While the default vector image is hardcoded, users may specify an alternative via the `--vector-image` flag:
```shell
dokku logs:vector-start --vector-image timberio/vector:latest-debian
```
The `vector` container will be started with the following volume mounts:
- `/var/lib/dokku/data/logs/vector.json:/etc/vector/vector.json`
- `/var/run/docker.sock:/var/run/docker.sock`
- `/var/log/dokku/apps:/var/log/dokku/apps`
The final volume mount - `/var/log/dokku/apps` - may be used for users that wish to ship logs to a file on disk that may be later logrotated. This directory is owned by the `dokku` user and group, with permissions set to `0755`. At this time, log-rotation is not configured for this directory.
#### Stopping the Vector container
Vector may be stopped via the `logs:vector-stop` command.
```shell
dokku logs:vector-stop
```
The `vector` container will be stopped and removed from the system. If the container is not running, this command will do nothing.
#### Configuring a log sink
Vector uses the concept of log "sinks" to send logs to a given endpoint. Log sinks may be configured globally or on a per-app basis by specifying a `vector-sink` in DSN form with the `logs:set` command. Specifying a sink value will reload any running vector container.
```shell
# setting the sink value in quotes is encouraged to avoid
# issues with ampersand encoding in shell commands
dokku logs:set node-js-app sink "console://?encoding[codec]=json"
```
A sink may be removed by setting an empty value, which will also reload the running vector container.
```shell
dokku logs:set node-js-app vector-sink
```
Only one sink may be specified on a per-app basis at a given time.
Log sinks can also be specified globally by specifying the `--global` flag to `logs:set` with no app name specified:
```shell
dokku logs:set --global vector-sink "console://?encoding[codec]=json"
```
As with app-specific sink settings, the global value may also be cleared by setting no value.
```shell
dokku logs:set --global vector-sink
```
##### Log Sink DSN Format
The DSN form of a sink is as follows:
```
SINK_TYPE://?SINK_OPTIONS
```
Valid values for `SINK_TYPE` include all log vector log sinks, while `SINK_OPTIONS` is a query-string form for the sink's options. The following is a short description on how to set various values:
- `bool`: form: `key=bool`
- `string`: form: `key=string`
- `int`: form: `key=int`
- `[string]`: form: `key[]=string`
- `[int]`: form: `key[]=int`
- `table`: form: `option[key]=value
Please read the [sink documentation](https://vector.dev/docs/reference/sinks/) for your sink of choice to configure the sink as desired.

View File

@@ -157,6 +157,38 @@ https://static.dokku.me/logo.png
While a full URL may be used in order to invoke checks, if you are using relative URLs, the port *must* be omitted.
> Changed as of 0.22.5
Please note that dollar sign bracket characters (`{` and `}`) must be escaped when used within a `CHECKS` file. Escaping follows golang template rules. The proper way to do this is via one of the following methods:
```
# escaping the `{` character
# using double-quotes
{{"{"}}
# using raw string constants
{{`{`}}
# escaping the `}` character
# using double-quotes
{{"}"}}
# using raw string constants
{{`}`}}
```
### Templating Checks Files
> New as of 0.22.5
An app's `CHECKS` file is sent through a single pass of the [`sigil`](https://github.com/gliderlabs/sigil/) templating tool. This enables usage of Golang templating within application `CHECKS` files. In addition to general templating access, access to app environment variables is also allowed via the `var` function:
```
{{ var "SOME_ENV_VAR" }}
```
This may be useful if certain zero-downtime checks require access to an app-specific value, such as a domain name.
### Check settings
The default behavior is to wait for `5` seconds before running the checks, to timeout the checks after `30` seconds, and to attempt the checks `5` times. If the checks fail `5` times, the deployment is considered failed and the old container will continue serving traffic.

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.22.4-2 (Mon Feb 22 23:20:37 CET 2016)"
# wait for "==> build-arch: ==> Finished making: dokku 0.22.8-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

@@ -3,7 +3,7 @@
Pull the dokku/dokku image:
```shell
docker pull dokku/dokku:0.22.4
docker pull dokku/dokku:0.22.8
```
Next, run the image.
@@ -17,7 +17,7 @@ docker run \
--publish 8443:443 \
--volume /var/lib/dokku:/mnt/dokku \
--volume /var/run/docker.sock:/var/run/docker.sock \
dokku/dokku:0.22.4
dokku/dokku:0.22.8
```
Dokku is run in the following configuration:

View File

@@ -6,7 +6,7 @@ Dokku is an extensible, open source Platform as a Service that runs on a single
To start using Dokku, you'll need a system that meets the following minimum requirements:
- A fresh installation of [Ubuntu 16.04/18.04 x64](https://www.ubuntu.com/download), [Debian 9+ x64](https://www.debian.org/distrib/) or [CentOS 7 x64](https://www.centos.org/download/) *(experimental)* with the FQDN set <sup>[1]</sup>
- A fresh installation of [Ubuntu 16.04/18.04/20.04 x64](https://www.ubuntu.com/download), [Debian 9+ x64](https://www.debian.org/distrib/) or [CentOS 7 x64](https://www.centos.org/download/) *(experimental)* with the FQDN set <sup>[1]</sup>
- At least 1 GB of system memory <sup>[2]</sup>
You can *optionally* have a domain name pointed at the host's IP, though this is not necessary.
@@ -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.22.4/bootstrap.sh;
sudo DOKKU_TAG=v0.22.4 bash bootstrap.sh
wget https://raw.githubusercontent.com/dokku/dokku/v0.22.8/bootstrap.sh;
sudo DOKKU_TAG=v0.22.8 bash bootstrap.sh
```
The installation process takes about 5-10 minutes, depending upon internet connection speed.

View File

@@ -8,15 +8,34 @@ If you’re stuck, there are a number of places you can get help:
The Official Dokku website is always a great place to visit. It features links to oft-used developer tools, community plugins, and guides on using Dokku.
## The IRC and Slack Channels
## Monitored Locations
The [Code Of Conduct](https://github.com/dokku/.github/blob/master/CODE_OF_CONDUCT.md) applies to all actively monitored Dokku discussion areas. Please be mindful of your neighbors on the internet.
### Forums
- [Github Discussions](https://github.com/dokku/dokku/discussions)
GitHub Discussions is a new way for the Dokku community to interact with each other! This is a place to ask questions to the community or discuss potential feature requests before filing issues.
### The Slack Channel
- [irc.freenode.net/#dokku](https://webchat.freenode.net/?channels=dokku)
- [Gliderlabs Slack](https://glider-slackin.herokuapp.com/) (Join the `#dokku` channel)
If you’re stumped, give us a holler in the Dokku IRC or Slack channels. Someone from the development team is usually there, especially during the daylight hours for North and South America users. We’d love to hear from you, whether you need some help, want to find users in your area, or would like to donate your brand new sports car.
If you’re stumped, give us a holler in the Dokku Slack channel. Someone from the development team is usually there, especially during the daylight hours for North and South American users. We’d love to hear from you, whether you need some help, want to find users in your area, or would like to donate your brand new sports car.
## Stack Overflow
## Unmonitored Locations
- [https://stackoverflow.com/questions/tagged/dokku](https://stackoverflow.com/questions/tagged/dokku)
You may find help on these locations, but they are not actively monitored by the development team. The [Code of Conduct](https://github.com/dokku/.github/blob/master/CODE_OF_CONDUCT.md) still applies.
### Stack Overflow
- [The Dokku tag on Stack Overflow](https://stackoverflow.com/questions/tagged/dokku)
Tag your questions with `dokku` to enable existing users of Stack Overflow to find your questions.
### IRC (on freenode)
- [irc.freenode.net/#dokku](https://webchat.freenode.net/?channels=dokku)
This location isn't as well monitored as Slack, and loses history.

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.22.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.22.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.22.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.22.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.22.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.22.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.22.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.22.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.22.4/docs/assets/favicons/apple-touch-icon-180x180.png">
<link rel="icon" type="image/png" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.4/docs/assets/favicons/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.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.22.4/docs/assets/favicons/favicon-96x96.png" sizes="96x96">
<link rel="icon" type="image/png" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.4/docs/assets/favicons/favicon-16x16.png" sizes="16x16">
<link rel="manifest" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.4/docs/assets/favicons/manifest.json">
<link rel="shortcut icon" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.4/docs/assets/favicons/favicon.ico">
<link rel="apple-touch-icon" sizes="57x57" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.8/docs/assets/favicons/apple-touch-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.8/docs/assets/favicons/apple-touch-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.8/docs/assets/favicons/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.8/docs/assets/favicons/apple-touch-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.8/docs/assets/favicons/apple-touch-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.8/docs/assets/favicons/apple-touch-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.8/docs/assets/favicons/apple-touch-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.8/docs/assets/favicons/apple-touch-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.8/docs/assets/favicons/apple-touch-icon-180x180.png">
<link rel="icon" type="image/png" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.8/docs/assets/favicons/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.8/docs/assets/favicons/android-chrome-192x192.png" sizes="192x192">
<link rel="icon" type="image/png" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.8/docs/assets/favicons/favicon-96x96.png" sizes="96x96">
<link rel="icon" type="image/png" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.8/docs/assets/favicons/favicon-16x16.png" sizes="16x16">
<link rel="manifest" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.8/docs/assets/favicons/manifest.json">
<link rel="shortcut icon" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.8/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.22.4/docs/assets/favicons/mstile-144x144.png">
<meta name="msapplication-config" content="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.4/docs/assets/favicons/browserconfig.xml">
<meta name="msapplication-TileImage" content="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.8/docs/assets/favicons/mstile-144x144.png">
<meta name="msapplication-config" content="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.8/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.22.4/docs/assets/style.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.8/docs/assets/style.css" rel="stylesheet">
<!-- <link href="/dokku/docs/assets/style.css" rel="stylesheet"> -->
<style>
.sponsors {
@@ -91,6 +91,9 @@
<li class="nav-item">
<a class="nav-link" href="https://glider-slackin.herokuapp.com/">Slack</a>
</li>
<li class="nav-item">
<a class="nav-link" href="https://github.com/dokku/dokku/discussions">Forums</a>
</li>
<li class="nav-item">
<a class="nav-link" href="https://gliderlabs.us10.list-manage.com/subscribe?u=49c4b06ffd30bcf49ec53c277&amp;id=f526006fd5">Newsletter</a>
</li>
@@ -127,12 +130,12 @@
<p class="line">
<span class="path"></span>
<span class="prompt">$</span>
<span class="command">wget https://raw.githubusercontent.com/dokku/dokku/v0.22.4/bootstrap.sh</span>
<span class="command">wget https://raw.githubusercontent.com/dokku/dokku/v0.22.8/bootstrap.sh</span>
</p>
<p class="line">
<span class="path"></span>
<span class="prompt">$</span>
<span class="command">sudo DOKKU_TAG=v0.22.4 bash bootstrap.sh</span>
<span class="command">sudo DOKKU_TAG=v0.22.8 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

@@ -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.22.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.22.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.22.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.22.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.22.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.22.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.22.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.22.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.22.4/docs/assets/favicons/apple-touch-icon-180x180.png">
<link rel="icon" type="image/png" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.4/docs/assets/favicons/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.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.22.4/docs/assets/favicons/favicon-96x96.png" sizes="96x96">
<link rel="icon" type="image/png" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.4/docs/assets/favicons/favicon-16x16.png" sizes="16x16">
<link rel="manifest" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.4/docs/assets/favicons/manifest.json">
<link rel="shortcut icon" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.4/docs/assets/favicons/favicon.ico">
<link rel="apple-touch-icon" sizes="57x57" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.8/docs/assets/favicons/apple-touch-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.8/docs/assets/favicons/apple-touch-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.8/docs/assets/favicons/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.8/docs/assets/favicons/apple-touch-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.8/docs/assets/favicons/apple-touch-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.8/docs/assets/favicons/apple-touch-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.8/docs/assets/favicons/apple-touch-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.8/docs/assets/favicons/apple-touch-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.8/docs/assets/favicons/apple-touch-icon-180x180.png">
<link rel="icon" type="image/png" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.8/docs/assets/favicons/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.8/docs/assets/favicons/android-chrome-192x192.png" sizes="192x192">
<link rel="icon" type="image/png" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.8/docs/assets/favicons/favicon-96x96.png" sizes="96x96">
<link rel="icon" type="image/png" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.8/docs/assets/favicons/favicon-16x16.png" sizes="16x16">
<link rel="manifest" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.8/docs/assets/favicons/manifest.json">
<link rel="shortcut icon" href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.8/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.22.4/docs/assets/favicons/mstile-144x144.png">
<meta name="msapplication-config" content="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.4/docs/assets/favicons/browserconfig.xml">
<meta name="msapplication-TileImage" content="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.8/docs/assets/favicons/mstile-144x144.png">
<meta name="msapplication-config" content="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.8/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.22.4/docs/assets/style.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/gh/dokku/dokku@v0.22.8/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>
@@ -84,6 +84,9 @@
<li class="nav-item">
<a class="nav-link" href="https://glider-slackin.herokuapp.com/">Slack</a>
</li>
<li class="nav-item">
<a class="nav-link" href="https://github.com/dokku/dokku/discussions">Forums</a>
</li>
<li class="nav-item">
<a class="nav-link" href="https://gliderlabs.us10.list-manage.com/subscribe?u=49c4b06ffd30bcf49ec53c277&amp;id=f526006fd5">Newsletter</a>
</li>
@@ -172,12 +175,16 @@
<a href="/{{NAME}}/development/testing/" class="list-group-item">Running Tests</a>
<a href="/{{NAME}}/development/release-process/" class="list-group-item">Release Process</a>
<a href="#" class="list-group-item disabled">Continuous Integration</a>
<a href="/{{NAME}}/deployment/continuous-integration/github-actions/" class="list-group-item">Github Actions</a>
<a href="/{{NAME}}/deployment/continuous-integration/gitlab-ci/" class="list-group-item">Gitlab CI</a>
<a href="/{{NAME}}/deployment/continuous-integration/generic/" class="list-group-item">Generic</a>
<a href="#" class="list-group-item disabled">Community Contributions</a>
<a href="/{{NAME}}/community/clients/" class="list-group-item">Clients</a>
<a href="/{{NAME}}/community/plugins/" class="list-group-item">Plugins</a>
<a href="#" class="list-group-item disabled">Community Tutorials</a>
<a href="/{{NAME}}/community/tutorials/deploying-with-gitlab-ci/" class="list-group-item">Deploying with Gitlab CI</a>
<a href="/{{NAME}}/community/tutorials/run-on-external-volume/" class="list-group-item">Run on External Volume</a>
</div>
</div>

View File

@@ -30,6 +30,8 @@
"dokku-events-logs": "advanced-usage/event-logs/",
"dokku-storage": "advanced-usage/persistent-storage/",
"community/tutorials/deploying-with-gitlab-ci": "deployment/continuous-integration/gitlab-ci/",
"plugins": "community/plugins/"
}
}

1
dokku
View File

@@ -59,6 +59,7 @@ export DOKKU_VALID_EXIT=0
export DOKKU_PID="$BASHPID"
export DOKKU_LOGS_DIR=${DOKKU_LOGS_DIR:="/var/log/dokku"}
export DOKKU_LOGS_HOST_DIR=${DOKKU_LOGS_HOST_DIR:=$DOKKU_LOGS_DIR}
export DOKKU_EVENTS_LOGFILE=${DOKKU_EVENTS_LOGFILE:="$DOKKU_LOGS_DIR/events.log"}
export DOKKU_CONTAINER_LABEL=dokku

View File

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

View File

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

View File

@@ -2,6 +2,7 @@ package appjson
import (
"bytes"
"context"
"encoding/json"
"errors"
"fmt"
@@ -11,6 +12,7 @@ import (
"github.com/dokku/dokku/plugins/common"
shellquote "github.com/kballard/go-shellquote"
"golang.org/x/sync/errgroup"
)
// AppJSON is a struct that represents an app.json file as understood by Dokku
@@ -130,16 +132,31 @@ func getReleaseCommand(appName string, image string) string {
}
func getDokkuAppShell(appName string) string {
dokkuAppShell := "/bin/bash"
if b, _ := common.PlugnTriggerOutput("config-get-global", []string{"DOKKU_APP_SHELL"}...); strings.TrimSpace(string(b[:])) != "" {
dokkuAppShell = strings.TrimSpace(string(b[:]))
shell := "/bin/bash"
globalShell := ""
appShell := ""
ctx := context.Background()
errs, ctx := errgroup.WithContext(ctx)
errs.Go(func() error {
b, _ := common.PlugnTriggerOutput("config-get-global", []string{"DOKKU_APP_SHELL"}...)
globalShell = strings.TrimSpace(string(b[:]))
return nil
})
errs.Go(func() error {
b, _ := common.PlugnTriggerOutput("config-global", []string{"DOKKU_APP_SHELL"}...)
appShell = strings.TrimSpace(string(b[:]))
return nil
})
errs.Wait()
if appShell != "" {
shell = appShell
} else if globalShell != "" {
shell = globalShell
}
if b, _ := common.PlugnTriggerOutput("config-get", []string{appName, "DOKKU_APP_SHELL"}...); strings.TrimSpace(string(b[:])) != "" {
dokkuAppShell = strings.TrimSpace(string(b[:]))
}
return dokkuAppShell
return shell
}
func executeScript(appName string, imageTag string, phase string) error {

View File

@@ -7,6 +7,7 @@ require (
github.com/dokku/dokku/plugins/common v0.0.0-00010101000000-000000000000
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51
github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3 // indirect
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a
)
replace github.com/dokku/dokku/plugins/common => ../common

View File

@@ -6,3 +6,5 @@ github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNU
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8=
github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3 h1:utdYOikI1XjNtTFGCwSM6OmFJblU4ld4gACoJsbadJg=
github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a h1:DcqTD9SDLc+1P/r1EmRBwnVsrOwW+kk2vWf9n+1sGhs=
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=

View File

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

View File

@@ -6,3 +6,5 @@ github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3 h1:utdYOikI1X
github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a h1:DcqTD9SDLc+1P/r1EmRBwnVsrOwW+kk2vWf9n+1sGhs=
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=

View File

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

View File

@@ -12,23 +12,41 @@ func ReportSingleApp(appName, infoFlag string) error {
return err
}
flags := map[string]common.ReportFunc{
"--app-dir": reportDir,
"--app-deploy-source": reportDeploySource,
"--app-locked": reportLocked,
}
flagKeys := []string{}
for flagKey := range flags {
flagKeys = append(flagKeys, flagKey)
}
trimPrefix := false
uppercaseFirstCharacter := true
infoFlags := common.CollectReport(appName, infoFlag, flags)
return common.ReportSingleApp("app", appName, infoFlag, infoFlags, flagKeys, trimPrefix, uppercaseFirstCharacter)
}
func reportDir(appName string) string {
return common.AppRoot(appName)
}
func reportDeploySource(appName string) string {
deploySource := ""
if b, err := common.PlugnTriggerSetup("deploy-source", []string{appName}...).SetInput("").Output(); err != nil {
deploySource = strings.TrimSpace(string(b[:]))
}
return deploySource
}
func reportLocked(appName string) string {
locked := "false"
if appIsLocked(appName) {
locked = "true"
}
infoFlags := map[string]string{
"--app-dir": common.AppRoot(appName),
"--app-deploy-source": deploySource,
"--app-locked": locked,
}
trimPrefix := false
uppercaseFirstCharacter := true
return common.ReportSingleApp("app", appName, infoFlag, infoFlags, trimPrefix, uppercaseFirstCharacter)
return locked
}

View File

@@ -65,8 +65,8 @@ func main() {
err = apps.CommandRename(oldAppName, newAppName, *skipDeploy)
case "report":
args := flag.NewFlagSet("apps:report", flag.ExitOnError)
osArgs, infoFlag, err := common.ParseReportArgs("apps", os.Args[2:])
if err == nil {
osArgs, infoFlag, flagErr := common.ParseReportArgs("apps", os.Args[2:])
if flagErr == nil {
args.Parse(osArgs)
appName := args.Arg(0)
err = apps.CommandReport(appName, infoFlag)

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core builder-cnb plugin"
version = "0.22.4"
version = "0.22.8"
[plugin.config]

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core builder-dockerfile plugin"
version = "0.22.4"
version = "0.22.8"
[plugin.config]

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core builder-herokuish plugin"
version = "0.22.4"
version = "0.22.8"
[plugin.config]

View File

@@ -6,3 +6,5 @@ github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3 h1:utdYOikI1X
github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a h1:DcqTD9SDLc+1P/r1EmRBwnVsrOwW+kk2vWf9n+1sGhs=
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=

View File

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

View File

@@ -12,16 +12,26 @@ func ReportSingleApp(appName, infoFlag string) error {
return err
}
buildpacks, err := common.PropertyListGet("buildpacks", appName, "buildpacks")
if err != nil {
return err
flags := map[string]common.ReportFunc{
"--buildpacks-list": reportList,
}
infoFlags := map[string]string{
"--buildpacks-list": strings.Join(buildpacks, ","),
flagKeys := []string{}
for flagKey := range flags {
flagKeys = append(flagKeys, flagKey)
}
trimPrefix := false
uppercaseFirstCharacter := true
return common.ReportSingleApp("buildpacks", appName, infoFlag, infoFlags, trimPrefix, uppercaseFirstCharacter)
infoFlags := common.CollectReport(appName, infoFlag, flags)
return common.ReportSingleApp("buildpacks", appName, infoFlag, infoFlags, flagKeys, trimPrefix, uppercaseFirstCharacter)
}
func reportList(appName string) string {
buildpacks, err := common.PropertyListGet("buildpacks", appName, "buildpacks")
if err != nil {
return ""
}
return strings.Join(buildpacks, ",")
}

View File

@@ -44,8 +44,8 @@ func main() {
err = buildpacks.CommandRemove(appName, buildpack, *index)
case "report":
args := flag.NewFlagSet("buildpacks:report", flag.ExitOnError)
osArgs, infoFlag, err := common.ParseReportArgs("buildpacks", os.Args[2:])
if err == nil {
osArgs, infoFlag, flagErr := common.ParseReportArgs("buildpacks", os.Args[2:])
if flagErr == nil {
args.Parse(osArgs)
appName := args.Arg(0)
err = buildpacks.CommandReport(appName, infoFlag)

View File

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

View File

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

View File

@@ -1,12 +1,12 @@
package common
import (
"context"
"errors"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"reflect"
"regexp"
"sort"
"strconv"
@@ -14,6 +14,7 @@ import (
"unicode"
"github.com/ryanuber/columnize"
"golang.org/x/sync/errgroup"
)
type errfunc func() error
@@ -64,17 +65,37 @@ func CommandUsage(helpHeader string, helpContent string) {
// GetAppScheduler fetches the scheduler for a given application
func GetAppScheduler(appName string) string {
if appName == "--global" {
appName = ""
}
appScheduler := ""
globalScheduler := ""
ctx := context.Background()
errs, ctx := errgroup.WithContext(ctx)
if appName != "--global" {
errs.Go(func() error {
appScheduler = getAppScheduler(appName)
return nil
})
}
errs.Go(func() error {
globalScheduler = GetGlobalScheduler()
return nil
})
errs.Wait()
if appScheduler == "" {
appScheduler = globalScheduler
}
return appScheduler
}
func getAppScheduler(appName string) string {
b, _ := PlugnTriggerOutput("config-get", []string{appName, "DOKKU_SCHEDULER"}...)
value := strings.TrimSpace(string(b[:]))
if value != "" {
return value
}
return GetGlobalScheduler()
return ""
}
// GetGlobalScheduler fetchs the global scheduler
@@ -90,23 +111,38 @@ func GetGlobalScheduler() string {
// GetDeployingAppImageName returns deploying image identifier for a given app, tag tuple. validate if tag is presented
func GetDeployingAppImageName(appName, imageTag, imageRepo string) (string, error) {
b, err := PlugnTriggerOutput("deployed-app-repository", []string{appName}...)
if err != nil {
return "", err
}
imageRemoteRepository := strings.TrimSpace(string(b[:]))
imageRemoteRepository := ""
newImageTag := ""
newImageRepo := ""
b, err = PlugnTriggerOutput("deployed-app-image-tag", []string{appName}...)
if err != nil {
return "", err
}
newImageTag := strings.TrimSpace(string(b[:]))
ctx := context.Background()
errs, ctx := errgroup.WithContext(ctx)
errs.Go(func() error {
b, err := PlugnTriggerOutput("deployed-app-repository", []string{appName}...)
if err == nil {
imageRemoteRepository = strings.TrimSpace(string(b[:]))
}
return err
})
errs.Go(func() error {
b, err := PlugnTriggerOutput("deployed-app-image-tag", []string{appName}...)
if err == nil {
newImageTag = strings.TrimSpace(string(b[:]))
}
return err
})
b, err = PlugnTriggerOutput("deployed-app-image-repo", []string{appName}...)
if err != nil {
errs.Go(func() error {
b, err := PlugnTriggerOutput("deployed-app-image-repo", []string{appName}...)
if err == nil {
newImageRepo = strings.TrimSpace(string(b[:]))
}
return err
})
if err := errs.Wait(); err != nil {
return "", err
}
newImageRepo := strings.TrimSpace(string(b[:]))
if newImageRepo != "" {
imageRepo = newImageRepo
@@ -287,7 +323,7 @@ func ParseReportArgs(pluginName string, arguments []string) ([]string, string, e
}
// ReportSingleApp is an internal function that displays a report for an app
func ReportSingleApp(reportType string, appName string, infoFlag string, infoFlags map[string]string, trimPrefix bool, uppercaseFirstCharacter bool) error {
func ReportSingleApp(reportType string, appName string, infoFlag string, infoFlags map[string]string, infoFlagKeys []string, trimPrefix bool, uppercaseFirstCharacter bool) error {
flags := []string{}
for key := range infoFlags {
flags = append(flags, key)
@@ -297,7 +333,11 @@ func ReportSingleApp(reportType string, appName string, infoFlag string, infoFla
if len(infoFlag) == 0 {
LogInfo2Quiet(fmt.Sprintf("%s %v information", appName, reportType))
for _, k := range flags {
v := infoFlags[k]
v, ok := infoFlags[k]
if !ok {
continue
}
prefix := "--"
if trimPrefix {
prefix = fmt.Sprintf("--%v-", reportType)
@@ -316,19 +356,17 @@ func ReportSingleApp(reportType string, appName string, infoFlag string, infoFla
for _, k := range flags {
if infoFlag == k {
v := infoFlags[k]
v, ok := infoFlags[k]
if !ok {
continue
}
fmt.Println(v)
return nil
}
}
keys := reflect.ValueOf(infoFlags).MapKeys()
strkeys := make([]string, len(keys))
for i := 0; i < len(keys); i++ {
strkeys[i] = keys[i].String()
}
return fmt.Errorf("Invalid flag passed, valid flags: %s", strings.Join(strkeys, ", "))
sort.Strings(infoFlagKeys)
return fmt.Errorf("Invalid flag passed, valid flags: %s", strings.Join(infoFlagKeys, ", "))
}
// RightPad right-pads the string with pad up to len runes

View File

@@ -7,6 +7,7 @@ import (
"io/ioutil"
"os"
"strings"
"time"
"github.com/codeskyblue/go-sh"
)
@@ -20,6 +21,43 @@ func ContainerIsRunning(containerID string) bool {
return strings.TrimSpace(string(b[:])) == "true"
}
// ContainerStart runs 'docker container start' against an existing container
// whether that container is running or not
func ContainerStart(containerID string) bool {
cmd := sh.Command(DockerBin(), "container", "start", containerID)
cmd.Stdout = nil
cmd.Stderr = nil
if err := cmd.Run(); err != nil {
return false
}
return true
}
// ContainerExists checks to see if a container exists
func ContainerExists(containerID string) bool {
cmd := sh.Command(DockerBin(), "container", "inspect", containerID)
cmd.Stdout = nil
cmd.Stderr = nil
if err := cmd.Run(); err != nil {
return false
}
return true
}
// ContainerWaitTilReady will wait timeout seconds and then check if a container is running
// returning an error if it is not running at the end of the timeout
func ContainerWaitTilReady(containerID string, timeout time.Duration) error {
time.Sleep(timeout)
if !ContainerIsRunning(containerID) {
return fmt.Errorf("Container %s is not running", containerID)
}
return nil
}
// CopyFromImage copies a file from named image to destination
func CopyFromImage(appName string, image string, source string, destination string) error {
if !VerifyImage(image) {

View File

@@ -163,7 +163,7 @@ dokku_log_plugn_trigger_call() {
local l_hook="$1"
shift
dokku_log_event "INVOKED: ${l_hook}( $* ) NAME=$NAME FINGERPRINT=$FINGERPRINT"
dokku_log_event "INVOKED: ${l_hook}( $* ) NAME=$NAME FINGERPRINT=$FINGERPRINT DOKKU_PID=$DOKKU_PID"
}
dokku_container_log_verbose_quiet() {
@@ -180,7 +180,7 @@ dokku_container_log_verbose_quiet() {
IFS=$OIFS
}
is_valid_app_name() {
fn-is-valid-app-name() {
declare desc="verify that the app name matches naming restrictions"
local APP="$1"
[[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on"
@@ -190,10 +190,10 @@ is_valid_app_name() {
fi
fi
dokku_log_fail "App name must begin with lowercase alphanumeric character, and cannot include uppercase characters, colons, or underscores"
return 1
}
is_valid_app_name_old() {
fn-is-valid-app-name-old() {
declare desc="verify that the app name matches the old naming restrictions"
local APP="$1"
[[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on"
@@ -203,6 +203,28 @@ is_valid_app_name_old() {
fi
fi
return 1
}
is_valid_app_name() {
declare desc="verify that the app name matches naming restrictions"
local APP="$1"
if fn-is-valid-app-name "$APP"; then
return
fi
dokku_log_fail "App name must begin with lowercase alphanumeric character, and cannot include uppercase characters, colons, or underscores"
}
is_valid_app_name_old() {
declare desc="verify that the app name matches the old naming restrictions"
local APP="$1"
if fn-is-valid-app-name-old "$APP"; then
return
fi
dokku_log_fail "App name must begin with lowercase alphanumeric character, and cannot include uppercase characters, or colons"
}
@@ -211,8 +233,13 @@ verify_app_name() {
declare APP="$1"
local VALID_NEW=false
local VALID_OLD=false
is_valid_app_name "$APP" 2>/dev/null && VALID_NEW=true
is_valid_app_name_old "$APP" 2>/dev/null && VALID_OLD=true
if fn-is-valid-app-name "$APP" 2>/dev/null; then
VALID_NEW=true
fi
if fn-is-valid-app-name-old "$APP" 2>/dev/null; then
VALID_OLD=true
fi
if [[ "$VALID_NEW" == "false" ]] && [[ "$VALID_OLD" == "false" ]]; then
dokku_log_fail "App name must begin with lowercase alphanumeric character, and cannot include uppercase characters, colons, or underscores"

View File

@@ -6,4 +6,5 @@ require (
github.com/codegangsta/inject v0.0.0-20150114235600-33e0aa1cb7c0 // indirect
github.com/codeskyblue/go-sh v0.0.0-20190412065543-76bd3d59ff27
github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a
)

View File

@@ -4,3 +4,5 @@ github.com/codeskyblue/go-sh v0.0.0-20190412065543-76bd3d59ff27 h1:HHUr4P/aKh4qu
github.com/codeskyblue/go-sh v0.0.0-20190412065543-76bd3d59ff27/go.mod h1:VQx0hjo2oUeQkQUET7wRwradO6f+fN5jzXgB/zROxxE=
github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3 h1:utdYOikI1XjNtTFGCwSM6OmFJblU4ld4gACoJsbadJg=
github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a h1:DcqTD9SDLc+1P/r1EmRBwnVsrOwW+kk2vWf9n+1sGhs=
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=

View File

@@ -1,8 +1,10 @@
package common
import (
"bufio"
"fmt"
"os"
"strconv"
"strings"
)
@@ -93,6 +95,28 @@ func LogVerboseQuietContainerLogs(containerID string) {
}
}
// LogVerboseQuietContainerLogsTail is the verbose log formatter for container logs with tail mode enabled
func LogVerboseQuietContainerLogsTail(containerID string, lines int, tail bool) {
args := []string{"container", "logs", containerID}
if lines > 0 {
args = append(args, "--tail", strconv.Itoa(lines))
}
if tail {
args = append(args, "--follow")
}
sc := NewShellCmdWithArgs(DockerBin(), args...)
stdout, _ := sc.Command.StdoutPipe()
sc.Command.Start()
scanner := bufio.NewScanner(stdout)
scanner.Split(bufio.ScanLines)
for scanner.Scan() {
m := scanner.Text()
LogVerboseQuiet(m)
}
sc.Command.Wait()
}
// LogWarn is the warning log formatter
func LogWarn(text string) {
fmt.Fprintln(os.Stderr, fmt.Sprintf(" ! %s", text))
@@ -110,7 +134,7 @@ func LogStderr(text string) {
// LogDebug is the debug log formatter
func LogDebug(text string) {
if os.Getenv("DOKKU_TRACE") == "" {
fmt.Fprintln(os.Stderr, fmt.Sprintf(" ? %s", text))
if os.Getenv("DOKKU_TRACE") == "1" {
fmt.Fprintln(os.Stderr, fmt.Sprintf(" ? %s", strings.TrimPrefix(text, " ? ")))
}
}

View File

@@ -132,3 +132,35 @@ func createParallelWorkerPool(jobs chan string, results chan parallelCommandResu
wg.Wait()
close(results)
}
// ReportFunc is a type that declares functions
// useful for :report subcommands
type ReportFunc func(string) string
// CollectReport iterates over a set of report functions
// to collect the :report output in parallel
func CollectReport(appName string, infoFlag string, flags map[string]ReportFunc) map[string]string {
var sm sync.Map
var wg sync.WaitGroup
for flag, fn := range flags {
if infoFlag != "" && infoFlag != flag {
continue
}
wg.Add(1)
go func(flag string, fn ReportFunc) {
defer wg.Done()
s := fn(appName)
sm.Store(flag, s)
}(flag, fn)
}
wg.Wait()
infoFlags := map[string]string{}
sm.Range(func(key interface{}, value interface{}) bool {
infoFlags[key.(string)] = value.(string)
return true
})
return infoFlags
}

View File

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

View File

@@ -12,9 +12,14 @@ import (
)
// CommandPropertySet is a generic function that will set a property for a given plugin/app combination
func CommandPropertySet(pluginName, appName, property, value string, properties map[string]string) {
if err := VerifyAppName(appName); err != nil {
LogFail(err.Error())
func CommandPropertySet(pluginName, appName, property, value string, properties map[string]string, globalProperties map[string]bool) {
if appName != "--global" {
if err := VerifyAppName(appName); err != nil {
LogFail(err.Error())
}
}
if appName == "--global" && !globalProperties[property] {
LogFail("Property cannot be specified globally")
}
if property == "" {
LogFail("No property specified")

View File

@@ -80,21 +80,34 @@ func PlugnTrigger(triggerName string, args ...string) error {
// PlugnTriggerOutput fire the given plugn trigger with the given args
func PlugnTriggerOutput(triggerName string, args ...string) ([]byte, error) {
rescueStderr := os.Stderr
r, w, _ := os.Pipe()
os.Stderr = w
out, err := PlugnTriggerSetup(triggerName, args...).Output()
w.Close()
LogDebug(fmt.Sprintf("plugn trigger %s %v", triggerName, args))
rE, wE, _ := os.Pipe()
rO, wO, _ := os.Pipe()
session := PlugnTriggerSetup(triggerName, args...)
session.Stderr = wE
session.Stdout = wO
err := session.Run()
wE.Close()
wO.Close()
readStderr, _ := ioutil.ReadAll(r)
os.Stderr = rescueStderr
readStderr, _ := ioutil.ReadAll(rE)
readStdout, _ := ioutil.ReadAll(rO)
var stderr error
stderr := string(readStderr[:])
if err != nil {
stderr = fmt.Errorf(string(readStderr[:]))
err = fmt.Errorf(stderr)
}
return out, stderr
if os.Getenv("DOKKU_TRACE") == "1" {
for _, line := range strings.Split(stderr, "\n") {
LogDebug(fmt.Sprintf("plugn trigger %s stderr: %s", triggerName, line))
}
for _, line := range strings.Split(string(readStdout[:]), "\n") {
LogDebug(fmt.Sprintf("plugn trigger %s stdout: %s", triggerName, line))
}
}
return readStdout, err
}
// PlugnTriggerSetup sets up a plugn trigger call

View File

@@ -8,3 +8,5 @@ github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3 h1:utdYOikI1X
github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a h1:DcqTD9SDLc+1P/r1EmRBwnVsrOwW+kk2vWf9n+1sGhs=
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,2 +1,7 @@
/commands
/subcommands/*
/triggers/*
/triggers
/install
/post-*
/report

View File

@@ -1,5 +1,6 @@
SUBCOMMANDS = subcommands/failed
BUILD = commands subcommands
SUBCOMMANDS = subcommands/failed subcommands/report subcommands/set subcommands/vector-logs subcommands/vector-start subcommands/vector-stop
TRIGGERS = triggers/install triggers/post-delete triggers/report
BUILD = commands subcommands triggers
PLUGIN_NAME = logs
include ../../common.mk

223
plugins/logs/functions.go Normal file
View File

@@ -0,0 +1,223 @@
package logs
import (
"encoding/json"
"errors"
"fmt"
"net/url"
"path/filepath"
"strings"
"time"
"github.com/dokku/dokku/plugins/common"
"github.com/joncalhoun/qson"
)
type vectorConfig struct {
Sources map[string]vectorSource `json:"sources"`
Sinks map[string]vectorSink `json:"sinks"`
}
type vectorSource struct {
Type string `json:"type"`
IncludeLabels []string `json:"include_labels,omitempty"`
}
type vectorSink map[string]interface{}
const vectorContainerName = "vector"
func killVectorContainer() error {
if !common.ContainerExists(vectorContainerName) {
return nil
}
if err := stopVectorContainer(); err != nil {
return err
}
time.Sleep(10 * time.Second)
if err := removeVectorContainer(); err != nil {
return err
}
return nil
}
func removeVectorContainer() error {
if !common.ContainerExists(vectorContainerName) {
return nil
}
cmd := common.NewShellCmd(strings.Join([]string{
common.DockerBin(), "container", "rm", "-f", vectorContainerName}, " "))
return common.SuppressOutput(func() error {
if cmd.Execute() {
return nil
}
if common.ContainerExists(vectorContainerName) {
return errors.New("Unable to remove vector container")
}
return nil
})
}
func startVectorContainer(vectorImage string) error {
cmd := common.NewShellCmd(strings.Join([]string{
common.DockerBin(),
"container",
"run", "--detach", "--name", vectorContainerName, common.MustGetEnv("DOKKU_GLOBAL_RUN_ARGS"),
"--volume", "/var/lib/dokku/data/logs/vector.json:/etc/vector/vector.json",
"--volume", "/var/run/docker.sock:/var/run/docker.sock",
"--volume", common.MustGetEnv("DOKKU_LOGS_HOST_DIR") + ":/var/logs/dokku/apps",
vectorImage,
"--config", "/etc/vector/vector.json", "--watch-config", "1"}, " "))
cmd.ShowOutput = false
if !cmd.Execute() {
return errors.New("Unable to start vector container")
}
return nil
}
func stopVectorContainer() error {
if !common.ContainerExists(vectorContainerName) {
return nil
}
if !common.ContainerIsRunning(vectorContainerName) {
return nil
}
cmd := common.NewShellCmd(strings.Join([]string{
common.DockerBin(), "container", "stop", vectorContainerName}, " "))
return common.SuppressOutput(func() error {
if cmd.Execute() {
return nil
}
if common.ContainerIsRunning(vectorContainerName) {
return errors.New("Unable to stop vector container")
}
return nil
})
}
func valueToConfig(appName string, value string) (vectorSink, error) {
var data vectorSink
u, err := url.Parse(value)
if err != nil {
return data, err
}
if u.Query().Get("sinks") != "" {
return data, errors.New("Invalid option sinks")
}
t := fmt.Sprintf("type=%s", u.Scheme)
i := fmt.Sprintf("inputs[]=docker-source:%s", appName)
if appName == "--global" {
i = "inputs[]=docker-global-source"
}
if appName == "--null" {
i = "inputs[]=docker-null-source"
}
initialQuery := fmt.Sprintf("%s&%s", t, i)
query := u.RawQuery
if query == "" {
query = initialQuery
} else if strings.HasPrefix(query, "&") {
query = fmt.Sprintf("%s%s", initialQuery, query)
} else {
query = fmt.Sprintf("%s&%s", initialQuery, query)
}
b, err := qson.ToJSON(query)
if err != nil {
return data, err
}
if err := json.Unmarshal(b, &data); err != nil {
return data, err
}
return data, nil
}
func writeVectorConfig() error {
apps, _ := common.DokkuApps()
data := vectorConfig{
Sources: map[string]vectorSource{},
Sinks: map[string]vectorSink{},
}
for _, appName := range apps {
value := common.PropertyGet("logs", appName, "vector-sink")
if value == "" {
continue
}
sink, err := valueToConfig(appName, value)
if err != nil {
return err
}
data.Sources[fmt.Sprintf("docker-source:%s", appName)] = vectorSource{
Type: "docker_logs",
IncludeLabels: []string{fmt.Sprintf("com.dokku.app-name=%s", appName)},
}
data.Sinks[fmt.Sprintf("docker-sink:%s", appName)] = sink
}
value := common.PropertyGet("logs", "--global", "vector-sink")
if value != "" {
sink, err := valueToConfig("--global", value)
if err != nil {
return err
}
data.Sources["docker-global-source"] = vectorSource{
Type: "docker_logs",
IncludeLabels: []string{"com.dokku.app-name"},
}
data.Sinks["docker-global-sink"] = sink
}
if len(data.Sources) == 0 {
// pull from no containers
data.Sources["docker-null-source"] = vectorSource{
Type: "docker_logs",
IncludeLabels: []string{"com.dokku.vector-null"},
}
}
if len(data.Sinks) == 0 {
// write logs to a blackhole
sink, err := valueToConfig("--null", "blackhole://?print_amount=1")
if err != nil {
return err
}
data.Sinks["docker-null-sink"] = sink
}
b, err := json.MarshalIndent(data, "", " ")
if err != nil {
return err
}
vectorConfig := filepath.Join(common.MustGetEnv("DOKKU_LIB_ROOT"), "data", "logs", "vector.json")
if err := common.WriteSliceToFile(vectorConfig, []string{string(b)}); err != nil {
return err
}
return nil
}

View File

@@ -5,6 +5,7 @@ go 1.15
require (
github.com/codeskyblue/go-sh v0.0.0-20190412065543-76bd3d59ff27
github.com/dokku/dokku/plugins/common v0.0.0-00010101000000-000000000000
github.com/joncalhoun/qson v0.0.0-20200422171543-84433dcd3da0
github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3 // indirect
github.com/spf13/pflag v1.0.5 // indirect
)

View File

@@ -2,7 +2,11 @@ github.com/codegangsta/inject v0.0.0-20150114235600-33e0aa1cb7c0 h1:sDMmm+q/3+Bu
github.com/codegangsta/inject v0.0.0-20150114235600-33e0aa1cb7c0/go.mod h1:4Zcjuz89kmFXt9morQgcfYZAYZ5n8WHjt81YYWIwtTM=
github.com/codeskyblue/go-sh v0.0.0-20190412065543-76bd3d59ff27 h1:HHUr4P/aKh4quafGxDT9LDasjGdlGkzLbfmmrlng3kA=
github.com/codeskyblue/go-sh v0.0.0-20190412065543-76bd3d59ff27/go.mod h1:VQx0hjo2oUeQkQUET7wRwradO6f+fN5jzXgB/zROxxE=
github.com/joncalhoun/qson v0.0.0-20200422171543-84433dcd3da0 h1:ct2XA1aDw8A07Dr8gtrrZgIgLKcZNAl2o9nn0WRMK4Y=
github.com/joncalhoun/qson v0.0.0-20200422171543-84433dcd3da0/go.mod h1:DFXrEwSRX0p/aSvxE21319menCBFeQO0jXpRj7LEZUA=
github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3 h1:utdYOikI1XjNtTFGCwSM6OmFJblU4ld4gACoJsbadJg=
github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a h1:DcqTD9SDLc+1P/r1EmRBwnVsrOwW+kk2vWf9n+1sGhs=
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=

View File

@@ -6,6 +6,21 @@ import (
"github.com/dokku/dokku/plugins/common"
)
var (
// DefaultProperties is a map of all valid ps properties with corresponding default property values
DefaultProperties = map[string]string{
"vector-sink": "",
}
// GlobalProperties is a map of all valid global logs properties
GlobalProperties = map[string]bool{
"vector-sink": true,
}
)
// VectorImage contains the default vector image to run
const VectorImage = "timberio/vector:0.11.X-debian"
// GetFailedLogs outputs failed deploy logs for a given app
func GetFailedLogs(appName string) error {
common.LogInfo2Quiet(fmt.Sprintf("%s failed deploy logs", appName))

View File

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

35
plugins/logs/report.go Normal file
View File

@@ -0,0 +1,35 @@
package logs
import (
"github.com/dokku/dokku/plugins/common"
)
// ReportSingleApp is an internal function that displays the logs report for one or more apps
func ReportSingleApp(appName, infoFlag string) error {
if err := common.VerifyAppName(appName); err != nil {
return err
}
flags := map[string]common.ReportFunc{
"--logs-vector-sink": reportVectorSink,
"--logs-global-vector-sink": reportGlobalVectorSink,
}
flagKeys := []string{}
for flagKey := range flags {
flagKeys = append(flagKeys, flagKey)
}
trimPrefix := false
uppercaseFirstCharacter := true
infoFlags := common.CollectReport(appName, infoFlag, flags)
return common.ReportSingleApp("logs", appName, infoFlag, infoFlags, flagKeys, trimPrefix, uppercaseFirstCharacter)
}
func reportVectorSink(appName string) string {
return common.PropertyGet("logs", appName, "vector-sink")
}
func reportGlobalVectorSink(appName string) string {
return common.PropertyGet("logs", "--global", "vector-sink")
}

View File

@@ -23,7 +23,12 @@ Additional commands:`
helpContent = `
logs [-h] [-t|--tail] [-n|--num num] [-q|--quiet] [-p|--ps process] <app>, Display recent log output
logs:failed [<app>], Shows the last failed deploy logs
logs:failed [--all|<app>], Shows the last failed deploy logs
logs:report [<app>] [<flag>], Displays a logs report for one or more apps
logs:set [--global|<app>] <key> <value>, Set or clear a logs property for an app
logs:vector-logs [--num num] [--tail], Display vector log output
logs:vector-start, Start the vector logging container
logs:vector-stop, Stop the vector logging container
`
)

View File

@@ -24,6 +24,42 @@ func main() {
args.Parse(os.Args[2:])
appName := args.Arg(0)
err = logs.CommandFailed(appName, *allApps)
case "report":
args := flag.NewFlagSet("logs:report", flag.ExitOnError)
osArgs, infoFlag, flagErr := common.ParseReportArgs("logs", os.Args[2:])
if flagErr == nil {
args.Parse(osArgs)
appName := args.Arg(0)
err = logs.CommandReport(appName, infoFlag)
}
case "set":
args := flag.NewFlagSet("logs:set", flag.ExitOnError)
global := args.Bool("global", false, "--global: set a global property")
args.Parse(os.Args[2:])
appName := args.Arg(0)
property := args.Arg(1)
value := args.Arg(2)
if *global {
appName = "--global"
property = args.Arg(0)
value = args.Arg(1)
}
err = logs.CommandSet(appName, property, value)
case "vector-logs":
args := flag.NewFlagSet("logs:vector-logs", flag.ExitOnError)
num := args.Int("num", 100, "the number of lines to display")
tail := args.Bool("tail", false, "continually stream logs")
args.Parse(os.Args[2:])
err = logs.CommandVectorLogs(*num, *tail)
case "vector-start":
args := flag.NewFlagSet("logs:vector-start", flag.ExitOnError)
vectorImage := args.String("vector-image", logs.VectorImage, "--vector-image: the name of the docker image to run for vector")
args.Parse(os.Args[2:])
err = logs.CommandVectorStart(*vectorImage)
case "vector-stop":
args := flag.NewFlagSet("logs:vector-stop", flag.ExitOnError)
args.Parse(os.Args[2:])
err = logs.CommandVectorStop()
default:
common.LogFail(fmt.Sprintf("Invalid plugin subcommand call: %s", subcommand))
}

View File

@@ -0,0 +1,36 @@
package main
import (
"flag"
"fmt"
"os"
"strings"
"github.com/dokku/dokku/plugins/common"
"github.com/dokku/dokku/plugins/logs"
)
// main entrypoint to all triggers
func main() {
parts := strings.Split(os.Args[0], "/")
trigger := parts[len(parts)-1]
flag.Parse()
var err error
switch trigger {
case "install":
err = logs.TriggerInstall()
case "post-delete":
appName := flag.Arg(0)
err = logs.TriggerPostDelete(appName)
case "report":
appName := flag.Arg(0)
err = logs.ReportSingleApp(appName, "")
default:
common.LogFail(fmt.Sprintf("Invalid plugin trigger call: %s", trigger))
}
if err != nil {
common.LogFail(err.Error())
}
}

View File

@@ -1,8 +1,11 @@
package logs
import (
"errors"
"fmt"
"path/filepath"
"strconv"
"time"
"github.com/dokku/dokku/plugins/common"
)
@@ -45,3 +48,94 @@ func CommandFailed(appName string, allApps bool) error {
return GetFailedLogs(appName)
}
// CommandReport displays a logs report for one or more apps
func CommandReport(appName string, infoFlag string) error {
if len(appName) == 0 {
apps, err := common.DokkuApps()
if err != nil {
return err
}
for _, appName := range apps {
if err := ReportSingleApp(appName, infoFlag); err != nil {
return err
}
}
return nil
}
return ReportSingleApp(appName, infoFlag)
}
// CommandSet sets or clears a logs property for an app
func CommandSet(appName string, property string, value string) error {
if property == "vector-sink" && value != "" {
_, err := valueToConfig(appName, value)
if err != nil {
return err
}
}
common.CommandPropertySet("logs", appName, property, value, DefaultProperties, GlobalProperties)
if property == "vector-sink" {
common.LogVerboseQuiet(fmt.Sprintf("Writing updated vector config to %s", filepath.Join(common.MustGetEnv("DOKKU_LIB_ROOT"), "data", "logs", "vector.json")))
return writeVectorConfig()
}
return nil
}
// CommandVectorLogs tails the log output for the vector container
func CommandVectorLogs(lines int, tail bool) error {
if !common.ContainerExists(vectorContainerName) {
return errors.New("Vector container does not exist")
}
if !common.ContainerIsRunning(vectorContainerName) {
return errors.New("Vector container is not running")
}
common.LogInfo1Quiet("Vector container logs")
common.LogVerboseQuietContainerLogsTail(vectorContainerName, lines, tail)
return nil
}
// CommandVectorStart starts a new vector container
// or starts an existing one if it already exists
func CommandVectorStart(vectorImage string) error {
common.LogInfo2("Starting vector container")
common.LogVerbose("Ensuring vector configuration exists")
if err := writeVectorConfig(); err != nil {
return err
}
if common.ContainerExists(vectorContainerName) {
if common.ContainerIsRunning(vectorContainerName) {
common.LogVerbose("Vector container is running")
return nil
}
common.LogVerbose("Starting vector container")
if !common.ContainerStart(vectorContainerName) {
return errors.New("Unable to start vector container")
}
} else {
if err := startVectorContainer(vectorImage); err != nil {
return err
}
}
common.LogVerbose("Waiting for 10 seconds")
if err := common.ContainerWaitTilReady(vectorContainerName, 10*time.Second); err != nil {
return errors.New("Vector container did not start properly, run logs:vector-logs for more details")
}
common.LogVerbose("Vector container is running")
return nil
}
// CommandVectorStop stops and removes an existing vector container
func CommandVectorStop() error {
common.LogInfo2Quiet("Stopping and removing vector container")
return killVectorContainer()
}

41
plugins/logs/triggers.go Normal file
View File

@@ -0,0 +1,41 @@
package logs
import (
"fmt"
"os"
"path/filepath"
"github.com/dokku/dokku/plugins/common"
)
// TriggerInstall initializes app restart policies
func TriggerInstall() error {
if err := common.PropertySetup("logs"); err != nil {
return fmt.Errorf("Unable to install the logs plugin: %s", err.Error())
}
directory := filepath.Join(common.MustGetEnv("DOKKU_LIB_ROOT"), "data", "logs")
if err := os.MkdirAll(directory, 0755); err != nil {
return err
}
if err := common.SetPermissions(directory, 0755); err != nil {
return err
}
logDirectory := filepath.Join(common.MustGetEnv("DOKKU_LOGS_DIR"), "apps")
if err := os.MkdirAll(logDirectory, 0755); err != nil {
return err
}
if err := common.SetPermissions(logDirectory, 0755); err != nil {
return err
}
return nil
}
// TriggerPostDelete destroys the network property for a given app container
func TriggerPostDelete(appName string) error {
return common.PropertyDestroy("logs", appName)
}

View File

@@ -8,3 +8,5 @@ github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3 h1:utdYOikI1X
github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a h1:DcqTD9SDLc+1P/r1EmRBwnVsrOwW+kk2vWf9n+1sGhs=
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=

View File

@@ -22,6 +22,9 @@ var (
"attach-post-deploy": "",
"tld": "",
}
// GlobalProperties is a map of all valid global network properties
GlobalProperties = map[string]bool{}
)
// BuildConfig builds network config files
@@ -206,21 +209,3 @@ func ClearNetworkConfig(appName string) bool {
}
return success
}
// ReportSingleApp is an internal function that displays the app report for one or more apps
func ReportSingleApp(appName, infoFlag string) error {
if err := common.VerifyAppName(appName); err != nil {
return err
}
infoFlags := map[string]string{
"--network-bind-all-interfaces": common.PropertyGet("network", appName, "bind-all-interfaces"),
"--network-attach-post-create": common.PropertyGet("network", appName, "attach-post-create"),
"--network-attach-post-deploy": common.PropertyGet("network", appName, "attach-post-deploy"),
"--network-web-listeners": strings.Join(GetListeners(appName, "web"), " "),
}
trimPrefix := false
uppercaseFirstCharacter := true
return common.ReportSingleApp("network", appName, infoFlag, infoFlags, trimPrefix, uppercaseFirstCharacter)
}

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core network plugin"
version = "0.22.4"
version = "0.22.8"
[plugin.config]

47
plugins/network/report.go Normal file
View File

@@ -0,0 +1,47 @@
package network
import (
"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) error {
if err := common.VerifyAppName(appName); err != nil {
return err
}
flags := map[string]common.ReportFunc{
"--network-bind-all-interfaces": reportBindAllInterfaces,
"--network-attach-post-create": reportAttachPostCreate,
"--network-attach-post-deploy": reportAttachPostDeploy,
"--network-web-listeners": reportWebListeners,
}
flagKeys := []string{}
for flagKey := range flags {
flagKeys = append(flagKeys, flagKey)
}
trimPrefix := false
uppercaseFirstCharacter := true
infoFlags := common.CollectReport(appName, infoFlag, flags)
return common.ReportSingleApp("network", appName, infoFlag, infoFlags, flagKeys, trimPrefix, uppercaseFirstCharacter)
}
func reportBindAllInterfaces(appName string) string {
return common.PropertyGet("network", appName, "bind-all-interfaces")
}
func reportAttachPostCreate(appName string) string {
return common.PropertyGet("network", appName, "attach-post-create")
}
func reportAttachPostDeploy(appName string) string {
return common.PropertyGet("network", appName, "attach-post-deploy")
}
func reportWebListeners(appName string) string {
return strings.Join(GetListeners(appName, "web"), " ")
}

View File

@@ -53,8 +53,8 @@ func main() {
err = network.CommandRebuildall()
case "report":
args := flag.NewFlagSet("network:report", flag.ExitOnError)
osArgs, infoFlag, err := common.ParseReportArgs("network", os.Args[2:])
if err == nil {
osArgs, infoFlag, flagErr := common.ParseReportArgs("network", os.Args[2:])
if flagErr == nil {
args.Parse(osArgs)
appName := args.Arg(0)
err = network.CommandReport(appName, infoFlag)

View File

@@ -169,6 +169,6 @@ func CommandSet(appName string, property string, value string) error {
}
}
common.CommandPropertySet("network", appName, property, value, DefaultProperties)
common.CommandPropertySet("network", appName, property, value, DefaultProperties, GlobalProperties)
return nil
}

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core nginx-vhosts plugin"
version = "0.22.4"
version = "0.22.8"
[plugin.config]

View File

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

View File

@@ -8,3 +8,5 @@ github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3 h1:utdYOikI1X
github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a h1:DcqTD9SDLc+1P/r1EmRBwnVsrOwW+kk2vWf9n+1sGhs=
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core proxy plugin"
version = "0.22.4"
version = "0.22.8"
[plugin.config]

View File

@@ -43,33 +43,6 @@ func IsAppProxyEnabled(appName string) bool {
return proxyEnabled
}
// ReportSingleApp is an internal function that displays the app report for one or more apps
func ReportSingleApp(appName string, infoFlag string) error {
if err := common.VerifyAppName(appName); err != nil {
return err
}
proxyEnabled := "false"
if IsAppProxyEnabled(appName) {
proxyEnabled = "true"
}
var proxyPortMap []string
for _, portMap := range getProxyPortMap(appName) {
proxyPortMap = append(proxyPortMap, portMap.String())
}
infoFlags := map[string]string{
"--proxy-enabled": proxyEnabled,
"--proxy-type": getAppProxyType(appName),
"--proxy-port-map": strings.Join(proxyPortMap, " "),
}
trimPrefix := false
uppercaseFirstCharacter := true
return common.ReportSingleApp("proxy", appName, infoFlag, infoFlags, trimPrefix, uppercaseFirstCharacter)
}
func addProxyPorts(appName string, proxyPortMap []PortMap) error {
allPortMaps := getProxyPortMap(appName)
allPortMaps = append(allPortMaps, proxyPortMap...)

52
plugins/proxy/report.go Normal file
View File

@@ -0,0 +1,52 @@
package proxy
import (
"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 string, infoFlag string) error {
if err := common.VerifyAppName(appName); err != nil {
return err
}
flags := map[string]common.ReportFunc{
"--proxy-enabled": reportEnabled,
"--proxy-type": reportType,
"--proxy-port-map": reportPortMap,
}
flagKeys := []string{}
for flagKey := range flags {
flagKeys = append(flagKeys, flagKey)
}
trimPrefix := false
uppercaseFirstCharacter := true
infoFlags := common.CollectReport(appName, infoFlag, flags)
return common.ReportSingleApp("proxy", appName, infoFlag, infoFlags, flagKeys, trimPrefix, uppercaseFirstCharacter)
}
func reportEnabled(appName string) string {
proxyEnabled := "false"
if IsAppProxyEnabled(appName) {
proxyEnabled = "true"
}
return proxyEnabled
}
func reportType(appName string) string {
return getAppProxyType(appName)
}
func reportPortMap(appName string) string {
var proxyPortMap []string
for _, portMap := range getProxyPortMap(appName) {
proxyPortMap = append(proxyPortMap, portMap.String())
}
return strings.Join(proxyPortMap, " ")
}

View File

@@ -64,8 +64,8 @@ func main() {
err = proxy.CommandPortsSet(appName, portMaps)
case "report":
args := flag.NewFlagSet("proxy:report", flag.ExitOnError)
osArgs, infoFlag, err := common.ParseReportArgs("proxy", os.Args[2:])
if err == nil {
osArgs, infoFlag, flagErr := common.ParseReportArgs("proxy", os.Args[2:])
if flagErr == nil {
args.Parse(osArgs)
appName := args.Arg(0)
err = proxy.CommandReport(appName, infoFlag)

View File

@@ -1,5 +1,5 @@
SUBCOMMANDS = subcommands/inspect subcommands/rebuild subcommands/report subcommands/restart subcommands/restart-policy subcommands/restore subcommands/retire subcommands/scale subcommands/set subcommands/start subcommands/stop
TRIGGERS = triggers/app-restart triggers/install triggers/post-app-clone triggers/post-app-rename triggers/post-create triggers/post-delete triggers/post-stop triggers/pre-deploy triggers/procfile-extract triggers/procfile-get-command triggers/procfile-remove triggers/report
SUBCOMMANDS = subcommands/inspect subcommands/rebuild subcommands/report subcommands/restart subcommands/restore subcommands/retire subcommands/scale subcommands/set subcommands/start subcommands/stop
TRIGGERS = triggers/app-restart triggers/core-post-deploy triggers/install triggers/post-app-clone triggers/post-app-clone-setup triggers/post-app-rename triggers/post-app-rename-setup triggers/post-create triggers/post-delete triggers/post-extract triggers/post-stop triggers/pre-deploy triggers/procfile-extract triggers/procfile-get-command triggers/procfile-remove triggers/report
BUILD = commands subcommands triggers
PLUGIN_NAME = ps

View File

@@ -12,3 +12,5 @@ github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3 h1:utdYOikI1X
github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a h1:DcqTD9SDLc+1P/r1EmRBwnVsrOwW+kk2vWf9n+1sGhs=
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core ps plugin"
version = "0.22.4"
version = "0.22.8"
[plugin.config]

View File

@@ -2,7 +2,6 @@ package ps
import (
"fmt"
"strconv"
"strings"
"github.com/dokku/dokku/plugins/common"
@@ -17,6 +16,9 @@ var (
DefaultProperties = map[string]string{
"restart-policy": "on-failure:10",
}
// GlobalProperties is a map of all valid global ps properties
GlobalProperties = map[string]bool{}
)
// Rebuild rebuilds app from base image
@@ -24,64 +26,6 @@ func Rebuild(appName string) error {
return common.PlugnTrigger("receive-app", []string{appName}...)
}
// ReportSingleApp is an internal function that displays the ps report for one or more apps
func ReportSingleApp(appName, infoFlag string) error {
if err := common.VerifyAppName(appName); err != nil {
return err
}
policy, _ := getRestartPolicy(appName)
if policy == "" {
policy = DefaultProperties["restart-policy"]
}
canScale := "false"
if canScaleApp(appName) {
canScale = "true"
}
deployed := "false"
if common.IsDeployed(appName) {
deployed = "true"
}
runningState := getRunningState(appName)
count, err := getProcessCount(appName)
if err != nil {
count = -1
}
b, _ := common.PlugnTriggerOutput("config-get", []string{appName, "DOKKU_APP_RESTORE"}...)
restore := strings.TrimSpace(string(b[:]))
if restore == "0" {
restore = "false"
} else {
restore = "true"
}
infoFlags := map[string]string{
"--deployed": deployed,
"--processes": strconv.Itoa(count),
"--ps-can-scale": canScale,
"--ps-restart-policy": policy,
"--restore": restore,
"--running": runningState,
}
scheduler := common.GetAppScheduler(appName)
if scheduler == "docker-local" {
processStatus := getProcessStatus(appName)
for process, value := range processStatus {
infoFlags[fmt.Sprintf("--status-%s", process)] = value
}
}
trimPrefix := false
uppercaseFirstCharacter := true
return common.ReportSingleApp("ps", appName, infoFlag, infoFlags, trimPrefix, uppercaseFirstCharacter)
}
// Restart restarts the app
func Restart(appName string) error {
if !common.IsDeployed(appName) {

125
plugins/ps/report.go Normal file
View File

@@ -0,0 +1,125 @@
package ps
import (
"fmt"
"strconv"
"strings"
"github.com/dokku/dokku/plugins/common"
)
// ReportSingleApp is an internal function that displays the ps report for one or more apps
func ReportSingleApp(appName, infoFlag string) error {
if err := common.VerifyAppName(appName); err != nil {
return err
}
flags := map[string]common.ReportFunc{
"--deployed": reportDeployed,
"--processes": reportProcesses,
"--ps-can-scale": reportCanScale,
"--ps-restart-policy": reportRestartPolicy,
"--restore": reportRestore,
"--running": reportRunningState,
}
extraFlags := addStatusFlags(appName, infoFlag)
for flag, fn := range extraFlags {
flags[flag] = fn
}
flagKeys := []string{}
for flagKey := range flags {
flagKeys = append(flagKeys, flagKey)
}
trimPrefix := false
uppercaseFirstCharacter := true
infoFlags := common.CollectReport(appName, infoFlag, flags)
return common.ReportSingleApp("ps", appName, infoFlag, infoFlags, flagKeys, trimPrefix, uppercaseFirstCharacter)
}
func addStatusFlags(appName string, infoFlag string) map[string]common.ReportFunc {
flags := map[string]common.ReportFunc{}
if infoFlag != "" && !strings.HasPrefix(infoFlag, "--status-") {
return flags
}
scheduler := common.GetAppScheduler(appName)
if scheduler != "docker-local" {
return flags
}
containerFiles := common.ListFilesWithPrefix(common.AppRoot(appName), "CONTAINER.")
for _, filename := range containerFiles {
// See https://github.com/golang/go/wiki/CommonMistakes#using-goroutines-on-loop-iterator-variables
containerFilePath := filename
process := strings.TrimPrefix(filename, fmt.Sprintf("%s/CONTAINER.", common.AppRoot(appName)))
flags[fmt.Sprintf("--status-%s", process)] = func(appName string) string {
containerID := common.ReadFirstLine(containerFilePath)
containerStatus, _ := common.DockerInspect(containerID, "{{ .State.Status }}")
if containerStatus == "" {
containerStatus = "missing"
}
return fmt.Sprintf("%s (CID: %s)", containerStatus, containerID[0:11])
}
}
return flags
}
func reportCanScale(appName string) string {
canScale := "false"
if canScaleApp(appName) {
canScale = "true"
}
return canScale
}
func reportDeployed(appName string) string {
deployed := "false"
if common.IsDeployed(appName) {
deployed = "true"
}
return deployed
}
func reportProcesses(appName string) string {
count, err := getProcessCount(appName)
if err != nil {
count = -1
}
return strconv.Itoa(count)
}
func reportRestartPolicy(appName string) string {
policy, _ := getRestartPolicy(appName)
if policy == "" {
policy = DefaultProperties["restart-policy"]
}
return policy
}
func reportRestore(appName string) string {
b, _ := common.PlugnTriggerOutput("config-get", []string{appName, "DOKKU_APP_RESTORE"}...)
restore := strings.TrimSpace(string(b[:]))
if restore == "0" {
restore = "false"
} else {
restore = "true"
}
return restore
}
func reportRunningState(appName string) string {
return getRunningState(appName)
}

View File

@@ -32,8 +32,8 @@ func main() {
err = ps.CommandRebuild(appName, *allApps, *parallelCount)
case "report":
args := flag.NewFlagSet("ps:report", flag.ExitOnError)
osArgs, infoFlag, err := common.ParseReportArgs("ps", os.Args[2:])
if err == nil {
osArgs, infoFlag, flagErr := common.ParseReportArgs("ps", os.Args[2:])
if flagErr == nil {
args.Parse(osArgs)
appName := args.Arg(0)
err = ps.CommandReport(appName, infoFlag)

View File

@@ -163,7 +163,7 @@ func CommandSet(appName string, property string, value string) error {
return dockeroptions.SetDockerOptionForPhases(appName, []string{"deploy"}, "restart", value)
}
common.CommandPropertySet("ps", appName, property, value, DefaultProperties)
common.CommandPropertySet("ps", appName, property, value, DefaultProperties, GlobalProperties)
return nil
}

View File

@@ -8,3 +8,5 @@ github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3 h1:utdYOikI1X
github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a h1:DcqTD9SDLc+1P/r1EmRBwnVsrOwW+kk2vWf9n+1sGhs=
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=

View File

@@ -1,4 +1,4 @@
[plugin]
description = "dokku core repo plugin"
version = "0.22.4"
version = "0.22.8"
[plugin.config]

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