Skip to content

Commit

Permalink
Merge pull request #226 from tigrisdata/main
Browse files Browse the repository at this point in the history
  • Loading branch information
himank authored Apr 27, 2022
2 parents 191e31d + 341c966 commit da1ca33
Show file tree
Hide file tree
Showing 84 changed files with 271 additions and 271 deletions.
22 changes: 1 addition & 21 deletions .github/workflows/push-docker-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,13 @@ on:
types: [published]
workflow_call:
secrets:
GH_ECR_AWS_ACCESS_KEY_ID:
required: true
GH_ECR_AWS_SECRET_ACCESS_KEY:
required: true
GH_DOCKER_ACCESS_USER:
required: true
GH_DOCKER_ACCESS_TOKEN:
required: true

env:
AWS_REGION: "us-west-2"
ECR_REPOSITORY: "prod/tigrisdb"
DOCKER_REPOSITORY: "tigrisdata/tigrisdb"
DOCKER_REPOSITORY: "tigrisdata/tigris"

jobs:
build-and-push-image:
Expand All @@ -35,33 +29,19 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v2

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.GH_ECR_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.GH_ECR_AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}

- name: Login to Docker Hub
id: login-docker-hub
uses: docker/login-action@v1
with:
username: ${{ secrets.GH_DOCKER_ACCESS_USER }}
password: ${{ secrets.GH_DOCKER_ACCESS_TOKEN }}

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1

- name: Docker meta
id: meta
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
uses: docker/metadata-action@v3
with:
# list of Docker images to use as base name for tags
images: |
${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}
${{ env.DOCKER_REPOSITORY }}
# generate Docker tags based on the following events/attributes
# we generate the latest tag off the alpha branch
Expand Down
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[submodule "api/proto"]
path = api/proto
url = https://github.com/tigrisdata/tigrisdb-api.git
url = https://github.com/tigrisdata/tigris-api.git
branch = main
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@ clean:

# OSX specific targets to run tests against FDB installed on the Mac OSX host (non-containerized)
osx_test: generate test_client
TIGRISDB_SERVER_FOUNDATIONDB_CLUSTER_FILE=$(OSX_CLUSTER_FILE) GOARCH=$(GOARCH) CGO_ENABLED=$(CGO_ENABLED) go test $(TEST_PARAM) ./...
TIGRIS_SERVER_FOUNDATIONDB_CLUSTER_FILE=$(OSX_CLUSTER_FILE) GOARCH=$(GOARCH) CGO_ENABLED=$(CGO_ENABLED) go test $(TEST_PARAM) ./...

osx_run: generate server
TIGRISDB_SERVER_FOUNDATIONDB_CLUSTER_FILE=$(OSX_CLUSTER_FILE) ./server/service
TIGRIS_SERVER_FOUNDATIONDB_CLUSTER_FILE=$(OSX_CLUSTER_FILE) ./server/service

upgrade_api:
git submodule update --remote --recursive --rebase
Expand Down
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# TigrisDB
# Tigris Data

