Merge remote-tracking branch 'upstream/master' into issue_656

License: MIT
Signed-off-by: Robert Ignat <robert.ignat91@gmail.com>
This commit is contained in:
Robert Ignat 2019-02-15 16:45:32 +02:00
commit 47252f8e62
10 changed files with 45 additions and 126 deletions

View File

@ -1 +1 @@
0.8.0: QmfDMnXBd6ChZziataTVWszPFKo1Yr4AwMYWPHXKBfCUAe 0.9.0-rc1: QmcRVRzzSRxvs3juEmeVEwEBhHsk12gpCEbzApeqV4K8wU

Binary file not shown.

View File

@ -56,21 +56,3 @@ jobs:
- make install - make install
- docker pull ipfs/go-ipfs - docker pull ipfs/go-ipfs
- make test_sharness && make clean_sharness - make test_sharness && make clean_sharness
- stage: "Snapcraft deployment stage (Stable)"
name: "Deploy Snapcraft"
if: (NOT type IN (pull_request)) AND (fork = false) AND (tag =~ ^v\d+\.\d+\.\d+$)
script:
- openssl aes-256-cbc -K $encrypted_5a1cb914c6c9_key -iv $encrypted_5a1cb914c6c9_iv -in .snapcraft/travis_snapcraft.cfg -out .snapcraft/snapcraft.cfg -d
- docker run -v $(pwd):$(pwd) -t snapcore/snapcraft sh -c "apt update -qq && cd $(pwd) && ./snap/snap-multiarch.sh edge" # should be stable
- stage: "Snapcraft deployment stage (Candidate)"
name: "Deploy Snapcraft"
if: (NOT type IN (pull_request)) AND (fork = false) AND (tag =~ ^v\d+\.\d+\.\d+-rc\d+$)
script:
- openssl aes-256-cbc -K $encrypted_5a1cb914c6c9_key -iv $encrypted_5a1cb914c6c9_iv -in .snapcraft/travis_snapcraft.cfg -out .snapcraft/snapcraft.cfg -d
- docker run -v $(pwd):$(pwd) -t snapcore/snapcraft sh -c "apt update -qq && cd $(pwd) && ./snap/snap-multiarch.sh edge" # should be candidate
- stage: "Snapcraft deployment stage (Edge)"
name: "Deploy Snapcraft"
if: (NOT type IN (pull_request)) AND (branch = master) AND (fork = false) AND (tag IS NOT present)
script:
- openssl aes-256-cbc -K $encrypted_5a1cb914c6c9_key -iv $encrypted_5a1cb914c6c9_iv -in .snapcraft/travis_snapcraft.cfg -out .snapcraft/snapcraft.cfg -d
- docker run -v $(pwd):$(pwd) -t snapcore/snapcraft sh -c "apt update -qq && cd $(pwd) && ./snap/snap-multiarch.sh edge"

View File

