Skip to content

Instantly share code, notes, and snippets.

@pepopowitz
Last active July 14, 2020 18:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pepopowitz/e6cb8a59573fc1398e081406745e53fd to your computer and use it in GitHub Desktop.
Save pepopowitz/e6cb8a59573fc1398e081406745e53fd to your computer and use it in GitHub Desktop.

How I got all diffusion tests passing locally

  • I had installed elasticsearch@2.4 from homebrew, but the diffusion gemfile called for version 5. As a result I was seeing errors from bundle exec rspec ./spec/workers/artist_match_worker_spec.rb complaining about the syntax of elasticsearch queries.
  • I tried to brew install elasticsearch@5.6 but the 5.6 formula had been removed in the last month :(
  • I ran brew install elasticsearch@6 and tried to run the tests but there were breaking changes between 5 and 6, and I got more query errors from the same spec file.
  • I tried to install v5.6 again and Jon made me read the error output better. I discovered that you can still get to the deleted formula via the old git SHA, with this command:
    • git -C "$(brew --repo homebrew/core)" show 157167491^:Formula/elasticsearch@5.6.rb
  • That will output the entire contents of that file, so I saved it to a local file:
    • git -C "$(brew --repo homebrew/core)" show 157167491^:Formula/elasticsearch@5.6.rb > elasticsearch@5.6.rb
  • Now I could use homebrew to install the local formula:
    • brew install elasticsearch@5.6.rb
    • note the .rb at the end of this command and the previous, as it distinguishes the local file from the formula within homebrew's official tap
  • The output of the install mentioned that homebrew didn't create a symlink for it because it was an old/deleted version. I manually linked it with:
    • brew link elasticsearch@5.6 --force
    • The force flag was necessary because it's an old/deleted version.
  • The elasticsearch@5.6 service didn't start up correctly. brew services list showed it as started, but yellow.
    • I ran cat /Users/stevenhicks/Library/LaunchAgents/homebrew.mxcl.elasticsearch@6.plist, which is the path associated with elasticsearch@5.6 outputted by brew services list, to identify the location of the log file for this service.
    • It gave me the path /usr/local/var/log/elasticsearch.log.
    • I tried to cat /usr/local/var/log/elasticsearch.log but the file didn't exist.
    • I created the file with touch /usr/local/var/log/elasticsearch.log, hoping that the service would be able to tell me why it couldn't start.
    • I ran brew services restart elasticsearch@5.6 to restart the service. It started up and brew services list showed it as green!

things I learned along the way

  • You can still get to deleted formulae
  • brew info lies about where the log/data paths are. cat ...plist (with the plist output by brew services list) is a more accurate way to find the log/data paths.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment