Heroku Buildpack directory missing after creation in compile step

198 Views Asked by At

I have a buildpack make to compile enchant dictionaries, and it's having issues having the directory persisting after the dyno deployment.

Below is the relevant snippet.

DEFAULT_DIR_ENCHANT_DICTS="/app/.enchant/myspell"
mkdir -p $DEFAULT_DIR_ENCHANT_DICTS
cd /app/.enchant/myspell
echo $PWD

I've confirmed that the directory is created during this compile via cd since it fails otherwise, and printed it after changing to it. However after deployment, doing heroku run bash on the app and then trying to visit the directory shows that it hasn't actually be created.

I suspect this has something to do with heroku being ephemeral, and hence not keeping these changes, but I haven't been able to find any documentation on securing directories from being wipe before deployment.

Interestingly, I create this folder as well:

"/app/.heroku/python/lib/python3.6/site-packages/enchant/share/enchant/myspell"

which doesn't get wiped, leading me to believe that certain folders don't get wiped; however, enchant requires the files to be in this specific location in order to be detected, since it seems to not detect them via site-packages folder currently.

1

There are 1 best solutions below

1
On BEST ANSWER

I think you'll want to create the dir somewhere other than /app. That's because when the buildpack runs, it's done in a temp dir. For most purposes the dir you want is pwd. You're buildpack might look like this:

DEFAULT_DIR_ENCHANT_DICTS="$(pwd)/.enchant/myspell"
mkdir -p $DEFAULT_DIR_ENCHANT_DICTS
cd .enchant/myspell
echo $PWD