@ -29,7 +29,7 @@ const programName = `ipfs-cluster-ctl`
// Version is the cluster-ctl tool version. It should match // Version is the cluster-ctl tool version. It should match
// the IPFS cluster's version // the IPFS cluster's version
const Version = "0.8.0" const Version = "0.9.0-rc1"
var ( var (
defaultHost = "/ip4/127.0.0.1/tcp/9094" defaultHost = "/ip4/127.0.0.1/tcp/9094"

View File

@ -21,12 +21,12 @@ const tracingEnvConfigKey = "cluster_tracing"
const ( const (
DefaultEnableStats = false DefaultEnableStats = false
DefaultPrometheusEndpoint = "/ip4/0.0.0.0/tcp/8888" DefaultPrometheusEndpoint = "/ip4/0.0.0.0/tcp/8888"
DefaultStatsReportingInterval = 2 * time.Second DefaultReportingInterval = 2 * time.Second
DefaultEnableTracing = false DefaultEnableTracing = false
DefaultJaegerAgentEndpoint = "/ip4/0.0.0.0/udp/6831" DefaultJaegerAgentEndpoint = "/ip4/0.0.0.0/udp/6831"
DefaultTracingSamplingProb = 0.3 DefaultSamplingProb = 0.3
DefaultTracingServiceName = "cluster-daemon" DefaultServiceName = "cluster-daemon"
) )
// MetricsConfig configures metrics collection. // MetricsConfig configures metrics collection.
@ -35,13 +35,13 @@ type MetricsConfig struct {
EnableStats bool EnableStats bool
PrometheusEndpoint ma.Multiaddr PrometheusEndpoint ma.Multiaddr
StatsReportingInterval time.Duration ReportingInterval time.Duration
} }
type jsonMetricsConfig struct { type jsonMetricsConfig struct {
EnableStats bool `json:"enable_stats"` EnableStats bool `json:"enable_stats"`
PrometheusEndpoint string `json:"prometheus_endpoint"` PrometheusEndpoint string `json:"prometheus_endpoint"`
StatsReportingInterval string `json:"reporting_interval"` ReportingInterval string `json:"reporting_interval"`
} }
// ConfigKey provides a human-friendly identifier for this type of Config. // ConfigKey provides a human-friendly identifier for this type of Config.
@ -54,7 +54,7 @@ func (cfg *MetricsConfig) Default() error {
cfg.EnableStats = DefaultEnableStats cfg.EnableStats = DefaultEnableStats
endpointAddr, _ := ma.NewMultiaddr(DefaultPrometheusEndpoint) endpointAddr, _ := ma.NewMultiaddr(DefaultPrometheusEndpoint)
cfg.PrometheusEndpoint = endpointAddr cfg.PrometheusEndpoint = endpointAddr
cfg.StatsReportingInterval = DefaultStatsReportingInterval cfg.ReportingInterval = DefaultReportingInterval
return nil return nil
} }
@ -79,7 +79,7 @@ func (cfg *MetricsConfig) Validate() error {
if cfg.PrometheusEndpoint == nil { if cfg.PrometheusEndpoint == nil {
return errors.New("metrics.prometheus_endpoint is undefined") return errors.New("metrics.prometheus_endpoint is undefined")
} }
if cfg.StatsReportingInterval < 0 { if cfg.ReportingInterval < 0 {
return errors.New("metrics.reporting_interval is invalid") return errors.New("metrics.reporting_interval is invalid")
} }
} }
@ -121,8 +121,8 @@ func (cfg *MetricsConfig) loadMetricsOptions(jcfg *jsonMetricsConfig) error {
return config.ParseDurations( return config.ParseDurations(
metricsConfigKey, metricsConfigKey,
&config.DurationOpt{ &config.DurationOpt{
Duration: jcfg.StatsReportingInterval, Duration: jcfg.ReportingInterval,
Dst: &cfg.StatsReportingInterval, Dst: &cfg.ReportingInterval,
Name: "metrics.reporting_interval", Name: "metrics.reporting_interval",
}, },
) )
@ -133,7 +133,7 @@ func (cfg *MetricsConfig) ToJSON() ([]byte, error) {
jcfg := &jsonMetricsConfig{ jcfg := &jsonMetricsConfig{
EnableStats: cfg.EnableStats, EnableStats: cfg.EnableStats,
PrometheusEndpoint: cfg.PrometheusEndpoint.String(), PrometheusEndpoint: cfg.PrometheusEndpoint.String(),
StatsReportingInterval: cfg.StatsReportingInterval.String(), ReportingInterval: cfg.ReportingInterval.String(),
} }
return config.DefaultJSONMarshal(jcfg) return config.DefaultJSONMarshal(jcfg)
@ -145,15 +145,15 @@ type TracingConfig struct {
EnableTracing bool EnableTracing bool
JaegerAgentEndpoint ma.Multiaddr JaegerAgentEndpoint ma.Multiaddr
TracingSamplingProb float64 SamplingProb float64
TracingServiceName string ServiceName string
} }
type jsonTracingConfig struct { type jsonTracingConfig struct {
EnableTracing bool `json:"enable_tracing"` EnableTracing bool `json:"enable_tracing"`
JaegerAgentEndpoint string `json:"jaeger_agent_endpoint"` JaegerAgentEndpoint string `json:"jaeger_agent_endpoint"`
TracingSamplingProb float64 `json:"sampling_prob"` SamplingProb float64 `json:"sampling_prob"`
TracingServiceName string `json:"service_name"` ServiceName string `json:"service_name"`
} }
// ConfigKey provides a human-friendly identifier for this type of Config. // ConfigKey provides a human-friendly identifier for this type of Config.
@ -166,8 +166,8 @@ func (cfg *TracingConfig) Default() error {
cfg.EnableTracing = DefaultEnableTracing cfg.EnableTracing = DefaultEnableTracing
agentAddr, _ := ma.NewMultiaddr(DefaultJaegerAgentEndpoint) agentAddr, _ := ma.NewMultiaddr(DefaultJaegerAgentEndpoint)
cfg.JaegerAgentEndpoint = agentAddr cfg.JaegerAgentEndpoint = agentAddr
cfg.TracingSamplingProb = DefaultTracingSamplingProb cfg.SamplingProb = DefaultSamplingProb
cfg.TracingServiceName = DefaultTracingServiceName cfg.ServiceName = DefaultServiceName
return nil return nil
} }
@ -191,7 +191,7 @@ func (cfg *TracingConfig) Validate() error {
if cfg.JaegerAgentEndpoint == nil { if cfg.JaegerAgentEndpoint == nil {
return errors.New("tracing.jaeger_agent_endpoint is undefined") return errors.New("tracing.jaeger_agent_endpoint is undefined")
} }
if cfg.TracingSamplingProb < 0 { if cfg.SamplingProb < 0 {
return errors.New("tracing.sampling_prob is invalid") return errors.New("tracing.sampling_prob is invalid")
} }
} }
@ -229,8 +229,8 @@ func (cfg *TracingConfig) loadTracingOptions(jcfg *jsonTracingConfig) error {
return fmt.Errorf("loadTracingOptions: JaegerAgentEndpoint multiaddr: %v", err) return fmt.Errorf("loadTracingOptions: JaegerAgentEndpoint multiaddr: %v", err)
} }
cfg.JaegerAgentEndpoint = agentAddr cfg.JaegerAgentEndpoint = agentAddr
cfg.TracingSamplingProb = jcfg.TracingSamplingProb cfg.SamplingProb = jcfg.SamplingProb
cfg.TracingServiceName = jcfg.TracingServiceName cfg.ServiceName = jcfg.ServiceName
return nil return nil
} }
@ -240,8 +240,8 @@ func (cfg *TracingConfig) ToJSON() ([]byte, error) {
jcfg := &jsonTracingConfig{ jcfg := &jsonTracingConfig{
EnableTracing: cfg.EnableTracing, EnableTracing: cfg.EnableTracing,
JaegerAgentEndpoint: cfg.JaegerAgentEndpoint.String(), JaegerAgentEndpoint: cfg.JaegerAgentEndpoint.String(),
TracingSamplingProb: cfg.TracingSamplingProb, SamplingProb: cfg.SamplingProb,
TracingServiceName: cfg.TracingServiceName, ServiceName: cfg.ServiceName,
} }
return config.DefaultJSONMarshal(jcfg) return config.DefaultJSONMarshal(jcfg)

View File

@ -78,7 +78,7 @@ func setupMetrics(cfg *MetricsConfig) error {
// register prometheus with opencensus // register prometheus with opencensus
view.RegisterExporter(pe) view.RegisterExporter(pe)
view.SetReportingPeriod(cfg.StatsReportingInterval) view.SetReportingPeriod(cfg.ReportingInterval)
// register the metrics views of interest // register the metrics views of interest
if err := view.Register(DefaultViews...); err != nil { if err := view.Register(DefaultViews...); err != nil {
@ -116,15 +116,15 @@ func setupMetrics(cfg *MetricsConfig) error {
mux.Handle("/metrics", pe) mux.Handle("/metrics", pe)
mux.Handle("/debug/vars", expvar.Handler()) mux.Handle("/debug/vars", expvar.Handler())
mux.HandleFunc("/debug/pprof", pprof.Index) mux.HandleFunc("/debug/pprof", pprof.Index)
mux.HandleFunc("/debug/cmdline", pprof.Cmdline) mux.HandleFunc("/debug/pprof/cmdline", pprof.Cmdline)
mux.HandleFunc("/debug/profile", pprof.Profile) mux.HandleFunc("/debug/pprof/profile", pprof.Profile)
mux.HandleFunc("/debug/symbol", pprof.Symbol) mux.HandleFunc("/debug/pprof/symbol", pprof.Symbol)
mux.HandleFunc("/debug/trace", pprof.Trace) mux.HandleFunc("/debug/pprof/trace", pprof.Trace)
mux.Handle("/debug/block", pprof.Handler("block")) mux.Handle("/debug/pprof/block", pprof.Handler("block"))
mux.Handle("/debug/goroutine", pprof.Handler("goroutine")) mux.Handle("/debug/pprof/goroutine", pprof.Handler("goroutine"))
mux.Handle("/debug/heap", pprof.Handler("heap")) mux.Handle("/debug/pprof/heap", pprof.Handler("heap"))
mux.Handle("/debug/mutex", pprof.Handler("mutex")) mux.Handle("/debug/pprof/mutex", pprof.Handler("mutex"))
mux.Handle("/debug/threadcreate", pprof.Handler("threadcreate")) mux.Handle("/debug/pprof/threadcreate", pprof.Handler("threadcreate"))
if err := http.ListenAndServe(promAddr, mux); err != nil { if err := http.ListenAndServe(promAddr, mux); err != nil {
logger.Fatalf("Failed to run Prometheus /metrics endpoint: %v", err) logger.Fatalf("Failed to run Prometheus /metrics endpoint: %v", err)
} }
@ -142,7 +142,7 @@ func setupTracing(cfg *TracingConfig) (*jaeger.Exporter, error) {
je, err := jaeger.NewExporter(jaeger.Options{ je, err := jaeger.NewExporter(jaeger.Options{
AgentEndpoint: agentAddr, AgentEndpoint: agentAddr,
Process: jaeger.Process{ Process: jaeger.Process{
ServiceName: cfg.TracingServiceName, ServiceName: cfg.ServiceName,
}, },
}) })
if err != nil { if err != nil {
@ -152,6 +152,6 @@ func setupTracing(cfg *TracingConfig) (*jaeger.Exporter, error) {
// register jaeger with opencensus // register jaeger with opencensus
trace.RegisterExporter(je) trace.RegisterExporter(je)
// configure tracing // configure tracing
trace.ApplyConfig(trace.Config{DefaultSampler: trace.ProbabilitySampler(cfg.TracingSamplingProb)}) trace.ApplyConfig(trace.Config{DefaultSampler: trace.ProbabilitySampler(cfg.SamplingProb)})
return je, nil return je, nil
} }

View File

@ -180,6 +180,6 @@
"license": "MIT", "license": "MIT",
"name": "ipfs-cluster", "name": "ipfs-cluster",
"releaseCmd": "git commit -S -a -m \"gx publish $VERSION\"", "releaseCmd": "git commit -S -a -m \"gx publish $VERSION\"",
"version": "0.8.0" "version": "0.9.0-rc1"
} }

View File

@ -1,27 +0,0 @@
#!/bin/bash
#
# Build the ipfs-cluster snaps and push them to the store.
set -ev
release=$1
snap() {
export SNAP_ARCH_TRIPLET=$1
export TARGET_GOARCH=$2
target_arch=$3
release=$4
echo "Building and pushing snap:"
echo "SNAP_ARCH_TRIPLET=${SNAP_ARCH_TRIPLET}"
echo "TARGET_GOARCH=${TARGET_GOARCH}"
echo "target_arch=${target_arch}"
echo "release=${release}"
snapcraft clean
snapcraft --target-arch $target_arch
snapcraft push ipfs-cluster*${target_arch}.snap --release $release
}
snap x86_64-linux-gnu amd64 amd64 $release
snap arm-linux-gnueabihf arm armhf $release
snap aarch64-linux-gnu arm64 arm64 $release

View File

@ -1,36 +0,0 @@
name: ipfs-cluster
version: git
summary: Collective pinning and composition for IPFS
description: |
ipfs-cluster allows to replicate content (by pinning) in multiple IPFS nodes.
confinement: strict
apps:
service:
command: ipfs-cluster-service
plugs: [home, network, network-bind]
aliases: [ipfs-cluster-service]
ctl:
command: ipfs-cluster-ctl
plugs: [network]
aliases: [ipfs-cluster-ctl]
parts:
ipfs-cluster:
source: .
plugin: nil
build-packages: [make, wget]
prepare: |
mkdir -p ../go/src/github.com/ipfs/ipfs-cluster
cp -R . ../go/src/github.com/ipfs/ipfs-cluster
build: |
env GOPATH=$(pwd)/../go CC=$SNAP_ARCH_TRIPLET-gcc CXX=$SNAP_ARCH_TRIPLET-g++ CGO_ENABLED=1 GOARCH=$TARGET_GOARCH make -C ../go/src/github.com/ipfs/ipfs-cluster install
install: |
mkdir $SNAPCRAFT_PART_INSTALL/bin
for file in $(find ../go/bin/ -type f); do
mv $file $SNAPCRAFT_PART_INSTALL/bin/
done
after: [go]
go:
source-tag: go1.11

View File

@ -9,7 +9,7 @@ import (
// Version is the current cluster version. Version alignment between // Version is the current cluster version. Version alignment between
// components, apis and tools ensures compatibility among them. // components, apis and tools ensures compatibility among them.
var Version = semver.MustParse("0.8.0") var Version = semver.MustParse("0.9.0-rc1")
// RPCProtocol is used to send libp2p messages between cluster peers // RPCProtocol is used to send libp2p messages between cluster peers
var RPCProtocol = protocol.ID( var RPCProtocol = protocol.ID(