Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change coordinator to query and add m3query service #817

Merged
merged 9 commits into from
Aug 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ coverage:
status:
project:
default: on
coordinator:
flags: coordinator
query:
flags: query
dbnode:
flags: dbnode
m3ninx:
Expand All @@ -18,10 +18,10 @@ coverage:
default: off

flags:
coordinator:
query:
paths:
- src/coordinator/
- src/cmd/services/m3coordinator/
- src/query/
- src/cmd/services/m3query/
dbnode:
paths:
- src/dbnode/
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,12 @@ SERVICES := \
m3coordinator \
m3nsch_server \
m3nsch_client \
m3query \

SUBDIRS := \
cmd \
dbnode \
coordinator \
query \
m3nsch \
m3ninx \

Expand Down
2 changes: 1 addition & 1 deletion docker/m3coordinator/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ LABEL maintainer="The M3DB Authors <[email protected]>"
EXPOSE 7201/tcp 7203/tcp

COPY --from=builder /go/src/github.com/m3db/m3db/bin/m3coordinator /bin/
COPY --from=builder /go/src/github.com/m3db/m3db/src/coordinator/config/m3coordinator-local-etcd.yml /etc/m3coordinator/m3coordinator.yml
COPY --from=builder /go/src/github.com/m3db/m3db/src/query/config/m3coordinator-local-etcd.yml /etc/m3coordinator/m3coordinator.yml
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm do you want to chance the directory name here too

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah maybe we should move these config files outside of src completely? It's weird we have some YAML files in these dirs floating around.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i guess we should figure out if we want to have an m3coordinator and an m3query dockerfile? we can discuss today once everyone is in


ENTRYPOINT [ "/bin/m3coordinator" ]
CMD [ "-f", "/etc/m3coordinator/m3coordinator.yml" ]
27 changes: 27 additions & 0 deletions docker/m3query/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# stage 1: build
FROM golang:1.10-alpine AS builder
LABEL maintainer="The M3DB Authors <[email protected]>"

# Install Glide
RUN apk add --update glide git make bash

# Add source code
RUN mkdir -p /go/src/github.com/m3db/m3db
ADD . /go/src/github.com/m3db/m3db

# Build m3coordinator binary
RUN cd /go/src/github.com/m3db/m3db/ && \
git submodule update --init && \
make m3query-linux-amd64

# stage 2: lightweight "release"
FROM alpine:latest
LABEL maintainer="The M3DB Authors <[email protected]>"

EXPOSE 7201/tcp 7203/tcp

COPY --from=builder /go/src/github.com/m3db/m3db/bin/m3query /bin/
COPY --from=builder /go/src/github.com/m3db/m3db/src/query/config/m3query-local-etcd.yml /etc/m3query/m3query.yml

ENTRYPOINT [ "/bin/m3query" ]
CMD [ "-f", "/etc/m3query/m3query.yml" ]
28 changes: 15 additions & 13 deletions scripts/integration-tests/docker-integration-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@

set -xe

echo "Build docker image"
echo "Build docker images"

docker build -t "m3dbnode:$(git rev-parse HEAD)" -f ./docker/m3dbnode/Dockerfile .
docker build -t "m3coordinator:$(git rev-parse HEAD)" -f ./docker/m3coordinator/Dockerfile .
docker build -t "m3query:$(git rev-parse HEAD)" -f ./docker/m3query/Dockerfile .

echo "Run docker container"
echo "Run m3dbnode docker container"

docker run --name "m3dbnode-version-$(git rev-parse HEAD)" -d --rm -p 9000:9000 -p 9001:9001 -p 9002:9002 -p 9003:9003 -p 9004:9004 -p 7201:7201 "m3dbnode:$(git rev-parse HEAD)"

echo "Sleeping for a bit to ensure db"
echo "Sleeping for a bit to ensure db up"

sleep 10 # TODO Replace sleeps with logic to determine when to proceed

Expand Down Expand Up @@ -40,13 +42,13 @@ curl -vvvsSf -X POST localhost:7201/api/v1/namespace -d '{
}
}'

echo "Sleep while namespace is init'd"
echo "Sleep while namespace is init'd"

sleep 10 # TODO Replace sleeps with logic to determine when to proceed

[ "$(curl -sSf localhost:7201/api/v1/namespace | jq .registry.namespaces.default.indexOptions.enabled)" == true ]

echo "Initialization placement"
echo "Initialization placement"

curl -vvvsSf -X POST localhost:7201/api/v1/placement/init -d '{
"num_shards": 64,
Expand All @@ -66,11 +68,11 @@ curl -vvvsSf -X POST localhost:7201/api/v1/placement/init -d '{

[ "$(curl -sSf localhost:7201/api/v1/placement | jq .placement.instances.m3db_local.id)" == '"m3db_local"' ]

echo "Wait for placement to fully initialize"
echo "Wait for placement to fully initialize"

sleep 60 # TODO Replace sleeps with logic to determine when to proceed

echo "Write data"
echo "Write data"

curl -vvvsSf -X POST localhost:9003/writetagged -d '{
"namespace": "default",
Expand Down Expand Up @@ -103,24 +105,24 @@ queryResult=$(curl -sSf -X POST localhost:9003/query -d '{
},
"rangeStart": 0,
"rangeEnd":'"$(date +"%s")"'
}' | jq '.results | length')
}' | jq '.results | length')

if [ "$queryResult" -lt 1 ]; then
echo "Result not found"
if [ "$queryResult" -lt 1 ]; then
echo "Result not found"
exit 1
else
else
echo "Result found"
fi

echo "Deleting placement"
echo "Deleting placement"

curl -vvvsSf -X DELETE localhost:7201/api/v1/placement

echo "Deleting namespace"

curl -vvvsSf -X DELETE localhost:7201/api/v1/namespace/default

echo "Stop docker container"
echo "Stop docker container"

docker stop "m3dbnode-version-$(git rev-parse HEAD)"

Expand Down
4 changes: 2 additions & 2 deletions scripts/process-cover.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ fi
COVERFILE=$1
SUBMIT_COVER="$(dirname $0)/../.ci/codecov.sh"

TARGETS=("dbnode" "coordinator" "m3ninx")
TARGETS=("dbnode" "query" "m3ninx")
target_patterns() {
case $1 in
'dbnode') echo "^mode|github.com/m3db/m3db/src/dbnode|github.com/m3db/m3db/src/cmd/services/m3dbnode";;
'coordinator') echo "^mode|github.com/m3db/m3db/src/coordinator|github.com/m3db/m3db/src/cmd/services/m3coordinator";;
'query') echo "^mode|github.com/m3db/m3db/src/query|github.com/m3db/m3db/src/cmd/services/m3query";;
'm3ninx') echo "^mode|github.com/m3db/m3db/src/m3ninx";;
*) echo "unknown key: $1"; exit 1;;
esac
Expand Down
2 changes: 1 addition & 1 deletion scripts/site-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -e

ASSET_DIR=${1:-src/coordinator/generated/assets/openapi}
ASSET_DIR=${1:-src/query/generated/assets/openapi}

# Copy over OpenAPI doc.
mkdir -p m3metrics.io/openapi
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/services/m3coordinator/main/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
_ "net/http/pprof" // pprof: for debug listen server if configured
"os"

"github.com/m3db/m3db/src/coordinator/services/m3coordinator/server"
"github.com/m3db/m3db/src/query/server"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/services/m3dbnode/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
"strings"
"time"

coordinatorcfg "github.com/m3db/m3db/src/cmd/services/m3coordinator/config"
coordinatorcfg "github.com/m3db/m3db/src/cmd/services/m3query/config"
"github.com/m3db/m3db/src/dbnode/client"
"github.com/m3db/m3db/src/dbnode/environment"
"github.com/m3db/m3x/config/hostid"
Expand Down
4 changes: 2 additions & 2 deletions src/cmd/services/m3dbnode/main/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ import (

clusterclient "github.com/m3db/m3cluster/client"
"github.com/m3db/m3db/src/cmd/services/m3dbnode/config"
dbserver "github.com/m3db/m3db/src/cmd/services/m3dbnode/server"
coordinatorserver "github.com/m3db/m3db/src/coordinator/services/m3coordinator/server"
"github.com/m3db/m3db/src/dbnode/client"
dbserver "github.com/m3db/m3db/src/dbnode/server"
coordinatorserver "github.com/m3db/m3db/src/query/server"
xconfig "github.com/m3db/m3x/config"
)

