Commit Graph

1691 Commits

Author SHA1 Message Date
Kishan Mohanbhai Sagathiya
6bd897ac47 Added UserAllocations support for add 2019-08-16 18:13:06 +05:30
Hector Sanjuan
dc2e73dfc2
Release 0.11.0-rc6 2019-08-13 20:25:53 +02:00
Hector Sanjuan
216d288b65
Merge pull request #884 from ipfs/fix/883-testadd
Fix #883: Tweak timeouts for better tests
2019-08-13 20:24:09 +02:00
Hector Sanjuan
28ae394fa9 Fix #883: Tweak timeouts for better tests 2019-08-13 19:44:48 +02:00
Hector Sanjuan
ea977d43aa
Merge pull request #882 from ipfs/fix/docker-crdt
Improve Docker support for CRDTs
2019-08-13 19:44:04 +02:00
Hector Sanjuan
4556cbe726 Docker: improve for CRDTs
This:

  * Allows choosing the consensus for the automatic "init" on Docker with
  IPFS_CLUSTER_CONSENSUS.

  * Removes IPFS_PATH and the sed replacements for 0.0.0.0 on RestAPI and
  Ipfsproxy endpoints because these are easily supported by setting env vars
  correctly and pose some security risk when running with net=host.

  * Brings up to date Dockerfile-test and Dockerfile-bundle, even if mostly
  unused.
2019-08-13 19:32:38 +02:00
Hector Sanjuan
bd6d01b32e Docker-compose: simplify, use CRDTs and mDNS
This makes the docker-compose.yml a way to get a test-example cluster up and
running. Since mDNS works now, cluster peers can auto-discover in the docker
network and do not need a command override to bootstrap.

More docs have been added to the top to make sure users use it to get up and
running with a test-cluster. Unnecessary port-exposures have been
removed. Cluster options have been set in a more canonical way using env vars.
2019-08-13 19:32:38 +02:00
Hector Sanjuan
dc3170b1d2 cluster: add mDNS service discovery
I always thought the libp2p node would do this, but it is not the case.
With this, CRDT peers are able to autodiscover on local networks.
2019-08-13 19:32:38 +02:00
Hector Sanjuan
912740e2f7
Merge pull request #871 from ipfs/issue_852
Improve error handling on `add`
2019-08-13 19:16:50 +02:00
Hector Sanjuan
b1769edf0c Tests: add: do not delete test folders when shutting down peer 2019-08-13 18:19:10 +02:00
Hector Sanjuan
f9889e712f
Merge pull request #875 from ipfs/fix/pin-methods
ipfshttp: Remove "refs" method
2019-08-13 17:27:48 +02:00
Hector Sanjuan
b6b44f65f7 Adder: fix tests
rpc mock returned 0 allocations and things started failing.
2019-08-13 17:26:02 +02:00
Hector Sanjuan
b4f6fe284d Remove all references to pin_method 2019-08-13 16:16:45 +02:00
Hector Sanjuan
111cc29fc6 Add tests: fix tests for adder BlockPutHelper 2019-08-13 16:06:20 +02:00
Hector Sanjuan
5c2af68459 Adder: BlockPutHelper should fail on all RPC errors
It kept trying even when the destination libp2p host was down
because that's a ClientError.
2019-08-13 16:06:20 +02:00
Kishan Mohanbhai Sagathiya
70e429f925 Fix #852: Improve error handling on add
Keep sending blocks while adding as long as one destination works.
2019-08-13 16:06:20 +02:00
Hector Sanjuan
5303a7f721
Merge pull request #874 from ipfs/feat/865-init-consensus
Service: Select consensus on "init" (not on "daemon")
2019-08-13 10:21:45 +02:00
Hector Sanjuan
3b3e3493a8 Service: init: improve log messages
Align with previous behaviour and make sure it is logged that
the configuration file was written.

