Thread overview
How to run d app as service ?
Feb 19, 2018
Jayam
Feb 19, 2018
Nicholas Wilson
Feb 19, 2018
bauss
Feb 19, 2018
Jacob Carlborg
Feb 19, 2018
Seb
Feb 20, 2018
aberba
February 19, 2018
In production server, we need to run Dlang app as service.
February 19, 2018
On Monday, 19 February 2018 at 12:29:12 UTC, Jayam wrote:
> In production server, we need to run Dlang app as service.

Please direct such questions to the learn group. Also I suspect you'll need to provide more information than that.
February 19, 2018
On Monday, 19 February 2018 at 12:29:12 UTC, Jayam wrote:
> In production server, we need to run Dlang app as service.

What do you mean by running dlang app as a service?

An application written in D?

Same way you would with a C++ application.
February 19, 2018
On 2018-02-19 13:29, Jayam wrote:
> In production server, we need to run Dlang app as service.

If you're referring to running it as a service in the background, I highly recommend Systemd if your platform supports. You don't need to to any specific with the D application. Just correctly Systemd for your application, it should be pretty easy to find by googling, it's not anything specific to D.

-- 
/Jacob Carlborg
February 19, 2018
On Monday, 19 February 2018 at 12:29:12 UTC, Jayam wrote:
> In production server, we need to run Dlang app as service.

If you are looking for a PaaS (platform as a service), using Heroku is pretty easy:

https://tour.dlang.org/tour/en/vibed/deploy-on-heroku

Also as other mentioned, everything else is similar to how you would do it with any other compiled language, e.g. Systemd

People nowadays seems to be preferring Docker for deployment, you can just COPY the built binary into any container or alternatively you can build it in Docker too:


https://github.com/wilzbach/dlang-docker/blob/master/example-app/Dockerfile
February 20, 2018
On Monday, 19 February 2018 at 12:29:12 UTC, Jayam wrote:
> In production server, we need to run Dlang app as service.

The Heroku tour Seb wrote about above is one easy way to host a serverside app (if that's what you're looking for).  However, serverside apps need someone sort of database so you may use one of Heroku addons for a third party mysql hosting.


Recently I've found a much convenient and future prof approach with Google's app engine. When you have their CLI client installed, all that is left is a config yaml file (to set it as a custom runtime)  and your docker file.

app.yaml
---------
env: flex
runtime: custom


Then the docker file will configure your app into a docker image. I've written a sample docker Vibe.d app in my Github repo at https://github.com/aberba/docker-vibed-demo.

With your app.yaml file placed in your docker project root,  all you now do is run the command:

gcloud app deploy


Google Cloud has mysql and Postgresql support. Plus tone of other services when u need them. Its much cheaper than Heroku for starters. Cheaper than AWS with their per minute pay-what-you-use pricing policy.


Anyways, if you know enough docker orchestration, you can roll out your own docker cluster. A lot of options are available with Docker.