Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prompt for release deployment selection when there shouldn't be #167

Closed
hut8 opened this issue Nov 6, 2016 · 4 comments
Closed

Prompt for release deployment selection when there shouldn't be #167

hut8 opened this issue Nov 6, 2016 · 4 comments

Comments

@hut8
Copy link

hut8 commented Nov 6, 2016

Hey! I'm new to Elixir so this may be a PEBKAC, but thanks for an awesome tool either way. It makes me feel like I'm using Capistrano but better. However I think I've found a bug 馃槚

It almost looks like #36, but I'm pretty sure it's different as I've set GIT_CLEAN_PATHS=${GIT_CLEAN_PATHS:="rel"} and it seems like the correct files exist in that directory (rel contains what I expect; see below).

Environment

  • Edeliver version (mix edeliver --version): edeliver v1.4.0
  • Elixir version (elixir -v):
Erlang/OTP 19 [erts-8.1] [source-4cc2ce3] [64-bit] [smp:2:2] [async-threads:10] [hipe] [kernel-poll:false]

Elixir 1.3.3
  • Build tool and version (distillery|exrm): distillery
  • Operating system (on build / deploy hosts): Ubuntu Xenial
  • Are you using an umbrella project (yes|no): no

Current behavior

I've deployed my app a couple of times. My build and production server are the same machine. I have AUTO_VERSION set: export AUTO_VERSION='git-revision' as well as GIT_CLEAN_PATHS=${GIT_CLEAN_PATHS:="rel"}

When I build with mix edeliver build release --verbose, it ends (successfully) with the following:

==> Release successfully built!
    You can run it in one of the following ways:
      Interactive: rel/broad_highway/bin/broad_highway console
      Foreground: rel/broad_highway/bin/broad_highway foreground
      Daemon: rel/broad_highway/bin/broad_highway start
-----> Copying release 0.0.3+bc2cc13 to local release store
-----> Copying broad_highway.tar.gz to release store

So as you can see, I just built 0.0.3+bc2cc13. Good so far.

When I run mix edeliver deploy release production --clean-deploy --start-deploy --verbose, I'm met with:

Found 3 different versions to deploy.
Type the version you want to deploy
or set --version=X in the command line.
Versions:
 0.0.3+604f892
 0.0.3+9a6812a
 0.0.3+bc2cc13

Now I'm confused. Isn't --clean-deploy supposed to get rid of the old releases? When I search for these releases on the build machine (which is also the production server), here's the output when I try to find where the releases are actually going:

liam@broad-highway ~ % sudo find / -iname 0.0.3+9a6812a 2> /dev/null
/home/broad-highway/app/broad_highway/releases/0.0.3+9a6812a # that's the one that's running
liam@broad-highway ~ % sudo find / -iname 0.0.3+604f892 2> /dev/null
# nothing at all
liam@broad-highway ~ % sudo find / -iname 0.0.3+bc2cc13 2> /dev/null
/tmp/edeliver/broad_highway/builds/rel/broad_highway/releases/0.0.3+bc2cc13 # that's the one I'm trying to deploy

Also, listing the releases directory, I get what I expect:

liam@broad-highway ~ % ls /tmp/edeliver/broad_highway/builds/rel/broad_highway/releases/
0.0.3+bc2cc13  RELEASES  start_erl.data

Expected behavior

Because I'm using --clean-deploy, I would expect that only 0.0.3+bc2cc13 is found when running . I'm not sure why 0.0.3+604f892 is found at all (running sudo find / -iname '*604f892*' 2> /dev/null on the build/production machine returns nothing ever), and edeliver finds the current production release, which it shouldn't.

@bharendt
Copy link
Contributor

bharendt commented Nov 8, 2016

Hello. Thanks for the detailed description.
The --clean-deploy option causes edeliver to clean the releases dir on the deploy host(s), before uploading and extracting the release tar. This option is mainly intended to be used when testing upgrades. When you test an upgrade from version A to B and you have to adjust the upgrade B (the relup script), you have to remove the existing old release B from your test-release before testing the upgrade to B again. So the --clean-deploy option removes all existing releases from <your-app-path>/releases/* on the deploy host, before deploying the "initial" release (again).

The selection you see while deploying are the available built releases in your release store, which you can deploy to a host. If you want to build and deploy a release immediately without that selection, you can use the edeliver update command which does both in one step and directly deploys the previously built release.

And if you want the release selection to be more meaningful, you can add commit-count or the build date to the (auto-) version.

@hut8
Copy link
Author

hut8 commented Nov 8, 2016

Awesome. When you write,

The selection you see while deploying are the available built releases in your release store

I set my release store (I think, unless I'm misunderstanding) to /tmp/edeliver/broad_highway/builds/rel/broad_highway/releases/. Or is this not the release store?

But as you can see from the output above, ls /tmp/edeliver/broad_highway/builds/rel/broad_highway/releases/ returns only one release (the most current) on that server. So why were three found?

@lessless
Copy link
Member

lessless commented Feb 4, 2018

Hey @hut8 ,
I'm closing this since it seems to not be an issue anymore. Here is the code responsible for looking up releases https://github.com/edeliver/edeliver/blob/master/libexec/erlang#L658
What yours RELEASE_STORE is pointing to?

@lessless lessless closed this as completed Feb 4, 2018
@18thletter
Copy link

Hey, @hut8. This is almost 2 years too late, but these leftover releases are coming from your local release store. For me, this is in my project, at .deliver/releases. You most likely added an entry for your release store to your .gitignore at some point. Check this directory for releases that are stale.

I'm leaving this here in case someone else is having the same question.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants