Skip to main content

Plugin

NameCloud APIM - Clever Cloud Reaper
Identifiercp:otoroshi_plugins.com.cloud.apim.otoroshi.extensions.clevercloudreaper.CleverCloudReaper
Stepaccess validation (ValidateAccess)
Instances per routeone

The plugin does nothing when the extension is disabled, and nothing on a route whose app cannot be found (no app_id, and no target on app-<uuid>.cleverapps.io).

Configuration​

FieldTypeDefault
app_idstringfrom the targetsthe Clever Cloud app, app_<uuid>
owner_idstringdiscoveredits owner, orga_<uuid> or user_<uuid>
grace_periodinteger, seconds3600time without traffic before the app is put to sleep
fail_timeoutinteger, seconds900time a start or a stop may take before the app goes into error; longest wait of a held request
allow_waiting_pagebooleantrueserve the waiting page to browsers
api_behaviorhold | unavailableholdwhat the other requests get while the app wakes up
ready_delayinteger, seconds3wait of held requests once the app is up
must_be_up_atarray of ranges[]time ranges where the app stays up
timezonestringthe extension'stimezone of the ranges
monitoring_filtersarray of filters[]requests that are not traffic
waiting_pagestring, HTMLthe built-in pagea custom waiting page

Values that cannot be read fall back to their default rather than breaking the route: a negative duration, an unknown api_behavior (it holds), a range with an invalid time, a filter with an unknown source or no regex (they are dropped).

A range of must_be_up_at​

FieldTypeDefault
daysarray of stringsevery daymonday... sunday, or mon... sun, any case. Empty, *, all, every_day or everyday for every day
startstring, HH:mm08:00included
endstring, HH:mm19:00excluded. Before start for a range running overnight

A filter of monitoring_filters​

FieldType
sourcepath | uri | header | user_agent | querywhat the regex is searched in
namestringthe header or query param, for header and query
regexstringa Java regex, searched in the value. Anchor it with ^ and $ for an exact match

Example​

{
"plugin": "cp:otoroshi_plugins.com.cloud.apim.otoroshi.extensions.clevercloudreaper.CleverCloudReaper",
"enabled": true,
"include": [],
"exclude": [],
"config": {
"app_id": "app_0f4c2b0e-1a2b-4c3d-8e9f-0123456789ab",
"grace_period": 1800,
"fail_timeout": 600,
"allow_waiting_page": true,
"api_behavior": "unavailable",
"ready_delay": 5,
"timezone": "Europe/Paris",
"must_be_up_at": [
{ "days": ["mon", "tue", "wed", "thu", "fri"], "start": "08:30", "end": "19:00" },
{ "days": ["*"], "start": "23:30", "end": "00:30" }
],
"monitoring_filters": [
{ "source": "path", "regex": "^/health$" },
{ "source": "query", "name": "probe", "regex": ".+" }
]
}
}

Responses of the plugin​

What the plugin answers by itself, without calling the app:

WhenStatusBodyHeaders
CleverCloud-Reaper: status200{"status": "...", "ready_delay_ms": 3000}CleverCloud-Reaper-Status
CleverCloud-Reaper: poll, app asleep or in error503sameCleverCloud-Reaper-Status, Retry-After: 30
monitoring request, app asleep200{"monitoring": true, "status": "..."}CleverCloud-Reaper-Status
browser, app asleep, waiting page on503the waiting pageCleverCloud-Reaper-Status, Retry-After: 30
app asleep, unavailable503{"error": "the application is waking up, retry later", "status": "..."}CleverCloud-Reaper-Status, Retry-After: 30
app asleep, hold, app in error503Otoroshi error, the application could not be started
app asleep, hold, fail timeout504Otoroshi error, the application did not wake up in time

Every answer of the plugin carries Cache-Control: no-store, except the two Otoroshi errors, which use the error templates of the route. Their cause ids are errors.clever.reaper.start.failed and errors.clever.reaper.wakeup.timeout.

The headers are described in Headers.