Skip to content

Commit

Permalink
Don't hard-code runtime application path
Browse files Browse the repository at this point in the history
It is not guaranteed that the app is installed to /app. Users of buildpacks other than Heroku require applications to be stored at other paths, such as [pkgr](http://github.com/crohr/pkgr) which uses /opt/${APP_NAME}. Furthermore, the source may not be located at /app at compile time, since not every buildpack executor uses a layered filesystem, and so must resort to using a sandbox build directory (some call this the good old days).

See crohr/pkgr#93 for the source of this.
  • Loading branch information
benlangfeld committed Jan 18, 2016
1 parent db39aa9 commit e8d80fe
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ config_vars_to_export=(DATABASE_URL)
# A command to run right after compiling the app
post_compile="pwd"
# Set the path the app is run from
runtime_path=/app
```


Expand Down
1 change: 1 addition & 0 deletions elixir_buildpack.config
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ erlang_version=18.1.3
elixir_version=1.2.0
always_rebuild=false
config_vars_to_export=(DATABASE_URL)
runtime_path=/app
8 changes: 4 additions & 4 deletions lib/erlang_funcs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ function install_erlang() {
mkdir -p $(erlang_build_path)
tar zxf ${cache_path}/$(erlang_tarball) -C $(erlang_build_path) --strip-components=1

rm -rf /app/.platform_tools/erlang
mkdir -p /app/.platform_tools
ln -s $(erlang_build_path) /app/.platform_tools/erlang
$(erlang_build_path)/Install -minimal /app/.platform_tools/erlang
rm -rf $(runtime_erlang_path)
mkdir -p $(runtime_platform_tools_path)
ln -s $(erlang_build_path) $(runtime_erlang_path)
$(erlang_build_path)/Install -minimal $(runtime_erlang_path)

cp -R $(erlang_build_path) $(erlang_path)
PATH=$(erlang_path)/bin:$PATH
Expand Down
8 changes: 8 additions & 0 deletions lib/path_funcs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ function erlang_path() {
echo "$(platform_tools_path)/erlang"
}

function runtime_platform_tools_path() {
echo "${runtime_path}/.platform_tools"
}

function runtime_erlang_path() {
echo "$(runtime_platform_tools_path)/erlang"
}

function elixir_path() {
echo "$(platform_tools_path)/elixir"
}
Expand Down

0 comments on commit e8d80fe

Please sign in to comment.