Commit Graph

1090 Commits

Author SHA1 Message Date
CI
db3d76fd1b functions: 0.3.184 release [skip ci] 2017-11-16 18:25:15 +00:00
CI
0f3b64867f functions: 0.3.183 release [skip ci] 2017-11-16 18:15:31 +00:00
Travis Reeder
96cfc9f5c1 Update json (#463)
* wip

* wip

* Added more fields to JSON and added blank line between objects.

* Update tests.

* wip

* Updated to represent recent discussions.

* Fixed up the json test

* More docs

* Changed from blank line to bracket, newline, open bracket.

* Blank line added back, easier for delimiting.
2017-11-16 09:59:13 -08:00
CI
86fb89d250 functions: 0.3.182 release [skip ci] 2017-11-16 17:55:59 +00:00
CI
a8a0345090 functions: 0.3.181 release [skip ci] 2017-11-16 15:48:31 +00:00
Alexander Bransby-Sharples
c5ec0cc41e Add CORS support to fn api (#455)
The Gin middleware is being used if one or more Origins are specified. Default setup for each Origin is as follows:

- GET,POST, PUT, HEAD methods allowed
- Credentials share disabled
- Preflight requests cached for 12 hours

Which are the defaults gin-contrib/cors comes with out of the box.

Gin-cors will return a 403 if it gets a request with an Origin header that isn't on its' list. If no Origin header is specified then it will just return the servers response.

Start fn with CORS enabled:

`API_CORS="http://localhost:4000, http://localhost:3000" make run`
2017-11-16 15:37:26 +00:00
CI
406267a040 functions: 0.3.180 release [skip ci] 2017-11-16 00:17:55 +00:00
CI
92c68e3665 functions: 0.3.179 release [skip ci] 2017-11-15 16:40:04 +00:00
CI
3031a465a2 functions: 0.3.178 release [skip ci] 2017-11-14 21:05:21 +00:00
Reed Allman
61b416a9b5 automagic sql db migrations (#461)
* adds migrations

closes #57

migrations only run if the database is not brand new. brand new
databases will contain all the right fields when CREATE TABLE is called,
this is for readability mostly more than efficiency (do not want to have
to go through all of the database migrations to ascertain what columns a table
has). upon startup of a new database, the migrations will be analyzed and the
highest version set, so that future migrations will be run. this should also
avoid running through all the migrations, which could bork db's easily enough
(if the user just exits from impatience, say).

otherwise, all migrations that a db has not yet seen will be run against it
upon startup, this should be seamless to the user whether they had a db that
had 0 migrations run on it before or N. this means users will not have to
explicitly run any migrations on their dbs nor see any errors when we upgrade
the db (so long as things go well). if migrations do not go so well, users
will have to manually repair dbs (this is the intention of the `migrate`
library and it seems sane), this should be rare, and I'm unsure myself how
best to resolve not having gone through this myself, I would assume it will
require running down migrations and then manually updating the migration
field; in any case, docs once one of us has to go through this.

migrations are written to files and checked into version control, and then use
go-bindata to generate those files into go code and compiled in to be consumed
by the migrate library (so that we don't have to put migration files on any
servers) -- this is also in vcs. this seems to work ok. I don't like having to
use the separate go-bindata tool but it wasn't really hard to install and then
go generate takes care of the args. adding migrations should be relatively
rare anyway, but tried to make it pretty painless.

1 migration to add created_at to the route is done here as an example of how
to do migrations, as well as testing these things ;) -- `created_at` will be
`0001-01-01T00:00:00.000Z` for any existing routes after a user runs this
version. could spend the extra time adding 'today's date to any outstanding
records, but that's not really accurate, the main thing is nobody will have to
nuke their db with the migrations in place & we don't have any prod clusters
really to worry about. all future routes will correctly have `created_at` set,
and plan to add other timestamps but wanted to keep this patch as small as
possible so only did routes.created_at.

there are tests that a spankin new db will work as expected as well as a db
after running all down & up migrations works. the latter tests only run on mysql
and postgres, since sqlite3 does not like ALTER TABLE DROP COLUMN; up
migrations will need to be tested manually for sqlite3 only, but in theory if
they are simple and work on postgres and mysql, there is a good likelihood of
success; the new migration from this patch works on sqlite3 fine.

for now, we need to use `github.com/rdallman/migrate` to move forward, as
getting integrated into upstream is proving difficult due to
`github.com/go-sql-driver/mysql` being broken on master (yay dependencies).
Fortunately for us, we vendor a version of the `mysql` bindings that actually
works, thus, we are capable of using the `mattes/migrate` library with success
due to that. this also will require go1.9 to use the new `database/sql.Conn`
type, CI has been updated accordingly.

some doc fixes too from testing.. and of course updated all deps.

anyway, whew. this should let us add fields to the db without busting
everybody's dbs. open to feedback on better ways, but this was overall pretty
simple despite futzing with mysql.

* add migrate pkg to deps, update deps

use rdallman/migrate until we resolve in mattes land

* add README in migrations package

* add ref to mattes lib
2017-11-14 12:54:33 -08:00
CI
bfbc6096ee functions: 0.3.177 release [skip ci] 2017-11-14 02:08:26 +00:00
Tolga Ceylan
af8eed098d fn: graceful shutdown adjustments (#498)
Graceful shutdown should wait for Shutdown call instead of
ListenAndServe. This is because ListenAndServe returns
immediately upon Shutdown call.
2017-11-13 17:58:15 -08:00
CI
42e7143ed4 functions: 0.3.176 release [skip ci] 2017-11-13 17:49:52 +00:00
CI
3e4ebbda33 functions: 0.3.175 release [skip ci] 2017-11-13 17:46:21 +00:00
CI
be844de01d functions: 0.3.174 release [skip ci] 2017-11-13 17:23:46 +00:00
CI
27bdd9ed71 functions: 0.3.173 release [skip ci] 2017-11-09 15:23:37 +00:00
CI
2318e04d0b functions: 0.3.172 release [skip ci] 2017-11-08 14:48:08 +00:00
CI
601e2d18fd functions: 0.3.171 release [skip ci] 2017-11-03 00:51:56 +00:00
Tolga Ceylan
a530cd9be3 Minor naming and control flow changes to satisfy golint 2017-11-02 15:36:55 -07:00
CI
67ba894fb3 functions: 0.3.170 release [skip ci] 2017-11-01 11:59:15 +00:00
CI
12d86f4a65 functions: 0.3.169 release [skip ci] 2017-10-27 17:14:02 +00:00
Nigel Deakin
222a80bbd6 Run gofmt 2017-10-27 16:29:35 +01:00
Nigel Deakin
063c2b2e91 Call setTracer() before Agent creation 2017-10-27 16:15:01 +01:00
CI
bb3fdb7bb2 functions: 0.3.168 release [skip ci] 2017-10-26 20:00:42 +00:00
Reed Allman
241cca5b92 Merge pull request #465 from fnproject/fix_inconsistent_cardinality
Add protection against inconsistent cardinaliity errors
2017-10-26 12:49:51 -07:00
Nigel Deakin
7bc64ecc0a Add protection against inconsistent cardinaliity errors 2017-10-26 19:38:46 +01:00
CI
38006324de functions: 0.3.167 release [skip ci] 2017-10-26 18:30:26 +00:00
CI
fd5d90216c functions: 0.3.166 release [skip ci] 2017-10-26 17:47:05 +00:00
Reed Allman
ce252d0448 Merge pull request #424 from fnproject/call-listener
CallListener - replaces RunnerListener
2017-10-26 10:36:14 -07:00
Travis Reeder
965630af15 Remove error returns. 2017-10-26 11:12:08 +02:00
CI
ba9968a7a3 functions: 0.3.165 release [skip ci] 2017-10-25 18:08:21 +00:00
Reed Allman
91d2a89e19 Merge pull request #447 from fnproject/tracing_to_prometheus
Tracing to prometheus
2017-10-25 10:58:07 -07:00
CI
cbc88dec4c functions: 0.3.164 release [skip ci] 2017-10-25 14:36:38 +00:00
Reed Allman
7ba2dc005e fix debug logger output (#458)
our dear friend mr. funclogger was bypassing calls to our multi writer since
we were embedding a *bytes.Buffer, it was using ReadFrom and WriteString which
would never call the stderr logger's Write method (or, as I learned, other
things trying to wrap that buffer's Write method...).

the tl;dr is many times DEBUG lines don't get spat out, from async tasks
especially (few people using this).

I think the final solution is probably to make funclogger a 'more robust'
interface that we understand instead of trying to minimize it to an
io.ReaderWriterCloser, much like how bytes.Buffer has all kinds of
methods implemented on it, we can implement things like ReadFrom and
WriteString most likely. not a big fan of how things are now (and it's my own
doing) with the readerwritercloser coming from multiple places but meh,
will get to it some day soon, the log stuff will be a pretty hot path.
2017-10-25 16:25:59 +02:00
Nigel Deakin
c6dd66f3ce Send serve_http spans to Prometheus as well. Revamp Grafana dashboard. 2017-10-25 15:22:25 +01:00
CI
d25064f604 functions: 0.3.163 release [skip ci] 2017-10-25 13:08:35 +00:00
Travis Reeder
d30bcb0397 Fix lost error 2017-10-25 14:41:18 +02:00
Travis Reeder
de04562b8e Pushed triggers into start() and end() 2017-10-25 14:14:31 +02:00
Travis Reeder
fb386b2864 Change extenders -> extensions 2017-10-25 14:13:57 +02:00
Travis Reeder
633b26594e minor 2017-10-25 14:13:26 +02:00
Travis Reeder
d080c23981 First draft of modifying RunnerListener to CallListener to get it closer to the action (and named better). 2017-10-25 14:13:25 +02:00
Nigel Deakin
0ddb750eaa Send serve_http spans to Prometheus as well. Revamp Grafana dashboard. 2017-10-25 12:58:08 +01:00
Nigel Deakin
e72cd55a4a Various changes in response to comments 2017-10-23 15:32:50 +01:00
CI
09ba54c6cb functions: 0.3.162 release [skip ci] 2017-10-22 14:47:24 +00:00
Nigel Deakin
02d49ffd93 Run gofmt 2017-10-20 19:04:47 +01:00
Nigel Deakin
39feaf8b69 Send tracing spans to Prometheus 2017-10-20 16:30:19 +01:00
CI
896ed24f44 functions: 0.3.161 release [skip ci] 2017-10-19 22:02:52 +00:00
CI
ed0088f2a5 functions: 0.3.160 release [skip ci] 2017-10-19 21:08:42 +00:00
CI
bc9103883a functions: 0.3.159 release [skip ci] 2017-10-19 19:40:06 +00:00
CI
d95ee8997a functions: 0.3.158 release [skip ci] 2017-10-19 18:36:50 +00:00