This project is based on https://github.com/ardanlabs/gotraining/blob/master/starter-kits/http. It uses postgresql to persist data.
$ go get ./...
You have to launch docker-compose in order to have all the required components up and running:
$ docker-compose up -d
$ go build ./cmd/apid
$ ./apid
Migration use cli tool migrate.
$ go get -u -d github.com/mattes/migrate/cli github.com/lib/pq
$ go build -tags 'postgres' -o /usr/local/bin/migrate github.com/mattes/migrate/cli
$ migrate -database "postgres://go-api-postgres:go-api-postgres@localhost:5432/go-api-postgres?x-migrations-table=migrations" create -ext sql -dir migrations create_images
$ migrate -source=file://migrations -database "postgres://go-api-postgres:go-api-postgres@localhost:5432/go-api-postgres?sslmode=disable" up
$ migrate -source=file://migrations -database "postgres://go-api-postgres:go-api-postgres@localhost:5432/go-api-postgres?sslmode=disable" down
You can access to the swagger API documentation at: http://[HOST][PORT]:3000/swagger/api-docs/
$ compile=CGO_ENABLED=0 GOOS=linux go build -installsuffix cgo ./cmd/apid/
$ docker build -t go-api .
$ docker run --name go-api -e CONFIGOR_APPHOST=0.0.0.0 -e CONFIGOR_DATABASE_HOST=go-api-postgres --link go-api-postgres:go-api-postgres -p 3000:3000 -d go-api
- Migrations
- Logger (Graylog)
- Make tests
- Config (configor)
- Swagger docs
- Use sqlx instead of sql (structScan)
- Health and readiness
- Prometheus metrics
- Communicate with RabbitMQ
- Dockerfile (and docker-compose)
- Jenkins integration
- govendor (production needs)
Thanks to contribute to this project. Each TODO must be done in a pull request.