yapapi
. If this is your first time using Golem and yapapi, please first refer to the resources linked above.nginx
HTTP server. Thus, our Dockerfile consists of a single line:aiohttp
library) listening to connections on our requestor machine (the localhost).capabilities
constraint which specifies that we only want to deploy our image on those providers on which the VM runtime supports the new VPN functionality.ENTRYPOINT
and CMD
commands, we'll need to start the nginx HTTP server with explicit execution script commands after the image is deployed. That's what the start
handler for our Service
is doing:start
handler, which sends the start
and deploy
commands gets correctly executed and the script it generates sent for execution.ENTRYPOINT
command in the original Dockerfile) which configures the nginx daemon.index.html
file customized with the name of the provider node on which the server is runningnginx
HTTP serverrun
handler for the service, since, after the HTTP daemon is started, there are no more scripts that we'll want to execute on the VM and we'll only need to communicate with the server using regular HTTP requests within our VPN.aiohttp
library to define a very simple TCP server which will listen to requests coming to a port on our localhost.HttpService
and call its handle_request
method using the path and the query string of the incoming HTTP request. Once the request is handled by the instance, an aiohttp.webResponse
is returned.handle_request
method of our HttpServer
class:network_node
record of the Service
. As the URI is also an endpoint of our REST API, we need to pass it the API key - the same key that we get from our yagna
daemon and that we provide to the requestor agent script using the YAGNA_APPKEY
environment variable.GET
request using the path and the query string that we have received from the local HTTP server.Golem
engine to start our service.Golem
:network
argument - connect them to the just-created VPN: