Umbrella app + ruby

I am running an elixir-phoenix umbrella app on Heroku. Locally I have added erlport and some code to bridge to a ruby program that I use (asciidoctor). For this I need ruby + one gem (asciidoctor-latex).

Could someone advise me on how to run this configuration on Heroku?

Have you looked into multi buildpack?

1 Like

Thanks! I will read up on this.

That works. I had to put the buildpacks in this order:

  1. heroku/ruby
  2. https://github.com/HashNuke/heroku-buildpack-elixir.git
  3. https://github.com/gjaldon/heroku-buildpack-phoenix-static

and then relocate the Gemfile from apps/ruby_bridge to the
root of my umbrella project.

I still have an issue on the Heroku deployment in which the
elixir-to-ruby bridge is not functioning because of a path
(file not found) issue. But the ruby part itself is OK.

1 Like

Another question about the ruby to elixir bridge using erlport.

I have it working on my laptop, but am having trouble on Heroku. The first problem was in the file ruby_bridge/lib/ruby_bridge.ex:

defmodule RubyBridge do
    @ruby_dir Application.app_dir(:ruby_bridge, "priv/ruby")
    use Export.Ruby

    def render_asciidoc(text) do
      {:ok, ruby} = Ruby.start(ruby_lib: @ruby_dir)
      IO.puts "Hello! This is render_asciidoc"
       ruby
       |> Ruby.call(render(text), from_file: "/app/apps/ruby_bridge/priv/ruby/asciidoc")
    end
end

By changing the path "asciidoc" to "/app/apps/ruby_bridge/priv/ruby/asciidoc", was able to get it to execute. It calls on the code in ruby_bridge/priv/ruby/asciidoc.rb, as listed below. Statement (1) is executed, but not (2) because the require statement fails. I’ve tried various paths, but have not hit on the correct one yet.

Any advice on how to solve this one?

puts "(1) Hello, I am here, in asciidoc.rb, top of file"
# require 'asciidoctor-latex'
require '/app/vendor/bundle/bin/asciidoctor-latex'

def render(text)
  puts "(2) Hello, I am here, in asciidoc.rb -- render(text)"
  result = Asciidoctor.convert text, { 'dialect' => 'latex' }
  Tuple.new(
    [:ok, result]
  )
end