GithubHelp home page GithubHelp logo

varun7 / emulator-samples Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cloudspannerecosystem/emulator-samples

0.0 0.0 0.0 82 KB

Samples for using Cloud Spanner Emulator

Home Page: https://cloud.google.com/spanner/docs/emulator

License: Apache License 2.0

Shell 0.55% C++ 39.88% Python 19.92% Java 29.66% Go 8.42% Dockerfile 0.30% Starlark 1.27%

emulator-samples's Introduction

Cloud Spanner Emulator Samples

This repository contains samples that demonstrate how to use Cloud Spanner emulator in CI/CD pipelines.

Please feel free to report issues and send pull requests, but note that these samples are not officially supported as part of the Cloud Spanner product.

Starting Emulator from Docker

The emulator can be started using Docker on Linux, MacOS and Windows. As a prerequisite, you would need to install docker on your system. You can configure a default instance and/or database using following sample recipe:

Build and run docker image.

cd emulator-samples/docker

# Build an image.
docker build -t start-spanner-emulator .

# Run docker container.
docker run --detach --name emulator -p 9010:9010 -p 9020:9020
start-spanner-emulator

# Verify the container is running.
docker ps

Test that everything is working.

As a prerequisite, install Google Cloud SDK. You can then update gcloud configuration to point to the docker container running emulator as following:

# Verify that gcloud is installed.
gcloud --version

# Create a new gcloud configuration for this test.
gcloud config configurations create emulator-docker

gcloud config set api_endpoint_overrides/spanner http://0.0.0.0:9020/
gcloud config set auth/disable_credentials true
gcloud config set core/project test-project

gcloud config list
[api_endpoint_overrides]
spanner = http://0.0.0.0:9020/
[auth]
disable_credentials = true
[core]
project = test-project

gcloud spanner instances list --project=test-project
NAME           DISPLAY_NAME   CONFIG                NODE_COUNT  STATE
test-instance  Test Instance  emulator-test-config  1           READY

gcloud spanner databases list --instance=test-instance --project=test-project
NAME           STATE
test-database  READY

Cleanup

# Stop docker when your integration tests complete.
docker stop emulator

Disclaimer

This is not an official Google product.

emulator-samples's People

Contributors

vizerai avatar agasheesh avatar nielm avatar snehashah16 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.