Commit Graph

1840 Commits

Author SHA1 Message Date
Reed Allman
38a2baa5d0 Merge pull request #339 from fnproject/app-yaml
Example and documentation for deploying full applications
2017-09-20 12:38:49 -07:00
Travis Reeder
deb2ae8103 Merge branch 'master' into app-yaml 2017-09-20 11:49:33 -07:00
Travis Reeder
904f288ed6 Replace FN_ROUTE with FN_PATH 2017-09-20 11:35:18 -07:00
Reed Allman
22a1b296e3 fix slot races
I'd be pretty surprised if these were happening but meh, a computer running at
capacity can make the runtime scheduler do all kinds of weird shit, so this
locks down the behavior around slot launching.

I didn't load test much as there are cries of 'wolf' running amok, and it's
late, so this could be off a little -- but I think it's about this easy.  cold
is the only one launching slots for itself, so it should always receive its
own slot (provided within time bounds). for hot we just need a way to tell the
ram token allocator that we aren't there anymore, so that somebody can close
the token (important).

If the bug still persists then it seems likely that there is another bug
around timing I'm not aware of (possible, but unlikely) or the more likely
case that it's actually taking up to the timeout to launch a container / find
a ram slot / find a free container. Otherwise, it's not related to the agent
and the http server timeouts may need fiddling with (read / write timeout),
if ruby client is failing to connect though I'm guessing that it's just that
nobody is reading the body (i.e. no function runs) and the error handling
isn't very well done, as we are replying with 504 if we hit a timeout (but if
nobody is listening, they won't get it).
2017-09-20 10:43:12 -07:00
Reed Allman
337e962416 add pagination to all list endpoints
calls, apps, and routes listing were previously returning the entire data set,
which just won't scale. this adds pagination with cursoring forward to each of
these endpoints (see the [docs](docs/definitions.md)).

the patch is really mostly tests, shouldn't be that bad to pick through.

some blarble about implementation is in order:

calls are sorted by ids but allow searching within certain `created_at` ranges
(finally). this is because sorting by `created_at` isn't feasible when
combined with paging, as `created_at` is not guaranteed to be unique -- id's
are (eliding theoreticals). i.e. on a page boundary, if there are 200 calls
with the same `created_at`, providing a `cursor` of that `created_at` will
skip over the remaining N calls with that `created_at`.  also using id will be
better on the index anyway (well, less of them). yay having sortable ids! I
can't discern any issues doing this, as even if 200 calls have the same
created_at, they will have different ids, and the sort should allow paginating
them just fine. ids are also url safe, so the id works as the cursor value
just fine.

apps and routes are sorted by alphabetical order. as they aren't guaranteed to
be url safe, we are base64'ing them in the front end to a url safe format and
then returning them, and then base64 decoding them when we get them. this does
mean that they can be relatively large if the path/app is long, but if we
don't want to add ids then they were going to be pretty big anyway. a bonus
that this kind of obscures them. if somebody has better idea on formatting, by
all means.

notably, we are not using the sql paging facilities, and we are baking our own
based on cursors, which ends up being much more efficient for querying longer
lists of resources. this also should be easy to implement in other non-sql dbs
and the cursoring formats we can change on the fly since we are just exposing
them as opaque strings. the front end deals with the base64 / formatting, etc
and the back end is taking raw values (strfmt.DateTime or the id for calls).
the cursor that is being passed to/by the user is simply the last resource on the
previous page, so in theory we don't even need to return it, but it does make
it a little easier to use, also, cursor being blank on the last page depends
on page full-ness, so sometimes users will get a cursor when there are no
results on next page (1/N chance, and it's not really end of world -- actually
searching for the next thing would make things more complex). there are ample
tests for this behavior.

