Commit Graph

1659 Commits

Author SHA1 Message Date
Kishan Mohanbhai Sagathiya
ee6a35d9b5 Sort addresses in /id
and thus in GET `/peers` as well
2019-08-11 21:15:43 +05:30
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
Hector Sanjuan
256f4bec5e Fix #793: Allow to fully disable unpinning
As raised in #793, sometimes the user wants to simply disallow unpinning
altogether in a Cluster peer so that no content can be removed from IPFS
through cluster, even when crendentials are compromised (including access to
RPC endpoint).

This introduces an unpin_disable parameter for the ipfshttp connector. There
is no way that a cluster will effecitvely unpin something if the connector
refuses to ask ipfs.
2019-07-29 19:08:31 +02:00
Hector Sanjuan
3ff6ccbd77 Fix #648: Update go-libp2p-peerstore with ttl fixes 2019-07-29 13:34:24 +02:00
Kishan Sagathiya
c0b8301525 Fix #854: 404 on deleting a pin that isn't part of pinset (#854)
With this commit
- If cid in `DELETE /pins/{cid}` isn't part of the pinset, it would
return 404
- If path in `DELETE /pins/{keyType}/{path}` resolves to a cid that
isn't part of the pinset, it would return 404
2019-07-29 13:26:53 +02:00
Kishan Sagathiya
e0c38a2ddf Auto-trust bootstrap peers (#857)
Fix #834: Auto-trust bootstrap peers (#857)

Add bootstrap peers to list of trusted peers for crdt.
2019-07-29 10:17:43 +02:00
Hector Sanjuan
6188d6ff52 service: Make --consensus a mandatory flag
It has a few implications to launch a raft peer when you wanted to do crdt and vice-versa.

Same when exporting and exporting states.

Users starting cluster peers should be explicit about their consensus choice.

Also, if we ever want to make `crdt` the default, we can't do that before
making `raft` non-default first. I don't like to break things but otherwise
the experience for new users wanting to try crdts might be aweful.
2019-07-26 18:15:41 +02:00
Hector Sanjuan
7a78620017
Fix #853: Make a more orderly shutdown of rest api libp2p host (#855)
Cancelling its context before closing the listeners and de-registering
protocols is ground for panics on libp2p.
2019-07-26 17:32:11 +02:00
Kishan Sagathiya
7f52242f35 Fix #840: Removed Raft peers should dissapear from peerstore (#846)
With this commit, cluster peer will observe on events of peer removal
from cluster. On occurence of the event, the cluster peer will clear
the removed peer from its peerstore.
2019-07-25 14:40:05 +02:00
Kishan Sagathiya
e7b731e0e4 Fix #835: service: init --peers
* Init should take a list of peers

This commit adds `--peers` option to `ipfs-cluster-service init`

`ipfs-cluster-service init --peers <multiaddress,multiaddress>`

- Adds and writes the given peers to the peerstore file
- For raft config section, adds the peer IDs to the `init_peerset`
- For crdt config section, add the peer IDs to the `trusted_peers`
2019-07-25 10:47:44 +02:00
Hector Sanjuan
ef8f2cb17d
Merge pull request #847 from ipfs/update/deps2
Update libp2p to 0.2.1
2019-07-23 15:40:18 +02:00
Hector Sanjuan
a719206f21 Tests: remove workaround for libp2p panic 2019-07-23 15:15:36 +02:00
Hector Sanjuan
0e668f60bf Update go-libp2p to 0.2.1
Fixes #845
2019-07-23 15:14:21 +02:00
Hector Sanjuan
7c636061bd
Improve pin/unpin method signatures (#843)
* Improve pin/unpin method signatures:

These changes the following Cluster Go API methods:

* -> Cluster.Pin(ctx, cid, options) (pin, error)
* -> Cluster.Unpin(ctx, cid) (pin, error)
* -> Cluster.PinPath(ctx, path, opts) (pin,error)

Pin and Unpin now return the pinned object.

The signature of the methods now matches that of the API Client, is clearer as
to what options the user can set and is aligned with PinPath, UnpinPath, which
returned pin methods.

The REST API now returns the Pinned/Unpinned object rather than 204-Accepted.

This was necessary for a cleaner pin/update approach, which I'm working on in
another branch.

Most of the changes here are updating tests to the new signatures

* Adapt load-balancing client to new Pin/Unpin signatures

* cluster.go: Fix typo

Co-Authored-By: Kishan Sagathiya <kishansagathiya@gmail.com>

* cluster.go: Fix typo

Co-Authored-By: Kishan Sagathiya <kishansagathiya@gmail.com>
2019-07-22 15:39:11 +02:00
Kishan Sagathiya
b6ba67804f Fix #448: rest api client: Load balancing client implementations
This adds a LoadBalancing rest client implementation which is initialized with a set of client configurations and can use two strategies: failover and roundrobin (more strategies can be added by implementing the LBStrategy interface).
2019-07-19 15:17:51 +02:00
Kishan Sagathiya
b96c2b664d Do not load API components removed from the config (#836)
* Do not load API components removed from the config

This commit introduces a map that would keep track of whether components
for a component were missing or not from the JSON config file. This map
can be check while creating cluster to avoid loading a component.

It would consider component only if the component is fully missing from the
config.
Say the component in question is `ipfsproxy` which is under `api`
section.
This would use defaults for `ipfsproxy` and load IPFS proxy.

```
{
"api":{
	"ipfsproxy": {}
	}
}
```

However, this would not load IPFS proxy
```
{
"api":{}
}
```
2019-07-18 17:33:14 +02:00
Hector Sanjuan
45e9a313db
Merge pull request #837 from ipfs/issue_778
JSON Config object key should match JSON tags
2019-07-15 15:58:25 +02:00
Kishan Mohanbhai Sagathiya
586253a2ce JSON Config object key should match JSON tags
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
2019-07-15 17:47:35 +05:30
Hector Sanjuan
e1e331600a
Merge pull request #833 from ipfs/fix/add-test
Fix: fix flaky add test
2019-07-09 10:09:27 +02:00
Hector Sanjuan
f1aa9eecfb
Merge pull request #831 from ipfs/feat/auto-recover
Feat: regularly trigger "recover" automatically
2019-07-09 10:09:05 +02:00
Hector Sanjuan
8d3f99a5fc Fix: fix flaky add test
This test has been failing a lot lately. Waiting for metrics might help.
2019-07-09 02:37:47 +02:00
Hector Sanjuan
997208a82f Feat: regularly trigger "recover" automatically
Interval controlled by a pin_recover_interval option in the config.
2019-07-08 16:55:05 +02:00
Hector Sanjuan
53f1a99feb
Merge pull request #830 from ipfs/update/deps-asjnkwe
Update dependencies
2019-07-05 19:40:11 +01:00
Hector Sanjuan
d8cb4cd7d8 Update dependencies 2019-07-05 18:12:57 +01:00
Hector Sanjuan
daf9672311
Merge pull request #781 from ipfs/fix/remove-gx
Fix #765: Remove gx
2019-07-04 14:03:21 +01:00
Kishan Mohanbhai Sagathiya
dce3d3e924 Remove docker_install
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
2019-07-04 13:58:38 +01:00
Kishan Mohanbhai Sagathiya
b73c3975d9 Remove gx
- remove docker_install
- set GO111MODULE=on

License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
2019-07-04 13:58:37 +01:00
Kishan Mohanbhai Sagathiya
1dc3e1db2c Remove gx
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
2019-07-04 13:58:17 +01:00
Protocol Labs
4c8738f585 Fix #765 Added needed gx references 2019-07-04 13:57:52 +01:00
Protocol Labs
b573074f7b Fix #765 Remove gx 2019-07-04 13:57:48 +01:00
Hector Sanjuan
411aa73944
Merge pull request #738 from ipfs/issue_497
Pin timeouts should start from the last block
2019-07-04 13:53:20 +01:00
Hector Sanjuan
4c16675a39
Release 0.11.0-rc5 2019-06-27 17:58:26 +01:00
Hector Sanjuan
b34a2d54f9
Merge pull request #820 from ipfs/fix/small-fixes-crdts
Some more small fixes
2019-06-27 17:52:03 +01:00
Hector Sanjuan
80cf0ed695
Merge pull request #815 from ipfs/fix/false-positive-alerts
fix how accrual fd treats ttls
2019-06-27 17:50:51 +01:00