Kong and Consul Lab For Golang

Overview

Kong and Consul Lab

Prerequisites

  1. docker

Deploy Consul Server

docker run -d -p 8500:8500 -p 8600:8600/udp --name=consul-server consul agent -server -ui -node=consul-server-1 -bootstrap-expect=1 -client=0.0.0.0  -log-level=debug

Deploy Home APP

docker build -t home-image .
docker run -d -p 8070:8070 --name=home-app home-image

Deploy Product APP

docker build -t product-image .
docker run -d -p 8090:8090 --name=product-app product-image

Deploy Career APP

docker build -t career-image .
docker run -d -p 8080:8080 --name=career-app career-image

Test DNS

please refer to this doc: https://www.consul.io/docs/discovery/dns

dig @127.0.0.1 -p 8600 home-app.service.consul ANY
dig @127.0.0.1 -p 8600 career-app.service.consul ANY
dig @127.0.0.1 -p 8600 product-app.service.consul ANY

Deploy Kong

  1. deploy postgress
docker run -d --name kong-database \
  -p 5432:5432 \
  -e "POSTGRES_USER=kong" \
  -e "POSTGRES_DB=kong" \
  -e "POSTGRES_PASSWORD=kong" \
  postgres:9.6
  1. Migrate postgress
docker run --rm --link kong-database:kong-database \
  -e "KONG_DATABASE=postgres" \
  -e "KONG_PG_HOST=kong-database" \
  -e "KONG_PG_PASSWORD=kong" \
  -e "KONG_PASSWORD=kong" \
  kong:latest kong migrations bootstrap
  1. Start Kong gateway
docker run -d --name kong \
  --link kong-database:kong-database\
  -e "KONG_DATABASE=postgres" \
  -e "KONG_PG_HOST=kong-database" \
  -e "KONG_PG_USER=kong" \
  -e "KONG_PG_PASSWORD=kong" \
  -e "KONG_PROXY_ACCESS_LOG=/dev/stdout" \
  -e "KONG_ADMIN_ACCESS_LOG=/dev/stdout" \
  -e "KONG_PROXY_ERROR_LOG=/dev/stderr" \
  -e "KONG_ADMIN_ERROR_LOG=/dev/stderr" \
  -e "KONG_ADMIN_LISTEN=0.0.0.0:8001, 0.0.0.0:8444 ssl" \
  -e "KONG_DNS_RESOLVER=172.17.0.2:8600" \
  -p 8000:8000 \
  -p 8443:8443 \
  -p 8001:8001 \
  -p 8444:8444 \
  kong:latest

Add service and routes to KONG

Please refer to this doc: https://docs.konghq.com/gateway-oss/2.5.x/admin-api/#service-object

curl -i -X POST \
--url http://localhost:8001/services/ \
--data 'name=home-svc' \
--data 'host=home-app.service.consul'

curl -i -X POST \
--url http://localhost:8001/services/ \
--data 'name=product-svc' \
--data 'host=product-app.service.consul' \
--data 'path=/product'

curl -i -X POST \
--url http://localhost:8001/services/ \
--data 'name=career-svc' \
--data 'host=career-app.service.consul' \
--data 'path=/career'

curl -i -X POST \
--url http://localhost:8001/services/ \
--data 'name=blog-svc' \
--data 'host=career-app.service.consul' \
--data 'path=/blog'

Please refer to this doc: https://docs.konghq.com/gateway-oss/2.5.x/admin-api/#route-object

curl -i -X POST \
--url http://localhost:8001/services/home-svc/routes \
--data 'hosts[]=localhost' \
--data 'paths=/home'

curl -i -X POST \
--url http://localhost:8001/services/product-svc/routes \
--data 'hosts[]=localhost' \
--data 'paths=/product'

curl -i -X POST \
--url http://localhost:8001/services/career-svc/routes \
--data 'hosts[]=localhost' \
--data 'paths=/career'

curl -i -X POST \
--url http://localhost:8001/services/blog-svc/routes \
--data 'hosts[]=localhost' \
--data 'paths=/blog'

Deploy Konga

docker run --rm --link kong-database:kong-database \
pantsel/konga -c prepare -a postgres -u postgresql://kong:[email protected]:5432/konga_db

docker run -d --name konga \
-p 1337:1337 \
--link kong-database:kong-database \
-e "DB_ADAPTER=postgres" \
-e "DB_HOST=kong-database" \
-e "DB_USER=kong" \
-e "DB_PASSWORD=kong" \
-e "DB_DATABASE=konga_db" \
-e "KONGA_HOOK_TIMEOUT=120000" \
-e "NODE_ENV=production" \
pantsel/konga
Owner
Ridwan Dwi Siswanto
Jr. DevOps Engineer | System Administrator | Network Engineer
Ridwan Dwi Siswanto
golang consul tools

中文文档 consult A consul key/value tool for golang Usage install go get -u github.com/xxjwxc/[email protected] New Config conf := consulkv.NewConfig() With

