yapapi. If this is your first time using Golem and yapapi, please first refer to the resources linked above.
nginxHTTP server. Thus, our Dockerfile consists of a single line:
aiohttplibrary) listening to connections on our requestor machine (the localhost).
capabilitiesconstraint which specifies that we only want to deploy our image on those providers on which the VM runtime supports the new VPN functionality.
CMDcommands, we'll need to start the nginx HTTP server with explicit execution script commands after the image is deployed. That's what the
starthandler for our
starthandler, which sends the
deploycommands gets correctly executed and the script it generates sent for execution.
ENTRYPOINTcommand in the original Dockerfile) which configures the nginx daemon.
index.htmlfile customized with the name of the provider node on which the server is running
runhandler 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.
aiohttplibrary to define a very simple TCP server which will listen to requests coming to a port on our localhost.
HttpServiceand call its
handle_requestmethod using the path and the query string of the incoming HTTP request. Once the request is handled by the instance, an
handle_requestmethod of our
network_noderecord 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
yagnadaemon and that we provide to the requestor agent script using the
GETrequest using the path and the query string that we have received from the local HTTP server.
Golemengine to start our service.
networkargument - connect them to the just-created VPN: