1

I've developed an app on Windows machine and I need to deploy it to Ubuntu 18.04 server. The tools I'd like to use are distillery and edeliver.

So can I just build the release with distillery on my Windows machine or should I build it on the machine with the same CPU architecture and Ubuntu 18.04 as the future production machine will be, for example create Virtualbox Ubuntu guest machine, share my app's project folder between Windows host machine and guest machine and build release on Ubuntu guest machine?

If someone develop elixir apps on Windows can you share steps of your deployment procedure?

AndreyKo
  • 1,421
  • 2
  • 11
  • 25

3 Answers3

0

Normally distillery packs everything you need to run your app and it's platform dependent. We do our builds in docker with image that matches production server architecture precisely, but it's also possible to use some dedicated build server.

However, if your app doesn't use any odd libraries that depend on binaries, I think (but I'm not sure) you might get away with just setting up runtime on server as you wish and just moving erlang bytecode compiled on Windows. But why would you want to do that?

Ivan Yurov
  • 1,578
  • 10
  • 27
  • Thanks, Ivan, I use at least one c library in my project (comeonin bcrypt) which should be compiled on Ubuntu machine to work correctly I think. And I'd prefer not to install the build environment on production server. – AndreyKo Jan 23 '19 at 12:38
  • Then Docker is your way to go. You don't even have to do it locally, I think github now has tools for building in containers, or AWS CodeBuild would do. – Ivan Yurov Jan 23 '19 at 12:42
  • Sorry for newbee question (I've never used Docker). No problem to install Docker on my Windows machine. What's next? I want to continue developing app on Windows and it seems edeliver commands don't work on Windows (according to https://github.com/edeliver/edeliver/issues/120 issue) – AndreyKo Jan 23 '19 at 13:11
  • Yeah, you'll be able to develop as usual, you will just run all release related routines from within docker and pull the result out of the container. It's relatively easy, you just need to install Docker and create a Dockerfile for your project, where you describe what image you're gonna use (there is a plenty of community images at dockerhub) and what local files should be in that image (copy it in, or bind as a volume). – Ivan Yurov Jan 23 '19 at 13:16
  • Look at this part of documentation for Distillery: https://hexdocs.pm/distillery/guides/building_in_docker.html – Ivan Yurov Jan 23 '19 at 13:18
  • Thanks for help, Ivan! I've read the docs and it looks promising and if I get it right we create the docker volume which shares my app source folder with docker ubuntu machine. Then we build the release on ubuntu and get the tarball in the shared folder. The next step is to upload this tarball from windows to production server. But there are more steps which edeliver takes care of: extract the tarball, migrate database. Do you do this manually every time? – AndreyKo Jan 23 '19 at 13:59
  • You can run edelivery stuff from docker container and it'll do that just like you were on linux machine. – Ivan Yurov Jan 23 '19 at 21:43
  • Thanks, I'll give it a try. – AndreyKo Jan 23 '19 at 21:52
0

I have attempted to help @PaulSchoenfelder with deploying Elixir apps built on Windows in the past. I don't believe I'm talking out of school to say we never had roaring success with this. We could get it to work but it always had some rough edges. Hence my answer to you would be build it (and run Distillery against it) on your Ubuntu target.


EDIT: I had forgotten that if you're on Windows 10 then WSL may be an option for you as well.

Onorio Catenacci
  • 14,928
  • 14
  • 81
  • 132
0

In general, the best way to deploy Erlang or Elixir is to use a release. A release will include the Erlang Runtime as well as all your config, beam files etc.

In theory, you can cross-compile a release but it is probably more trouble than it is worth. I generally just use a Virtual Machine via Vagrant

I have an email course about it here https://elixirtraining.us7.list-manage.com/subscribe?u=150de5dbc56d446a48f7fc3fd&id=03791ac7a9

Zachary K
  • 3,205
  • 1
  • 29
  • 36