xxj 7 Mar 6, 2022
Use Consul to do service discovery, use gRPC +kafka to do message produce and consume. Use redis to store result.

目录 gRPC/consul/kafka简介 gRPC+kafka的Demo gRPC+kafka整体示意图 限流器 基于redis计数器生成唯一ID kafka生产消费 kafka生产消费示意图 本文kafka生产消费过程 基于pprof的性能分析Demo 使用pprof统计CPU/HEAP数据的

null 42 Jun 5, 2022
Service registration and discovery, support etcd, zookeeper, consul, etc.

discox 支持类型 zookeeper etcd consul 示例 zookeeper server package main import ( "fmt" "github.com/goeasya/discox" "os" ) func main() { cfg := discox

goeasya 4 Mar 19, 2022
Consul Load-Balancing made simple

Notes From release 1.5.15 onward, fabio changes the default GOGC from 800 back to the golang default of 100.

fabio 6.9k Jun 20, 2022
Consul Load-Balancing made simple

Notes From release 1.5.15 onward, fabio changes the default GOGC from 800 back to the golang default of 100. Apparently this made some sense back in t

fabio 6.9k Jun 20, 2022
Consul K/V Store Implementation For Go

Consul K/V Store Implementation For Go Enables Consul to be used as a configuration source in go applications Dynamic Configuration with Consul's Key/

null 9 Jun 7, 2022
A golang library about socks5, supports all socks5 commands. That Provides server and client and easy to use. Compatible with socks4 and socks4a.

socks5 This is a Golang implementation of the Socks5 protocol library. To see in this SOCKS Protocol Version 5. This library is also compatible with S

chenhao zhang 39 May 29, 2022
Squzy - is a high-performance open-source monitoring, incident and alert system written in Golang with Bazel and love.

Squzy - opensource monitoring, incident and alerting system About Squzy - is a high-performance open-source monitoring and alerting system written in

Squzy 454 May 24, 2022
Golang tool to parse netblocks and domain names from SPF and get information about ASN

gospf Example Install go get github.com/incogbyte/gospf # get from releases ht

incogbyte 4 Apr 22, 2022
Remake of the original sqlifinder but in GOlang, and allows for listed targets, domain crawling, and tor connections

_______ _____ _____ _______ _____ __ _ ______ _______ ______ |______ | __| | | |______ | | \ | | \ |______ |_____/

RE43P3R 2 Mar 22, 2022
Laptop Booking Application in Golang and gRPC, load-balancing with NGINX, and fully compatible with HTTPS OpenAPI v3

Laptop Booking Application in Golang and gRPC Goals GitHub CI & Coverage Badge Serialize protobuf messages Create laptop unary gRPC Search laptop Serv

Tien La 3 Jun 17, 2022
A simple FTP protocol with client and server implemented in TypeScript and Golang

websocket-ftp A simple FTP protocol with client and server implemented in TypeScript and Golang. Example (Client) const buffer: Uint8Array = (new Text

LQR471814 0 Apr 14, 2022
Maidenhead - This golang library compress and decompress latitude and longitude coordinates into Maidenhead locator

The Maidenhead Locator System (a.k.a. QTH Locator and IARU Locator) is a geocode system used by amateur radio operators to succinctly describe their geographic coordinates.

Alessandro Lucaferro 2 Jan 30, 2022
Hprose 1.0 for Golang (Deprecated). Hprose 2.0 for Golang is here:

Hprose for Golang Introduction Installation Usage Http Server Http Client Synchronous Invoking Synchronous Exception Handling Asynchronous Invoking As

Hprose 136 Jun 19, 2022
A Minecraft scanner written in Golang (first Golang project)

__ __/ \__ Gothyc A Minecraft port scanner written in Go. ?? / \__/ \__ \__/ \__/ \ Version 0.3.0 \__/ \__/ Author @toas

toast 10 Mar 26, 2022
Transparent TLS and HTTP proxy serve and operate on all 65535 ports, with domain regex whitelist and rest api control

goshkan Transparent TLS and HTTP proxy serve & operating on all 65535 ports, with domain regex whitelist and rest api control tls and http on same por

Sina Ghaderi 9 Mar 16, 2022
Tapestry is an underlying distributed object location and retrieval system (DOLR) which can be used to store and locate objects. This distributed system provides an interface for storing and retrieving key-value pairs.

Tapestry This project implements Tapestry, an underlying distributed object location and retrieval system (DOLR) which can be used to store and locate

Han Cai 1 Mar 16, 2022
Gmqtt is a flexible, high-performance MQTT broker library that fully implements the MQTT protocol V3.1.1 and V5 in golang

中文文档 Gmqtt News: MQTT V5 is now supported. But due to those new features in v5, there area lots of breaking changes. If you have any migration problem

null 671 Jun 22, 2022
A LWM2M Client and Server implementation (For Go/Golang)

Betwixt - A LWM2M Client and Server in Go Betwixt is a Lightweight M2M implementation written in Go OMA Lightweight M2M is a protocol from the Open Mo

Zubair Hamed 54 May 28, 2022