0

Hi I am trying to run a vibe.d serve on google compute cloud.

The machine instance is:

Machine type        n1-standard-1
CPU platform        Intel Skylake
Architecture        x86/64
vCPUs to core ratio        —
Custom visible cores        —
Display device        Disabled
GPUs        None

I have assigned a static IP using network interfaces where type is default, and external IP is a static IP. Both HTTP and HTTPS traffics are allowed.

Under VPC Network > firewall rules, I have created a new rule:

Network    default
Priority    1000
Direction    Ingress
Action on match    Allow
Source filters
    IP ranges        0.0.0.0/0 

Protocols and ports
    tcp:8080
Enforcement    Enabled 

Now, I created a dub project with sudo rights. The app.d is like this:

import vibe.vibe;

void main()
{
        auto settings = new HTTPServerSettings;
        settings.port = 8080;
        settings.bindAddresses = ["::", "MY.SERVERS.STATIC.IP"]; // tested with this line commented out, and with ::1
        auto listener = listenHTTP(settings, &hello);
        scope (exit)
        {
                listener.stopListening();
        }

        logInfo("Please open http://127.0.0.1:8080/ in your browser.");
        runApplication();
}

void hello(HTTPServerRequest req, HTTPServerResponse res)
{
        res.writeBody("Hello, World!");
}

i run with dub run. This leads to:

[main(----) INF] Listening for requests on http://[::]:8080/
Failed to listen on MY.SERVERS.STATIC.IP:8080
[main(----) INF] Please open http://127.0.0.1:8080/ in your browser.
Vibe was run as root, and no user/group has been specified for privilege lowering. Running with full permissions.

netstat | grep 8080 returns nothing.

Note, that if i replace MY.SERVERS.STATIC.IP with 0.0.0.0, and keep ::1, then although i get:

[main(----) INF] Listening for requests on http://[::1]:8080/
[main(----) INF] Listening for requests on http://0.0.0.0:8080/
[main(----) INF] Please open http://127.0.0.1:8080/ in your browser.
Vibe was run as root, and no user/group has been specified for privilege lowering. Running with full permissions.

The server remains unreachable. I can ping, but calling with firefox or chrome with port number returns a 404 error.

What can I do to run a vibe.d server on google cloud? Thank you

Sean
  • 789
  • 6
  • 26

0 Answers0