Do not say "peerstore written with 0 entries" as that might be
taken like an error.
2019-08-12 16:58:06 +02:00
Hector Sanjuan
fc965f9528 service: init: do not create badger section when using Raft. 2019-08-12 16:44:22 +02:00
Hector Sanjuan
850b57e62e ipfshttp: Remove "refs" method
go-ipfs no longer performs a global lock when two simultaneous requests to pin
happen. This allows us to remove a bunch of code.
2019-08-12 12:16:01 +02:00
Hector Sanjuan
d8c20adc4e
Merge pull request #869 from ipfs/fix/732-pin-update-the-good-way
Fix #732: Introduce native pin/update
2019-08-12 12:15:30 +02:00
Hector Sanjuan
25d0ec03f9
Merge pull request #876 from ipfs/fix/stringsliceflag
Use string flag instead of string slice
2019-08-12 12:06:17 +02:00
Kishan Mohanbhai Sagathiya
684f58894d Use string flag instead of string slice
Because string slice is not very user friendly. Using string instead
would allow us to pass a comma separated list of arguments in one option
2019-08-12 11:31:26 +02:00
Hector Sanjuan
2311bdac19 daemon: do consensus things inside a switch 2019-08-12 10:39:49 +02:00
Hector Sanjuan
2815debebc sharness: test init with crdt 2019-08-12 10:36:00 +02:00
Hector Sanjuan
e614d2e9b2
Merge pull request #867 from ipfs/crdt/trust-all
CRDT: TrustAll by default.
2019-08-12 10:27:24 +02:00
Hector Sanjuan
f32a53c4e6 Daemon: "init" do not TrustAll when passing --peers 2019-08-12 10:25:55 +02:00
Hector Sanjuan
676ad1b61e CRDT: TrustAll by default. 2019-08-12 10:25:04 +02:00
Hector Sanjuan
063c5f1b78 Service: Select consensus on "init" (not on "daemon")
Fixes #865.

This makes the necessary changes so that consensu is selected on "init" with a
flag set, by default, to "crdt". This generates only a "crdt" or a "raft"
section, not both.

If the configuration file has a "raft" section, "raft" will be used to start
the daemon. If it has a "crdt" section, "crdt" will be used. If it has none or
both sections, an error will happen.

This also affects "state *" commands, which will now autoselect how to work
from the existing configuration.
2019-08-09 19:20:53 +02:00
Hector Sanjuan
3720d288a0 Adder: fix old mock rpc in tests 2019-08-09 17:13:01 +02:00
Hector Sanjuan
fb2d427035 Travis: run all tests 2019-08-09 16:12:32 +02:00
Hector Sanjuan
80ed3ebced Use go:generate to generate the protobuf 2019-08-09 16:12:28 +02:00
Hector Sanjuan
1eade4ae58 Fix #732: Introduce native pin/update
This introduces a pin/update operation which allows to Pin a new item to
cluster indicating that said pin is an update to an already-existing pin.

When this is the case, all the configuration for the existing pin is copied to
the new one (including allocations). The IPFS connector will then trigger
pin/update directly in IPFS, allowing an efficient pinning based on
DAG-differences. Since the allocations where the same for both pins,
the pin/update can proceed.

PinUpdate does not unpin the previous pin (it is not possible to do this
atomically in cluster like it happens in IPFS). The user can manually do it
after the pin/update is done.

Internally, after a lot of deliberations on what the optimal way for this is,
I opted for adding a `PinUpdate` option to the `PinOptions` type (carries the
CID to update from). In order to carry this option from the REST API to the
IPFS Connector, it is serialized in the Protobuf (and stored in the
datastore). There is no other way to do this in a simple fashion since the Pin
object is piece of information that is sent around.

Additionally, making it a PinOption plays well with the Pin/PinPath APIs which
need little changes. Effectively, you are pinning a new thing. You are just
indicating that it should be configured from an existing one.

Fixes #732
2019-08-09 16:11:52 +02:00
Hector Sanjuan
00e78a6b6d
Daemon: support remote configuration (#868)
* Daemon: support remote configuration

This:

* Adds support for fetching the configuration from a remote HTTP location:

`ipfs-cluster-service init http://localhost:8080/ipfs/Qm...` will instruct
cluster to read the configuration file from ipfs on start (potentially making
use of ipns and dnslink).

This is done by creating a `service.json` like `{ "source": <url> }`.

The source is then read when loading that configuration every time the daemon starts.

This allows to let users always use a mutating remote configuration, potentially
adding/removing trusted peers from the list or adjusting other things.

* Configuration and state helpers from ipfs-cluster-service have been extracted
to its own cmdutils package. This will help supporting something like an
`ipfs-cluster-follow` command in the next releases.

* Allows to disable the rest api by not defining it in the configuration (I thought
this was already so, but apparently only affected the ipfsproxy).

* Removes informer/allocator configurations from the daemon (--alloc). No one used
a non default pair. In fact, it was potentially buggy to use the reposize one.
2019-08-09 12:56:27 +02:00
Hector Sanjuan
04b281e86f
Merge pull request #872 from ipfs/fix/docker-builds
Dockerfiles: enable goproxy
2019-08-07 23:42:45 +02:00
Hector Sanjuan
2176d40f60 Dockerfiles: enable goproxy
This should improve the amount of CI errors lately when hitting github.
2019-08-07 11:22:46 +02:00
Hector Sanjuan
ca608b07f2
Merge pull request #864 from ipfs/feat/follower-mode
Fix #803: Add "follower_mode" to the config
2019-08-07 10:57:29 +02:00
Hector Sanjuan
47d6a7a204
Update ipfscluster_test.go
Co-Authored-By: Kishan Sagathiya <kishansagathiya@gmail.com>
2019-08-07 10:13:07 +02:00
Hector Sanjuan
1dfb396402
Update cluster.go
Co-Authored-By: Kishan Sagathiya <kishansagathiya@gmail.com>
2019-08-07 10:12:46 +02:00
Hector Sanjuan
ecd9acbcc9
Merge pull request #870 from ipfs/fix/sharness
Fix sharness init with --peers test
2019-08-06 21:52:34 +02:00
Hector Sanjuan
128242762c Fix sharness init with --peers test
[AddrInfosFromP2pAddrs](https://github.com/libp2p/go-libp2p-core/blob/master/peer/addrinfo.go#L25)
might not keep order therefore the tests flip.
2019-08-06 19:08:12 +02:00
Hector Sanjuan
7136d143fa
Merge pull request #862 from ipfs/fix/raft-state-sharness
Sharness: run state import/export with both crdt and raft
2019-08-05 13:28:47 +02:00
Hector Sanjuan
f3c0de37a6
Merge pull request #860 from ipfs/fix/648-peerttl
Fix #648: Update go-libp2p-peerstore with ttl fixes
2019-08-01 13:12:56 +02:00
Hector Sanjuan
e5aabe9896
Merge pull request #863 from ipfs/fix/add-local-test
Tests: AddLocal, increase delay
2019-07-31 17:20:54 +02:00
Hector Sanjuan
084e763468 Fix #803: Add "follower_mode" to the config
Peers configured with follower_mode = true fail to add/pin/unpin.

Additionally they do not contact other peers when doing Status, Sync or
Recover and report on themselves.

They still contact other peers when doing "peers ls", as this is an OpenRPC
endpoint.

This is merely improving user interaction with a cluster peer and avoids
getting into confusing places:

* pin/unpin seems to work even no one trusts them
* status will query all peers in the peerset only to get auth errors and
ignore them, becoming way slower than it could be

This is not a security feature.
2019-07-30 19:59:59 +02:00
Hector Sanjuan
c5864ada66 Tests: AddLocal, increase delay
The only way I can reproduce this failure is to reduce the delay.
2019-07-30 15:29:18 +02:00
Hector Sanjuan
153e4f97c9 Sharness: run state import/export with both crdt and raft 2019-07-30 13:48:48 +02:00
Hector Sanjuan
eace9031dc
Merge pull request #856 from ipfs/feat/force-consensus-choice
service: Make --consensus a mandatory flag
2019-07-30 11:32:49 +02:00
Hector Sanjuan
30b99573b8
Merge pull request #832 from ipfs/fix/793-unpin-disable
Fix #793: Allow to fully disable unpinning
2019-07-29 19:14:16 +02:00
Kishan Sagathiya
0a5598a922 Fix #211: Remove commented code around LeaderObservation (#858)
* Remove 32bit safegaurd and remove LeaderObersvation
2019-07-29 19:11:24 +02:00