gatling icon indicating copy to clipboard operation
gatling copied to clipboard

errors when performing initial deployment using gatling

Open ipatch opened this issue 7 years ago • 23 comments

I'm using the below command on my VPS to deploy an app I recently put together. sudo -E mix gatling.deploy kegcopr_api

However, the deployment errors out when it tries to start the app as a service.

$ mix release --warnings-as-errors --env=prod (/home/deploy/kegcopr_api)
==> Assembling release..
==> Building release kegcopr_api:0.0.1 using environment prod
==> Including ERTS 8.3 from /home/deploy/.asdf/installs/erlang/19.3/lib/erlang/erts-8.3
==> Packaging release..
==> Release successfully built!
    You can run it in one of the following ways:
      Interactive: _build/prod/rel/kegcopr_api/bin/kegcopr_api console
      Foreground: _build/prod/rel/kegcopr_api/bin/kegcopr_api foreground
      Daemon: _build/prod/rel/kegcopr_api/bin/kegcopr_api start
$ tar -xf kegcopr_api.tar.gz (/home/deploy/deployments/kegcopr_api)
/etc/init.d/kegcopr_api already exists
$ service kegcopr_api start
** (ErlangError) erlang error: :enoent
    (elixir) lib/system.ex:564: System.cmd("service", ["kegcopr_api", "start"], [stderr_to_stdout: true, into: %IO.Stream{device: :standard_io, line_or_bytes: :line, raw: false}])
    lib/gatling/tasks/deploy.ex:189: Mix.Tasks.Gatling.Deploy.start_service/1
    lib/gatling/tasks/deploy.ex:201: Mix.Tasks.Gatling.Deploy.call/2
    lib/gatling/tasks/deploy.ex:39: Mix.Tasks.Gatling.Deploy.deploy/1
    (mix) lib/mix/task.ex:294: Mix.Task.run_task/3
    (mix) lib/mix/cli.ex:58: Mix.CLI.run_task/2

Any help related to this issue would greatly be appreciated.

And I forgot to mention I'm using erlang 19.3 and elixir 1.4.2 via the asdf package manager.

Update Removed the file /etc/init.d/kegcopr_api and reran the below command, sudo -E mix gatling.deploy kegcopr_api

Now I'm getting the following error messages.

$ mix release --warnings-as-errors --env=prod (/home/deploy/kegcopr_api)
==> Assembling release..
==> Building release kegcopr_api:0.0.1 using environment prod
==> Including ERTS 8.3 from /home/deploy/.asdf/installs/erlang/19.3/lib/erlang/erts-8.3
==> Packaging release..
==> Release successfully built!
    You can run it in one of the following ways:
      Interactive: _build/prod/rel/kegcopr_api/bin/kegcopr_api console
      Foreground: _build/prod/rel/kegcopr_api/bin/kegcopr_api foreground
      Daemon: _build/prod/rel/kegcopr_api/bin/kegcopr_api start
$ tar -xf kegcopr_api.tar.gz (/home/deploy/deployments/kegcopr_api)
$ update-rc.d kegcopr_api defaults
** (ErlangError) erlang error: :enoent
    (elixir) lib/system.ex:564: System.cmd("update-rc.d", ["kegcopr_api", "defaults"], [stderr_to_stdout: true, into: %IO.Stream{device: :standard_io, line_or_bytes: :line, raw: false}])
    lib/gatling/tasks/deploy.ex:139: Mix.Tasks.Gatling.Deploy.install_init_script/1
    lib/gatling/tasks/deploy.ex:201: Mix.Tasks.Gatling.Deploy.call/2
    lib/gatling/tasks/deploy.ex:37: Mix.Tasks.Gatling.Deploy.deploy/1
    (mix) lib/mix/task.ex:294: Mix.Task.run_task/3
    (mix) lib/mix/cli.ex:58: Mix.CLI.run_task/2

ipatch avatar Apr 25 '17 16:04 ipatch

I was never able to get the app deployed using Debian 7.11 probably because of the lack of systemd. However, when I created a new Debian 8.7 droplet with my hosting provider I was able to successfully deploy the app.

ipatch avatar May 03 '17 21:05 ipatch

I am having similar issues. I have not been able to deploy on a fresh Ubuntu 16.04.2 x64 OS

I get this error when I run the command sudo --preserve-env mix gatling.deploy app

(Mix) Trying to load App.Mixfile from "nofile" but another project with the same name was already defined at "/home/admin/app/mix.exs"

Elixir version: 1.4.4

praisegeek avatar Jun 09 '17 07:06 praisegeek

Getting similar issue but for upgrade deployments. Deployments were working fine for last few months, but this issue came up today.

remote: $ service myapp ping
remote: warning: redefining module MyApp.Mixfile (current version defined in memory)
remote:   nofile:1
remote:
remote: ** (Mix) Trying to load MyApp.Mixfile from "nofile" but another project with the same name was already defined at "nofile"

There were no core changes in either mix files or any tasks related to it. In fact, the changes which were push were mainly in JavaScript.

Elixir 1.4.2 Phoenix 1.2

wicliff avatar Jun 13 '17 12:06 wicliff

Has anyone figured out how to get past this. Here is what I get when initially trying to deploy.

** (Mix) Trying to load MyApp.Mixfile from "nofile" but another project with the same name was already defined at "nofile"

laifharwood avatar Jun 16 '17 22:06 laifharwood

@laifharwood The problem we found was that Erlang version got upgraded on the deployment server to version 20, and Elixir to 1.4.4

