Commit Graph

55 Commits

Author SHA1 Message Date
Hector Sanjuan
d6a7caf7a4 Issue #259: Address CR comments
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2017-12-04 13:59:48 +01:00
Hector Sanjuan
4922c95589 Support --local parameter for Status[Local] and Sync[Local] operations
This allows to call the Rest API's status and sync endpoints with a
"?local=true" parameter. This will trigger operations but only on the
local peer. Cluster *Local and RPC-*Local methods have been accordingly,
although they are aliases for the PinTracker methods (but otherwise they
would not be exposed in external APIs). ipfs-cluster-ctl has been updated to
support the new flag.

The rationaly behind this feature is that sometimes, a single cluster peer
(or the ipfs daemon in it) is misbehaving. The user then wants to Sync,
Recover, or see Status for that single peer. This is specially relevant
when working with big pinsets in larger clusters, as a Status() call will
be considerably more expensive when broadcasted everywhere.

Note that the Rest API keeps returning GlobalPinInfo objects even on local=true
calls. This ensures that the user always gets the same datatype from an endpoint.

License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2017-12-01 12:56:26 +01:00
Hector Sanjuan
e824aea55e RecoverAll: Implement RecoverAllLocal() which recovers all pins in a peer
This adds API, RPC calls to support RecoverAllLocal() (and expose RecoverLocal()
on the Rest API too). cluster-ctl is updated accordingly.

License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2017-11-30 01:53:31 +01:00
Hector Sanjuan
16acaa67c0 Release 0.3.0
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2017-11-15 23:39:50 +01:00
Hector Sanjuan
15bb953afd Issue #192: Update docs to the new peerset handling
Also, start removing mentions of `PeerAdd` operation, as things should
happen with `--bootstrap` (Join). PeerAdd should not be part of the user
workflow and might disappear or be hidden in the future.

License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-11-14 22:06:59 +01:00
Hector Sanjuan
2a616aeddb Issue #219: Provide a list of peers and a list of addresses in the ID object.
Fix cluster-ctl to show right number of peers

License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-11-10 16:11:09 +01:00
Hector Sanjuan
f5e5ed1e6e Release 0.2.1
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-10-26 17:01:04 +02:00
Hector Sanjuan
7c5f40babf Release 0.2.0
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-10-23 19:39:37 +02:00
ZenGround0
03b21bf97d Merge pull request #177 from ipfs/162-new-configs
Issue #162: Rework configuration format
2017-10-20 09:29:33 -04:00
Hector Sanjuan
26e126d7f4 Check request error in cluster-ctl
An error check is missing and this triggers panics when a response is nil
2017-10-18 19:04:29 +02:00
Hector Sanjuan
8f06baa1bf Issue #162: Rework configuration format
The following commit reimplements ipfs-cluster configuration under
the following premises:

  * Each component is initialized with a configuration object
  defined by its module
  * Each component decides how the JSON representation of its
  configuration looks like
  * Each component parses and validates its own configuration
  * Each component exposes its own defaults
  * Component configurations are make the sections of a
  central JSON configuration file (which replaces the current
  JSON format)
  * Component configurations implement a common interface
  (config.ComponentConfig) with a set of common operations
  * The central configuration file is managed by a
  config.ConfigManager which:
    * Registers ComponentConfigs
    * Assigns the correspondent sections from the JSON file to each
    component and delegates the parsing
    * Delegates the JSON generation for each section
    * Can be notified when the configuration is updated and must be
    saved to disk

The new service.json would then look as follows:

```json
{
  "cluster": {
    "id": "QmTVW8NoRxC5wBhV7WtAYtRn7itipEESfozWN5KmXUQnk2",
    "private_key": "<...>",
    "secret": "00224102ae6aaf94f2606abf69a0e278251ecc1d64815b617ff19d6d2841f786",
    "peers": [],
    "bootstrap": [],
    "leave_on_shutdown": false,
    "listen_multiaddress": "/ip4/0.0.0.0/tcp/9096",
    "state_sync_interval": "1m0s",
    "ipfs_sync_interval": "2m10s",
    "replication_factor": -1,
    "monitor_ping_interval": "15s"
  },
  "consensus": {
    "raft": {
      "heartbeat_timeout": "1s",
      "election_timeout": "1s",
      "commit_timeout": "50ms",
      "max_append_entries": 64,
      "trailing_logs": 10240,
      "snapshot_interval": "2m0s",
      "snapshot_threshold": 8192,
      "leader_lease_timeout": "500ms"
    }
  },
  "api": {
    "restapi": {
      "listen_multiaddress": "/ip4/127.0.0.1/tcp/9094",
      "read_timeout": "30s",
      "read_header_timeout": "5s",
      "write_timeout": "1m0s",
      "idle_timeout": "2m0s"
    }
  },
  "ipfs_connector": {
    "ipfshttp": {
      "proxy_listen_multiaddress": "/ip4/127.0.0.1/tcp/9095",
      "node_multiaddress": "/ip4/127.0.0.1/tcp/5001",
      "connect_swarms_delay": "7s",
      "proxy_read_timeout": "10m0s",
      "proxy_read_header_timeout": "5s",
      "proxy_write_timeout": "10m0s",
      "proxy_idle_timeout": "1m0s"
    }
  },
  "monitor": {
    "monbasic": {
      "check_interval": "15s"
    }
  },
  "informer": {
    "disk": {
      "metric_ttl": "30s",
      "metric_type": "freespace"
    },
    "numpin": {
      "metric_ttl": "10s"
    }
  }
}
```

