tag:support.flying-sphinx.com,2011-01-05:/discussions/problems/1177-heroku-error-when-deploying-thinking-sphinx-gem-304-no-such-file-or-directory-tmpbuild_xxxlogFlying Sphinx: Discussion 2018-10-19T03:09:30Ztag:support.flying-sphinx.com,2011-01-05:Comment/311185982014-01-14T22:46:16Z2014-01-14T22:46:16ZHeroku error when deploying thinking-sphinx gem >3.0.4: "No such file or directory - /tmp/build_xxx/log"<div><p>I see this in the 3.0.6 release notes:<br>
"Insist on the log directory existing, to ensure correct behaviour
for symlinked paths. (Michael Pearson)."</p>
<p>... my git repository does include an empty log directory (all
files are ignored, but the directory has a .gitkeep file).</p></div>kevinmtrowbridgetag:support.flying-sphinx.com,2011-01-05:Comment/311185982014-01-14T22:48:44Z2014-01-14T22:48:44ZHeroku error when deploying thinking-sphinx gem >3.0.4: "No such file or directory - /tmp/build_xxx/log"<div><p>Hi Kevin</p>
<p>Thinking Sphinx is expecting a log directory to exist, and it
seems your app doesn't have one (at least in the git repo). The
easiest solution is to add a .git_keep file to your repo:</p>
<pre>
<code>touch log/.git_keep
git add log/.git_keep
git commit -m "Ensure the log directory exists."</code>
</pre>
<p>Unrelated to this issue, but it's worth noting that TS 3.1.0
expects Sphinx 2.1.2 or newer by default. If you don't wish to
upgrade Sphinx versions, please review the release notes and make
the corresponding changes:<br>
<a href=
"https://github.com/pat/thinking-sphinx/releases/tag/v3.1.0">https://github.com/pat/thinking-sphinx/releases/tag/v3.1.0</a></p>
<p>Flying Sphinx servers have Sphinx 2.1.4 available, and also
2.0.9 if you want the latest 2.0.x release. To switch versions, set
<code>version</code> in the corresponding environment of
<code>config/thinking_sphinx.yml</code> to the appropriate version
number.</p></div>Pat Allantag:support.flying-sphinx.com,2011-01-05:Comment/311185982014-01-14T22:49:18Z2014-01-14T22:49:18ZHeroku error when deploying thinking-sphinx gem >3.0.4: "No such file or directory - /tmp/build_xxx/log"<div><p>Oh, it exists? That's odd. And that .gitkeep file is definitely
committed to the repo?</p></div>Pat Allantag:support.flying-sphinx.com,2011-01-05:Comment/311185982014-01-14T23:05:09Z2014-01-14T23:05:09ZHeroku error when deploying thinking-sphinx gem >3.0.4: "No such file or directory - /tmp/build_xxx/log"<div><p>It seems to definitely exist. I can see it in Github's version
of my repo. However, if I 'heroku run bash' and 'ls' -- I don't see
it there. Seems like if I can get the empty directory existing on
Heroku that might solve the issue. Not sure why it's not there.</p></div>kevinmtrowbridgetag:support.flying-sphinx.com,2011-01-05:Comment/311185982014-01-14T23:25:24Z2014-01-14T23:25:24ZHeroku error when deploying thinking-sphinx gem >3.0.4: "No such file or directory - /tmp/build_xxx/log"<div><p>It's especially odd because I use TS v3.0.6 in Heroku apps, and
the .gitkeep file is all we have in the log directory in the git
repository too.</p></div>Pat Allantag:support.flying-sphinx.com,2011-01-05:Comment/311185982014-01-14T23:35:21Z2014-01-14T23:35:21ZHeroku error when deploying thinking-sphinx gem >3.0.4: "No such file or directory - /tmp/build_xxx/log"<div><p>So, I've just run <code>heroku run bash</code> on the production
environment for our app, and the only file in the log directory is
production.log. Our staging environment just has staging.log, and
neither have the .gitkeep file. Both log files are empty, mind you,
and they're not in the git repo.</p>
<p>But I've not spotted anything in the default buildpack that is
responsible for this behaviour...</p></div>Pat Allantag:support.flying-sphinx.com,2011-01-05:Comment/311185982014-01-15T00:22:26Z2014-01-15T00:22:26ZHeroku error when deploying thinking-sphinx gem >3.0.4: "No such file or directory - /tmp/build_xxx/log"<div><p>Just raised the issue with some of the Heroku team on Twitter,
their first suggestion is perhaps the .gitkeep file is being
ignored because it's listed in your .slugignore, if you have
one?</p></div>Pat Allantag:support.flying-sphinx.com,2011-01-05:Comment/311185982014-01-15T00:30:38Z2014-01-15T00:30:38ZHeroku error when deploying thinking-sphinx gem >3.0.4: "No such file or directory - /tmp/build_xxx/log"<div><p>Ok -- I appreciate your help. As of now, the main issue seems to
be that I cannot get Heroku to create a log directory in this
particular app.</p>
<p>I ran 'heroku run bash' on another app that I own, this one had
a log directory with production.log inside, the same behavior as
you describe.</p>
<p>In this app, there's no log directory and no matter what I do
(commit files to it, totally remove all mention of it from
gitignore, etc) -- cannot get the log directory to appear in the
app. Strange.</p></div>kevinmtrowbridgetag:support.flying-sphinx.com,2011-01-05:Comment/311185982014-01-15T00:32:38Z2014-01-15T00:32:38ZHeroku error when deploying thinking-sphinx gem >3.0.4: "No such file or directory - /tmp/build_xxx/log"<div><p>No, I do not have a .slugignore file -- I saw that, but sadly it
was one of the first things I looked into. Getting into deep water
now as to why the log directory does not exist. If I clone the repo
locally, all is well. I am wondering if I have some service
configured (new relic?) or Logentries that might somehow be causing
this behavior.</p></div>kevinmtrowbridgetag:support.flying-sphinx.com,2011-01-05:Comment/311185982014-01-15T00:34:17Z2014-01-15T00:34:17ZHeroku error when deploying thinking-sphinx gem >3.0.4: "No such file or directory - /tmp/build_xxx/log"<div><p>Thinking maybe I should push the repo to a new Heroku app and
see if the behavior is different there somehow.</p></div>kevinmtrowbridgetag:support.flying-sphinx.com,2011-01-05:Comment/311185982014-01-15T00:47:53Z2014-01-15T00:47:53ZHeroku error when deploying thinking-sphinx gem >3.0.4: "No such file or directory - /tmp/build_xxx/log"<div><p>I'm not familiar with logentries, but I doubt it's NewRelic
(given we have that in our app too). Pushing the repo to a fresh
Heroku app could be a good next step.</p></div>Pat Allantag:support.flying-sphinx.com,2011-01-05:Comment/311185982014-01-15T01:02:22Z2014-01-15T01:02:22ZHeroku error when deploying thinking-sphinx gem >3.0.4: "No such file or directory - /tmp/build_xxx/log"<div><p>Pat -- I submitted an Heroku support ticket. It's not trivial to
recreate the app environment enough to get it to deploy
successfully. I have other things to do tonight! I will let you
know when we find a resolution. For now I am reverting the app to
thinking-sphinx 3.0.4.</p>
<p>Thanks again for your help,<br>
Kevin</p></div>kevinmtrowbridgetag:support.flying-sphinx.com,2011-01-05:Comment/311185982014-01-15T01:04:37Z2014-01-15T01:04:37ZHeroku error when deploying thinking-sphinx gem >3.0.4: "No such file or directory - /tmp/build_xxx/log"<div><p>No worries - hope you can get it sorted soon. If there's any way
I can help further, do let me know. Shall close this ticket for the
moment though.</p></div>Pat Allantag:support.flying-sphinx.com,2011-01-05:Comment/311185982014-01-24T23:00:04Z2014-01-24T23:00:04ZHeroku error when deploying thinking-sphinx gem >3.0.4: "No such file or directory - /tmp/build_xxx/log"<div><p>Hi Pat,</p>
<p>I have been corresponding with the Heroku staff about this issue
and I want to relay back to you what they have told me.</p>
<p>Ryan B, Heroku Support:<br>
"This is expected behavior that the log directory is deleted prior
to the build. See #2 in this article: <a href=
"https://devcenter.heroku.com/articles/slug-compiler#compilation">https://devcenter.heroku.com/articles/slug-compiler#compilation</a><br>
If you need this directory, probably the easiest thing to do is to
include name the directory something like _log and then prepend
your Procfile entry with mv _log log && so the directory is
there at runtime. If you need this directory at build time, your
other option would be to fork the Ruby buildpack and do something
similar to re-create the directory before the build takes
place."</p>
<p>Kevin T:<br>
"Hi Ryan, I am not sure that is true -- the article says:<br>
"Remove unused files, including .git directories, .gitmodules
files, anything in log and tmp, and anything specified in a
top-level .slugignore file." "anything in log" -- it does not say
remove the log directory itself. Both Pat Allen & myself find
that the /log directory is present in other apps. The
thinking-sphinx gem is dependent on the log directory being
present, and having a log/.gitkeep file seems to be sufficient to
keep the log directory around in other cases. The reason
thinking-sphinx 3.1.0 is crashing on my instance is a change is
made which expects the /log directory to be present. The reason I
press the issue is that I am going to take this back to Pat Allen,
which will possibly influence how he develops the thinking-sphinx
gem going forward. Flying-sphinx is an addon supported by
Heroku.<br>
Thanks,<br>
Kevin"</p>
<p>Ryan B:<br>
"I just checked the code, and the directory really is deleted in
its entirety. The article should be updated. If you are seeing the
/log directory on other apps, there must something re-creating it
either at build time or runtime. It is entirely possible that the
apps you are referring to are using some buildpack that re-creates
the directory because the pruning takes place between the code
being unpacked from the repo and execution of the buildpack."</p></div>kevinmtrowbridgetag:support.flying-sphinx.com,2011-01-05:Comment/311185982014-01-24T23:03:08Z2014-01-24T23:03:08ZHeroku error when deploying thinking-sphinx gem >3.0.4: "No such file or directory - /tmp/build_xxx/log"<div><p>So -- if what Ryan B says is true, that change to Thinking
Sphinx that throws an exception if the log directory is absent, may
cause problems for other people on Heroku as well.</p>
<p>For now, I will experiment with adding the lines to our Procfile
to create an empty log directory.</p>
<p>For a longer term solution, do you think I should create a
Github issue against the TS gem to document this, or potentially
investigate creating a patch that could be worked into a future
release?</p>
<p>Thanks,<br>
Kevin</p></div>kevinmtrowbridgetag:support.flying-sphinx.com,2011-01-05:Comment/311185982014-01-24T23:06:49Z2014-01-24T23:06:49ZHeroku error when deploying thinking-sphinx gem >3.0.4: "No such file or directory - /tmp/build_xxx/log"<div><p>In all honesty I don't agree with the behavior on Heroku's part
to actually delete the 'log' directory. It seems if it's in git,
and has a .gitkeep file, it should be kept, and deleting it will
cause problems for more than just the thinking_sphinx gem.</p>
<p>I don't understand why they need to be so aggressive, but then
again, I don't know what problems they're trying to solve by doing
this. I don't know if you have some other avenues of reaching out
to them to see if this behavior could be changed.</p></div>kevinmtrowbridgetag:support.flying-sphinx.com,2011-01-05:Comment/311185982014-01-24T23:34:19Z2014-01-24T23:54:32ZHeroku error when deploying thinking-sphinx gem >3.0.4: "No such file or directory - /tmp/build_xxx/log"<div><p>Yeah -- the solution that Ryan B gave doesn't work. I still get
the same crash. The command in the Procfile is not executed soon
enough or somehow it's not working out:</p>
<p>web: mv _log log && bundle exec unicorn -p $PORT -c
./config/unicorn.rb</p>
<p>... I don't have a solution yet for how we can upgrade past TS
3.0.4.</p>
<p>The problem I'm trying to solve that set this all off, is that,
on 3.0.4, we get these random exceptions in our development builds:
"Encoding::UndefinedConversionError -- U+2019 from UTF-8 to
ISO-8859-1"</p>
<p>So for now, I am keeping the upgraded 3.1.0 running on my
development build, and just avoiding checking the changes in by
keeping them in a "Don't commit" changelist.</p>
<p>This works for me, but I have some junior developers on my team,
and they keep running into this exception. I would like to upgrade
the whole app and solve the problem, but as I have been mentioning,
I cannot get Heroku to take the upgraded version.</p></div>kevinmtrowbridgetag:support.flying-sphinx.com,2011-01-05:Comment/311185982014-01-26T03:56:17Z2014-01-26T03:56:17ZHeroku error when deploying thinking-sphinx gem >3.0.4: "No such file or directory - /tmp/build_xxx/log"<div><p>Hi Kevin</p>
<p>I’ll try tweak TS’s behaviour so it doesn’t
require a log directory. Odd that Heroku’s behaviour seems so
inconsistent, but if they’re not going to change, I guess TS
better change instead.</p>
<p>As for the encoding error - what version of Sphinx are you using
locally?</p>
<p>—<br>
Pat</p></div>Pat Allantag:support.flying-sphinx.com,2011-01-05:Comment/311185982014-01-27T04:24:35Z2014-01-27T04:24:35ZHeroku error when deploying thinking-sphinx gem >3.0.4: "No such file or directory - /tmp/build_xxx/log"<div><p>Hi Kevin</p>
<p>I've just pushed a fix to this log issue into the develop branch
- which you can use via the following in your Gemfile:</p>
<pre>
<code>gem 'thinking-sphinx', '~> 3.1.0',
:git => 'git://github.com/pat/thinking-sphinx.git',
:branch => 'develop',
:ref => 'c82ccdbe12'</code>
</pre>
<p>It's worth noting that as of the latest commit, TS now defaults
to Sphinx 2.1.4 on Flying Sphinx if you're not specifying a version
manually in config/thinking_sphinx.yml.</p>
<p>Let me know if there's any issues.</p>
<p>Pat</p></div>Pat Allantag:support.flying-sphinx.com,2011-01-05:Comment/311185982014-01-28T21:50:32Z2014-01-28T21:50:32ZHeroku error when deploying thinking-sphinx gem >3.0.4: "No such file or directory - /tmp/build_xxx/log"<div><p>Hi Pat,</p>
<p>Thank you very much for doing this. I deployed this version of
the gem to our staging server, and it worked perfectly.</p>
<p>I will probably wait to deploy the change into production, until
it gets wrapped into an official numbered release. It's not an
urgent problem, just something that I wanted to see we had
resolved, because we like Flying Sphinx and want to keep up with
your releases.</p>
<p>Thanks again,<br>
Kevin</p></div>kevinmtrowbridgetag:support.flying-sphinx.com,2011-01-05:Comment/311185982014-04-24T04:08:56Z2014-04-24T04:08:56ZHeroku error when deploying thinking-sphinx gem >3.0.4: "No such file or directory - /tmp/build_xxx/log"<div><p>Hi Kevin</p>
<p>Just further to this - TS v3.1.1 was released a few days ago, so
you can now upgrade to a proper gem release if you wish.</p>
<p>Cheers</p>
<p>Pat</p></div>Pat Allantag:support.flying-sphinx.com,2011-01-05:Comment/311185982014-04-24T04:49:09Z2014-04-24T04:49:09ZHeroku error when deploying thinking-sphinx gem >3.0.4: "No such file or directory - /tmp/build_xxx/log"<div><p>Thank you Pat -- I noticed that and I've updated it in our
Gemfile!</p>
<p>Appreciate your help with this. Hope you are well,<br>
Kevin</p></div>kevinmtrowbridge