Dev mode links are not relative to project root #130

Closed
eproxus opened this Issue Feb 26, 2014 · 14 comments

Comments

Projects
None yet
3 participants
@eproxus

eproxus commented Feb 26, 2014

When using the following structure:

root
├── apps
│   ├── app_a
│   └── app_b
├── node
│   ├── relx.config
│   └── _rel
│       ├── ...
│       ├── lib
│       └── ...
└── relx

And running (when in root) ./relx -r . -c node/relx.config -o node/_rel -d true release will create symlinks in node/_rel/lib that point to ./apps/app_a relative from node/_rel/lib and not relative from root which I would expect:

$ ls node/_rel/lib
lrwxr-xr-x   1 user  staff   13 Feb 26 17:35 app_a-1.0 -> ./apps/app_a
lrwxr-xr-x   1 user  staff   16 Feb 26 17:35 app-b-1.0 -> ./apps/app_b

The symlinks should be ../../../apps/APP instead. In this case, the release cannot be started and Relx can't find any beam files when making another release.

@jwilberding

This comment has been minimized.

Show comment Hide comment
@jwilberding

jwilberding Apr 6, 2014

Owner

@ericbmerritt What are your thoughts on this?

Owner

jwilberding commented Apr 6, 2014

@ericbmerritt What are your thoughts on this?

@eproxus

This comment has been minimized.

Show comment Hide comment
@eproxus

eproxus Apr 11, 2014

The situation now seems to be that this only works reliably with single app releases, but as soon as you are in a multi app setting and using the project root setting to define your structure, the dev mode is unusable. I can't see how making it relative would break any single app projects (root should either be in the app root, or set manually). Right now, it simply just doesn't work.

eproxus commented Apr 11, 2014

The situation now seems to be that this only works reliably with single app releases, but as soon as you are in a multi app setting and using the project root setting to define your structure, the dev mode is unusable. I can't see how making it relative would break any single app projects (root should either be in the app root, or set manually). Right now, it simply just doesn't work.

@tsloughter

This comment has been minimized.

Show comment Hide comment
@tsloughter

tsloughter May 4, 2014

Owner

Hm, I'll be looking at some devmode issues this weekend, I'll keep this in mind.

Owner

tsloughter commented May 4, 2014

Hm, I'll be looking at some devmode issues this weekend, I'll keep this in mind.

@tsloughter

This comment has been minimized.

Show comment Hide comment
@tsloughter

tsloughter May 4, 2014

Owner

@eproxus is this still an issue on master? I don't see what you are talking about. The symlink paths I get are absolute.

Owner

tsloughter commented May 4, 2014

@eproxus is this still an issue on master? I don't see what you are talking about. The symlink paths I get are absolute.

@eproxus

This comment has been minimized.

Show comment Hide comment
@eproxus

eproxus May 5, 2014

I'll try it again. We had some other problems on master related to boot files and start scripts (start.boot was not created, but {{release-name}}.boot which made the start script fail).

eproxus commented May 5, 2014

I'll try it again. We had some other problems on master related to boot files and start scripts (start.boot was not created, but {{release-name}}.boot which made the start script fail).

@eproxus

This comment has been minimized.

Show comment Hide comment
@eproxus

eproxus May 5, 2014

Nope, still doesn't work. Links are still absolute to the root directory.

Output of relx:

$ ./relx -r . -d -c nodes/my-node/relx.config -o nodes/my-node/_rel --overlay_vars vars-common.config --overlay_vars vars-local.config --overlay_vars vars-local-secret.config release
===> Starting relx build process ...
===> Resolving OTP Applications from directories:
          ./ebin
          ./apps
          ./deps
          /opt/erlang/R16B03-1.wx/lib
===> Resolving available OTP Releases from directories:
          ./ebin
          ./apps
          ./deps
          /opt/erlang/R16B03-1.wx/lib
===> Resolved 'my-node'-1.0.0
/rlx_template_renderer_31703210_1136695: Warning: Compiled template not saved (need out_dir option)
/rlx_template_renderer_26761713_7621571: Warning: Compiled template not saved (need out_dir option)
/rlx_template_renderer_90835556_7690496: Warning: Compiled template not saved (need out_dir option)
/rlx_template_renderer_81338091_6716977: Warning: Compiled template not saved (need out_dir option)
/rlx_template_renderer_93303211_3689902: Warning: Compiled template not saved (need out_dir option)
/rlx_template_renderer_77954291_3173133: Warning: Compiled template not saved (need out_dir option)
/rlx_copy_from_template_63582081_2793553: Warning: Compiled template not saved (need out_dir option)
/rlx_copy_to_template_86875142_3410246: Warning: Compiled template not saved (need out_dir option)
/rlx_copy_from_template_63582081_5594727: Warning: Compiled template not saved (need out_dir option)
/rlx_copy_to_template_20299976_6715988: Warning: Compiled template not saved (need out_dir option)
/rlx_template_from_template_1710199_7473828: Warning: Compiled template not saved (need out_dir option)
/rlx_template_to_template_16289668_8370837: Warning: Compiled template not saved (need out_dir option)
/Users/user/src/my-project/nodes/my-node/files/sys.config: Warning: Compiled template not saved (need out_dir option)
===> Dev mode enabled, release will be symlinked
Errors generating release

my_app: File not found: "my_app.app"

wes: File not found: "wes.app"

s3erl: File not found: "s3erl.app"

lhttpc: File not found: "lhttpc.app"

lager: File not found: "lager.app"

uuid: File not found: "uuid.app"

goldrush: File not found: "goldrush.app"

quickrand: File not found: "quickrand.app"

elli: File not found: "elli.app"

locker: File not found: "locker.app"

jiffy: File not found: "jiffy.app"

And the links look like this:

» ls -lah nodes/my-node/_rel/lib/
total 208
lrwxr-xr-x   1 user  staff    38B May  5 12:03 asn1-2.0.4 -> /opt/erlang/R16B03-1.wx/lib/asn1-2.0.4
lrwxr-xr-x   1 user  staff    13B May  5 12:03 my_app-1.0 -> ./apps/my_app
lrwxr-xr-x   1 user  staff    11B May  5 12:03 elli-0.4.1 -> ./deps/elli
...

eproxus commented May 5, 2014

Nope, still doesn't work. Links are still absolute to the root directory.

Output of relx:

$ ./relx -r . -d -c nodes/my-node/relx.config -o nodes/my-node/_rel --overlay_vars vars-common.config --overlay_vars vars-local.config --overlay_vars vars-local-secret.config release
===> Starting relx build process ...
===> Resolving OTP Applications from directories:
          ./ebin
          ./apps
          ./deps
          /opt/erlang/R16B03-1.wx/lib
===> Resolving available OTP Releases from directories:
          ./ebin
          ./apps
          ./deps
          /opt/erlang/R16B03-1.wx/lib
===> Resolved 'my-node'-1.0.0
/rlx_template_renderer_31703210_1136695: Warning: Compiled template not saved (need out_dir option)
/rlx_template_renderer_26761713_7621571: Warning: Compiled template not saved (need out_dir option)
/rlx_template_renderer_90835556_7690496: Warning: Compiled template not saved (need out_dir option)
/rlx_template_renderer_81338091_6716977: Warning: Compiled template not saved (need out_dir option)
/rlx_template_renderer_93303211_3689902: Warning: Compiled template not saved (need out_dir option)
/rlx_template_renderer_77954291_3173133: Warning: Compiled template not saved (need out_dir option)
/rlx_copy_from_template_63582081_2793553: Warning: Compiled template not saved (need out_dir option)
/rlx_copy_to_template_86875142_3410246: Warning: Compiled template not saved (need out_dir option)
/rlx_copy_from_template_63582081_5594727: Warning: Compiled template not saved (need out_dir option)
/rlx_copy_to_template_20299976_6715988: Warning: Compiled template not saved (need out_dir option)
/rlx_template_from_template_1710199_7473828: Warning: Compiled template not saved (need out_dir option)
/rlx_template_to_template_16289668_8370837: Warning: Compiled template not saved (need out_dir option)
/Users/user/src/my-project/nodes/my-node/files/sys.config: Warning: Compiled template not saved (need out_dir option)
===> Dev mode enabled, release will be symlinked
Errors generating release

my_app: File not found: "my_app.app"

wes: File not found: "wes.app"

s3erl: File not found: "s3erl.app"

lhttpc: File not found: "lhttpc.app"

lager: File not found: "lager.app"

uuid: File not found: "uuid.app"

goldrush: File not found: "goldrush.app"

quickrand: File not found: "quickrand.app"

elli: File not found: "elli.app"

locker: File not found: "locker.app"

jiffy: File not found: "jiffy.app"

And the links look like this:

» ls -lah nodes/my-node/_rel/lib/
total 208
lrwxr-xr-x   1 user  staff    38B May  5 12:03 asn1-2.0.4 -> /opt/erlang/R16B03-1.wx/lib/asn1-2.0.4
lrwxr-xr-x   1 user  staff    13B May  5 12:03 my_app-1.0 -> ./apps/my_app
lrwxr-xr-x   1 user  staff    11B May  5 12:03 elli-0.4.1 -> ./deps/elli
...
@tsloughter

This comment has been minimized.

Show comment Hide comment
@tsloughter

tsloughter May 5, 2014

Owner

That is crazy... What system are you using? Also, it is erroring building the release because it can't find any of the app files, maybe that is related?

Owner

tsloughter commented May 5, 2014

That is crazy... What system are you using? Also, it is erroring building the release because it can't find any of the app files, maybe that is related?

@eproxus

This comment has been minimized.

Show comment Hide comment
@eproxus

eproxus May 5, 2014

OS X, Erlang 17.0 or Erlang R16B03-1. I'll see if I can create a sample project to trigger it with.

eproxus commented May 5, 2014

OS X, Erlang 17.0 or Erlang R16B03-1. I'll see if I can create a sample project to trigger it with.

@eproxus

This comment has been minimized.

Show comment Hide comment
@eproxus

eproxus May 5, 2014

Here's a trigger project: https://github.com/eproxus/relx_bug (using 17.0 binaries for rebar and relx, you can replace them with R16B03-1 binaries or something else). Note that rebar needs to be version 2.2.0 (master has bugs that makes this example not work).

eproxus commented May 5, 2014

Here's a trigger project: https://github.com/eproxus/relx_bug (using 17.0 binaries for rebar and relx, you can replace them with R16B03-1 binaries or something else). Note that rebar needs to be version 2.2.0 (master has bugs that makes this example not work).

@eproxus

This comment has been minimized.

Show comment Hide comment
@eproxus

eproxus May 5, 2014

It seems it can't find the app files because the root directory is not "handled correctly", depending on definition. 😄

eproxus commented May 5, 2014

It seems it can't find the app files because the root directory is not "handled correctly", depending on definition. 😄

@tsloughter

This comment has been minimized.

Show comment Hide comment
@tsloughter

tsloughter May 5, 2014

Owner

Good news and bad news, both are the same news. This did reproduce the error for me :)

And I discovered the issue. The root dir set with -r needs to be resolved. Because you are setting it to . in the Makefile it is being left as that when the links are created and must relate to not finding the apps as well.

This should be an easy fix that I can work on tonight.

For now, is there a reason you need the -r in your real project? It doesn't look needed in this example at least. Using:

$ ./relx -d -c nodes/my-node/relx.config -o nodes/my-node/_rel releas

Worked just fine.

Owner

tsloughter commented May 5, 2014

Good news and bad news, both are the same news. This did reproduce the error for me :)

And I discovered the issue. The root dir set with -r needs to be resolved. Because you are setting it to . in the Makefile it is being left as that when the links are created and must relate to not finding the apps as well.

This should be an easy fix that I can work on tonight.

For now, is there a reason you need the -r in your real project? It doesn't look needed in this example at least. Using:

$ ./relx -d -c nodes/my-node/relx.config -o nodes/my-node/_rel releas

Worked just fine.

@eproxus

This comment has been minimized.

Show comment Hide comment
@eproxus

eproxus May 5, 2014

That seems to work for me as well. I thought it was something related to how I found the overlay vars files, but this also seems to work (they are relative to the relx.config file?).

eproxus commented May 5, 2014

That seems to work for me as well. I thought it was something related to how I found the overlay vars files, but this also seems to work (they are relative to the relx.config file?).

@tsloughter

This comment has been minimized.

Show comment Hide comment
@tsloughter

tsloughter May 5, 2014

Owner

Great! Yea, they are relative to the config file.

Hope this moves things along for you, but is still an annoying bug that I'll hopefully resolve tonight.

Owner

tsloughter commented May 5, 2014

Great! Yea, they are relative to the config file.

Hope this moves things along for you, but is still an annoying bug that I'll hopefully resolve tonight.

@eproxus

This comment has been minimized.

Show comment Hide comment
@eproxus

eproxus May 5, 2014

Awesome, thanks for the support!

eproxus commented May 5, 2014

Awesome, thanks for the support!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment