Commit Graph

2016 Commits

Author SHA1 Message Date
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
91962e50b9 fnlb: 0.0.143 release [skip ci] fnlb-0.0.143 2017-11-14 02:09:38 +00:00
CI
bfbc6096ee functions: 0.3.177 release [skip ci] 0.3.177 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
ef43e2c772 fnlb: 0.0.142 release [skip ci] fnlb-0.0.142 2017-11-13 17:51:11 +00:00
CI
42e7143ed4 functions: 0.3.176 release [skip ci] 0.3.176 2017-11-13 17:49:52 +00:00
CI
8c4c7cfda1 fnlb: 0.0.141 release [skip ci] fnlb-0.0.141 2017-11-13 17:47:47 +00:00
CI
3e4ebbda33 functions: 0.3.175 release [skip ci] 0.3.175 2017-11-13 17:46:21 +00:00
Chad Arimura
cb0ff466a0 small changes 2017-11-13 09:39:24 -08:00
Chad Arimura
5822072bbd few small changes 2017-11-13 09:35:43 -08:00
CI
317059e632 fnlb: 0.0.140 release [skip ci] fnlb-0.0.140 2017-11-13 17:25:05 +00:00
CI
be844de01d functions: 0.3.174 release [skip ci] 0.3.174 2017-11-13 17:23:46 +00:00
Travis Reeder
42e8bf1601 Replace arch diagram. 2017-11-13 09:13:21 -08:00
CI
85c61a4a99 fnlb: 0.0.139 release [skip ci] fnlb-0.0.139 2017-11-09 15:24:52 +00:00
CI
27bdd9ed71 functions: 0.3.173 release [skip ci] 0.3.173 2017-11-09 15:23:37 +00:00
Travis Reeder
6c21103057 Rollback dockerfile (image too big) and add docker run command to docs. (#488) 2017-11-09 16:12:45 +01:00
CI
fde2173087 fnlb: 0.0.138 release [skip ci] fnlb-0.0.138 2017-11-08 14:50:18 +00:00
CI
2318e04d0b functions: 0.3.172 release [skip ci] 0.3.172 2017-11-08 14:48:08 +00:00
Reed Allman
d1b22f7fb3 Merge pull request #474 from fnproject/remove-swarm-link
remove link to outdated swarm doc
2017-11-08 14:37:55 +00:00
CI
7999cdc52d fnlb: 0.0.137 release [skip ci] fnlb-0.0.137 2017-11-03 00:54:03 +00:00
CI
601e2d18fd functions: 0.3.171 release [skip ci] 0.3.171 2017-11-03 00:51:56 +00:00
Reed Allman
0b594cfeff Merge pull request #475 from skinowski/go_lint
Minor naming and control flow changes to satisfy golint
2017-11-03 00:41:18 +00:00
Tolga Ceylan
a530cd9be3 Minor naming and control flow changes to satisfy golint 2017-11-02 15:36:55 -07:00
Derek Schultz
21e42658b3 remove link to outdated swarm doc 2017-11-02 16:18:03 -06:00
CI
d6078f3c8f fnlb: 0.0.136 release [skip ci] fnlb-0.0.136 2017-11-01 12:01:17 +00:00
CI
67ba894fb3 functions: 0.3.170 release [skip ci] 0.3.170 2017-11-01 11:59:15 +00:00
Reed Allman
c471a2c8f6 Merge pull request #425 from fnproject/building-extensions
Support for docker extension building
2017-11-01 11:48:15 +00:00
Travis Reeder
b295fcbac7 Remove cruft from rebase 2017-11-01 11:13:07 +00:00
Travis Reeder
b83abe5a02 Bug 2017-10-31 15:59:51 +00:00
Travis Reeder
6a821768fa Uses go get to simplify it. 2017-10-31 15:37:13 +00:00
Travis Reeder
3266769c91 Works better than using dep... 2017-10-31 15:37:13 +00:00
Travis Reeder
d40775073e wip 2017-10-31 15:37:13 +00:00
Travis Reeder
3f32c6d6b8 cleanup dockerfile 2017-10-31 15:37:13 +00:00
Travis Reeder
5a5c23893a Version bump. 2017-10-31 15:37:13 +00:00
Travis Reeder
342e0019fa wip 2017-10-31 15:37:12 +00:00
Travis Reeder
a82b6fb1ef First draft of modifying RunnerListener to CallListener to get it closer to the action (and named better). 2017-10-31 15:37:11 +00:00
CI
1ea4872a88 fnlb: 0.0.135 release [skip ci] fnlb-0.0.135 2017-10-27 17:15:19 +00:00
CI
12d86f4a65 functions: 0.3.169 release [skip ci] 0.3.169 2017-10-27 17:14:02 +00:00
Nigel Deakin
c2c6f9dc5e Merge pull request #466 from fnproject/set_tracing_earlier
Call setTracer() before Agent creation
2017-10-27 18:03:16 +01: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
1b5643658d fnlb: 0.0.134 release [skip ci] fnlb-0.0.134 2017-10-26 20:01:57 +00:00
CI
bb3fdb7bb2 functions: 0.3.168 release [skip ci] 0.3.168 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
4606a01eaf fnlb: 0.0.133 release [skip ci] fnlb-0.0.133 2017-10-26 18:31:44 +00:00
CI
38006324de functions: 0.3.167 release [skip ci] 0.3.167 2017-10-26 18:30:26 +00:00
Reed Allman
adae6fc4cb Merge pull request #460 from fnproject/fix-swagger-linter
Run linter with swagger doc from disk
2017-10-26 11:18:35 -07:00
CI
e246a2a5ca fnlb: 0.0.132 release [skip ci] fnlb-0.0.132 2017-10-26 17:48:18 +00:00
CI
fd5d90216c functions: 0.3.166 release [skip ci] 0.3.166 2017-10-26 17:47:05 +00:00