Skip to content

Commit

Permalink
Resolve Merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
aleitner committed Aug 27, 2018
2 parents 2b2c19f + c4e364c commit cfc70f9
Show file tree
Hide file tree
Showing 69 changed files with 402 additions and 371 deletions.
53 changes: 40 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

GO_VERSION ?= 1.10
COMPOSE_PROJECT_NAME := ${TAG}-$(shell git rev-parse --abbrev-ref HEAD)
GO_DIRS := $(shell go list ./... | grep -v storj.io/storj/examples)
BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
ifeq (${BRANCH},master)
TAG := $(shell git rev-parse --short HEAD)-go${GO_VERSION}
Expand All @@ -12,22 +11,50 @@ TAG := $(shell git rev-parse --short HEAD)-${BRANCH}-go${GO_VERSION}
endif


# currently disabled linters:
# gofmt # enable after switch to go1.11
# goimpor # enable after switch to go1.11
# unparam # enable later
# gosec # enable later
# vetshadow # enable later
# gochecknoinits # enable later
# gochecknoglobals # enable later
# dupl # needs tuning
# gocyclo # needs tuning
# lll # long lines, not relevant
# gotype, gotypex # already done by compiling
# safesql # no sql
# interfacer # not that useful
lint: check-copyrights
@echo "Running ${@}"
@gometalinter \
--deadline=170s \
--disable-all \
--enable=golint \
--enable=errcheck \
--enable=goimports \
--enable=vet \
--enable=deadcode \
--enable=goconst \
--deadline=10m \
--enable-all \
--enable=golint \
--enable=errcheck \
--enable=unconvert \
--enable=structcheck \
--enable=misspell \
--disable=goimports \
--enable=ineffassign \
--disable=gofmt \
--enable=nakedret \
--enable=megacheck \
--disable=unparam \
--disable=gosec \
--disable=vetshadow \
--disable=gochecknoinits \
--disable=gochecknoglobals \
--disable=dupl \
--disable=gocyclo \
--disable=lll \
--disable=gotype --disable=gotypex \
--disable=safesql \
--disable=interfacer \
--skip=examples \
--exclude=".*\.pb\.go" \
--exclude=".*\.dbx\.go" \
--exclude=".*_test.go" \
--exclude="examples/*" \
${GO_DIRS}
./...

check-copyrights:
@echo "Running ${@}"
Expand All @@ -51,7 +78,7 @@ build-dev-deps:

test: lint
go install -v ./...
go test -v -covermode=count -coverprofile=coverage.out ./...
go test -race -v -covermode=atomic -coverprofile=coverage.out ./...
gover
@echo done

Expand Down
101 changes: 39 additions & 62 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ Storj is in the midst of a rearchitecture. Please stay tuned for our v3 whitepap

----

Storj is a platform, token, and suite of decentralized applications that allows you to store data in a secure and decentralized manner. Your files are encrypted, shredded into little pieces and stored in a global decentralized network of computers. Luckily, we also support allowing you (and only you) to recover them!
Storj is a platform, token, and suite of decentralized applications that allows
you to store data in a secure and decentralized manner. Your files are
encrypted, shredded into little pieces and stored in a global decentralized
network of computers. Luckily, we also support allowing you (and only you) to
recover them!

## Table of Contents

Expand All @@ -23,17 +27,19 @@ Storj is a platform, token, and suite of decentralized applications that allows
# Start Using Storj


#### Download the latest release
#### Download, setup, and run the latest release

Go here to download the latest build
// TODO: add link when a build is released
// TODO for how to run the release
* TODO: add link when a build is released
* TODO for how to run the release

## Using Storj via the Storj CLI <a name="storjcli"></a>

#### Configure the Storj CLI
1) In a new terminal setup the Storj CLI: ```$ storj setup```
2) Edit the API Key, overlay address, and pointer db address fields in the Storj CLI config file located at ```~/.storj/cli/config.yaml``` with values from the captplanet config file located at ```~/.storj/capt/config.yaml```
2) Edit the API Key, overlay address, and pointer db address fields in the Storj
CLI config file located at ```~/.storj/cli/config.yaml``` with values from the
captplanet config file located at ```~/.storj/capt/config.yaml```

#### Test out some Storj CLI commands!

