Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Shopify/bigtable-emulator
https://github.com/Shopify/bigtable-emulator
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/Shopify/bigtable-emulator
- Owner: Shopify
- License: mit
- Archived: true
- Created: 2017-11-07T13:32:51.000Z (about 7 years ago)
- Default Branch: main
- Last Pushed: 2024-04-19T11:44:55.000Z (9 months ago)
- Last Synced: 2024-08-04T00:02:39.169Z (6 months ago)
- Language: Go
- Size: 109 KB
- Stars: 42
- Watchers: 386
- Forks: 9
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-bigtable - Shopify Bigtable Emulator - In memory Go implementation of Bigtable. (Tools / Emulators)
README
# Bigtable emulator Docker image
This repository contains the Google Cloud Bigtable emulator, which is an in memory Go implementation of Bigtable allowing to create integration tests and a local development environment. Warning: this is not a production tool.
The emulator is offered in the [Google Cloud SDK](https://cloud.google.com/bigtable/docs/emulator). However, it might be difficult or overkill to install the SDK on every development and CI box. In those situations, this image provides a lightweight alternative (< 17MB). It also provides an easy way to setup necessary tables and column families at startup.
# Using it
To start it, run the following command:
```
docker run -d -p 9035:9035 shopify/bigtable-emulator
```You can specify the tables and column families you need using the `-cf` switch. The format is a comma separated list of `..`. Ex:
```
docker run -d -p 9035:9035 shopify/bigtable-emulator -cf dev.records.data,dev.records.metadata
```# Connecting to it
You have to set the `BIGTABLE_EMULATOR_HOST` environment variable to the right docker host and container port (`localhost:9035` in most cases). Then:
```go
import (
"cloud.google.com/go/bigtable"
"golang.org/x/net/context"
"golang.org/x/oauth2"
"google.golang.org/api/option"
)type devTokenSource struct{}
func (devTokenSource) Token() (*oauth2.Token, error) {
return new(oauth2.Token), nil
}func NewDevBigTableClient() (*bigtable.Client, error) {
ctx := context.Background()
project := "dev"
instance := "dev"
return bigtable.NewClient(
ctx,
project,
instance,
option.WithTokenSource(&devTokenSource{}),
)
}```
# License
This software is available under the MIT license (see 'LICENSE' file for more details).