Commit Graph

1197 Commits

Author SHA1 Message Date
James Jeffrey
f9a46f7c1c Update vendor 2017-07-19 15:43:53 -07:00
James Jeffrey
06505cef17 Update back to put 2017-07-19 15:43:44 -07:00
Travis Reeder
cd88c16915 Merge branch 'issue_107' into 'master'
Use chi style middle ware

Closes #107 and #131

See merge request !110
2017-07-19 13:44:26 -07:00
James Jeffrey
cf2c3cf404 Use chi style middle ware 2017-07-19 13:44:26 -07:00
Reed Allman
570e9265f1 Merge branch '114' into 'master'
Fix unexpected failure when trying to update route with exact the same attributes

Closes #114 and #102

See merge request !111
2017-07-18 13:40:54 -07:00
Denis Makogon
07b0fab720 Fix unexpected failure when trying to update route with exact the same attributes 2017-07-18 13:40:54 -07:00
Denis Makogon
fea44b0dbf Merge branch 'mask-errors' into 'master'
mask errors in api response, log real error

See merge request !108
2017-07-18 09:17:03 -07:00
Derek Schultz
86be09a3c3 Merge branch 'fix-formatting' into 'master'
Fix formatting to make tests pass

See merge request !113
2017-07-18 09:12:20 -07:00
Denis Makogon
40bfce856e Fix formatting to make tests 2017-07-18 19:06:39 +03:00
Travis Reeder
ce008b7b01 Merge branch 'fntest2' into 'master'
Update for testing functions.

Closes #7

See merge request !107
2017-07-18 09:01:53 -07:00
Mukhtar Haji
704c6f0ad6 Merge branch 'java-maven-runtime' into 'master'
Adds java-maven runtime

See merge request !36
2017-07-18 08:44:51 -07:00
Reed Allman
0e3b182877 Merge branch 'db-max-conns' into 'master'
increase max idle conns

See merge request !109
2017-07-17 15:32:01 -07:00
Travis Reeder
053c7cb0e6 Added gomega and updated deps. 2017-07-17 13:01:00 -07:00
Travis Reeder
f8b8c6f7e8 Update for testing functions. 2017-07-17 11:41:10 -07:00
Reed Allman
db35a8cfd2 Merge branch 'multilb' into 'master'
back the lb with a db for scale

See merge request !104
2017-07-14 12:18:45 -07:00
Reed Allman
cb3464fcb1 increase max idle conns
we're routinely doing transactions which will hold up connections for some
time, it was pretty easy to run out of 30 conns from routine function
invocations. the 'right' thing is probably to add a config val to the url that
we can strip before passing into the db, but i'm not sure i want to have our
own query params in db urls, either.
2017-07-14 04:18:50 -07:00
Reed Allman
c0aed2fbb0 mask errors in api response, log real error
we had this _almost_ right, in that we were trying, but we weren't masking the
error from the user response for any error we don't intend to show. this also
adds a stack trace from any internal server errors, so that we might be able
to track them down in the future (looking at you, 'context deadline
exceeded'). in addition, this adds a new `models.APIError` interface which all
of the errors in `models` now implement, and can be caught easily / added to
easily.

the front end now does no status rewriting based on api errors, now when we
get a non-nil error we can call `handleResponse(c, err)` with it and if it's a
proper error, return it to the user with the right status code, otherwise log
a stack trace and return `internal server error`. this cleans up a lot of the
front end code.

also rewrites start task ctx deadline exceeded as timeout. with iw we had
async tasks so we could start the clock later and it didn't matter, but now
with sync tasks time out sometimes just making docker calls, and we want the
task status to show up as timed out. we may want to just catch all this above
in addition to this, but this seems like the right thing to do.

remove squishing together errors. this was weird, now we return the first
error for the purposes of using the new err interface.

removed a lot of 5xx errors that really should have been 4xx errors. changed
some of the 400 errors to 409 errors, since they are from sending in
conflicting info and not a malformed request.

removed unused errors / useless errors (many were used for logging, and didn't
provide any context. now with stack traces we don't need context as much in
the logs).
2017-07-14 03:44:16 -07:00
Travis Reeder
c605317250 More middleware updates. 2017-07-13 14:40:36 -07:00
Travis Reeder
6d2c503010 Updated middleware example to return error format that fn understands. 2017-07-13 10:21:02 -07:00
Mukhtar Haji
73e81ec736 Update test boilerplate to reflect API changes 2017-07-13 10:47:59 +01:00
Travis Reeder
667c611fac Added functions to MiddlewareContext interface 2017-07-12 22:28:49 -07:00
Travis Reeder
86b93e27f7 Updated ctx to MiddlewareContext in various places. 2017-07-12 21:40:16 -07:00
Travis Reeder
7a81aa5761 Merge branch 'middleware-update' into 'master'
Allow setting values in middleware context like gin context.

See merge request !99
2017-07-12 15:05:13 -07:00
Travis Reeder
1dcc93b32b Updated dependencies 2017-07-12 14:18:01 -07:00
Travis Reeder
98539fba8a Updated deps 2017-07-12 14:08:59 -07:00
Reed Allman
8d669c202c Merge branch 'one-db' into 'master'
merge datastores into sqlx package

See merge request !101
2017-07-11 11:30:41 -07:00
Travis Reeder
0f83355f0a Merge branch 'fix-root-route-invocation' into 'master'
Allow calling root route on app

Closes #64

See merge request !91
2017-07-11 09:44:29 -07:00
Mukhtar Haji
cdc8c03c87 Remove runtime as a dependency and add test lib
This change also simplifies the entrypoint in the func.yaml, so only the
user's function is referenced. All runtime related stuff is completely
abstracted away from the user.
2017-07-11 11:43:47 +01:00
Reed Allman
1bb314508e Merge branch 'use-ctx-logger' into 'master'
Using ctx logger in more places to get more context in the logs - ie: call_id

See merge request !102
2017-07-10 16:13:51 -07:00
Travis Reeder
e56ac42bc2 Using ctx logger in more places to get more context in the logs - ie: call_id 2017-07-10 16:13:51 -07:00
Reed Allman
6217ef7d35 Merge branch 'remove-logrus-from-fn' into 'master'
Remove logrus from fn

See merge request !98
2017-07-07 16:41:45 -07:00
Travis Reeder
aed8ec8e2a Remove logrus from fn 2017-07-07 16:41:45 -07:00
Travis Reeder
bd9c9c5202 WIP, setting values in middleware context like gin context. 2017-07-07 16:34:04 -07:00
Reed Allman
b793d97a07 Merge branch 'detect_vendor' into 'master'
Detect vendor dir by having the func be on the go path

See merge request !95
2017-07-07 15:47:13 -07:00
Travis Reeder
130991819d functions: 0.3.20 release [skip ci] 2017-07-07 14:54:16 -07:00
Travis Reeder
b24ff782bf Minor cleanup for hot lambda. 2017-07-07 14:51:42 -07:00
James Jeffrey
fcc878bdc4 Merge branch 'fix-netwokring-for-int-tests' into 'master'
Make mysql ports consistent

See merge request !97
2017-07-07 13:10:50 -07:00
Denis Makogon
d69423b6b7 Make mysql ports consistent 2017-07-07 23:05:17 +03:00
James Jeffrey
2c42861b48 Merge branch 'fix-netwokring-for-int-tests' into 'master'
Enable different kinds of networking communications to Docker for integration tests

See merge request !96
2017-07-07 12:49:17 -07:00
Denis Makogon
54068ae0b6 Enable different kinds of networking communications to Docker 2017-07-07 22:46:26 +03:00
James Jeffrey
fdd7ad929f : 0.3.19 release [skip ci] 2017-07-07 11:05:31 -07:00
James Jeffrey
15fd29f1e9 [skip ci] Bump fn Version 0.3.13 2017-07-07 10:45:36 -07:00
James Jeffrey
7343df70de Add example of using vendor for golang 2017-07-07 10:35:36 -07:00
James Jeffrey
b175dcf291 Just copy func file 2017-07-07 10:15:05 -07:00
Reed Allman
aada2476e9 Merge branch 'add_go_fmt' into 'master'
Add go fmt

See merge request !94
2017-07-07 10:14:08 -07:00
James Jeffrey
81e39b210d Add go fmt 2017-07-07 10:14:08 -07:00
James Jeffrey
4bac217847 Detect vendor dir by having the func be on the go path 2017-07-07 10:00:18 -07:00
Reed Allman
e637f9736e back the lb with a db for scale
now we can run multiple lbs in the same 'cluster' and they will all point to
the same nodes. all lb nodes are not guaranteed to have the same set of
functions nodes to route to at any point in time since each lb node will
perform its own health checks independently, but they will all be backed by
the same list from the db to health check at least. in cases where there will
be more than a few lbs we can rethink this strategy, we mostly need to back
the lbs with a db so that they persist nodes and remain fault tolerant in that
sense. the strategy of independent health checks is useful to reduce thrashing
the db during network partitions between lb and fn pairs. it would be nice to
have gossip health checking to reduce network traffic, but this works too, and
we'll need to seed any gossip protocol with a list from a db anyway.

db_url is the same format as what functions takes. i don't have env vars set
up for fnlb right now (low hanging fruit), the flag is `-db`, it defaults to
in memory sqlite3 so nodes will be forgotten between reboots. used the sqlx
stuff, decided not to put the lb stuff in the datastore stuff as this was easy
enough to just add here to get the sugar, and avoid bloating the datastore
interface. the tables won't collide, so can just use same pg/mysql as what the
fn servers are running in prod even, db load is low from lb (1 call every 1s
per lb).

i need to add some tests, touch testing worked as expected.
2017-07-07 07:45:17 -07:00
Reed Allman
eed8555da6 add sqlite3 dep 2017-07-07 01:31:11 -07:00
Reed Allman
4e52c595d2 merge datastores into sqlx package
replace default bolt option with sqlite3 option. the story here is that we
just need a working out of the box solution, and sqlite3 is just fine for that
(actually, likely better than bolt).

with sqlite3 supplanting bolt, we mostly have sql databases. so remove redis
and then we just have one package that has a `sql` implementation of the
`models.Datastore` and lean on sqlx to do query rewriting. this does mean
queries have to be formed a certain way and likely have to be ANSI-SQL (no
special features) but we weren't using them anyway and our base api is
basically done and we can easily extend this api as needed to only implement
certain methods in certain backends if we need to get cute.

* remove bolt & redis datastores (can still use as mqs)
* make sql queries work on all 3 (maybe?)
* remove bolt log store and use sqlite3
* shove the FnLog shit into the datastore shit for now (free pg/mysql logs...
just for demos, etc, not prod)
* fix up the docs to remove bolt references
* add sqlite3, sqlx dep
* fix up tests & mock stuff, make validator less insane
* remove put & get in datastore layer as nobody is using.

this passes tests which at least seem like they test all the different
backends. if we trust our tests then this seems to work great. (tests `make
docker-test-run-with-*` work now too)
2017-07-07 01:30:02 -07:00