Had to revert back the Erlang version to 19.3 and Elixir to 1.4.2. Deployments started working after that, but really not sure if that is the actual problem or something else.

wicliff avatar Jun 20 '17 05:06 wicliff

I am seeing the same problem and had to deploy manually on the server using mix release and then copying the files manually to the deploy directory.

Sadly I don't understand what is going here, but would love to assist in solving this. @dennisreimann can you check and help us out here? That would be awesome.

bitboxer avatar Jun 23 '17 05:06 bitboxer

My first guess would be a version conflict: Depending on your setup and Distillery config you might need the same Erlang versions on your build server and the production server. See the Distillery docs for more information on that: https://hexdocs.pm/distillery/walkthrough.html#deploying-your-release

dennisreimann avatar Jun 23 '17 18:06 dennisreimann

I only have one server. it builds and runs the production. And it only has one elixir version. When I run mix release it works and I can manually create the release and deploy it. But when I try to run any of the mix gatling.* commands, I see this error:

** (Mix) Trying to load MyApp.Mixfile from "nofile" but another project with the same name was already defined at "nofile"

So somehow gatling does something with the mix file and this doesn't work anymore on erlang/otp 20? Just a guess.

bitboxer avatar Jun 23 '17 21:06 bitboxer

Tried this yesterday with a fully fresh Digital Ocean droplet and Elixir 1.4.5 / OTP 20 on both sides. The deploying side was macOS, and the host was Ubuntu 17.04 , but otherwise all versions should've matched up. So I'd suspect its not a version conflict, but maybe there's something different between OSs?

wstrinz avatar Jun 26 '17 21:06 wstrinz

** (Mix) Trying to load MyApp.Mixfile from "nofile" but another project with the same name was already defined at "nofile"

having same issue on my new deployment server that uses Elixir 1.4.5 / OTP 20 and Ubuntu 16.04. Would much appriciate any help. How can i revert back OTP to 19?

fuchsberger avatar Jul 07 '17 00:07 fuchsberger

@Sathras Had the same problem and it was resolved when I removed Erlang & Elixir completely and installed the older versions again

# Remove installed versions
sudo apt-get purge esl-erlang elixir

# Checking for the versions available
sudo apt-cache showpkg esl-erlang | more

# You can install your specific version 
sudo apt-get install esl-erlang=1:19.0
sudo apt-get install elixir=1.4.2-1

# You need to hold the versions, so that they do not auto update
sudo apt-mark hold esl_erlang elixir

** commands are from memory, you can verify before running them

wicliff avatar Jul 07 '17 10:07 wicliff

@wicliff Thank you!

josephan avatar Jul 12 '17 07:07 josephan

The same happening here. Why is not already solved?

jfcalvo avatar Oct 11 '17 17:10 jfcalvo

I believe this project is unfortunately stalled. I am desperately waiting for a Phoenix 1.3 implementation since I don't have the skill to adapt a full solution by myself but it seams not to many people care :(

On Wed, Oct 11, 2017 at 12:53 José Francisco Calvo [email protected] wrote:

The same happening here. Why is not already solved?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/hashrocket/gatling/issues/53#issuecomment-335894281, or mute the thread https://github.com/notifications/unsubscribe-auth/AHukT3GXfnH8Cuu2LqOB6eOgCB_jltaDks5srQCNgaJpZM4NHvhk .

fuchsberger avatar Oct 11 '17 18:10 fuchsberger

I switched to https://github.com/labzero/bootleg

bitboxer avatar Oct 11 '17 19:10 bitboxer

According to hex.pm edeliver seems to be a pretty popular solution.

https://hex.pm/packages/edeliver

ipatch avatar Oct 11 '17 19:10 ipatch

We are trying to free up some resources to work on this. Until then check out this video from last week on how to deploy using Gatling - https://www.dailydrip.com/topics/elixir/drips/deploying-a-phoenix-app-with-gatling Maybe it will help temporarily solve some of the issues?

tmock12 avatar Oct 13 '17 11:10 tmock12

sudo mix gatling.deploy myapp

`warning: redefining module MyApp.Mixfile (current version defined in memory) nofile:1

** (Mix) Trying to load MyApp.Mixfile from "nofile" but another project with the same name was already defined at "nofile"`

Same issue as reported above - spent a little time digging around trying to resolve this, but came up empty-handed.

jrissler avatar Oct 15 '17 20:10 jrissler

Am having the same issue now with a new Phoenix 1.3 app deployed to Ubuntu 16.04, I imagine it is probably an Erlang/OTP versioning issue as speculated above. Am going to try my luck with edeliver, hoping Gatling comes back to life soon!

** (Mix) Trying to load App.Mixfile from "nofile" but another project with the same name was already defined at "nofile"

njwest avatar Oct 28 '17 14:10 njwest

Got the same issue, need to use the old version Erlang/OTP, really?

** (Mix) Trying to load Exsite.Mixfile from "nofile" but another project with the same name was already defined at "/root/exsite/mix.exs"

shisongsong avatar Nov 01 '17 16:11 shisongsong

@shisongsong eDeliver works for me on Erlang 1.4/OTP 20 with Phoenix 1.3 on Ubuntu, I recommend switching to that: https://github.com/edeliver/edeliver

njwest avatar Nov 02 '17 08:11 njwest

@niwest Thanks a lot ,I will have a try.

shisongsong avatar Nov 03 '17 02:11 shisongsong

Yo I didn't do anything. Give credit to the OG @shisongsong

niwest avatar Nov 03 '17 02:11 niwest