# Deploying Julia on Heroku - Buildpacks and PackageCompiler Failing

**URL:** https://discourse.julialang.org/t/deploying-julia-on-heroku-buildpacks-and-packagecompiler-failing/44043
**Category:** General Usage
**Tags:** question, build, package-compiler
**Created:** [July 31, 2020, 3:08pm UTC](https://discourse.julialang.org/t/deploying-julia-on-heroku-buildpacks-and-packagecompiler-failing/44043 "2020-07-31T15:08:44Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![markhalonen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/markhalonen/32/8053_2.png) [@markhalonen](https://discourse.julialang.org/u/markhalonen)
#### Post date: [July 31, 2020, 3:08pm UTC](https://discourse.julialang.org/t/deploying-julia-on-heroku-buildpacks-and-packagecompiler-failing/44043/1 "2020-07-31T15:08:44Z")

</div>

I’m trying to deploy this Julia HTTP api that simulates a coil gun using DiffEQ: [https://github.com/laurium-labs/coilgunui](https://github.com/laurium-labs/coilgunui)

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: [https://github.com/Optomatica/heroku-buildpack-julia/issues/6](https://github.com/Optomatica/heroku-buildpack-julia/issues/6)

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

```julia
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: [Deploying Julia. You’ve got something running in Julia… | by Mark Halonen | Medium](https://medium.com/@markhalonen/deploying-julia-1eb8a1686ca1)

Thanks in advance!

---

<div class="post-metadata">

### Author: ![markhalonen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/markhalonen/32/8053_2.png) [@markhalonen](https://discourse.julialang.org/u/markhalonen)
#### Post date: [July 31, 2020, 7:32pm UTC](https://discourse.julialang.org/t/deploying-julia-on-heroku-buildpacks-and-packagecompiler-failing/44043/2 "2020-07-31T19:32:59Z")

</div>

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

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

var request = require('request');

app.use('/', function (req, res) {
    var url = "http://34.237.210.243" + 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 [https://saunasim.com/](https://saunasim.com/) 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!!: [https://www.coilgunner.com/](https://www.coilgunner.com/)

---

<div class="post-metadata">

### Author: ![Amgad\_Naiem](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/amgad_naiem/32/16927_2.png) [@Amgad\_Naiem](https://discourse.julialang.org/u/Amgad_Naiem)
#### Post date: [August 6, 2020, 7:42am UTC](https://discourse.julialang.org/t/deploying-julia-on-heroku-buildpacks-and-packagecompiler-failing/44043/3 "2020-08-06T07:42:27Z")

</div>

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

---

<div class="post-metadata">

### Author: ![markhalonen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/markhalonen/32/8053_2.png) [@markhalonen](https://discourse.julialang.org/u/markhalonen)
#### Post date: [August 6, 2020, 2:02pm UTC](https://discourse.julialang.org/t/deploying-julia-on-heroku-buildpacks-and-packagecompiler-failing/44043/4 "2020-08-06T14:02:42Z")

</div>

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!
