Commit Graph

17 Commits

Author SHA1 Message Date
sakisv
a6ecfd66b6 Terminate instance if it's running out of disk space 2020-12-23 19:40:04 +02:00
Rebecca Law
fe18512dd2 Change how the bash script is started.
By adding `exec` to the entrypoint bash script for the application, we can trap an EXIT from the script and execute our custom `on_exit` method with checks if the application process is busy before terminating, waiting up to 10 seconds. We don't need to trap `TERM` so that's been removed again.

Written by:
@servingupaces
@tlwr
2019-10-31 16:41:16 +00:00
Toby Lorne
4ad2e30e52 Catch the TERM signal in the run_app_*paas scripts
When Cloud Foundry applications are to be rescheduled from one cell to
another, or they are stopped, they are sent a SIGTERM signal and 10
seconds later, a SIGKILL signal.

Currently the scripts trap the POSIX defined EXIT handler, rather than
the signal directly.

In order for the signal to properly be propagated to celery, and the
celery workers, the script should call the on_exit function when
receiving a TERM signal.

Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk>
Co-authored-by: Becca <rebecca.law@digital.cabinet.office.gov.uk>
Co-authored-by: Toby <toby.lornewelch-richards@digital.cabinet.office.gov.uk>
2019-10-29 17:21:16 +00:00
Andy Paine
655d5a4e16 AUTO-413: Use an internal app for statsd preview
- We are running statsd exporter as an app with a public route for
  Prometheus to scrape
- This updates preview to send statsd metrics over the CF internal
  networking to the statsd exporter
- Removes the sidecar statsd exporters too
2019-05-23 11:10:33 +01:00
Alexey Bezhan
570cbc3eab Add statsd_exporter to app PaaS startup scripts
`statsd_exporter` is only started if `STATSD_HOST` is set to `localhost`.
2019-04-24 13:50:13 +01:00
Athanasios Voutsadakis
d365921093 Address PR comments
Make timeout 9s on both files
Use more descriptive variable name
Declare the logs dir as a constant
2018-03-06 16:11:42 +00:00
Athanasios Voutsadakis
9a8e771d95 Lower the termination timeout to 10s
Cloudfoundry only gives us 10s to terminate our processes:
https://docs.cloudfoundry.org/devguide/deploy-apps/app-lifecycle.html#shutdown
2018-02-27 17:44:16 +00:00
Alexey Bezhan
40c27c6e70 Don't parse AWS credentials from VCAP_SERVICES in run_app_paas
AWS credentials are provided in the environment variables directly,
so we don't need to parse them from VCAP_SERVICES
2018-01-09 10:45:03 +00:00
Leo Hemsted
c6e6fad01f if apps crash on startup, then fail deploy process
we saw an issue where the app started, then immediately crashed due to
a setup error. However, jenkins had already returned positively, and
the deploy continued.

cf-deploy should fail if the app doesn't start up.

We do this by looking through the cloudfoundry events, and aborting
if there are any `app.crash` events for the new GUID.
2017-12-14 14:23:32 +00:00
Athanasios Voutsadakis
444876222e Touch log files in the initialization
The logs agent would complain for the missing gunicorn error log file.
2017-12-05 13:36:45 +00:00
Athanasios Voutsadakis
646290e2c4 Implement worker_abort server hook
Also update the manifest command to pass the config file in as a parameter
and modify the logs agent to start shipping the error log to cloudwatch
2017-09-22 15:03:45 +01:00
Athanasios Voutsadakis
4b88ec639f Remove * from logs matching pattern
Now we are only going to have one log file that we're interested in
2017-09-11 11:11:06 +01:00
Leo Hemsted
4e7c19a98f update utils to v20 - log from multiple app.log*.json files
the rotating file handler puts the date on the end, so those old files won't be pushed
2017-08-25 14:38:04 +01:00
Leo Hemsted
e7b13e727a don't capture logs directly from stdout
previously in run_app_paas.sh, we captured stdout from the app and
piped that into the log file. However, this came up with a bunch of
problems, mainly:

* exceptions with stack traces often weren't formatted properly,
  and kibana could not parse them
* celery logs were duplicated - we'd collect both the json logs and
  the human readable stdout logs.

instead, with the updated utils library, we can use that to log json
straight to the appropriate directory directly.
2017-08-09 15:29:39 +01:00
bandesz
bacce90ac2 PaaS run script: redirect stderr to stdout 2017-03-21 15:03:03 +00:00
bandesz
b453dd59d0 Add termination timeout to run_app_paas.sh 2017-02-28 17:39:04 +00:00
bandesz
72dc93c6db Add awslogs logging for PaaS 2017-02-16 17:38:30 +00:00