Commit Graph
446 Commits
Author SHA1 Message Date
Jose Diaz-Gonzalez ab8eb5a727 Handle crashing containers by using restart=on-failure policy
Previously a crashed container would stay down, regardless of exit status. In some cases, it may be useful to restart the container. For example, an application may not be correctly implementing their error handling, or the crash may be caused by a transient error.

By setting the restart policy to `on-failure:N` - where N is a number of max restarts - we can help developers guard against crashing applications. Note that this is not a replacement for proper error handling, nor does this include notifications to a developer when a container is restarted. Those patterns should be implemented application side, or via a feature request to docker.

The value is configurable at the app-level by setting DOKKU_RESTART_LIMIT to a number. By default, containers will be restarted a max of 10 times. If a container crashes during the check-deploy plugin trigger, then the deploy will be marked as a failure.

Closes #216
Closes #398
Closes #1327
2015-09-16 23:47:33 -07:00
Jose Diaz-Gonzalez 27a2478a33 Follow bashstyle where possible 2015-09-16 16:06:31 -07:00
Jose Diaz-Gonzalez c929edfbe5 Source plugins from $PLUGIN_AVAILABLE_PATH when not using common plugin
This will allow us to override any core plugin
2015-09-15 02:22:08 -07:00
Michael Hobbs 8095df79f6 implement core plugin mgmt using plugn. add tests. 2015-09-15 02:17:28 -07:00
Jose Diaz-Gonzalez ad72a137e1 Fix sourcing of functions 2015-09-15 02:16:40 -07:00
Michael Hobbs 7a545759f2 initial pass at switching to plugn 2015-09-15 02:16:40 -07:00
Jose Diaz-Gonzalez e7c035e207 Use config_export function instead of calling dokku as a subcommand 2015-08-30 01:55:14 -04:00
Jose Diaz-Gonzalez 60c0f56724 Fix lint errors 2015-08-30 01:23:56 -04:00
Jose Diaz-Gonzalez afe65a86fb eval the output of "dokku config --export" to get env config
This should theoretically be safe, as "--export" forces the `dokku config` command to return 0 in all cases, and it should only output lines that are "valid" environment variables
2015-08-30 01:23:56 -04:00
Jim Myhrberg d5df6a4190 Use $PLUGIN_PATH instead of $(dirname $0)/..
As briefly discussed in #1425, source the `common/functions` file via an
absolute path, rather than determining the relative path by using
`dirname`. 3rd-party plugins should follow suit and use the new
`$PLUGIN_PATH` convention too.
2015-08-28 14:14:28 +01:00
Michael Hobbs d2f2bc9ac1 update docs to reflect default checks. rename DOKKU_DEFAULT_WAIT to DOKKU_DEFAULT_CHECKS_WAIT. refs #1323 2015-07-17 07:25:35 -07:00
Michael Hobbs c7cb014580 convenience functions for app container state 2015-07-13 09:27:42 -07:00
Michael Hobbs 633c595311 use docker inspect instead of docker ps grep pattern. closes #1281 2015-07-13 09:09:38 -07:00
Kilian Ciuffolo 0424d5a744 fixes #1270 faulty default container check 2015-07-13 09:09:38 -07:00
Jose Diaz-Gonzalez 68b12ab46f Merge pull request #1298 from SonicHedgehog/fix-check-root
Fix check-deploy skipping the root path
2015-07-13 10:31:21 -04:00
Jose Diaz-Gonzalez 43b179735b Merge pull request #1261 from Flink/bypass-checks-on-demand
Allows to skip checks (all or default)
2015-07-11 16:31:21 -04:00
Jakob Krigovsky 5f03518ec8 Fix check-deploy skipping the root path
The root path, `/`, was treated as an invalid URL because it didn’t
contain any characters after the slash.
2015-07-11 13:46:17 +02:00
Jakob Krigovsky a60dfd3b5e Set X-Forwarded-Proto header if TLS is enabled when running checks 2015-07-09 22:03:29 +02:00
Loïc Guitaut c316f59f4f Allows to skip checks (all or default)
Setting `DOKKU_SKIP_ALL_CHECKS` globally or for a given app will skip
all checks.
Setting `DOKKU_SKIP_DEFAULT_CHECKS` globally or for a given app will skip
default checks only.
2015-06-29 17:21:31 +02:00
Michael Hobbs 0d2e5f1a14 Merge branch 'master' into mh-ps-scale 2015-05-17 17:45:01 -07:00
Jose Diaz-Gonzalez eac3eba50e Merge pull request #1179 from trsc/prevent_dismissal_of_urls_in_checks_file
prevent dismissal of URLs in CHECKS file that contain query params
2015-05-16 14:30:21 -04:00
Vincent Fretin 2e69ff6041 wait 30 seconds and not 30 minutes 2015-05-16 18:20:50 +02:00
Andreas Follmann 6eefcbb87c prevent dismissal of URLs in CHECKS file that contain query params 2015-05-11 15:31:28 +02:00
Michael Hobbs 3361a20a30 only check containers running proc named web for now 2015-04-21 14:33:28 -07:00
Michael Hobbs e27d0e6fa5 wrap container id checks and reading into common function that attempts new and old style container id files
aggregate log streams
2015-04-21 14:32:30 -07:00
Michael Hobbs 33f872183e initial pass at container-level scaling 2015-04-21 14:27:23 -07:00
Josh Cohen e33d17b7dd updated text from @savant 2015-04-18 05:38:23 +00:00
Josh Cohen 30f9ab740d Logging info suggesting tuned CHECKS 2015-04-17 23:25:43 +00:00
Jose Diaz-Gonzalez 1a151ddabe Merge pull request #1056 from joshco/feature/retries
Review: Feature/retries
2015-04-13 17:18:00 -04:00
Josh Cohen b5eef489fd linting fixes 2015-04-13 20:22:14 +00:00
Josh Cohen cc565661e3 fix linting issues
rename UNCHECKED -> FAILEDCHECKS
2015-04-11 01:10:14 +00:00
Alexei Mikhailov b388c2ce1e Sourcing app-specific ENV during check-deploy, which gone missing in 052e3e88c8. 2015-04-09 18:54:08 +03:00
Josh Cohen 61270967c1 Change "RETRIES" to (MAX) "ATTEMPTS" as this better reflects behavior.
ATTEMPTS=0 means don't run the checks.  Useful if you want to skip the checks and can be overridden by DOKKU_CHECKS_ATTEMPTS
ATTEMPTS=1 means run only once
2015-04-07 14:51:49 +00:00
Josh 48f76bcfef Indentation
Indentation for new outer loop
2015-03-24 23:26:31 -04:00
Josh Cohen 3b252d43c6 Add RETRIES feature to checks.
The system will loop through checks RETRIES times until they succeed.
if they do not eventually succeed, it will fail the deployment
2015-03-25 03:17:44 +00:00
Michael Hobbs 77257c484f show logs on deploy success and failure. closes #1044 2015-03-20 12:32:49 -07:00
Michael Hobbs 72c829e29b default container check. closes #1020 2015-03-17 12:17:33 -07:00
Michael Hobbs ee039fe4f1 lintball. disable SC1001 2015-03-16 12:43:34 -07:00
Assaf Arkin 052e3e88c8 ADDED several enhancements for CHECKS file:
- Specify how long to wait before running first check
- Specify timeout for each check
- Check specific hosts, e.g. http://signin.example.com
- Check both HTTP and HTTPS resources
2015-03-14 10:13:36 -07:00
Michael Hobbs 959c51eb50 refactor function defs to be posix-like. remove usage of force positional argument in tests. support --force like arguments in client" 2015-02-07 11:35:04 -08:00
Michael Hobbs 5fb30ab934 source global env prior to app env. closes #931 2015-02-03 13:47:20 -08:00
Michael Hobbs 6bb01404ec poor lint fix choice. let's not do that. 2014-12-21 14:51:42 -08:00
Michael Hobbs 3706392e65 test with wercker 2014-12-21 14:51:40 -08:00
Jose Diaz-Gonzalez 7b361e564f Use 2 spaces for formatting bash
Also remove extra trailing newlines
2014-11-16 02:58:52 -05:00
Jose Diaz-Gonzalez f13c1031c7 Ensure there is a newline after calling set -e 2014-11-16 02:54:54 -05:00
Assaf Arkin 00ec004871 Zero down-time deploy and server checks
This change makes Dokku start up the new container, run a set of checks
against it, and only switch traffic over to the new containers if all
checks complete successfully. No requests are dropped during the switch
over.

To specify checks, add a CHECKS file to the root of your project
directory. This is a text file with one line per check. Empty lines and
lines starting with # are ignored.

A check is a relative URL and may be followed by expected content from
the page, for example:

  /about     Our Amazing Team

Even if you don’t use any checks, this change will prevent downtime
during switching from old to new container.

See: https://labnotes.org/zero-downtime-deploy-with-dokku/
2014-04-28 21:28:50 -07:00