How to package and deploy a Dart application on in-house plain Windows and Linux servers?

847 views
Skip to first unread message

William Rubin

unread,
Jan 10, 2016, 9:20:16 AM1/10/16
to Dart Server-side and Cloud Development
How would I package and deploy a Dart server application on a plain Windows box and a plain Linux box? 

I see lots of instructions for cloud based container solutions, etc. but nothing for "normal" in-house servers. 

I'm interested in understanding the difference an in-house Dart package and deploy on Linux and Windows as compared to to the rough equivalent in Go and a Windows deploy via .NET. Especially to see if Dart can be deployed in a self contained bundle without other dependencies needed on the servers, as Go allows.

Thanks,
--Will

Günter Zöchbauer

unread,
Jan 10, 2016, 10:06:28 AM1/10/16
to Dart Server-side and Cloud Development
Currently you "need" to install the Dart SDK (at least I think this is the best approach). 
I didn't have any issues when I tried to make a Dart app work by just copying the `dart` executable with the source files.
If you don't need access to external resources using package URIs (from the lib directory) you can create a a snapshot which leaves you with just two files to deploy. The dart executable and a snapshot.
There is currently a resource API work in progress, which AFAIK should allow to access resources using package URIs even when run from snapshots. 
Using normal file access works always of course.

I wrote a script that creates a directory (optional zipped into one file) that contains the build output for client application and all source files including used files from dependencies https://pub.dartlang.org/packages/pubs
No need to run `pub get` on the target platform.
I didn't use `pubs` for a while myself because I don't have anything to deploy currently. 
If you run into issues, please create an issue.

William Rubin

unread,
Jan 10, 2016, 1:10:42 PM1/10/16
to Dart Server-side and Cloud Development
> Currently you "need" to install the Dart SDK

Bummer. This means I'd have to fight the "just use Java" or "just use .NET" responses because they're already installed on their respective Windows or Linux boxes.

Go's being cross platform and self contained including within its own directory structure and xcopy deployable has turned out to be been a really nice advantage. Unfortunately (for me anyway), self contained deployment is something all the latest round of new run-time VM languages seemed to have skipped.

Thanks,
--Will

Günter Zöchbauer

unread,
Jan 10, 2016, 2:28:21 PM1/10/16
to Dart Server-side and Cloud Development
Coping two files instead of one makes it a no-go?
Server-side Dart might need some more love. 
Go is a compiled language and a binary file is the only output you can get at all.

William Rubin

unread,
Jan 10, 2016, 2:42:24 PM1/10/16
to Dart Server-side and Cloud Development
> Coping two files instead of one makes it a no-go?

No, installing the SDK into a separate area and having it used by potentially multiple applications and development groups is what makes it a tougher sell. Shared responsibility rather than owner responsibility is the issue.

Günter Zöchbauer

unread,
Jan 10, 2016, 4:13:06 PM1/10/16
to Dart Server-side and Cloud Development
As mentioned you can just copy the dart execuable with the source.

William Rubin

unread,
Jan 10, 2016, 4:52:12 PM1/10/16
to Dart Server-side and Cloud Development
I am not understanding. Are you saying I don't need to install the SDK? Is that with the scripts you wrote or without? Where do I place the lib files? Where do I place files pulled from pub.dartlang.org? (I know I'll need at least XML and a DB library.)

I guess that goes back to my original question ... is there any documentation for deploying a Dart server application on a plain Windows box and a plain Linux box? 

You've been helpful and this is likely all something really obvious I'm missing?!

--Will

Søren Gjesse

unread,
Jan 11, 2016, 2:37:07 AM1/11/16
to William Rubin, Dart Server-side and Cloud Development
As Günter mentioned you can build a snapshot from all you Dart source including packages. To create a snapshot:

  $ dart --snapshot test.snapshot test.dart

This will create the snapshot file test.snapshot. You can run your snapshot like this:

  $ dart test.snapshot

The snapshot test.snapshot is self-contained, and only need the Dart VM to run, which leaves you with just the two files dart (dart.exe on Windows) and test.snapshot to deploy. Also the snapshot is platform independent, so the generated snapshot can be used on both Linux, Mac OS and Windows.

There is more information on snapshots on https://www.dartlang.org/articles/snapshots/.

Regards,
Søren

---
Søren Gjesse
Software Engineer, Google Denmark
CVR nr. 28 86 69 84


--
You received this message because you are subscribed to the Google Groups "Dart Server-side and Cloud Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cloud+un...@dartlang.org.
Visit this group at https://groups.google.com/a/dartlang.org/group/cloud/.

William Rubin

unread,
Jan 11, 2016, 6:04:36 AM1/11/16
to Dart Server-side and Cloud Development, endo...@gmail.com
The link to the snapshots article was the piece I was missing. Günter's responses make sense to me now. I hadn't realized what snapshots were and thought they were something custom Günter had created for his own use. 

I'll play around with snapshots and deployment and see how it goes.

Thanks,
--Will

Warren Strange

unread,
Jan 11, 2016, 2:27:40 PM1/11/16
to Dart Server-side and Cloud Development, endo...@gmail.com

Another option to consider would be the Dart Docker images.  

You can package up your app into a Docker container which includes all dependencies and run it with a single command. 

Jagdish Korade

unread,
Jan 15, 2016, 2:47:30 PM1/15/16
to Dart Server-side and Cloud Development, endo...@gmail.com
Hi All

Could you suggest/advise me how to deploy dart on RHEL 5 / 6 /7 or it is supported only for Debian OS ?


Thanks,
Jagdish Korade

Søren Gjesse

unread,
Jan 18, 2016, 2:11:00 AM1/18/16
to Jagdish Korade, Dart Server-side and Cloud Development, William Rubin
At the moment there is no RHEL distribution of Dart that I am aware of. The binary which is in the Debian distribution is build in a Debian wheezy chroot, so depending on glibc versions it might also run on RHEL. The .zip we distribute from https://www.dartlang.org/downloads/archive/ is build on Ubuntu Precise. Otherwise building from source is always an option https://www.dartlang.org/downloads/linux.html#compiling.

Regards,
Søren

---
Søren Gjesse
Software Engineer, Google Denmark
CVR nr. 28 86 69 84


--
Reply all
Reply to author
Forward
0 new messages