Deploying Julia on Heroku - Buildpacks and PackageCompiler Failing

I’m trying to deploy this Julia HTTP api that simulates a coil gun using DiffEQ:

It’s just a couple endpoints to get params and run the simulation. I’d like it to run through HTTPS.

Heroku is awesome for getting an HTTPS endpoint in seconds instead of hours so I always try that first.

There is a Julia Buildpack for Heroku but that failed to build:

So next I tried using PackageCompiler inside Docker to deploy. I tried all 4 combinations:

  • precompile_statements_file built locally and upload image to Heroku. Fails with “target not found in system image”
  • precompile_statements_file building remotely (on Heroku servers) fails with “pipeline_error at ./process.jl:525”
  • precompile_execution_file built locally fails with “target not found in system image”
  • precompile_execution_file built remotely fails with “pipeline_error at ./process.jl:525”

When I run with the system image locally, it boots immediately, seems to work awesome.

If you wanted to reproduce, just run docker build . in the root of the repo and then

heroku create
heroku stack:set container -a HEROKU_APP_NAME
heroku container:push web
heroku container:release web

It would be awesome if I could figure out a faster way for setting up non-trivial Julia behind an HTTPS api in minutes, instead of hours, which is what I did last time i was faced with this:

Thanks in advance!

I found a decent solution… a proxy server on Heroku that just forwards to an ec2 instance running the Julia server:

const express = require('express')
const app = express()
const port = process.env.PORT || 3000

var request = require('request');

app.use('/', function (req, res) {
    var url = "" + req.url;
    req.pipe(request({ qs: req.query, uri: url })).pipe(res);

app.listen(port, () => console.log(`Example app listening at http://localhost:${port}`))

I have setup all on AWS with load balancers for HTTPS. When it broke I got an expert on Upwork to help me and it still took an hour of clicking around the myriad of AWS services to fix it.

So I’m pretty happy with this solution and she’s live!!:

1 Like

Nice workaround, although Docker on heroku takes a lot of time and doesn’t boot faster than buildpack.
I tried the project and it does work with larger dyno (Standard 2X) not sure if the docker have the same memory limitation or not but I guess you use a more performant dyno as well

Ah, for some reason I thought upgrading Heroku would cost $250/month to get bigger dynos… good to know that it works on the Standard 2X!