[![Go Report](https://goreportcard.com/badge/github.com/tigrisdata/tigrisdb)](https://goreportcard.com/report/github.com/tigrisdata/tigrisdb)
[![Build Status](https://github.com/tigrisdata/tigrisdb/workflows/Go/badge.svg)]()
[![Go Report](https://goreportcard.com/badge/github.com/tigrisdata/tigris)](https://goreportcard.com/report/github.com/tigrisdata/tigris)
[![Build Status](https://github.com/tigrisdata/tigris/workflows/Go/badge.svg)]()
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](CODE_OF_CONDUCT.md)

# Getting started

These instructions will get you through setting up TigrisDB locally as Docker
These instructions will get you through setting up Tigris Data locally as Docker
containers.

## Prerequisites
Expand All @@ -20,7 +20,7 @@ containers.
## Running locally

The [docker/local](docker/local) directory contains the docker-compose.yaml
which describes the configuration of TigrisDB components. You can run TigrisDB
which describes the configuration of Tigris Data components. You can run Tigris Data
in a local environment by executing:

```shell
Expand All @@ -33,23 +33,23 @@ docker-compose up -d
Install the CLI:

```shell
go install github.com/tigrisdata/tigrisdb-cli@latest
go install github.com/tigrisdata/tigris-cli@latest
```

Make sure to include the installed binary in your PATH.

Test that TigrisDB is up and running locally:
Test that Tigris is up and running locally:

```shell
export TIGRISDB_URL=http://localhost:8081
tigrisdb-cli db list databases
export TIGRIS_URL=http://localhost:8081
tigris-cli db list databases
```

More elaborate example of CLI usage can be
found [here](https://github.com/tigrisdata/tigrisdb-cli/).
found [here](https://github.com/tigrisdata/tigris-cli/).

Golang client example can be
found [here](https://github.com/tigrisdata/tigrisdb-client-go/).
found [here](https://github.com/tigrisdata/tigris-client-go/).

# Documentation

Expand All @@ -64,8 +64,8 @@ found [here](https://github.com/tigrisdata/tigrisdb-client-go/).
# Community & Support

* [Slack Community](https://join.slack.com/t/tigrisdatacommunity/shared_invite/zt-16fn5ogio-OjxJlgttJIV0ZDywcBItJQ)
* [GitHub Issues](https://github.com/tigrisdata/tigrisdb/issues)
* [GitHub Discussions](https://github.com/tigrisdata/tigrisdb/discussions)
* [GitHub Issues](https://github.com/tigrisdata/tigris/issues)
* [GitHub Discussions](https://github.com/tigrisdata/tigris/discussions)

# License

Expand Down
2 changes: 1 addition & 1 deletion api/proto
Submodule proto updated from 31086a to b9dbc0
24 changes: 12 additions & 12 deletions api/server/v1/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ import (
"google.golang.org/protobuf/types/known/anypb"
)

// TigrisDBError is our Tigris HTTP counterpart of grpc status. All the APIs should use this Error to return as a user facing
// error. TigrisDBError will return grpcStatus to the muxer so that grpc client can see grpcStatus as the final output. For
// TigrisError is our Tigris HTTP counterpart of grpc status. All the APIs should use this Error to return as a user facing
// error. TigrisError will return grpcStatus to the muxer so that grpc client can see grpcStatus as the final output. For
// HTTP clients see the **MarshalStatus** method where we are returning the response by not the grpc code as that is not
// needed for HTTP clients.
type TigrisDBError struct {
type TigrisError struct {
// The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]. We don't need to marshal
// this code for HTTP clients.
Code codes.Code `json:"code,omitempty"`
Expand All @@ -41,12 +41,12 @@ type TigrisDBError struct {
}

// Error to return the underlying error message
func (e *TigrisDBError) Error() string {
func (e *TigrisError) Error() string {
return e.Message
}

// GRPCStatus converts the TigrisDBError and return status.Status. This is used to return grpc status to the grpc clients
func (e *TigrisDBError) GRPCStatus() *status.Status {
// GRPCStatus converts the TigrisError and return status.Status. This is used to return grpc status to the grpc clients
func (e *TigrisError) GRPCStatus() *status.Status {
s := &spb.Status{
Code: int32(e.Code),
Message: e.Message,
Expand All @@ -69,15 +69,15 @@ func (e *TigrisDBError) GRPCStatus() *status.Status {
return status.FromProto(s)
}

// WithDetails a helper method for adding details to the TigrisDBError
func (e *TigrisDBError) WithDetails(details ...*ErrorDetails) *TigrisDBError {
// WithDetails a helper method for adding details to the TigrisError
func (e *TigrisError) WithDetails(details ...*ErrorDetails) *TigrisError {
e.Details = details
return e
}

// MarshalStatus marshal status object
func MarshalStatus(status *spb.Status) ([]byte, error) {
var resp = &TigrisDBError{}
var resp = &TigrisError{}
resp.Message = status.Message
resp.Code = codes.Code(status.Code)
if len(status.Details) > 0 {
Expand All @@ -97,17 +97,17 @@ func MarshalStatus(status *spb.Status) ([]byte, error) {
}

// Errorf returns Error(c, fmt.Sprintf(format, a...)).
func Errorf(c codes.Code, format string, a ...interface{}) *TigrisDBError {
func Errorf(c codes.Code, format string, a ...interface{}) *TigrisError {
return Error(c, fmt.Sprintf(format, a...))
}

// Error returns an error representing c and msg. If c is OK, returns nil.
func Error(c codes.Code, msg string) *TigrisDBError {
func Error(c codes.Code, msg string) *TigrisError {
if c == codes.OK {
return nil
}

return &TigrisDBError{
return &TigrisError{
Code: c,
Message: msg,
}
Expand Down
28 changes: 24 additions & 4 deletions api/server/v1/marshaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package api

import (
"encoding/json"
"time"

"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
jsoniter "github.com/json-iterator/go"
Expand Down Expand Up @@ -54,17 +55,36 @@ func (c *CustomMarshaler) Marshal(v interface{}) ([]byte, error) {
// the openAPI specs needs to be specified Data as object instead of bytes.
func (x *ReadResponse) MarshalJSON() ([]byte, error) {
resp := struct {
Data json.RawMessage `json:"data"`
Metadata *ResponseMetadata `json:"metadata"`
ResumeToken []byte `json:"resume_token"`
Data json.RawMessage `json:"data,omitempty"`
Metadata Metadata `json:"metadata,omitempty"`
ResumeToken []byte `json:"resume_token,omitempty"`
}{
Data: x.Data,
Metadata: x.Metadata,
Metadata: CreateMDFromResponseMD(x.Metadata),
ResumeToken: x.ResumeToken,
}
return json.Marshal(resp)
}

type Metadata struct {
CreatedAt *time.Time `json:"created_at,omitempty"`
UpdatedAt *time.Time `json:"updated_at,omitempty"`
}

func CreateMDFromResponseMD(x *ResponseMetadata) Metadata {
var md Metadata
if x.CreatedAt != nil {
tm := x.CreatedAt.AsTime()
md.CreatedAt = &tm
}
if x.UpdatedAt != nil {
tm := x.UpdatedAt.AsTime()
md.UpdatedAt = &tm
}

return md
}

// UnmarshalJSON on ReadRequest avoids unmarshalling filter and instead this way we can write a custom struct to do
// the unmarshalling and will be avoiding any extra allocation/copying.
func (x *ReadRequest) UnmarshalJSON(data []byte) error {
Expand Down
2 changes: 1 addition & 1 deletion cdc/listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ package cdc
import (
"github.com/apple/foundationdb/bindings/go/src/fdb"
jsoniter "github.com/json-iterator/go"
"github.com/tigrisdata/tigrisdb/internal"
"github.com/tigrisdata/tigris/internal"
)

type Tx struct {
Expand Down
2 changes: 1 addition & 1 deletion cdc/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"context"
"sync"

"github.com/tigrisdata/tigrisdb/store/kv"
"github.com/tigrisdata/tigris/store/kv"
)

type Manager struct {
Expand Down
4 changes: 2 additions & 2 deletions cdc/publisher.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import (
"github.com/apple/foundationdb/bindings/go/src/fdb"
"github.com/apple/foundationdb/bindings/go/src/fdb/subspace"
"github.com/apple/foundationdb/bindings/go/src/fdb/tuple"
"github.com/tigrisdata/tigrisdb/server/config"
"github.com/tigrisdata/tigrisdb/store/kv"
"github.com/tigrisdata/tigris/server/config"
"github.com/tigrisdata/tigris/store/kv"
)

type Publisher struct {
Expand Down
4 changes: 2 additions & 2 deletions cdc/streamer.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import (
"github.com/apple/foundationdb/bindings/go/src/fdb"
jsoniter "github.com/json-iterator/go"
"github.com/rs/zerolog/log"
"github.com/tigrisdata/tigrisdb/internal"
"github.com/tigrisdata/tigrisdb/server/config"
"github.com/tigrisdata/tigris/internal"
"github.com/tigrisdata/tigris/server/config"
)

type Streamer struct {
Expand Down
22 changes: 11 additions & 11 deletions deployment/manifests/base/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,30 @@ apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app.kubernetes.io/name: tigrisdb-server
app.kubernetes.io/part-of: tigrisdb
app.kubernetes.io/name: tigris-server
app.kubernetes.io/part-of: tigris
app.kubernetes.io/component: server
name: tigrisdb-server
name: tigris-server
spec:
selector:
matchLabels:
app.kubernetes.io/name: tigrisdb-server
app.kubernetes.io/name: tigris-server
template:
metadata:
labels:
app.kubernetes.io/name: tigrisdb-server
app.kubernetes.io/name: tigris-server
spec:
containers:
- name: tigrisdb-server
image: tigrisdata/tigrisdb:latest # Replace this with the version you want to run through kustomization
- name: tigris-server
image: tigrisdata/tigris:latest # Replace this with the version you want to run through kustomization
imagePullPolicy: Always
command: ["/server/service"]
volumeMounts:
- mountPath: /tmp
name: tmp
- mountPath: /mnt/fdb-config-volume
name: fdb-cluster-config-volume
- mountPath: /etc/tigrisdata/tigrisdb
- mountPath: /etc/tigrisdata/tigris
name: server-config-volume
ports:
- containerPort: 8080
Expand Down Expand Up @@ -72,19 +72,19 @@ spec:
# This configmap is created during the kustomization phase
- name: server-config-volume
configMap:
name: tigrisdb-server-config
name: tigris-server-config
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- podAffinityTerm:
topologyKey: kubernetes.io/hostname
labelSelector:
matchLabels:
app.kubernetes.io/name: tigrisdb-server
app.kubernetes.io/name: tigris-server
weight: 100
- podAffinityTerm:
topologyKey: kubernetes.io/hostname
labelSelector:
matchLabels:
app.kubernetes.io/part-of: tigrisdb
app.kubernetes.io/part-of: tigris
weight: 5
2 changes: 1 addition & 1 deletion deployment/manifests/base/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ resources:
- service_grpc.yaml
- network-policy.yaml
configMapGenerator:
- name: tigrisdb-server-config
- name: tigris-server-config
files:
- server.yaml
4 changes: 2 additions & 2 deletions deployment/manifests/base/network-policy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: tigrisdb-server-network-policy
name: tigris-server-network-policy
spec:
podSelector:
matchLabels:
app.kubernetes.io/name: tigrisdb-server
app.kubernetes.io/name: tigris-server
ingress:
- {}
egress:
Expand Down
Loading

0 comments on commit da1ca33

Please sign in to comment.