Initial nginx reverse proxy for the IPFS IP

It supports cat and add for now. I have tried it using the ipfs-api npm
module
This commit is contained in:
Greg Karékinian
2017-03-20 19:38:51 +00:00
parent 3f81310109
commit 114503033b
3 changed files with 42 additions and 17 deletions

View File

@@ -12,19 +12,18 @@ include_recipe "ipfs"
# Configure ipfs
# The default gateway is already used by kosmos' hubot (8080)
execute "ipfs config Addresses.Gateway /ip4/127.0.0.1/tcp/9090" do
environment "IPFS_PATH" => "/home/ipfs/.ipfs"
user "ipfs"
not_if "ipfs config Addresses.Gateway | grep /ip4/127.0.0.1/tcp/9090"
notifies :restart, "service[ipfs]", :delayed
ipfs_config "Addresses.Gateway" do
value "/ip4/127.0.0.1/tcp/9090"
end
# Set up CORS headers
execute "ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '[\"kredits.kosmos.org\"]'" do
environment "IPFS_PATH" => "/home/ipfs/.ipfs"
user "ipfs"
not_if "ipfs config API.HTTPHeaders.Access-Control-Allow-Origin | grep kredits.kosmos.org"
notifies :restart, "service[ipfs]", :delayed
ipfs_config "API.HTTPHeaders.Access-Control-Allow-Origin" do
value ["kredits.kosmos.org"]
end
# Set up the Gateway to be writable
ipfs_config "Gateway.Writable" do
value true
end
include_recipe "kosmos-ipfs::letsencrypt"