I've turned off all query parameters allowing `LIKE` queries on certain listing
endpoints, as we should not expose sql behavior through our API in the event
that we end up not using a sql db down the road. I think we should only allow
prefix matching, which sql can support as well as other types of databases
relatively cheaply, but this is not hooked up here as it didn't 'just work'
when I was fiddling with it (can add later, they're unnecessary and weren't
wired in before in front end).

* remove route listing across apps (unused)
* fix panic when doing `/app//`. this is prob possible for other types of
endpoints, out of scope here. added a guard in front of all endpoints for this
* adds `from_time` and `to_time` query parameters to calls, so you can e.g.
list the last hour of tasks. these are not required and default to
oldest/newest.
* hooked back up the datastore tests to the sql db, only run with sqlite atm,
but these are useful, added a lot to them too.
* added a bunch of tests to the front end, so pretty sure this all works now.
* added to swagger, we'll need to re-gen. also wrote some words about
pagination workings, I'm not sure how best to link to these, feedback welcome.
* not sure how we want to manage indexes, but we may need to add some (looking
at created_at, mostly)
* `?route` changed to `?path` in routes listing, to keep consistency with
everything else
* don't 404 when searching for calls where the route doesn't exist, just
return an empty list (it's a query param ffs)

closes #141
2017-09-20 06:50:49 -07:00
CI
5ad17e13f4 fnlb: 0.0.75 release [skip ci] fnlb-0.0.75 2017-09-19 22:41:45 +00:00
CI
6a5b5fbcd4 functions: 0.3.109 release [skip ci] 0.3.109 2017-09-19 22:40:27 +00:00
Derek Schultz
fbb3ed6e9a Merge pull request #343 from fnproject/rollback-mysql
rollback mysql driver
2017-09-19 16:29:57 -06:00
Reed Allman
1a55c8050e rollback mysql driver
this https://github.com/go-sql-driver/mysql/pull/302 seems to have pretty much
crippled the ability to use mysql, so we need to lock a version before that
until that issue gets fixed.
2017-09-19 14:14:42 -07:00
CI
8988d5996c fnlb: 0.0.74 release [skip ci] fnlb-0.0.74 2017-09-19 17:54:45 +00:00
CI
e1248bca5e functions: 0.3.108 release [skip ci] 0.3.108 2017-09-19 17:53:34 +00:00
Reed Allman
4e96232c53 Merge pull request #341 from fnproject/dep-update
Finally rid of capital Sirupsen??
2017-09-19 10:48:14 -07:00
Chad Arimura
4c303205d6 Merge pull request #342 from fnproject/improved_stats by demoman
Update global stats charts to show breakdown by function
2017-09-19 10:43:36 -07:00
Nigel Deakin
ae69bb37e3 Update global stats charts to show bteakdown by function 2017-09-19 15:05:37 +01:00
Travis Reeder
3aecebdf48 Finally rid of capital Sirupsen?? 2017-09-18 23:33:47 -07:00
CI
6698efeaa9 fnlb: 0.0.73 release [skip ci] fnlb-0.0.73 2017-09-19 05:46:34 +00:00
CI
3c3f771207 functions: 0.3.107 release [skip ci] 0.3.107 2017-09-19 05:45:16 +00:00
Travis Reeder
cdb74915de Removed capital Sirupsen from glide.lock 2017-09-18 22:37:33 -07:00
Reed Allman
f335d34636 add server option to limit request size (#320)
we're going to want to do this in our service version of this thing, but
adding this here so that it's usable by everyone. just an option, can add it
to server configuration, but response is nicely formatted, etc.

closes #277
2017-09-18 22:34:19 -07:00
Travis Reeder
87deba45e2 Updated docs. 2017-09-18 17:17:00 -07:00
Travis Reeder
5476665ea9 Quick link fix. 2017-09-18 17:17:00 -07:00
Travis Reeder
4f653e3595 wip 2017-09-18 17:17:00 -07:00
Travis Reeder
75e2051169 Example app structure. round 1. 2017-09-18 17:16:59 -07:00
Travis Reeder
fdc3e76359 wip 2017-09-18 17:16:59 -07:00
CI
c6f9b50afe fnlb: 0.0.72 release [skip ci] fnlb-0.0.72 2017-09-18 22:41:06 +00:00
CI
a935a7102d functions: 0.3.106 release [skip ci] 0.3.106 2017-09-18 22:39:49 +00:00
Reed Allman
6ba06b8cff Merge pull request #338 from fnproject/fix-nilly
not ready for spans yet in hot land
2017-09-18 15:29:46 -07:00
CI
a5764b4a75 fnlb: 0.0.71 release [skip ci] fnlb-0.0.71 2017-09-18 21:12:22 +00:00
CI
913342c4d5 functions: 0.3.105 release [skip ci] 0.3.105 2017-09-18 21:11:00 +00:00
Reed Allman
f0d720cf2f Merge pull request #318 from fnproject/fnlog-fiddler
make fn logger more reasonable
2017-09-18 13:59:31 -07:00
Reed Allman
b95aed5ecf Merge pull request #335 from fnproject/sanitize-cl
fix neg content length
2017-09-18 13:58:12 -07:00
CI
0280df0cdf fnlb: 0.0.70 release [skip ci] fnlb-0.0.70 2017-09-15 17:37:34 +00:00
CI
893edfcd63 functions: 0.3.104 release [skip ci] 0.3.104 2017-09-15 17:36:21 +00:00
Reed Allman
58ead3f7b6 Merge pull request #327 from fnproject/loggyloo
add id to all call invocation logs
2017-09-15 10:26:03 -07:00
CI
09f358b324 fnlb: 0.0.69 release [skip ci] fnlb-0.0.69 2017-09-15 00:19:36 +00:00
CI
1a8a878e9f functions: 0.3.103 release [skip ci] 0.3.103 2017-09-15 00:18:17 +00:00
CI
693bdd50f0 fnlb: 0.0.68 release [skip ci] fnlb-0.0.68 2017-09-14 18:19:34 +00:00
CI
02571220c3 functions: 0.3.102 release [skip ci] 0.3.102 2017-09-14 18:18:21 +00:00
Travis Reeder
35d7d40af2 added /fn 2017-09-14 11:12:15 -07:00
Reed Allman
c7ebf0d7ba remove whacko files (#324) 2017-09-14 11:08:24 -07:00
CI
67d0b9cb9f functions: 0.3.101 release [skip ci] 0.3.101 2017-09-14 18:07:38 +00:00
Travis Reeder
9f87b1ead0 Client generator update (#262)
* Generated a bunch of clients.

* Builds go client.

* Removed test line.

* Changed dependencies to fnproject/fn_go

* Fix tests.
2017-09-14 10:57:22 -07:00
CI
0f6db73834 fnlb: 0.0.67 release [skip ci] fnlb-0.0.67 2017-09-14 17:20:33 +00:00
CI
4a4849b5e2 functions: 0.3.100 release [skip ci] 0.3.100 2017-09-14 17:19:19 +00:00
Reed Allman
f0b17b9708 Merge pull request #323 from fnproject/bubble
bubble up some docker errors to user
2017-09-14 10:09:10 -07:00
CI
779b53425c fnlb: 0.0.66 release [skip ci] fnlb-0.0.66 2017-09-13 18:30:07 +00:00
CI
d395c4edda functions: 0.3.99 release [skip ci] 0.3.99 2017-09-13 18:28:45 +00:00
Reed Allman
3b70b68d72 Merge pull request #322 from fnproject/302
Fix error handling when deleting app
2017-09-13 11:18:00 -07:00
Denis Makogon
5683d01603 Fix error handling 2017-09-13 21:03:53 +03:00
CI
6f5ec3a0e6 fnlb: 0.0.65 release [skip ci] fnlb-0.0.65 2017-09-13 17:25:31 +00:00