bitwalker / exrm

Automatically generate a release for your Elixir project!
MIT License
923 stars 110 forks source link

tar_unknown_generation_error #264

Closed dbulic closed 6 years ago

dbulic commented 8 years ago

I guess it's a similar issue like #158. Also, I have to run MIX_ENV=prod mix compile, as it's not invoked automatically. This is my first attempt at deploying via exrm, so I might have missed something. I followed Phoenix docs.

Full log is attached: release_log.txt

===> Running provider tar
{{case_clause,
     {'EXIT',
         {function_clause,
             [{filename,join,[[]],[{file,"filename.erl"},{line,393}]},
              {erl_tar,split_filename,4,[{file,"erl_tar.erl"},{line,471}]},
              {erl_tar,create_header,3,[{file,"erl_tar.erl"},{line,400}]},
              {erl_tar,add1,4,[{file,"erl_tar.erl"},{line,323}]},
              {erl_tar,foreach_while_ok,2,[{file,"erl_tar.erl"},{line,1000}]},
              {systools_make,add_to_tar,3,
                  [{file,"systools_make.erl"},{line,1879}]},
              {systools_make,add_appl,7,
                  [{file,"systools_make.erl"},{line,1750}]},
              {systools_make,'-add_applications/5-fun-0-',6,
                  [{file,"systools_make.erl"},{line,1569}]}]}}},
 [{systools_make,'-add_applications/5-fun-0-',6,
      [{file,"systools_make.erl"},{line,1569}]},
  {lists,foldl,3,[{file,"lists.erl"},{line,1262}]},
  {systools_make,add_applications,5,[{file,"systools_make.erl"},{line,1568}]},
  {systools_make,mk_tar,6,[{file,"systools_make.erl"},{line,1562}]},
  {systools_make,mk_tar,5,[{file,"systools_make.erl"},{line,1538}]},
  {systools_make,make_tar,2,[{file,"systools_make.erl"},{line,336}]},
  {rlx_prv_archive,make_tar,3,[{file,"src/rlx_prv_archive.erl"},{line,83}]},
  {relx,run_provider,2,[{file,"src/relx.erl"},{line,308}]}]}
===> Provider (tar) failed with: {error,
                                         {rlx_prv_archive,
                                          {tar_unknown_generation_error,
                                           "phoenixcore","1.0.0"}}}
bitwalker commented 8 years ago

Are you doing an upgrade? If not, can you run mix release.clean --implode --no-confirm, blow away _build and deps and then run mix deps.get && MIX_ENV=prod mix do compile, release? This error is coming from relx itself, and I'm not sure what's causing it, but the solution to this the last time it was seen was a clean checkout, so blowing away all the build/release artifacts should give us a clean slate.

You could also clone exrm-test and try to reproduce with that.

dbulic commented 8 years ago

Doing that still ends up with

===> Running provider tar
{{case_clause,
     {'EXIT',
         {function_clause,
             [{filename,join,[[]],[{file,"filename.erl"},{line,393}]},
              {erl_tar,split_filename,4,[{file,"erl_tar.erl"},{line,471}]},
              {erl_tar,create_header,3,[{file,"erl_tar.erl"},{line,400}]},
              {erl_tar,add1,4,[{file,"erl_tar.erl"},{line,323}]},
              {erl_tar,foreach_while_ok,2,[{file,"erl_tar.erl"},{line,1000}]},
              {systools_make,add_to_tar,3,
                  [{file,"systools_make.erl"},{line,1879}]},
              {systools_make,add_appl,7,
                  [{file,"systools_make.erl"},{line,1750}]},
              {systools_make,'-add_applications/5-fun-0-',6,
                  [{file,"systools_make.erl"},{line,1569}]}]}}},
 [{systools_make,'-add_applications/5-fun-0-',6,
      [{file,"systools_make.erl"},{line,1569}]},
  {lists,foldl,3,[{file,"lists.erl"},{line,1262}]},
  {systools_make,add_applications,5,[{file,"systools_make.erl"},{line,1568}]},
  {systools_make,mk_tar,6,[{file,"systools_make.erl"},{line,1562}]},
  {systools_make,mk_tar,5,[{file,"systools_make.erl"},{line,1538}]},
  {systools_make,make_tar,2,[{file,"systools_make.erl"},{line,336}]},
  {rlx_prv_archive,make_tar,3,[{file,"src/rlx_prv_archive.erl"},{line,83}]},
  {relx,run_provider,2,[{file,"src/relx.erl"},{line,308}]}]}
===> Provider (tar) failed with: {error,
                                         {rlx_prv_archive,
                                          {tar_unknown_generation_error,
                                           "phoenixcore","1.0.0"}}}

I noticed it doesn't happen with new project and am now trying to copy parts of my project into new one , trying to do release on each step to isolate what is causing the relx to break.

dbulic commented 8 years ago

Incredibly, it has to do with assets. Here is the script I use to build everything:

mix deps.get --only prod
MIX_ENV=prod mix compile

brunch build --production
MIX_ENV=prod mix phoenix.digest

MIX_ENV=prod mix release

If I wipe out web/static/assets and priv/static, it will make the release. However, once I copy my assets into web/static, it will fail with the error I mentioned earlier.

bitwalker commented 8 years ago

@dbulic Sorry I'm just getting back around to this!

I haven't heard anyone else using exrm with phoenix have issues with assets, I'm wondering if perhaps there is something specific to the files being put in web/static. Do you still have this issue? Could you run tree web/static and paste the output here? If you don't have tree installed, it should be available via your package manager (brew install tree was how I installed it myself)

dbulic commented 8 years ago

Thanks for getting back to me! However, I don't have the problem anymore - I simply copied files to a new project few at a time until I reached a point where it fails, so I stopped there. Don't have the old directory, so can't help you reproduce the issue. I think it's best just to close this issue. If someone stumbles upon same problem, hope you'll have enough info to repro it.

mingchuno commented 8 years ago

@dbulic I got exactly the same problem as you in #299 But I am not running a phoenix project. I am going to try to copy the project pic by pic like you and find the root cause

jeromedoyle commented 8 years ago

@dbulic @mingchuno I think this is because of long filename/filepaths. I've posted my findings in https://github.com/bitwalker/exrm/issues/299

bitwalker commented 8 years ago

@jeromedoyle Holy shit, I think you nailed it. I'd need to test to be sure, but I saw some of your module names in your tree output, and was surprised at how long they were. I wouldn't be surprised if that's what is causing the error in both issues.

jeromedoyle commented 8 years ago

Yeah, I don't like the long module names, but they map to the nested structure of the json I'm getting returned to me.