From f7ff1248fe074cd07ab4c526c582712c76e3d8f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A2u=20Cao?= Date: Wed, 2 Nov 2022 14:05:43 +0100 Subject: [PATCH] Enable Web UI on private network --- nodes/ipfs-1.json | 4 ++-- site-cookbooks/kosmos-ipfs/attributes/default.rb | 5 +++++ site-cookbooks/kosmos-ipfs/recipes/default.rb | 9 +++++++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/nodes/ipfs-1.json b/nodes/ipfs-1.json index 2252a37..637f7f2 100644 --- a/nodes/ipfs-1.json +++ b/nodes/ipfs-1.json @@ -37,13 +37,13 @@ "hostname::default", "ipfs::default", "ipfs::_user", + "firewall::default", + "chef-sugar::default", "kosmos-ipfs::kredits_pinner", "kosmos-nodejs::default", "nodejs::nodejs_from_package", "nodejs::repo", "kosmos-ipfs::firewall_swarm", - "firewall::default", - "chef-sugar::default", "kosmos-nginx::default", "nginx::default", "nginx::package", diff --git a/site-cookbooks/kosmos-ipfs/attributes/default.rb b/site-cookbooks/kosmos-ipfs/attributes/default.rb index e86b20f..466342c 100644 --- a/site-cookbooks/kosmos-ipfs/attributes/default.rb +++ b/site-cookbooks/kosmos-ipfs/attributes/default.rb @@ -1,6 +1,7 @@ node.normal['ipfs']['version'] = "0.15.0" node.normal['ipfs']['checksum'] = "5830ce226956c5e2a2de3a3440704402dd3501c43ec16eeec2d61491317005f2" +node.default['kosmos-ipfs']['api']['port'] = 5001 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", @@ -8,6 +9,10 @@ node.default['kosmos-ipfs']['ipfs']['config'] = { # lead to a slight performance improvement, as well as a reduction in memory # usage. 'Swarm.DisableBandwidthMetrics' => true, + # API with Web UI + "Addresses.API" => "/ip4/0.0.0.0/tcp/5001", + # Enable bandwith metrics + 'Swarm.DisableBandwidthMetrics' => false, # Disable the p2p-circuit relay transport 'Swarm.Transports.Network.Relay' => false, # Number of connections that, when exceeded, will trigger a connection GC diff --git a/site-cookbooks/kosmos-ipfs/recipes/default.rb b/site-cookbooks/kosmos-ipfs/recipes/default.rb index 30391bc..c4f867a 100644 --- a/site-cookbooks/kosmos-ipfs/recipes/default.rb +++ b/site-cookbooks/kosmos-ipfs/recipes/default.rb @@ -4,6 +4,7 @@ # include_recipe "ipfs" +include_recipe 'firewall' include_recipe "kosmos-ipfs::kredits_pinner" node['kosmos-ipfs']['ipfs']['config'].each do |k, v| @@ -15,3 +16,11 @@ end unless node.chef_environment == "development" include_recipe "kosmos-ipfs::firewall_swarm" end + +firewall_rule 'ipfs_api' do + port 5001 + source "10.1.1.0/24" + protocol :tcp + command :allow + logging :connections +end