Expand Down
2 changes: 1 addition & 1 deletion src/cmd/services/m3dbnode/main/main_index_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ import (
"github.com/m3db/m3cluster/placement"
"github.com/m3db/m3cluster/services"
"github.com/m3db/m3db/src/cmd/services/m3dbnode/config"
"github.com/m3db/m3db/src/cmd/services/m3dbnode/server"
"github.com/m3db/m3db/src/dbnode/client"
"github.com/m3db/m3db/src/dbnode/kvconfig"
"github.com/m3db/m3db/src/dbnode/server"
"github.com/m3db/m3db/src/dbnode/storage/index"
m3ninxidx "github.com/m3db/m3db/src/m3ninx/idx"
xconfig "github.com/m3db/m3x/config"
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/services/m3dbnode/main/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ import (
"github.com/m3db/m3cluster/services"
"github.com/m3db/m3cluster/shard"
"github.com/m3db/m3db/src/cmd/services/m3dbnode/config"
"github.com/m3db/m3db/src/cmd/services/m3dbnode/server"
"github.com/m3db/m3db/src/dbnode/client"
"github.com/m3db/m3db/src/dbnode/kvconfig"
"github.com/m3db/m3db/src/dbnode/server"
xconfig "github.com/m3db/m3x/config"
"github.com/m3db/m3x/ident"
"github.com/m3db/m3x/instrument"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ import (
"time"

etcdclient "github.com/m3db/m3cluster/client/etcd"
"github.com/m3db/m3db/src/coordinator/storage/local"
"github.com/m3db/m3db/src/query/storage/local"
"github.com/m3db/m3x/instrument"
)

// Configuration is the configuration for the coordinator.
// Configuration is the configuration for the query service.
type Configuration struct {
// Metrics configuration.
Metrics instrument.MetricsConfiguration `yaml:"metrics"`
Expand Down
46 changes: 46 additions & 0 deletions src/cmd/services/m3query/main/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// Copyright (c) 2018 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

package main

import (
"flag"
_ "net/http/pprof" // pprof: for debug listen server if configured
"os"

"github.com/m3db/m3db/src/query/server"
)

var (
configFile = flag.String("f", "", "configuration file")
)

func main() {
flag.Parse()

if len(*configFile) == 0 {
flag.Usage()
os.Exit(1)
}

server.Run(server.RunOptions{
ConfigFile: *configFile,
})
}
2 changes: 0 additions & 2 deletions src/coordinator/integration/testdata/read_data.snappy

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 5 additions & 5 deletions src/coordinator/README.md → src/query/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ Run m3coordinator binary:

Run Prometheus Docker image:

$ docker run -p 9090:9090 -v $GOPATH/src/github.com/m3db/m3db/src/coordinator/docker/prometheus-mac.yml:/etc/prometheus/prometheus.yml quay.io/prometheus/prometheus
$ docker run -p 9090:9090 -v $GOPATH/src/github.com/m3db/m3db/src/query/docker/prometheus-mac.yml:/etc/prometheus/prometheus.yml quay.io/prometheus/prometheus

### Running on GCP

Setup GCP for [single m3db node](https://github.com/m3db/m3db/pull/452/files?short_path=20bfc3f#diff-20bfc3ff6a860483887b93bf9cf0d135)

> For a multi-node cluster, [see here](https://github.com/m3db/m3db/src/coordinator/tree/master/benchmark)
> For a multi-node cluster, [see here](https://github.com/m3db/m3db/src/query/tree/master/benchmark)

Setup GCP for m3coordinator:

Expand All @@ -80,7 +80,7 @@ Setup and run Prometheus:
- url: http://10.142.0.8:7201/api/v1/prom/remote/write
```
3. Run Prometheus
$ sudo docker run -p 9090:9090 -v $GOPATH/src/github.com/m3db/m3db/src/coordinator/docker/prometheus.yml:/etc/prometheus/prometheus.yml quay.io/prometheus/prometheus
$ sudo docker run -p 9090:9090 -v $GOPATH/src/github.com/m3db/m3db/src/query/docker/prometheus.yml:/etc/prometheus/prometheus.yml quay.io/prometheus/prometheus

[doc-img]: https://godoc.org/github.com/m3db/m3db/src/coordinator?status.svg
[doc]: https://godoc.org/github.com/m3db/m3db/src/coordinator
[doc-img]: https://godoc.org/github.com/m3db/m3db/src/query?status.svg
[doc]: https://godoc.org/github.com/m3db/m3db/src/query
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
"strings"
"time"

"github.com/m3db/m3db/src/coordinator/util/logging"
"github.com/m3db/m3db/src/query/util/logging"

"github.com/golang/protobuf/jsonpb"
"github.com/golang/protobuf/proto"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ package database

import (
clusterclient "github.com/m3db/m3cluster/client"
"github.com/m3db/m3db/src/cmd/services/m3coordinator/config"
dbconfig "github.com/m3db/m3db/src/cmd/services/m3dbnode/config"
"github.com/m3db/m3db/src/coordinator/util/logging"
"github.com/m3db/m3db/src/cmd/services/m3query/config"
"github.com/m3db/m3db/src/query/util/logging"

"github.com/gorilla/mux"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ import (

clusterclient "github.com/m3db/m3cluster/client"
"github.com/m3db/m3cluster/generated/proto/placementpb"
"github.com/m3db/m3db/src/cmd/services/m3coordinator/config"
dbconfig "github.com/m3db/m3db/src/cmd/services/m3dbnode/config"
"github.com/m3db/m3db/src/coordinator/api/v1/handler"
"github.com/m3db/m3db/src/coordinator/api/v1/handler/namespace"
"github.com/m3db/m3db/src/coordinator/api/v1/handler/placement"
"github.com/m3db/m3db/src/coordinator/generated/proto/admin"
"github.com/m3db/m3db/src/coordinator/util"
"github.com/m3db/m3db/src/coordinator/util/logging"
"github.com/m3db/m3db/src/cmd/services/m3query/config"
dbnamespace "github.com/m3db/m3db/src/dbnode/storage/namespace"
"github.com/m3db/m3db/src/query/api/v1/handler"
"github.com/m3db/m3db/src/query/api/v1/handler/namespace"
"github.com/m3db/m3db/src/query/api/v1/handler/placement"
"github.com/m3db/m3db/src/query/generated/proto/admin"
"github.com/m3db/m3db/src/query/util"
"github.com/m3db/m3db/src/query/util/logging"

"github.com/golang/protobuf/jsonpb"
"go.uber.org/zap"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ import (
"github.com/m3db/m3cluster/kv"
"github.com/m3db/m3cluster/placement"
"github.com/m3db/m3cluster/services"
"github.com/m3db/m3db/src/cmd/services/m3coordinator/config"
dbconfig "github.com/m3db/m3db/src/cmd/services/m3dbnode/config"
"github.com/m3db/m3db/src/coordinator/api/v1/handler/namespace"
"github.com/m3db/m3db/src/coordinator/util/logging"
"github.com/m3db/m3db/src/cmd/services/m3query/config"
xtest "github.com/m3db/m3db/src/dbnode/x/test"
"github.com/m3db/m3db/src/query/api/v1/handler/namespace"
"github.com/m3db/m3db/src/query/util/logging"

"github.com/golang/mock/gomock"
"github.com/stretchr/testify/assert"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ import (
"net/http"

clusterclient "github.com/m3db/m3cluster/client"
"github.com/m3db/m3db/src/coordinator/api/v1/handler"
"github.com/m3db/m3db/src/coordinator/generated/proto/admin"
"github.com/m3db/m3db/src/coordinator/util/logging"
nsproto "github.com/m3db/m3db/src/dbnode/generated/proto/namespace"
"github.com/m3db/m3db/src/dbnode/storage/namespace"
"github.com/m3db/m3db/src/query/api/v1/handler"
"github.com/m3db/m3db/src/query/generated/proto/admin"
"github.com/m3db/m3db/src/query/util/logging"

"github.com/gogo/protobuf/jsonpb"
"go.uber.org/zap"
Expand Down
Loading