Expand All @@ -57,11 +63,11 @@ $ aws configure
AWS Access Key ID [None]: insecure-dev-access-key
AWS Secret Access Key [None]: insecure-dev-secret-key
Default region name [None]: us-east-1
Default output format [None]:
Default output format [None]:
$ aws configure set default.s3.multipart_threshold 1TB # until we support multipart
```

#### Test out some AWS S3 CLI commands!
#### Test out some AWS S3 CLI commands!

1) Create a bucket: ```$ aws s3 --endpoint=http://localhost:7777/ mb s3://bucket-name```
2) Upload an object: ```$ aws s3 --endpoint=http://localhost:7777/ cp ~/Desktop/your-large-file.mp4 s3://bucket-name```
Expand All @@ -77,86 +83,57 @@ For more information about the AWS s3 CLI visit: https://docs.aws.amazon.com/cli

### Install required packages

First, install git and golang. We currently support Debian-based and Mac operating systems
Download and install the latest release of Go, at least Go 1.11:
https://golang.org/

#### Debian based (like Ubuntu)
You will also need Git. (`brew install git`, `apt-get install git`, etc).

Download and install the latest release of go https://golang.org/
Install git and golang. We support Linux, Mac, and Windows operating
systems. Other operating systems supported by Go are probably not much
additional work.

```
apt-get install git golang
echo 'export STORJDEV="$HOME/storj"' >> $HOME/.bashrc
echo 'export GOPATH="$STORJDEV:$STORJDEV/vendor"' >> $HOME/.bashrc
echo 'export PATH="$PATH:$STORJDEV/bin"' >> $HOME/.bashrc
source $HOME/.bashrc
```

#### Mac OSX

```bash
brew install git go
if test -e $HOME/.bash_profile
then
echo 'export STORJDEV="$HOME/storj"' >> $HOME/.bash_profile
echo 'export GOPATH="$STORJDEV:$STORJDEV/vendor"' >> $HOME/.bash_profile
echo 'export PATH="$PATH:$STORJDEV/bin"' >> $HOME/.bash_profile
source $HOME/.bash_profile
else
echo 'export STORJDEV="$HOME/storj"' >> $HOME/.profile
echo 'export GOPATH="$STORJDEV:$STORJDEV/vendor"' >> $HOME/.profile
echo 'export PATH="$PATH:$STORJDEV/bin"' >> $HOME/.profile
source $HOME/.profile
fi
```

#### Windows
### Download and compile Storj

Windows requires go1.11 or newer.
> **Aside about GOPATH**: Go 1.11 supports a new feature called Go modules,
> and Storj has adopted Go module support. If you've used previous Go versions,
> Go modules no longer require a GOPATH environment variable. Go by default
> falls back to the old behavior if you check out code inside of the directory
> referenced by your GOPATH variable, so make sure to use another directory,
> `unset GOPATH` entirely, or set `GO111MODULE=on` before continuing with these
> instructions. If you don't have a GOPATH set, you can ignore this aside.
```bash
git clone git@github.com:storj/storj storj
cd storj
go install ./cmd/...

captplanet setup
captplanet run
```

### Install storj

Clone the storj repository. You may want to clone your own fork and branch.

```bash
mkdir -p $STORJDEV/src/storj.io
git clone https://github.com/storj/storj $STORJDEV/src/storj.io/storj
go install -v ./cmd/...
```

### Install all dependencies
### Configure a test network

```bash
git clone --recursive https://github.com/storj/storj-vendor $STORJDEV/vendor
rm -rf $STORJDEV/vendor/src/github.com/minio/minio/vendor/github.com/minio/cli
rm -rf $STORJDEV/vendor/src/github.com/minio/minio/vendor/golang.org/x/net/trace
~/go/bin/captplanet setup
```

### Start the network
### Start the test network

```bash
$ go install -v storj.io/storj/cmd/captplanet
$ captplanet setup
$ captplanet run
~/go/bin/captplanet run
```

### Try out some commands via Storj CLI or AWS CLI

### Run unit tests

```bash
go test storj.io/storj/...
go test -v ./...
```

You can execute only a single test package. For example: `go test storj.io/storj/pkg/kademlia`. Add -v for more informations about the executed unit tests.
You can execute only a single test package if you like. For example:
`go test ./pkg/kademlia`. Add `-v` for more informations about the executed unit
tests.

## Support <a name="support"></a>

If you have any questions or suggestions please reach out to us on [Rocketchat](https://community.storj.io/) or [Twitter](https://twitter.com/storjproject).
If you have any questions or suggestions please reach out to us on
[Rocketchat](https://community.storj.io/) or
[Twitter](https://twitter.com/storjproject).
2 changes: 2 additions & 0 deletions cmd/captplanet/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const (
storagenodeCount = 50
)

// HeavyClient is for configuring client
type HeavyClient struct {
Identity provider.IdentityConfig
Kademlia kademlia.Config
Expand All @@ -31,6 +32,7 @@ type HeavyClient struct {
MockOverlay bool `default:"true" help:"if false, use real overlay"`
}

// StorageNode is for configuring storage nodes
type StorageNode struct {
Identity provider.IdentityConfig
Kademlia kademlia.Config
Expand Down
4 changes: 1 addition & 3 deletions cmd/overlay/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ type cacheConfig struct {
}

func (c cacheConfig) open() (*overlay.Cache, error) {
overlay.NewBoltOverlayCache(cacheCfg.DatabaseURL, nil)

dburl, err := url.Parse(c.DatabaseURL)
if err != nil {
return nil, Error.Wrap(err)
Expand All @@ -38,7 +36,7 @@ func (c cacheConfig) open() (*overlay.Cache, error) {
if err != nil {
return nil, Error.New("invalid db: %s", err)
}
cache, err = overlay.NewRedisOverlayCache(dburl.Host, overlay.UrlPwd(dburl), db, nil)
cache, err = overlay.NewRedisOverlayCache(dburl.Host, overlay.GetUserPassword(dburl), db, nil)
if err != nil {
return nil, err
}
Expand Down
8 changes: 5 additions & 3 deletions cmd/overlay/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package main
import (
"encoding/json"
"io/ioutil"

"github.com/spf13/cobra"
"github.com/zeebo/errs"
"go.uber.org/zap"
Expand All @@ -16,6 +17,7 @@ import (
)

var (
// Error is the error class for overlays
Error = errs.Class("overlay error")
rootCmd = &cobra.Command{
Use: "overlay",
Expand Down Expand Up @@ -95,9 +97,9 @@ func cmdAdd(cmd *cobra.Command, args []string) (err error) {
Address: a,
},
Restrictions: &proto.NodeRestrictions{
FreeBandwidth: 2000000000,
FreeDisk: 2000000000,
},
FreeBandwidth: 2000000000,
FreeDisk: 2000000000,
},
Type: 1,
})
if err != nil {
Expand Down
7 changes: 5 additions & 2 deletions cmd/storj/cmd/cp.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ func copy(cmd *cobra.Command, args []string) (err error) {

if u.Scheme == "" {
f, err := os.Open(args[0])
if err != nil {
return err
}

fi, err := f.Stat()
if err != nil {
Expand All @@ -66,7 +69,7 @@ func copy(cmd *cobra.Command, args []string) (err error) {
return err
}

defer f.Close()
defer func() { _ = f.Close() }()

u, err = url.Parse(args[1])
if err != nil {
Expand Down Expand Up @@ -94,7 +97,7 @@ func copy(cmd *cobra.Command, args []string) (err error) {
return err
}

defer f.Close()
defer func() { _ = f.Close() }()

err = so.GetObject(ctx, oi.Bucket, oi.Name, 0, oi.Size, f, oi.ETag)
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions cmd/storj/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (

const defaultConfDir = "$HOME/.storj/cli"

// Config is miniogw.Config configuration
type Config struct {
miniogw.Config
}
Expand Down
8 changes: 4 additions & 4 deletions cmd/uplink/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ var (

runCfg miniogw.Config
setupCfg struct {
CA provider.CASetupConfig
Identity provider.IdentitySetupConfig
BasePath string `default:"$CONFDIR" help:"base path for setup"`
Concurrency uint `default:"4" help:"number of concurrent workers for certificate authority generation"`
CA provider.CASetupConfig
Identity provider.IdentitySetupConfig
BasePath string `default:"$CONFDIR" help:"base path for setup"`
// Concurrency uint `default:"4" help:"number of concurrent workers for certificate authority generation"`
Overwrite bool `default:"false" help:"whether to overwrite pre-existing configuration files"`
SatelliteAddr string `default:"localhost:7778" help:"the address to use for the satellite"`
APIKey string `default:"" help:"the api key to use for the satellite"`
Expand Down
4 changes: 2 additions & 2 deletions examples/piecestore-cli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"github.com/urfave/cli"
"github.com/zeebo/errs"

"storj.io/storj/pkg/piecestore"
pstore "storj.io/storj/pkg/piecestore"
"storj.io/storj/pkg/process"
)

Expand Down Expand Up @@ -101,7 +101,7 @@ func run(_ *cobra.Command, args []string) error {
return err
}

if fileInfo.IsDir() != true {
if !fileInfo.IsDir() {
return argError.New(fmt.Sprintf("Path (%s) is a file, not a directory", c.Args().Get(1)))
}

Expand Down
2 changes: 1 addition & 1 deletion examples/pointerdb-client/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (

var (
pointerdbClientPort string
ctx = context.Background()
ctx = context.Background()
)

func initializeFlags() {
Expand Down

0 comments on commit cfc70f9

Please sign in to comment.