Files
fn-serverless/Makefile
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

58 lines
1.8 KiB
Makefile

# Just builds
.PHONY: all test dep build test-log-datastore
dep:
dep ensure
build:
go build -o functions
test:
./test.sh
test-datastore:
cd api/datastore && go test -v ./...
test-log-datastore:
cd api/logs && go test -v ./...
test-build-arm:
GOARCH=arm GOARM=5 $(MAKE) build
GOARCH=arm GOARM=6 $(MAKE) build
GOARCH=arm GOARM=7 $(MAKE) build
GOARCH=arm64 $(MAKE) build
run: build
GIN_MODE=debug ./functions
docker-dep:
# todo: need to create a dep tool image for this (or just ditch this)
docker run --rm -it -v ${CURDIR}:/go/src/gitlab-odx.oracle.com/odx/functions -w /go/src/gitlab-odx.oracle.com/odx/functions treeder/glide install -v
docker-build:
docker pull funcy/go:dev
docker run --rm -v ${CURDIR}:/go/src/gitlab-odx.oracle.com/odx/functions -w /go/src/gitlab-odx.oracle.com/odx/functions funcy/go:dev go build -o functions-alpine
docker build --build-arg HTTP_PROXY -t funcy/functions:latest .
docker-run: docker-build
docker run --rm --privileged -it -e NO_PROXY -e HTTP_PROXY -e LOG_LEVEL=debug -e "DB_URL=sqlite3:///app/data/fn.db" -v ${CURDIR}/data:/app/data -p 8080:8080 funcy/functions
docker-test-run-with-sqlite3:
./api_test.sh sqlite3
docker-test-run-with-mysql:
./api_test.sh mysql
docker-test-run-with-postgres:
./api_test.sh postgres
docker-test:
docker run -ti --privileged --rm -e LOG_LEVEL=debug \
-v /var/run/docker.sock:/var/run/docker.sock \
-v ${CURDIR}:/go/src/gitlab-odx.oracle.com/odx/functions \
-w /go/src/gitlab-odx.oracle.com/odx/functions \
funcy/go:dev go test \
-v $(shell docker run --rm -ti -v ${CURDIR}:/go/src/gitlab-odx.oracle.com/odx/functions -w /go/src/gitlab-odx.oracle.com/odx/functions -e GOPATH=/go golang:alpine sh -c 'go list ./... | grep -v vendor | grep -v examples | grep -v tool | grep -v fn')
all: dep build