This new format aims to be easily extensible per component. As such,
it already surfaces quite a few new options which were hardcoded
before.

Additionally, since Go API have changed, some redundant methods have been
removed and small refactoring has happened to take advantage of the new
way.

License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-10-18 00:00:12 +02:00
dgrisham
25a910faad BasicAuth implementation -- CLI, server, and tests. 2017-10-14 15:55:21 -06:00
Hector Sanjuan
81518e0d68 Release 0.1.0
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-07-29 14:21:06 +02:00
Hector Sanjuan
0d9c7ddc0c Make sure dist READMEs are up to date (#137)
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-07-27 14:42:23 +02:00
Hector Sanjuan
46bda442b5 Merge pull request #127 from ipfs/release-fixes
Release fixes
2017-07-25 12:11:29 +02:00
Hector Sanjuan
f9d9c0c9a7 Add a space so peer ids can be copy-pasted more easily
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-07-25 00:16:08 +02:00
dgrisham
31cee53a55 Added --no-check-certificate flag for TLS API client 2017-07-23 10:11:10 -06:00
Hector Sanjuan
dcf9502d07 Address feedback in review
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-07-14 21:22:52 +02:00
Hector Sanjuan
5b0460f514 Fix #101: Sort peers on output from ipfs-cluster ctl
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-07-03 20:15:59 +02:00
Hector Sanjuan
235a9fc069 improve ipfs-cluster-ctl command help.
It seems that urfave/cli acts differently handling Description and Usage
depending on whether it is dealing with a command or a subcommand.

This fixes most of these issues, as well as the commands output which was
printing some blank lines.

License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-07-03 18:36:00 +02:00
Hector Sanjuan
cc8c9da28d Fixes #100: EOF responses when cluster peer is not responding
The ReadTimeout for the API was the same as for RPC. So the error
did not have time to be correctly returned to the client.

License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-05-18 13:16:27 +02:00
Hector Sanjuan
bb82c27b25 Fix #87: Implement ipfs-cluster-ctl pin ls <cid>
I have updated API endpoints to be /allocations rather than /pinlinst

It's more self-explanatory.

License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-04-06 21:12:16 +02:00
Hector Sanjuan
257077c5b2 Release 0.0.12
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-03-30 14:03:04 +02:00
Hector Sanjuan
db6956b737 Fix #77: ipfs-cluster-ctl output tweaks.
Be more consistent when printing errors (i.e. if json encoding
is requested then it should be used for errors too). Do not
print "Request accepted".

License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-03-28 19:10:50 +02:00
Hector Sanjuan
39683460c6 Release 0.0.11
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-03-28 11:57:11 +02:00
Hector Sanjuan
20b0a3382e ctl: fix some outputs
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-03-13 11:10:53 +01:00
Hector Sanjuan
7ce5961aba Release 0.0.10
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-03-09 15:04:42 +01:00
Hector Sanjuan
f93538aed1 Release 0.0.9
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-03-09 13:15:18 +01:00
Hector Sanjuan
6a4863e623 Release 0.0.8
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-03-09 13:15:08 +01:00
Hector Sanjuan
b19b3c6882 Release 0.0.7
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-03-09 12:41:52 +01:00
Hector Sanjuan
76707d4b9b Release 0.0.6
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-03-09 12:24:27 +01:00
Hector Sanjuan
a5275ad02e Merge branch 'small-fixes' into pin-options 2017-03-09 12:04:49 +01:00
Hector Sanjuan
e5c5909e42 Support a replication factor flag in "ipfs-cluster-ctl pin add".
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-03-08 18:51:03 +01:00
Hector Sanjuan
01d65a1595 Support replication factor as a pin parameter
This adds a replication_factor query argument to the API
endpoint which allows to set a replication factor per Pin.

License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-03-08 18:50:54 +01:00
Hector Sanjuan
9b652bcfb3 Rename CidArg to Pin.
CidArg used to be an internal name for an argument that carried a Cid.
Now it has surfaced to API level and makes no sense. It is a Pin. It
represents a Pin (Cid, Allocations, Replication Factor)

License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-03-08 16:57:27 +01:00
Hector Sanjuan
e014ba7751 Fix output when global pin info comes with an error
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-03-08 01:10:24 +01:00
Hector Sanjuan
7be6399433 Release 0.0.5
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-03-07 17:38:53 +01:00
Hector Sanjuan
135a222301 Release 0.0.4
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-03-03 18:49:45 +01:00
Hector Sanjuan
36c12fc297 Put tools README into dist/ folder
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-03-03 17:52:43 +01:00
Hector Sanjuan
85651ae8cb Issue #55: Move tooling information to it's own README in the subprojects.
Add LICENSE there too, so that the build tool for distributions includes
it in the tar files.

License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-03-03 16:13:09 +01:00
Hector Sanjuan
df3c190fc8 Release 0.0.3
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-03-03 15:08:31 +01:00
Hector Sanjuan
2512ecb701 Issue #41: Add Replication factor
New PeerManager, Allocator, Informer components have been added along
with a new "replication_factor" configuration option.

First, cluster peers collect and push metrics (Informer) to the Cluster
leader regularly. The Informer is an interface that can be implemented
in custom wayts to support custom metrics.

Second, on a pin operation, using the information from the collected metrics,
an Allocator can provide a list of preferences as to where the new pin
should be assigned. The Allocator is an interface allowing to provide
different allocation strategies.

Both Allocator and Informer are Cluster Componenets, and have access
to the RPC API.

The allocations are kept in the shared state. Cluster peer failure
detection is still missing and re-allocation is still missing, although
re-pinning something when a node is down/metrics missing does re-allocate
the pin somewhere else.

License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-02-14 19:13:08 +01:00
Hector Sanjuan
c0697599ac Add nice text formatters to the ipfs-cluster-ctl app
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-02-09 16:30:53 +01:00
Hector Sanjuan
6c18c02106 Issue #10: peers/add and peers/rm feature + tests
This commit adds PeerAdd() and PeerRemove() endpoints, CLI support,
tests. Peer management is a delicate issue because of how the consensus
works underneath and the places that need to track such peers.

When adding a peer the procedure is as follows:

* Try to open a connection to the new peer and abort if not reachable
* Broadcast a PeerManagerAddPeer operation which tells all cluster members
to add the new Peer. The Raft leader will add it to Raft's peerset and
the multiaddress will be saved in the ClusterPeers configuration key.
* If the above fails because some cluster node is not responding,
broadcast a PeerRemove() and try to undo any damage.
* If the broadcast succeeds, send our ClusterPeers to the new Peer along with
the local multiaddress we are using in the connection opened in the
first step (that is the multiaddress through which the other peer can reach us)
* The new peer updates its configuration with the new list and joins
the consensus

License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-02-02 13:51:49 +01:00
Hector Sanjuan
4c1e0068f5 Fix #15: Peers() provides lots of information now
I have renamed "members" to "peers".

Added IPFS daemon ID and addresses to the ID object and
have Peers() return the collection of ID() objects from the cluster.

License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-01-26 20:24:00 +01:00
Hector Sanjuan
7f9cb0b269 Separate recover() from sync()
This includes adding a new API endpoint, CLI command.

I have also changed some api endpoints. I find:

POST /pins/<cid>/sync
POST /pins/<cid>/recover
GET  /pins/<cid>
GET  /pins

better. The problem is makes the pin list /pinlist but it general
its more consistent.

License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-01-25 20:17:19 +01:00
Hector Sanjuan
2566a0cca5 golint and misspellings
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-01-25 18:10:18 +01:00
Hector Sanjuan
cba87c28a2 Release 0.0.2
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-01-25 13:10:49 +01:00
Hector Sanjuan
3f833a8c17 Use urfave/cli for ipfs-cluster-service too.
Added consistency to tools, plus it's worth the effot at this point.

License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-01-24 19:55:06 +01:00
Hector Sanjuan
81db084249 Make sure the commit string gets set. Fix PublicKey. Output JSON in cluster-ctl
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-01-24 16:56:14 +01:00