Skip to content

Commit

Permalink
Merge pull request #1 from refs/feature/protobuf-base-implementation
Browse files Browse the repository at this point in the history
Basic KV Store Service
  • Loading branch information
butonic authored Jul 16, 2020
2 parents ecd19bf + a5fc999 commit a739d64
Show file tree
Hide file tree
Showing 42 changed files with 3,468 additions and 354 deletions.
25 changes: 2 additions & 23 deletions .drone.star
Original file line number Diff line number Diff line change
Expand Up @@ -60,32 +60,11 @@ def testing(ctx):
},
],
},
{
'name': 'staticcheck',
'image': 'webhippie/golang:1.13',
'pull': 'always',
'commands': [
'make staticcheck',
],
'volumes': [
{
'name': 'gopath',
'path': '/srv/app',
},
],
},
{
'name': 'lint',
'image': 'webhippie/golang:1.13',
'pull': 'always',
'image': 'golangci/golangci-lint:v1.26',
'commands': [
'make lint',
],
'volumes': [
{
'name': 'gopath',
'path': '/srv/app',
},
'golangci-lint run --timeout 2m0s',
],
},
{
Expand Down
29 changes: 29 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
issues:
exclude-rules:
- path: pkg/proto/v0
text: "SA1019:"
linters:
- staticcheck
linters:
enable:
- bodyclose
- deadcode
- errcheck
- gosimple
- govet
- ineffassign
- staticcheck
- structcheck
- typecheck
- unused
- varcheck
- depguard
- golint
- goimports
- unconvert
- scopelint
- maligned
- misspell
- gocritic
- prealloc
#- gosec
49 changes: 14 additions & 35 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -155,42 +155,21 @@ docs: docs-copy docs-build
watch:
go run github.com/cespare/reflex -c reflex.conf

# $(GOPATH)/bin/protoc-gen-go:
# GO111MODULE=off go get -v github.com/golang/protobuf/protoc-gen-go
$(GOPATH)/bin/protoc-gen-go:
GO111MODULE=off go get -v github.com/golang/protobuf/protoc-gen-go

# $(GOPATH)/bin/protoc-gen-micro:
# GO111MODULE=off go get -v github.com/micro/protoc-gen-micro
$(GOPATH)/bin/protoc-gen-micro:
GO111MODULE=off go get -v github.com/micro/protoc-gen-micro

# $(GOPATH)/bin/protoc-gen-microweb:
# GO111MODULE=off go get -v github.com/webhippie/protoc-gen-microweb
pkg/proto/v0/store.pb.go: pkg/proto/v0/store.proto
protoc \
-I=pkg/proto/v0/ \
--go_out=pkg/proto/v0 store.proto

# $(GOPATH)/bin/protoc-gen-swagger:
# GO111MODULE=off go get -v github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger

# pkg/proto/v0/example.pb.go: pkg/proto/v0/example.proto
# protoc \
# -I=third_party/ \
# -I=pkg/proto/v0/ \
# --go_out=logtostderr=true:pkg/proto/v0 example.proto

# pkg/proto/v0/example.pb.micro.go: pkg/proto/v0/example.proto
# protoc \
# -I=third_party/ \
# -I=pkg/proto/v0/ \
# --micro_out=logtostderr=true:pkg/proto/v0 example.proto

# pkg/proto/v0/example.pb.web.go: pkg/proto/v0/example.proto
# protoc \
# -I=third_party/ \
# -I=pkg/proto/v0/ \
# --microweb_out=logtostderr=true:pkg/proto/v0 example.proto

# pkg/proto/v0/example.swagger.json: pkg/proto/v0/example.proto
# protoc \
# -I=third_party/ \
# -I=pkg/proto/v0/ \
# --swagger_out=logtostderr=true:pkg/proto/v0 example.proto

# .PHONY: protobuf
# protobuf: $(GOPATH)/bin/protoc-gen-go $(GOPATH)/bin/protoc-gen-micro $(GOPATH)/bin/protoc-gen-microweb $(GOPATH)/bin/protoc-gen-swagger pkg/proto/v0/example.pb.go pkg/proto/v0/example.pb.micro.go pkg/proto/v0/example.pb.web.go pkg/proto/v0/example.swagger.json
pkg/proto/v0/store.pb.micro.go: pkg/proto/v0/store.proto
protoc \
-I=pkg/proto/v0/ \
--micro_out=pkg/proto/v0 store.proto

.PHONY: protobuf
protobuf: $(GOPATH)/bin/protoc-gen-go $(GOPATH)/bin/protoc-gen-micro pkg/proto/v0/store.pb.go pkg/proto/v0/store.pb.micro.go
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,21 @@ Apache-2.0
```console
Copyright (c) 2020 ownCloud GmbH <https://owncloud.com>
```
>

## Design

```
/var/tmp
/ocis-store
/index.bleve
/databases
/ocs
/users
/settings
/bundles
/values
/assignments
/accounts
/accounts
/groups
```
Empty file removed changelog/unreleased/.keep
Empty file.
2 changes: 1 addition & 1 deletion cmd/ocis-store/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ func main() {
if err := command.Execute(); err != nil {
os.Exit(1)
}
}
}
6 changes: 1 addition & 5 deletions config/example.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
{
"debug": {
"addr": "0.0.0.0:9199",
"addr": "0.0.0.0:9460",
"token": "",
"pprof": false,
"zpages": false
},
"http": {
"addr": "0.0.0.0:9195"
},
"tracing": {
"enabled": false,
"type": "jaeger",
Expand All @@ -16,4 +13,3 @@
"service": "store"
}
}

