where is env_dir of heroku buildpack compile comes from? - heroku

I've read the article buildpack-api, but still get confused.
The bin/compile of buildpack has 3 arguments, BUILD_DIR CACHE_DIR ENV_DIR, which is used in the build process.
But how can a user specify the 3 DIRs? Is it comes from herocu config var like this?
heroku config:set CACHE_DIR=cache
and user should mannually create a cache directory in the root directory of his project?
howto specify the BUILD_DIR when it is not the root of the project?

Related

Permission denied in custom buildpack

I am writing a custom buildpack that downloads a file and stores it inside /var/lib/myfolder
To do this I first run mkdir -p /var/lib/myfolder
But this results in a Permission Denied when running the buildpack.
How can I solve this?
Only the /app folder will be stored at the end of your build, and your buildpack doesn't have sudo access.
You need to store all files inside that folder, and configure your libraries to use dependencies under the right path there.

Deploying phoenix framework on heroku with webpack

I followed the docs in the official website. The problem is I use webpack as my bundler instead of brunch. The deployment is successful. I can even access the api routes. My only problem is the assets (js,css) in the homepage is not found. Locally, I can access the home page successfully when I run mix phoenix.server.
I tried peeking at the priv/static folder in heroku (using heroku run bash) where the files are moved after being compiled and saw the asset files there. Did I miss anything? or a configuration that I should put?
Here is the remote deploy output
http://pastebin.com/1mL1YWTS
Here is my custom compile file (to override phoenix-static buldpack)
http://pastebin.com/BGHf9xBK
Here is my webpack.config.js
http://pastebin.com/Xv2E1yCE
I have used webpack with the following compile:
./node_modules/.bin/webpack -p
mix phoenix.digest
You need to call mix phoenix.digest to generate a manifest that can be used in the static path helpers. http://hexdocs.pm/phoenix/Mix.Tasks.Phoenix.Digest.html#run/1

How to clear heroku remote repository? [duplicate]

My heroku slug size is 389mb, so push is rejected. Now the Point is, if i deploy my same application on new domain (by using heroku create again), the slug size, i am seeing is just 200mb.. Why its different? Then I have tried this approach:
Approach 1: by deleting .git folder from my project directory, then again git init. and then deploying again on same heroku app.. It didn't make any differences!
Approach 2: By declaring .slugignore file in root of project folder. But its too not making any diff!
Approach 3: as per this site, https://github.com/heroku/heroku-repo
I have reset my repo like this,
heroku repo:reset -a appname
But, nothing happened!! What to do now? Can u guide me? Thnx.
As Heroku suggests:
Inspect your slug with heroku run bash and by using commands such as ls and du
Move large assets like PDFs or audio files to asset storage
Remove unneeded dependencies and exclude unnecessary files via .slugignore
Hey I was able to find the solution. Here is what i have done:
I have downloed Heroku Repo plugin from this site :https://github.com/heroku/heroku-repo just by this line:
heroku plugins:install https://github.com/heroku/heroku-repo.git
then I have just rebuilt my app by this command:
heroku repo:rebuild -a appname
This will empty the remote repository and push the repository up again, effectively triggering an app rebuild. and I got whole working app with original downsized (207mb) again. that's it.

Why changing heroku buildpack for existing app doesn't run bin/release

I had a php app on heroku with the default buildpack (apache), and then decided to change it to the php-fpm + nginx buildpack (https://github.com/iphoting/heroku-buildpack-php-tyler/).
I issued the change command:
heroku config:set BUILDPACK_URL=https://github.com/iphoting/heroku-buildpack-php-tyler.git
And pushed with:
git push heroku master
The slug then compiles, but all the binaries fail to execute with "command not found", because PATH config variable which should be updated with bin/release isn't updated.
In comparison, when creating an app from scratch with this buildpack with
heroku create -b https://github.com/iphoting/heroku-buildpack-php-tyler.git
Everything runs as expected (and PATH is present and updated).
My assumption is that bin/release was not run after changing the config variable BUILDPACK_URL, and therefore the PATH variable isn't set.
In order to make the app work, I had to manually add the PATH config variable. Did anybody else ever encounter this? Is this the expected behavior? By my understanding, bin/release should always run after a slug compile?
EDIT: corrected the git url to the correct ".git" one
You are correct in your assumption, the addons and config_vars properties of bin/release are only taken from a buildpack on an app's first deploy. See https://devcenter.heroku.com/articles/buildpack-api#binrelease for more details.
Heroku is moving over to a new system for a buildpack to add config vars that will work beyond an app's first deploy: https://devcenter.heroku.com/articles/labs-dot-profile-d
If a buildpack copies a .profile.d/buildpack_name.sh into the app, that file will be sourced during application boot. This can be used to set up things like the PATH.
You probably have a Procfile in your app repository. If you have an existing Procfile, then bin/release won't overwrite its contents. Simply copy the appropriate lines (5-9) from https://github.com/iphoting/heroku-buildpack-php-tyler/blob/master/bin/release into your Procfile.

heroku deployment with play framework 1.2.4 with own secure module

I have a play framework application (v1.2.4) to deploy to heroku.
I added secure module to my play app by copying the secure module from local PLAY_HOME. So that I could change Secure code to suit my project's needs.
Thus my folder structure looks like
work-root/
/play-project/ -> contains all play, libs & conf/application.conf
/secure/ -> copy of local secure module (& modified, which is why I copied. )
At the work-root, I did the following git operations:
git init
git add.
git commit -m 'first commmit with customised secure'
Please not that I didn't just commit from the play app folder (in play-project) but from a level above so that the custom secure app is also committed.
Then I created heroku app by
heroku create -s cedar --buildpack https://github.com/heroku/heroku-buildpack-pl
Which all worked.
to push code & have it deployed in heroku I did
git push heroku master
This didn't work,
~ Oops. conf/routes or conf/application.conf missing.
This is because they are not there but a level below.
I want to be able to tell Heroku that this is a play app the application.conf is in a "folder" called [play-project] & is within the current working directory.
Can someone please help me?
Many thanks Kind regards
--Rana Das
The default Play buildpack looks for those files. You can either fork the buildpack to make it work for your needs or you can switch to a more standard structure. To do what you want just go with a standard Play project layout (with the Play app in the root dir). Then for the secure module simply copy it's source into the modules/secure directory. Then Play will use your version of the module.

Resources