Skip to content

Commit

Permalink
Refactor port for http-addr 8080->8800
Browse files Browse the repository at this point in the history
  • Loading branch information
iknite committed Feb 19, 2019
1 parent 9f0d6f8 commit ae0a409
Show file tree
Hide file tree
Showing 25 changed files with 39 additions and 39 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ source of ordered events like logs, ledgers, etc...
main.go \
--apikey my-key \
client \
--endpoint http://localhost:8080 \
--endpoint http://localhost:8800 \
add \
--key 'test event' \
--value 2 \
Expand All @@ -107,7 +107,7 @@ source of ordered events like logs, ledgers, etc...
main.go \
--apikey my-key \
client \
--endpoint http://localhost:8080 \
--endpoint http://localhost:8800 \
membership \
--hyperDigest 3ec11c37f0a53ff5c4cfc3cf2573c33a9721cd25d8e670a3b2be0fda5724bb5c \
--historyDigest 776b33eab8ed829ecffab3d579bf7ccbcc126b94bac1aaca7d5d8b0a2687bdec \
Expand Down
2 changes: 1 addition & 1 deletion client/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ type Config struct {

func DefaultConfig() *Config {
return &Config{
Endpoint: "localhost:8080",
Endpoint: "localhost:8800",
APIKey: "my-key",
Insecure: true,
TimeoutSeconds: 10,
Expand Down
2 changes: 1 addition & 1 deletion cmd/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func newClientCommand(ctx *cmdContext) *cobra.Command {
}

f := cmd.PersistentFlags()
f.StringVarP(&clientCtx.config.Endpoint, "endpoint", "e", "127.0.0.1:8080", "Endpoint for REST requests on (host:port)")
f.StringVarP(&clientCtx.config.Endpoint, "endpoint", "e", "127.0.0.1:8800", "Endpoint for REST requests on (host:port)")
f.BoolVar(&clientCtx.config.Insecure, "insecure", false, "Allow self signed certificates")
f.IntVar(&clientCtx.config.TimeoutSeconds, "timeout-seconds", 10, "Seconds to cut the connection")
f.IntVar(&clientCtx.config.DialTimeoutSeconds, "dial-timeout-seconds", 5, "Seconds to cut the dialing")
Expand Down
2 changes: 1 addition & 1 deletion cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func newStartCommand(ctx *cmdContext) *cobra.Command {
f.StringVar(&conf.SSLCertificate, "certificate", fmt.Sprintf("%s/%s", ctx.path, "server.crt"), "Server crt file")
f.StringVar(&conf.SSLCertificateKey, "certificate-key", fmt.Sprintf("%s/%s", ctx.path, "server.key"), "Server key file")

f.StringVar(&conf.HTTPAddr, "http-addr", ":8080", "Endpoint for REST requests on (host:port)")
f.StringVar(&conf.HTTPAddr, "http-addr", ":8800", "Endpoint for REST requests on (host:port)")
f.StringVar(&conf.RaftAddr, "raft-addr", "9000", "Raft bind address (host:port)")
f.StringVar(&conf.MgmtAddr, "mgmt-addr", "8090", "Management endpoint bind address (host:port)")
f.StringVar(&conf.MgmtAddr, "metrics-addr", "9990", "Metrics export bind address (host:port)")
Expand Down
6 changes: 3 additions & 3 deletions config.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ server:
certificate: "/var/tmp/qed/server.crt" # Server certificate file
certificate_key: "/var/tmp/qed/server.key" # Server certificate key file
addr:
http: ":8080" # Endpoint for REST requests on (host:port).
http: ":8800" # Endpoint for REST requests on (host:port).
mgmt: ":8090" # Management endpoint bind address (host:port).
metrics: ":9990" # Metrics endpoint (host:port).
raft: ":9000" # Raft bind address (host:port).
Expand All @@ -53,7 +53,7 @@ server:
# Cient Configuration (cli commands `add` `incremental` and `verify`)
###############################################################################
client:
endpoint: "127.0.0.1:8080" # Endpoint for REST requests on (host:port)
endpoint: "127.0.0.1:8800" # Endpoint for REST requests on (host:port)
insecure: false # Allow self signed certificates
timeout:
connection: 10 # time in seconds to cut the ongoing connection
Expand All @@ -73,6 +73,6 @@ agent:
alert_urls: # List of Alert servers ([host]:port), through which an agent can post alerts
- "127.0.0.1:8888"
server_urls: # List of QED servers ([host]:port), through which an auditor can make queries
- "127.0.0.1:8080"
- "127.0.0.1:8800"
snapshots_store_urls: # List of end-publishers ([host]:port), through which an agent can send signedSnapshots or alerts
- "127.0.0.1:8888"
12 changes: 6 additions & 6 deletions deploy/aws/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ module "leader" {
server:
node_id: "leader"
addr:
http: ":8080"
http: ":8800"
mgmt: ":8090"
raft: ":9000"
gossip: ":9100"
Expand All @@ -60,7 +60,7 @@ module "follower-1" {
server:
node_id: "follower-1"
addr:
http: ":8080"
http: ":8800"
mgmt: ":8090"
raft: ":9000"
gossip: ":9100"
Expand Down Expand Up @@ -89,7 +89,7 @@ module "follower-2" {
server:
node_id: "follower-2"
addr:
http: ":8080"
http: ":8800"
mgmt: ":8090"
raft: ":9000"
gossip: ":9100"
Expand Down Expand Up @@ -133,7 +133,7 @@ module "follower-2" {
# join:
# - "${module.leader.private_ip}:9100"
# server_urls:
# - "${module.leader.private_ip}:8080"
# - "${module.leader.private_ip}:8800"
# alert_urls:
# - "${module.inmemory-storage.private_ip}:8888"
# snapshots_store_urls:
Expand Down Expand Up @@ -164,7 +164,7 @@ module "follower-2" {
# join:
# - "${module.leader.private_ip}:9100"
# server_urls:
# - "${module.leader.private_ip}:8080"
# - "${module.leader.private_ip}:8800"
# alert_urls:
# - "${module.inmemory-storage.private_ip}:8888"
# snapshots_store_urls:
Expand Down Expand Up @@ -194,7 +194,7 @@ module "follower-2" {
# join:
# - "${module.leader.private_ip}:9100"
# server_urls:
# - "${module.leader.private_ip}:8080"
# - "${module.leader.private_ip}:8800"
# alert_urls:
# - "${module.inmemory-storage.private_ip}:8888"
# snapshots_store_urls:
Expand Down
2 changes: 1 addition & 1 deletion deploy/aws/network.tf
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ module "security_group" {
egress_rules = ["all-all"]

ingress_cidr_blocks = ["${chomp(data.http.ip.body)}/32"]
ingress_rules = ["http-8080-tcp", "all-icmp", "ssh-tcp" ]
ingress_rules = ["http-8800-tcp", "all-icmp", "ssh-tcp" ]
ingress_with_cidr_blocks = [
{
from_port = 6060
Expand Down
4 changes: 2 additions & 2 deletions docs/advanced_usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ go run main.go start \
-p $(mktemp -d /var/tmp/demo.XXX) \
--raftpath $(mktemp -d /var/tmp/demo.XXX) \
-y ~/.ssh/id_ed25519-qed \
--http-addr :8080 \
--http-addr :8800 \
--raft-addr :9000 \
--mgmt-addr :8090 \
-l error
Expand Down Expand Up @@ -87,7 +87,7 @@ To be production-ready, both services must be developed and deployed separatelly
export masterEndpoint="127.0.0.1:9100"
export publisherEndpoint="http://127.0.0.1:8888"
export alertsEndpoint="http://127.0.0.1:8888"
export qedEndpoint="http://127.0.0.1:8080"
export qedEndpoint="http://127.0.0.1:8800"
```

```bash
Expand Down
2 changes: 1 addition & 1 deletion server/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func DefaultConfig() *Config {
return &Config{
APIKey: "",
NodeID: hostname,
HTTPAddr: "127.0.0.1:8080",
HTTPAddr: "127.0.0.1:8800",
RaftAddr: "127.0.0.1:9000",
MgmtAddr: "127.0.0.1:8090",
MetricsAddr: "127.0.0.1:9990",
Expand Down
2 changes: 1 addition & 1 deletion tests/attack_add/attack_add.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func main() {
workers := flag.Uint64("w", 1, "Request per second")
timeout := flag.Duration("t", 30*time.Second, "Timeout")
duration := flag.Duration("d", 10*time.Second, "Duration")
endpoint := flag.String("e", "http://localhost:8080/events", "Endpoint")
endpoint := flag.String("e", "http://localhost:8800/events", "Endpoint")
apikey := flag.String("k", "apikey", "apikey")
rate := flag.Int("r", 100, "Request per second")
flag.Parse()
Expand Down
2 changes: 1 addition & 1 deletion tests/cloud/aws/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ module "security_group" {
vpc_id = "${data.aws_vpc.default.id}"

ingress_cidr_blocks = ["${chomp(data.http.ip.body)}/32"]
ingress_rules = ["http-8080-tcp", "all-icmp", "ssh-tcp" ]
ingress_rules = ["http-8800-tcp", "all-icmp", "ssh-tcp" ]
egress_rules = ["all-all"]
}

Expand Down
2 changes: 1 addition & 1 deletion tests/cloud/aws/templates/start_master
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ echo Create id_ed25519 key
yes | ssh-keygen -t ed25519 -N '' -f /var/tmp/id_ed25519

echo Starting server...
nohup /tmp/to_upload/qed start -k pepe -p $(mktemp -d /var/tmp/demo.XXX) --raftpath $(mktemp -d /var/tmp/demo.XXX) -y /var/tmp/id_ed25519 -l error --http-addr ${master_address}:8080 --raft-addr ${master_address}:9000 --mgmt-addr ${master_address}:8090 &
nohup /tmp/to_upload/qed start -k pepe -p $(mktemp -d /var/tmp/demo.XXX) --raftpath $(mktemp -d /var/tmp/demo.XXX) -y /var/tmp/id_ed25519 -l error --http-addr ${master_address}:8800 --raft-addr ${master_address}:9000 --mgmt-addr ${master_address}:8090 &
echo done.

sleep 10
4 changes: 2 additions & 2 deletions tests/cloud/aws/templates/stress-throughput-60s
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ yes | ssh-keygen -t ed25519 -N '' -f /var/tmp/id_ed25519

echo Stress time!

wrk -t100 -c100 -d60s --latency -s /tmp/to_upload/attack_add.lua http://${master_address}:8080 >> /tmp/"$(curl -s http://169.254.169.254/latest/meta-data/instance-type)-results.txt"
wrk -t100 -c100 -d60s --latency -s /tmp/to_upload/attack_add.lua http://${master_address}:8800 >> /tmp/"$(curl -s http://169.254.169.254/latest/meta-data/instance-type)-results.txt"
cat /proc/cpuinfo >> /tmp/"$(curl -s http://169.254.169.254/latest/meta-data/instance-type)-results.txt"
echo done.

echo Cleanup...
/sbin/fuser -k -n tcp 8080
/sbin/fuser -k -n tcp 8800
rm -rf /var/tmp/demo.*
rm -f /var/tmp/id_ed25519{,.pub}
echo done.
2 changes: 1 addition & 1 deletion tests/demo/incremental-proof
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

case "$1" in
leader)
endpoint=http://localhost:8080
endpoint=http://localhost:8800
;;
follower1)
endpoint=http://localhost:8081
Expand Down
2 changes: 1 addition & 1 deletion tests/demo/query-membership
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

case "$1" in
leader)
endpoint=http://localhost:8080
endpoint=http://localhost:8800
;;
follower1)
endpoint=http://localhost:8081
Expand Down
4 changes: 2 additions & 2 deletions tests/demo/start-leader
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ echo Create id_ed25519 key
ssh-keygen -t ed25519 -N '' -f /var/tmp/id_ed25519

echo 'Starting leader...'
go run ../../main.go start -k pepe -p $(mktemp -d /var/tmp/demo.XXX) --raftpath $(mktemp -d /var/tmp/demo.XXX) -y /var/tmp/id_ed25519 -l debug --http-addr :8080 --raft-addr :9000 --mgmt-addr :8090
go run ../../main.go start -k pepe -p $(mktemp -d /var/tmp/demo.XXX) --raftpath $(mktemp -d /var/tmp/demo.XXX) -y /var/tmp/id_ed25519 -l debug --http-addr :8800 --raft-addr :9000 --mgmt-addr :8090
echo done.

echo Cleanup...
if [ $(uname) == "Darwin" ]; then
pkill main
else
fuser -k -n tcp 8080
fuser -k -n tcp 8800
fi

rm -rf /var/tmp/demo.*
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ import (
)

const (
QEDUrl = "http://127.0.0.1:8080"
QEDTLS = "https://localhost:8080"
QEDUrl = "http://127.0.0.1:8800"
QEDTLS = "https://localhost:8800"
QEDGossip = "127.0.0.1:9010"
QEDTamperURL = "http://127.0.0.1:8081/tamper"
StoreURL = "http://127.0.0.1:8888"
Expand Down
2 changes: 1 addition & 1 deletion tests/gossip/add.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash

go run $GOPATH/src/github.com/bbva/qed/main.go client add -k key -e http://127.0.0.1:8080 --key key$1 --value value$1
go run $GOPATH/src/github.com/bbva/qed/main.go client add -k key -e http://127.0.0.1:8800 --key key$1 --value value$1
2 changes: 1 addition & 1 deletion tests/gossip/run_gossip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
qedGossipEndpoint="127.0.0.1:9100"
snapshotStoreEndpoint="http://127.0.0.1:8888"
alertsStoreEndpoint="http://127.0.0.1:8888"
qedHTTPEndpoint="http://127.0.0.1:8080"
qedHTTPEndpoint="http://127.0.0.1:8800"
keyFile="/var/tmp/id_ed25519"
QED="go run $GOPATH/src/github.com/bbva/qed/main.go"

Expand Down
2 changes: 1 addition & 1 deletion tests/riot.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func NewDefaultConfig() *Config {
req: HTTPClient{
client: nil,
method: "POST",
endpoint: "http://localhost:8080",
endpoint: "http://localhost:8800",
expectedStatusCode: 200,
},
}
Expand Down
2 changes: 1 addition & 1 deletion tests/start_profiler
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ check_profiling() {

profiler_cmd() {
ELAPSED=0
while curl -s -X POST http://localhost:8080/health-check 2>&1 > /dev/null ; do
while curl -s -X POST http://localhost:8800/health-check 2>&1 > /dev/null ; do
(BALLOON_VERSION=$(curl -s http://localhost:6060/debug/vars | awk -F '"version": ' '/balloon_stats/ {print $2}' | tr -d '},')
# Avoid empty version because preload process is not already started...
: ${BALLOON_VERSION:=0}
Expand Down
6 changes: 3 additions & 3 deletions tests/start_server
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,16 @@ fi
if [ -z "$CLUSTER_SIZE" ]
then
echo Starting single server...
go run ../main.go start -k pepe -p /var/tmp/demo.dbpath --raftpath /var/tmp/demo.raftpath -y /var/tmp/id_ed25519 -l error --http-addr :8080 --raft-addr :9000 --mgmt-addr :8090 $PROFILING &
go run ../main.go start -k pepe -p /var/tmp/demo.dbpath --raftpath /var/tmp/demo.raftpath -y /var/tmp/id_ed25519 -l error --http-addr :8800 --raft-addr :9000 --mgmt-addr :8090 $PROFILING &
sleep 10
echo done.
else
echo Starting cluster mode...
go run ../main.go start -k pepe -p $(mktemp -d /var/tmp/demo.XXX) --raftpath $(mktemp -d /var/tmp/demo.XXX) -y /var/tmp/id_ed25519 -l error --http-addr :8080 --raft-addr :9000 --mgmt-addr :8090 $PROFILING &
go run ../main.go start -k pepe -p $(mktemp -d /var/tmp/demo.XXX) --raftpath $(mktemp -d /var/tmp/demo.XXX) -y /var/tmp/id_ed25519 -l error --http-addr :8800 --raft-addr :9000 --mgmt-addr :8090 $PROFILING &
sleep 10
echo Starting followers
for i in $(seq 1 $CLUSTER_SIZE); do
go run ../main.go start -k pepe -p $(mktemp -d /var/tmp/demo.XXX) --raftpath $(mktemp -d /var/tmp/demo.XXX) -y /var/tmp/id_ed25519 -l error --http-addr :808$i --join-addr :8090 --raft-addr :900$i --mgmt-addr :809$i --node-id node$i &
go run ../main.go start -k pepe -p $(mktemp -d /var/tmp/demo.XXX) --raftpath $(mktemp -d /var/tmp/demo.XXX) -y /var/tmp/id_ed25519 -l error --http-addr :880$i --join-addr :8090 --raft-addr :900$i --mgmt-addr :809$i --node-id node$i &
done
sleep 10
echo done.
Expand Down
2 changes: 1 addition & 1 deletion tests/stop_server
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ echo Cleanup...
if [ $(uname) == "Darwin" ]; then
killall main || exit 0
else
fuser -k -n tcp 8080 8081 8082 8083 8084 || true
fuser -k -n tcp 8800 8801 8802 8803 8804 || true
fi
sleep 5
[ -f /var/tmp/keepme ] || rm -rf /var/tmp/demo.*
Expand Down
2 changes: 1 addition & 1 deletion tests/stress-latency-60s
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
./start_server

echo Stress time!
go run attack_add/attack_add.go -w 100 -r 1000 -d 60s -k pepe -e http://localhost:8080/events > report.bin
go run attack_add/attack_add.go -w 100 -r 1000 -d 60s -k pepe -e http://localhost:8800/events > report.bin
cat report.bin | vegeta report
cat report.bin | vegeta plot > plot.html
echo done.
Expand Down
2 changes: 1 addition & 1 deletion tests/stress-throughput-60s
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
./start_server

echo Stress time!
wrk -t100 -c1000 -d60s --latency -s attack_add/attack_add.lua http://localhost:8080
wrk -t100 -c1000 -d60s --latency -s attack_add/attack_add.lua http://localhost:8800
echo done.

./stop_server

0 comments on commit ae0a409

Please sign in to comment.