6 changes: 1 addition & 5 deletions config/example.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
---
debug:
addr: 0.0.0.0:9199
addr: 0.0.0.0:9460
token:
pprof: false
zpages: false

http:
addr: 0.0.0.0:9195

tracing:
enabled: false
type: jaeger
Expand All @@ -16,4 +13,3 @@ tracing:
service: store

...

3 changes: 1 addition & 2 deletions docker/Dockerfile.linux.amd64
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@ LABEL maintainer="ownCloud GmbH <devops@owncloud.com>" \
org.label-schema.vendor="ownCloud GmbH" \
org.label-schema.schema-version="1.0"

EXPOSE 9195 9199
EXPOSE 9460

ENTRYPOINT ["/usr/bin/ocis-store"]
CMD ["server"]

COPY bin/ocis-store /usr/bin/ocis-store
rre
3 changes: 1 addition & 2 deletions docker/Dockerfile.linux.arm
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@ LABEL maintainer="ownCloud GmbH <devops@owncloud.com>" \
org.label-schema.vendor="ownCloud GmbH" \
org.label-schema.schema-version="1.0"

EXPOSE 9195 9199
EXPOSE 9460

ENTRYPOINT ["/usr/bin/ocis-store"]
CMD ["server"]

COPY bin/ocis-store /usr/bin/ocis-store
rre
3 changes: 1 addition & 2 deletions docker/Dockerfile.linux.arm64
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@ LABEL maintainer="ownCloud GmbH <devops@owncloud.com>" \
org.label-schema.vendor="ownCloud GmbH" \
org.label-schema.schema-version="1.0"

EXPOSE 9195 9199
EXPOSE 9460

ENTRYPOINT ["/usr/bin/ocis-store"]
CMD ["server"]

COPY bin/ocis-store /usr/bin/ocis-store
rre
1 change: 0 additions & 1 deletion docker/manifest.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,3 @@ manifests:
architecture: arm
variant: v6
os: linux
nux
1 change: 0 additions & 1 deletion docs/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@ geekdocFilePath: _index.md
---

This service provides ...
.
1 change: 0 additions & 1 deletion docs/building.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,3 @@ make build
{{< / highlight >}}

Finally you should have the binary within the `bin/` folder now, give it a try with `./bin/ocis-store -h` to see all available options.
ns.
15 changes: 7 additions & 8 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ STORE_TRACING_SERVICE
: Service name for tracing, defaults to `store`

STORE_DEBUG_ADDR
: Address to bind debug server, defaults to `0.0.0.0:9199`
: Address to bind debug server

STORE_DEBUG_TOKEN
: Token to grant metrics access, empty default value
Expand All @@ -73,7 +73,7 @@ STORE_DEBUG_ZPAGES
: Enable zpages debugging, defaults to `false`

STORE_HTTP_ADDR
: Address to bind http server, defaults to `0.0.0.0:9195`
: Address to bind http server, defaults to `0.0.0.0:9461`

STORE_HTTP_NAMESPACE
: The http namespace
Expand All @@ -84,7 +84,7 @@ STORE_HTTP_ROOT
#### Health

STORE_DEBUG_ADDR
: Address to debug endpoint, defaults to `0.0.0.0:9199`
: Address to debug endpoint

### Commandline flags

Expand Down Expand Up @@ -122,7 +122,7 @@ If you prefer to configure the service with commandline flags you can see the av
: Service name for tracing, defaults to `store`

--debug-addr
: Address to bind debug server, defaults to `0.0.0.0:9199`
: Address to bind debug server

--debug-token
: Token to grant metrics access, empty default value
Expand All @@ -134,7 +134,7 @@ If you prefer to configure the service with commandline flags you can see the av
: Enable zpages debugging, defaults to `false`

--http-addr
: Address to bind http server, defaults to `0.0.0.0:9195`
: Address to bind http server, defaults to `0.0.0.0:9461`

--http-namespace
: Namespace for internal services communication, defaults to `com.owncloud.web`
Expand All @@ -145,7 +145,7 @@ If you prefer to configure the service with commandline flags you can see the av
#### Health

--debug-addr
: Address to debug endpoint, defaults to `0.0.0.0:9199`
: Address to debug endpoint

### Configuration file

Expand Down Expand Up @@ -173,7 +173,7 @@ ocis-store health --help

## Metrics

This service provides some [Prometheus](https://prometheus.io/) metrics through the debug endpoint, you can optionally secure the metrics endpoint by some random token, which got to be configured through one of the flag `--debug-token` or the environment variable `STORE_DEBUG_TOKEN` mentioned above. By default the metrics endpoint is bound to `http://0.0.0.0:9199/metrics`.
This service provides some [Prometheus](https://prometheus.io/) metrics through the debug endpoint, you can optionally secure the metrics endpoint by some random token, which got to be configured through one of the flag `--debug-token` or the environment variable `STORE_DEBUG_TOKEN` mentioned above. By default the metrics endpoint is bound to `http://0.0.0.0:9460/metrics`.

go_gc_duration_seconds
: A summary of the GC invocation durations
Expand Down Expand Up @@ -270,4 +270,3 @@ promhttp_metric_handler_requests_in_flight

promhttp_metric_handler_requests_total
: Total number of scrapes by HTTP status code
scrapes by HTTP status code
1 change: 0 additions & 1 deletion docs/license.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@ geekdocFilePath: license.md
---

This project is licensed under the [Apache 2.0](https://github.com/owncloud/ocis-store/blob/master/LICENSE) license. For the license of the used libraries you have to check the respective sources.
.
22 changes: 18 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,26 @@ require (
contrib.go.opencensus.io/exporter/ocagent v0.6.0
contrib.go.opencensus.io/exporter/zipkin v0.1.1
github.com/UnnoTed/fileb0x v1.1.4
github.com/blevesearch/bleve v1.0.9
github.com/blevesearch/cld2 v0.0.0-20200327141045-8b5f551d37f5 // indirect
github.com/cznic/b v0.0.0-20181122101859-a26611c4d92d // indirect
github.com/go-chi/chi v4.1.0+incompatible
github.com/micro/cli/v2 v2.1.1
github.com/golang/protobuf v1.4.1
github.com/ikawaha/kagome.ipadic v1.1.2 // indirect
github.com/jmhodges/levigo v1.0.0 // indirect
github.com/micro/cli/v2 v2.1.2
github.com/micro/go-micro/v2 v2.6.0
github.com/oklog/run v1.0.0
github.com/openzipkin/zipkin-go v0.2.2
github.com/owncloud/ocis-pkg/v2 v2.2.0
github.com/owncloud/ocis-pkg/v2 v2.2.2-0.20200527082518-5641fa4a4c8c
github.com/owncloud/ocis-settings v0.0.0-20200629120229-69693c5f8f43
github.com/restic/calens v0.2.0
github.com/spf13/viper v1.5.0
go.opencensus.io v0.22.2
github.com/spf13/viper v1.6.3
github.com/tebeka/snowball v0.4.2 // indirect
github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c // indirect
github.com/ugorji/go v1.1.4 // indirect
go.opencensus.io v0.22.3
google.golang.org/protobuf v1.25.0
)

replace google.golang.org/grpc => google.golang.org/grpc v1.26.0
Loading

0 comments on commit a739d64

Please sign in to comment.