How to Deploy and Use Huajiao’s Open‑Source Gokeeper, Pepperbus, Peppercron & Dashboard
This guide introduces Huajiao Live’s newly open‑sourced backend components—Gokeeper for centralized configuration and service discovery, Pepperbus for message bus, Peppercron for distributed cron management, and the Dashboard UI—providing repository links, Docker images, installation steps, configuration formats, code examples, and operational details for quick deployment.
Introduction
Huajiao Live open‑sourced four backend services that are widely used in its platform: gokeeper (centralized configuration and service discovery), pepperbus (message bus), peppercron (distributed cron manager), and dashboard (management UI). The sections below describe how to obtain, run, and integrate each component.
Gokeeper
Repository: https://github.com/huajiao-tv/gokeeper Docker image: docker pull huajiao/gokeeper Gokeeper is a Go‑based configuration center that uses ETCD as the default backend (it also supports Consul, Zookeeper, etc.). It can be deployed as a single node or a cluster and provides service‑discovery capabilities.
Running Gokeeper
Prepare a local Docker environment with docker‑compose.
Clone the repository and start the service:
cd deploy/docker_compose
docker-compose up -dSupported Configuration Types
Gokeeper can encode Go native types using gob and also stores JSON strings. Supported Go types include:
bool, []bool
int, int64, []int, []int64
float64, []float64
string, []string
map[string]string, map[string]int, map[string]bool
map[int]string, map[int]int, map[int]bool
map[string][]string, map[string]struct{}, map[int]struct{}
time.DurationAccessing Gokeeper
Install the client library: go get -u github.com/huajiao-tv/gokeeper Create an ini file using the syntax <key> [type] = [value] (default type is string).
Generate a configuration object:
go get -u github.com/huajiao-tv/gokeeper/cmd/gokeeper-cli
$GOPATH/bin/gokeeper-cli -in ./ini_file_path -out dataExample client code:
// sections to load
sections := []string{"test.conf/DEFAULT"}
client := gokeeper.New(keeperAddr, domain, nodeID, component, sections, nil, gokeeper.WithGrpc())
client.LoadData(data.ObjectsContainer).RegisterCallback(run)
if err := client.Work(); err != nil {
panic(err)
}Service Discovery
The discovery layer abstracts the backend store, allowing clients to register and discover services without knowing the storage implementation. Features include selective subscription, real‑time push of node changes, fallback to existing nodes when the discovery service is unreachable, and configurable load‑balancing policies stored in the backend.
Client library:
go get -u github.com/huajiao-tv/gokeeper/client/discoveryService Provider Example
instance := discovery.NewInstance(discovery.GenRandomId(), "demo.test.com", map[string]string{discoverry.SchemaHttp: "127.0.0.1:17000"})
instance.Id = "test_id_1"
client := discovery.New(
"127.0.0.1:7001", // Gokeeper gRPC address
discovery.WithRegistry(instance),
discovery.WithRegistryTTL(60*time.Second),
discovery.WithScheduler(map[string]schedule.Scheduler{"demo.test.com": schedule.NewRoundRobinScheduler()}),
)Service Consumer Example
client := discovery.New(
"127.0.0.1:7001",
discovery.WithDiscovery("example_client1", []string{"demo.test.com"}),
)
addr, err := client.GetServiceAddr("demo.test.com", discovery.SchemaHttp)
if err != nil {
// handle error
}Pepperbus
Repository: https://github.com/huajiao-tv/pepperbus Docker image: docker pull huajiao/pepperbus Pepperbus is a message‑bus system used by Huajiao Live. The design details are documented in the original technical newsletter (Nov 26 2019).
Peppercron
Repository: https://github.com/huajiao-tv/peppercron Docker image: docker pull huajiao/peppercron Peppercron provides distributed cron scheduling. Its design was published on Oct 29 2019.
Dashboard
Repository: https://github.com/huajiao-tv/dashboard Docker image: docker pull huajiao/dashboard The dashboard offers a unified UI for managing Pepperbus and Peppercron. After cloning the repository, start all services with: docker-compose up -d The compose file creates the following containers:
redis – message persistence for Pepperbus
mysql – dashboard database
gokeeper_etcd – ETCD used by Gokeeper and Peppercron
gokeeper – configuration center
peppercron – distributed cron service
php-fpm – PHP consumer for the bus
pepperbus – message bus
dashboard – management UI
Accessing the Dashboard
Open http://localhost:8360 in a browser. The default credentials are admin / admin@pass (defined in config.yaml).
Adding a System in the UI
Use the UI to add a Pepperbus server, a Redis store, and a queue. Then create two topics ( queue1/topic1 and queue1/topic2) using the provided PHP SDK example ( example/php/consume.php). Topic 1 returns success by default; topic 2 returns failure.
Peppercron Task Management
Through the dashboard you can add a Peppercron task server, define tasks, test them, redirect output to a file, and verify execution results.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Huajiao Technology
The Huajiao Technology channel shares the latest Huajiao app tech on an irregular basis, offering a learning and exchange platform for tech enthusiasts.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
