Distillery on windows doesn't build tar.gz

Do you two have access to the same source code or are you working on distinct projects having the same problem?

Also could you please try it on a linux? Thats the major deployment target as far as I know.

yes we have access to the same code: https://github.com/Eqls/user_restfulapi_phx

we ran it on ubuntu vps and we got the same result :cry:

Well, I’m not getting even close to that, after mix release I get this (and a lot of warnings, I’ll ignore for now):

Generated user_restfulapi_phx app
** (Mix.Releases.Config.LoadError) could not load release config rel/config.exs
    ** (UndefinedFunctionError) function Mix.Config.Agent.start_link/0 is undefined (module Mix.Config.Agent is not available)
    Mix.Config.Agent.start_link()
    (stdlib) erl_eval.erl:677: :erl_eval.do_apply/6
    (stdlib) erl_eval.erl:446: :erl_eval.expr/5
    (stdlib) erl_eval.erl:126: :erl_eval.exprs/5
    (elixir) lib/code.ex:232: Code.eval_string/3
    (distillery) lib/mix/lib/releases/config/config.ex:281: Mix.Releases.Config.read_string!/1
    (distillery) lib/mix/lib/releases/config/config.ex:302: Mix.Releases.Config.read!/1
    (distillery) lib/mix/lib/releases/config/config.ex:54: Mix.Releases.Config.get/1
    (distillery) lib/distillery/tasks/release.ex:77: Mix.Tasks.Release.run/1
    (mix) lib/mix/task.ex:316: Mix.Task.run_task/3
    (mix) lib/mix/cli.ex:79: Mix.CLI.run_task/2
    (elixir) lib/code.ex:767: Code.require_file/2

But I’m using elixir 1.7.1, which has a known bug with disitillery AFAIK, because distillery used some private API.

I’m pretty sure you forgot to add server: true to the config :user_restfulapi_phx, UserRestfulapiPhxWeb.Endpoint section of your config. So after the release is built it is being run, but the phoenix server simply is not being started all by itself. It hast nothing to do with windows though.

Yeah, I was able to manage to build a relase on a VM with elixir 1.6.4, and after adding that line, it starts up and I get something listening on 4000 according to netstat -lnpt, as the VM is headless I haven’t checked what is actually served there.

For reference:

diff --git a/config/dev.exs b/config/dev.exs
index 544789a..7a92e94 100644
--- a/config/dev.exs
+++ b/config/dev.exs
   debug_errors:true,
   code_reloader: true,
   check_origin: false,
-  watchers: []
+  watchers: [],
+  server: true

 # ## SSL Support
 #

PS: Even though this works, I’m not sure if one should build a release using dev mode…

yeah it is working thank you all.
so i can see that it is running on the vps on localhost:4000, but how can i call it from outside?
I tried to build with prod setting too and setting the same thing, that it is served from localhost

I am trying to use nginx

ok it shows up now with this nginx setting:

 location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://localhost:34567;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";

}

now it is on the domain itself, how could i put it onto a specific port?

Huh? The docker exposed port or the nginx served port?

nono, I built it on the vps with distillery and I am running it with the foreground/start command.
and in nginx config i posted before it runs on port80, wich is defined a bit higher

server {
  listen 80;
  server_name myapp.com www.myapp.com;

  location / {
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_redirect off;
    proxy_pass http://localhost:34567;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
  }
}

I am guessing I can change the port there, but how could I run something next to it on a different port?

EDIT:
I figured it according to this: https://gist.github.com/apollolm/23cdf72bd7db523b4e1c