Giter VIP home page Giter VIP logo

goblog's Introduction

goblog

Code samples for the Go microservice blog series

Changelog

  • 2019-07-27: Total rewrite of Go code, including introducing Makefiles for build and a docker-compose file for deployment on Docker Swarm.

Some URLs to remember

Turbine stream URL: http://192.168.99.100:8282/turbine.stream?cluster=swarm Hystrix stream URL: http://accountservice:8181/hystrix.stream?cluster=swarm

Make sure Turbine doesn't crash on startup due to AMQ connection problem.

Setting up Docker Swarm cluster

docker-machine create --driver virtualbox --virtualbox-cpu-count 4 --virtualbox-memory 6000 --virtualbox-disk-size 30000 swarm-manager-0
eval "$(docker-machine env swarm-manager-0)"
docker network create --driver overlay my_network
docker swarm init --advertise-addr 192.168.99.100
Adding a worker node
docker swarm join --token SWMTKN-1-5njothki0tww7gestuh309qgrnr6r357phlsn7ue0r8qmlqnla-181tl1rfou16vv3e7nxrk4ra3 192.168.99.100:2377

Building

You need Go 1.12 or later installed on your system to build from source.

Builds are performed using Makefile(s). In the root /goblog folder:

make build

One can also run all tests, format code using makefile targets.

Deploying

Deploy using:

make deploy

The make target uses docker stack deploy behind the scenes.

Nice to haves

Here's some minor stuff worth remembering.

Running the CockroachDB client

Find a container running the cockroachdb/cockroach container using docker ps and note the container ID. Then we'll use docker exec to launch the SQL CLI:

> docker exec -it 10f4b6c727f8 ./cockroach sql --insecure

Create user and database for Cockroach

(this is possibly broken, from part 16 onwards the initial DB setup is performed using the docker stack)

Originally from: cockroachdb/cockroach#19826 (comment)

DROP USER IF EXISTS cockroach; \
DROP DATABASE IF EXISTS account CASCADE; \
CREATE DATABASE IF NOT EXISTS account; \
CREATE USER cockroach WITH PASSWORD 'password'; \
GRANT ALL ON DATABASE account TO cockroach;

goblog's People

Contributors

eriklupander 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.