diff --git a/Berksfile.lock b/Berksfile.lock index 75424cd..c478637 100644 --- a/Berksfile.lock +++ b/Berksfile.lock @@ -18,7 +18,7 @@ DEPENDENCIES hostsfile (= 2.4.5) ipfs git: https://github.com/67P/ipfs-cookbook.git - revision: 3d4e9cceeaf89d30ca1b063e26a51905e8ddfd6b + revision: 1d09c151083beecb9c606805b1cb135c2619e7c5 ref: master logrotate (= 2.2.0) mariadb (= 0.3.1) @@ -99,7 +99,7 @@ GRAPH hostname (0.4.2) hostsfile (>= 0.0.0) hostsfile (2.4.5) - ipfs (0.3.0) + ipfs (0.4.0) ark (>= 0.0.0) logrotate (2.2.0) mariadb (0.3.1) diff --git a/nodes/andromeda.kosmos.org.json b/nodes/andromeda.kosmos.org.json index 83d170a..4b282f8 100644 --- a/nodes/andromeda.kosmos.org.json +++ b/nodes/andromeda.kosmos.org.json @@ -10,6 +10,19 @@ "role[mastodon]", "role[ejabberd]" ], + "normal": { + "kosmos-ipfs": { + "ipfs": { + "config": { + "Swarm.ConnMgr.LowWater": 100, + "Swarm.ConnMgr.HighWater": 300 + } + } + }, + "ipfs": { + "memory_max": "1G" + } + }, "automatic": { "ipaddress": "andromeda.kosmos.org" } diff --git a/nodes/barnard.kosmos.org.json b/nodes/barnard.kosmos.org.json index 049d4b9..7af665b 100644 --- a/nodes/barnard.kosmos.org.json +++ b/nodes/barnard.kosmos.org.json @@ -9,6 +9,11 @@ "sockethub", "sockethub::proxy" ], + "normal": { + "ipfs": { + "memory_max": "256M" + } + }, "automatic": { "ipaddress": "barnard.kosmos.org" } diff --git a/site-cookbooks/kosmos-ipfs/attributes/default.rb b/site-cookbooks/kosmos-ipfs/attributes/default.rb index 3e0f7c7..bce7a81 100644 --- a/site-cookbooks/kosmos-ipfs/attributes/default.rb +++ b/site-cookbooks/kosmos-ipfs/attributes/default.rb @@ -1,5 +1,19 @@ -# FIXME api_port should come from the ipfs cookbook/attributes -# It has nothing to do with nginx +node.default['kosmos-ipfs']['ipfs']['config'] = { + # The default gateway is already used by kosmos' hubot (8080) + "Addresses.Gateway" => "/ip4/127.0.0.1/tcp/9090", + # Do not keep track of bandwidth metrics. Disabling bandwidth metrics can + # lead to a slight performance improvement, as well as a reduction in memory + # usage. + 'Swarm.DisableBandwidthMetrics' => true, + # Disable the p2p-circuit relay transport + 'Swarm.DisableRelay' => true, + # Number of connections that, when exceeded, will trigger a connection GC + # operation + 'Swarm.ConnMgr.HighWater' => 40, + # Minimum number of connections to maintain + 'Swarm.ConnMgr.LowWater' => 20 +} + node.default['kosmos-ipfs']['nginx']['api_port'] = 5001 node.default['kosmos-ipfs']['nginx']['gateway_port'] = 9090 node.default['kosmos-ipfs']['nginx']['external_api_port'] = 5444 diff --git a/site-cookbooks/kosmos-ipfs/metadata.rb b/site-cookbooks/kosmos-ipfs/metadata.rb index 0803761..d84c988 100644 --- a/site-cookbooks/kosmos-ipfs/metadata.rb +++ b/site-cookbooks/kosmos-ipfs/metadata.rb @@ -4,7 +4,7 @@ maintainer_email 'mail@kosmos.org' license 'MIT' description 'Installs/Configures kosmos-ipfs' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '0.1.3' +version '0.2.0' depends 'ipfs' depends 'kosmos-base' diff --git a/site-cookbooks/kosmos-ipfs/recipes/default.rb b/site-cookbooks/kosmos-ipfs/recipes/default.rb index 8ffa9ed..202faf4 100644 --- a/site-cookbooks/kosmos-ipfs/recipes/default.rb +++ b/site-cookbooks/kosmos-ipfs/recipes/default.rb @@ -24,32 +24,13 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -node.override['ipfs']['version'] = '0.4.21' -node.override['ipfs']['checksum'] = 'a7ec5ddc4d52f818cbf3853a80f7ec17f9fde9128f039485dbe1889cf673d562' include_recipe "ipfs" include_recipe "kosmos-ipfs::kredits_pinner" -# Configure ipfs - -# The default gateway is already used by kosmos' hubot (8080) -ipfs_config "Addresses.Gateway" do - value "/ip4/127.0.0.1/tcp/9090" -end - -# Set up the Gateway to be writable -ipfs_config "Gateway.Writable" do - value true -end - -# Set up CORS headers -ipfs_config "API.HTTPHeaders.Access-Control-Allow-Credentials" do - value ["true"] -end -ipfs_config "API.HTTPHeaders.Access-Control-Allow-Methods" do - value ["PUT", "GET", "POST"] -end -ipfs_config "API.HTTPHeaders.Access-Control-Allow-Origin" do - value ["*"] +node['kosmos-ipfs']['ipfs']['config'].each do |k, v| + ipfs_config k do + value v + end end unless node.chef_environment == "development"