Commit Graph

36 Commits

Author SHA1 Message Date
Hector Sanjuan
cef51c2129 Revert "Test with go 1.18"
This reverts commit 9e6428cb1fec27e56f88dbc6f1cca219b035431a.
2022-06-16 17:43:29 +02:00
Hector Sanjuan
a559b137c1 Test with go 1.18 2022-06-16 17:43:29 +02:00
Hector Sanjuan
e32341363d Docker: set ipfs as file owner when adding 2021-12-01 01:47:15 +01:00
Hector Sanjuan
23dd3ba41b Go1.17 2021-11-30 06:51:06 +01:00
Hector Sanjuan
74e4dfb2e4 Docker: allow controlling datastore backend via IPFS_CLUSTER_DATASTORE 2021-06-29 15:44:24 +02:00
Hector Sanjuan
f7c78df418
Dependency upgrades (#1357)
* build(deps): bump github.com/multiformats/go-multiaddr-dns

Bumps [github.com/multiformats/go-multiaddr-dns](https://github.com/multiformats/go-multiaddr-dns) from 0.2.0 to 0.3.1.
- [Release notes](https://github.com/multiformats/go-multiaddr-dns/releases)
- [Commits](https://github.com/multiformats/go-multiaddr-dns/compare/v0.2.0...v0.3.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* build(deps): bump github.com/hashicorp/go-hclog from 0.15.0 to 0.16.0

Bumps [github.com/hashicorp/go-hclog](https://github.com/hashicorp/go-hclog) from 0.15.0 to 0.16.0.
- [Release notes](https://github.com/hashicorp/go-hclog/releases)
- [Commits](https://github.com/hashicorp/go-hclog/compare/v0.15.0...v0.16.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* build(deps): bump github.com/ipfs/go-unixfs from 0.2.4 to 0.2.5

Bumps [github.com/ipfs/go-unixfs](https://github.com/ipfs/go-unixfs) from 0.2.4 to 0.2.5.
- [Release notes](https://github.com/ipfs/go-unixfs/releases)
- [Commits](https://github.com/ipfs/go-unixfs/compare/v0.2.4...v0.2.5)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* build(deps): bump github.com/libp2p/go-libp2p-peerstore

Bumps [github.com/libp2p/go-libp2p-peerstore](https://github.com/libp2p/go-libp2p-peerstore) from 0.2.6 to 0.2.7.
- [Release notes](https://github.com/libp2p/go-libp2p-peerstore/releases)
- [Commits](https://github.com/libp2p/go-libp2p-peerstore/compare/v0.2.6...v0.2.7)

Signed-off-by: dependabot[bot] <support@github.com>

* build(deps): bump go.uber.org/multierr from 1.6.0 to 1.7.0

Bumps [go.uber.org/multierr](https://github.com/uber-go/multierr) from 1.6.0 to 1.7.0.
- [Release notes](https://github.com/uber-go/multierr/releases)
- [Changelog](https://github.com/uber-go/multierr/blob/master/CHANGELOG.md)
- [Commits](https://github.com/uber-go/multierr/compare/v1.6.0...v1.7.0)

Signed-off-by: dependabot[bot] <support@github.com>

* Chore: update deps

* Update changelog

* Update to go1.16. Downgrade unixfs.

* go mod tidy

* travis: use go install

* golint no more

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-14 19:01:18 +02:00
Omkar Prabhu
18e4593e99 allowing non amd64 in docker-test 2020-09-01 22:57:38 +05:30
Jorropo
4bca0c31c6 Fixing Docker-test 2020-08-31 02:24:33 +02:00
Jorropo
cd0553d2cd Fix docker build. 2020-08-29 10:43:29 +02:00
Hector Sanjuan
0dfa9ca185
(chore) Upgrade dependencies
Upgrade dependencies and bump to go1.15.
2020-08-27 14:10:58 +02:00
Hector Sanjuan
f3ed4533f2 Revert "Revert to Go1.13"
This reverts commit 5bd6057bf9.
2020-04-02 18:03:58 +02:00
Hector Sanjuan
5bd6057bf9 Revert to Go1.13 2020-04-02 16:48:52 +02:00
Hector Sanjuan
b3853caf36 Dependency ugprade: changes needed
* Libp2p protectors no longer needed, use PSK directly
* Generate cluster 32-byte secret here (helper gone from pnet)
* Switch to go-log/v2 in all places
* DHT bootstrapping not needed. Adjust DHT options for tests.
* Do not rely on dissappeared CidToDsKey and DsKeyToCid functions fro dshelp.
* Disable QUIC (does not support private networks)
* Fix tests: autodiscovery started working properly
2020-03-22 14:50:25 +01:00
Hector Sanjuan
01973a72b1 Docker: add ipfs-cluster-follow to containers 2019-12-16 15:10:11 +01:00
Hector Sanjuan
d0b2c80a15 Dockerfile formatting 2019-12-06 10:56:17 +01:00
Hector Sanjuan
d2ec84d8f2 Address review 2019-10-31 10:58:09 +01:00
Hector Sanjuan
073a0dfa58 Dockerfiles: download modules in advance
This should speed up Dockerfile builds, particularly when building after
updating the code since the modules will not be to be re-downloaded.
2019-10-28 10:23:18 +01:00
Hector Sanjuan
78c83f0bb5 Bump things to Go 1.13 2019-10-04 19:27:02 +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
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
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
bfd4b7d3ee Tests: add failfast, bump to go1.12, adjust codecov 2019-05-17 13:54:13 +02:00
Hector Sanjuan
db3ff39f39 Enable go.mod for ipfs-cluster 2019-03-08 12:02:05 +00:00
Kishan Sagathiya
3b86a94418 Put a note for deprecating json fields
Put a note for deprecating json fields that they are only here to
maintain compatibility and they will be removed in future

Start using env vars starting with `CLUSTER_IPFSPROXY`

License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
2018-12-17 08:24:17 +05:30
Kishan Sagathiya
2da12bc59a Switch to root user to create data directory
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
2018-12-13 16:03:22 +05:30
Hector Sanjuan
b27ae72ef0 Update to go-1.11
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2018-10-01 12:03:08 +02:00
Hector Sanjuan
78a25e38f8 Fix #462: Support DNS multiaddresses for node_multiaddress
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2018-06-12 10:09:03 +02:00
Hector Sanjuan
33d9cdd3c4 Feat: emancipate Consensus from the Cluster component
This commit promotes the Consensus component (and Raft) to become a fully
independent thing like other components, passed to NewCluster during
initialization. Cluster (main component) no longer creates the consensus
layer internally. This has triggered a number of breaking changes
that I will explain below.

Motivation: Future work will require the possibility of running Cluster
with a consensus layer that is not Raft. The "consensus" layer is in charge
of maintaining two things:
  * The current cluster peerset, as required by the implementation
  * The current cluster pinset (shared state)

While the pinset maintenance has always been in the consensus layer, the
peerset maintenance was handled by the main component (starting by the "peers"
key in the configuration) AND the Raft component (internally)
and this generated lots of confusion: if the user edited the peers in the
configuration they would be greeted with an error.

The bootstrap process (adding a peer to an existing cluster) and configuration
key also complicated many things, since the main component did it, but only
when the consensus was initialized and in single peer mode.

In all this we also mixed the peerstore (list of peer addresses in the libp2p
host) with the peerset, when they need not to be linked.

By initializing the consensus layer before calling NewCluster, all the
difficulties in maintaining the current implementation in the same way
have come to light. Thus, the following changes have been introduced:

* Remove "peers" and "bootstrap" keys from the configuration: we no longer
edit or save the configuration files. This was a very bad practice, requiring
write permissions by the process to the file containing the private key and
additionally made things like Puppet deployments of cluster difficult as
configuration would mutate from its initial version. Needless to say all the
maintenance associated to making sure peers and bootstrap had correct values
when peers are bootstrapped or removed. A loud and detailed error message has
been added when staring cluster with an old config, along with instructions on
how to move forward.

* Introduce a PeerstoreFile ("peerstore") which stores peer addresses: in
ipfs, the peerstore is not persisted because it can be re-built from the
network bootstrappers and the DHT. Cluster should probably also allow
discoverability of peers addresses (when not bootstrapping, as in that case
we have it), but in the meantime, we will read and persist the peerstore
addresses for cluster peers in this file, different from the configuration.
Note that dns multiaddresses are now fully supported and no IPs are saved
when we have DNS multiaddresses for a peer.

* The former "peer_manager" code is now a pstoremgr module, providing utilities
to parse, add, list and generally maintain the libp2p host peerstore, including
operations on the PeerstoreFile. This "pstoremgr" can now also be extended to
perform address autodiscovery and other things indepedently from Cluster.

* Create and initialize Raft outside of the main Cluster component: since we
can now launch Raft independently from Cluster, we have more degrees of
freedom. A new "staging" option when creating the object allows a raft peer to
be launched in Staging mode, waiting to be added to a running consensus, and
thus, not electing itself as leader or doing anything like we were doing
before. This additionally allows us to track when the peer has become a
Voter, which only happens when it's caught up with the state, something that
was wonky previously.

* The raft configuration now includes an InitPeerset key, which allows to
provide a peerset for new peers and which is ignored when staging==true. The
whole Raft initialization code is way cleaner and stronger now.

* Cluster peer bootsrapping is now an ipfs-cluster-service feature. The
--bootstrap flag works as before (additionally allowing comma-separated-list
of entries). What bootstrap does, is to initialize Raft with staging == true,
and then call Join in the main cluster component. Only when the Raft peer
transitions to Voter, consensus becomes ready, and cluster becomes Ready.
This is cleaner, works better and is less complex than before (supporting
both flags and config values). We also backup and clean the state whenever
we are boostrapping, automatically

* ipfs-cluster-service no longer runs the daemon. Starting cluster needs
now "ipfs-cluster-service daemon". The daemon specific flags (bootstrap,
alloc) are now flags for the daemon subcommand. Here we mimic ipfs ("ipfs"
does not start the daemon but print help) and pave the path for merging both
service and ctl in the future.

While this brings some breaking changes, it significantly reduces the
complexity of the configuration, the code and most importantly, the
documentation. It should be easier now to explain the user what is the
right way to launch a cluster peer, and more difficult to make mistakes.

As a side effect, the PR also:

* Fixes #381 - peers with dynamic addresses
* Fixes #371 - peers should be Raft configuration option
* Fixes #378 - waitForUpdates may return before state fully synced
* Fixes #235 - config option shadowing (no cfg saves, no need to shadow)

License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2018-05-07 07:39:41 +02:00
Hector Sanjuan
025fc95279 Dockerfile-test: use go-ipfs:master
Allows us to test against latest ipfs (either it's broken and this
helps finding out, or it's not broken anymore and we don't lose time
trying to figure out why).

License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2017-11-29 10:34:03 +01:00
Hector Sanjuan
fb7be4137f Fix #216: Docker does not like an env variable in CMD (anymore?)
This used to work. Even if it's been surfaced by 4a8759939 we were
extensively testing the Dockerfile before that release.

License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-10-31 11:46:32 +01:00
Hector Sanjuan
47c877fa13 Dockerfile-test: Add bash to busybox
Remove the debian-stretch Dockerfile-test and put the busybox one
with bash in its place.

Tested that kubernetes-ipfs runs with it.

License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-10-21 11:52:25 +02:00
Hector Sanjuan
a57ee29e10 Use plain debian for Dockerfile-test
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-10-21 00:12:08 +02:00
Hector Sanjuan
1d256166d6 Fix #154: Update Dockerfiles
After changes on how the final docker image for go-ipfs is generated,
our Dockerfiles failed to build.

The new version is inspired on go-ipfs Dockerfile. It takes advantage
of docker >= v17.06 which allows multi-stage Dockerfiles with
several FROM directives and COPY --from. This allows build freely on a
first stage, without thinking of cleaning up, and then just copy the
final artifacts to a second, minimal image.

The Dockerfile-test is similarly updated. Minor changes have been
applied to the entrypoints.

License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-10-20 20:51:19 +02:00
ZenGround0
1d81a1fedc Docker test image add cluster respawn (#111)
* First draft of test dockerfile build

* Test dockerfile, build works, container runs and cluster tests go through

* Removed fifo for output

* renaming dockerfile

* Adding functionality for test 12
Added scripts and entrypoint mods to the testing docker image to allow for random shut down and startup
(both SIGSTOP and SIGINT) of the ipfs-cluster-service.

* test docker image ready for tests 12 and 13

* Added cluster daemon respawn
 to docker image
2017-06-29 12:34:00 +02:00
ZenGround0
6e4b325b35 Docker test image random reaper (#106)
* First draft of test dockerfile build

* Test dockerfile, build works, container runs and cluster tests go through

* Removed fifo for output

* renaming dockerfile

* Adding functionality for test 12
Added scripts and entrypoint mods to the testing docker image to allow for random shut down and startup
(both SIGSTOP and SIGINT) of the ipfs-cluster-service.

* test docker image ready for tests 12 and 13
2017-06-20 12:23:11 +02:00
ZenGround0
0c9f729662 Docker test image build (#103)
* First draft of test dockerfile build

* Test dockerfile, build works, container runs and cluster tests go through

* Removed fifo for output

* renaming dockerfile
2017-06-16 15:07:08 +02:00