On Mon, 19 Sep 2016 11:16:11 +0200, Sönke Ludwig wrote:

Am 18.09.2016 um 06:43 schrieb Uiy Uiy:

does vibe.d support load balancing and or virtual hosts? tried vibedist but no luck! Vibe.D seems like a pretty good attempt at a web server but seems to have lost support from the dev ;/

Virtual hosts are supported by setting the HTTPServerSettings.hostName
field accordingly. It is possible to call listenHTTP multiple times
with the same IP/port, but with different host names.

There is also support for a simple form of multi-thread based load
balancing by setting HTTPServerOption.distribute. However, it
circumvents D's shared qualifier, so that the user is fully
responsible for ensuring thread safety. For this reason, I'd generally
not recommend this, but instead use multi-process load balancing on a
single machine (letting multiple processes listen on the same port).

For multi-machine load-balancing, vibedist was planned, but it isn't
there yet. However, any off-the-shelf load-balancing solution should
work with vibe.d just like with other web servers - the main difference
is that manual configuration is required.

BTW, I'm currently still busy with other things, but development will be
back to full speed shortly! Considerable resources also went into
[diet-ng][1] and [vibe-core][2] (which is a revamped version of the
vibe.core module and will be the basis for all further developments),
which slowed down the pace for the main repository somewhat.

[1]: https://github.com/rejectedsoftware/diet-ng
[2]: https://github.com/vibe-d/vibe-core

Cool. Thanks.

I am having some trouble with the virtual hosts but I think I just have to play around with it.

What I really would like to do is be able to create n independent websites(each one is restricted to it's own "space") and serve them off the same ip but also allow for common functionality to be served between them, such as common templates, etc.

e.g.,
<code>
public
source
views
data
images
css
Site1.com
public
source
views
data
images
css
Site2.com
public
source
views
data
images
css
...
</code>

Then when Site1.com is accessed, all the files are served from it's subdirectory. It would be nice if some common templates, icons, etc can be stored in the root to be used by all the sites but otherwise secure(no way for someone to access site2's files from site1.

I see no way to set a path for each server or really accomplish this effectively with one vibe.d process. Any ideas?

I got this error from your site:

500 - Internal Server Error

Internal Server Error

Internal error information:
object.Exception@../../../root/.dub/packages/vibe-d-0.7.29/vibe-d/source/vibe/utils/dictionarylist.d(167): Accessing non-existent key 'group'.

/usr/include/dmd/phobos/std/exception.d:405 pure @safe void std.exception.bailOut!(Exception).bailOut(immutable(char)[], ulong, const(char[])) [0x92e9df]
/usr/include/dmd/phobos/std/exception.d:363 pure @safe bool std.exception.enforce!(Exception, bool).enforce(bool, lazy const(char)[], immutable(char)[], ulong) [0x93200a]
../../../root/.dub/packages/vibe-d-0.7.29/vibe-d/source/vibe/utils/dictionarylist.d:167 vibe.utils.dictionarylist.DictionaryList!(immutable(char)[], true, 16uL, false).DictionaryList.opIndexinout(pure @safe inout(immutable(char)[]) function(immutable(char)[])) [0xb675b7]
source/vibenews/web.d:195 void vibenews.web.WebInterface.getPostArticle(vibe.http.server.HTTPServerRequest, vibe.http.server.HTTPServerResponse, immutable(char)[]) [0x9f4530]
../../../root/.dub/packages/vibe-d-0.7.29/vibe-d/source/vibe/web/web.d:723 void vibe.web.web.handleRequest!("getPostArticle", void vibenews.web.WebInterface.getPostArticle(vibe.http.server.HTTPServerRequest, vibe.http.server.HTTPServerResponse, immutable(char)[]), vibenews.web.WebInterface).handleRequest(vibe.http.server.HTTPServerRequest, vibe.http.server.HTTPServerResponse, vibenews.web.WebInterface, vibe.web.web.WebInterfaceSettings) [0x9df817]
../../../root/.dub/packages/vibe-d-0.7.29/vibe-d/source/vibe/web/web.d:181 void vibe.web.web.T20registerWebInterfaceHTC8vibenews3web12WebInterfaceVE4vibe3web6common11MethodStylei5Z.registerWebInterface(vibe.http.router.URLRouter, vibenews.web.WebInterface, vibe.web.web.WebInterfaceSettings).lambda12!(vibe.http.server.HTTPServerRequest, vibe.http.server.HTTPServerResponse).lambda12(vibe.http.server.HTTPServerRequest, vibe.http.server.HTTPServerResponse) [0x9d95b4]
../../../root/.dub/packages/vibe-d-0.7.29/vibe-d/source/vibe/http/router.d:268 _D4vibe4http6router9URLRouter13handleRequestMFC4vibe4http6server17HTTPServerRequestC4vibe4http6server18HTTPServerResponseZ21
T9lambda4TmTAAyaZ9lambda4MFmMAAyaZb [0xacf50b]
../../../root/.dub/packages/vibe-d-0.7.29/vibe-d/source/vibe/http/router.d:595 const(bool function(immutable(char)[], scope bool delegate(ulong, scope immutable(char)))) vibe.http.router.MatchTree!(vibe.http.router.Route).MatchTree.doMatch [0xad02c4]
../../../root/.dub/packages/vibe-d-0.7.29/vibe-d/source/vibe/http/router.d:528 bool vibe.http.router.MatchTree!(vibe.http.router.Route).MatchTree.match(immutable(char)[], scope bool delegate(ulong, scope immutable(char))) [0xacfb5f]
../../../root/.dub/packages/vibe-d-0.7.29/vibe-d/source/vibe/http/router.d:261 void vibe.http.router.URLRouter.handleRequest(vibe.http.server.HTTPServerRequest, vibe.http.server.HTTPServerResponse) [0xacf1c5]
../../../root/.dub/packages/vibe-d-0.7.29/vibe-d/source/vibe/http/server.d:1796 bool vibe.http.server.handleRequest(vibe.core.stream.Stream, vibe.core.net.TCPConnection, vibe.http.server.HTTPListenInfo, ref vibe.http.server.HTTPServerSettings, ref bool) [0xaf907e]
../../../root/.dub/packages/vibe-d-0.7.29/vibe-d/source/vibe/http/server.d:1552 void vibe.http.server.handleHTTPConnection(vibe.core.net.TCPConnection, vibe.http.server.HTTPListenInfo) [0xaf76be]
../../../root/.dub/packages/vibe-d-0.7.29/vibe-d/source/vibe/http/server.d:1433 void vibe.http.server.listenHTTPPlain(vibe.http.server.HTTPServerSettings).doListen(vibe.http.server.HTTPListenInfo, bool, bool)._lambda4(vibe.core.net.TCPConnection) [0xaf7084]
../../../root/.dub/packages/vibe-d-0.7.29/vibe-d/source/vibe/core/drivers/libevent2
tcp.d:610 void vibe.core.drivers.libevent2tcp.ClientTask.execute() [0xb9d6c5]
../../../root/.dub/packages/vibe-d-0.7.29/vibe-d/source/vibe/core/core.d:488 void vibe.core.core.makeTaskFuncInfo!(void delegate()).makeTaskFuncInfo(ref void delegate()).callDelegate(vibe.core.core.TaskFuncInfo*) [0x9be0d1]
../../../root/.dub/packages/vibe-d-0.7.29/vibe-d/source/vibe/core/core.d:1119 void vibe.core.core.CoreTask.run() [0xb2ac11]
??:? void core.thread.Fiber.run() [0xc25f99]
??:? fiber
entryPoint [0xc25d1b]
??:? [0xffffffff]

when trying to log in.