Skip to content

Latest commit

 

History

History
 
 

examples

Sanic MicroService Example

Enviroment

We use docker and docker-compose to create the dev env automatically.

Currently it contains three docker images.
 
 - "db" for Postgres
 - "server" for Sanic server

Install Docker & Docker-Compose

Install Docker

Docker For Mac

Install Docker-Compose

(sudo) pip install -U docker-compose

Registry-Mirror

DaoCloud Mirror

Pull Source Code

git clone https://github.com/songcser/sanic-ms
cd sanic-ms/examples

Develop

Pull and run docker container

BUILD=y PULL=y ./develop/reset.sh

Reset

./develop/reset.sh

Restart server service

docker-compose restart server

Logs

docker-compose logs

Server Logs

docker-compose logs -f server

Cluster Service

./develop/cluster.sh

Test

./develop/test.sh

Access Server

open http://localhost:8000

open http://localhost:8000/users/

Access API

open http://localhost:8090

image

Access Zipkin

open http://localhost:9411

image image

Access Consul

open http://192.168.99.100:8500/ui/#/dc1/services

image