How to run an executable on Heroku from node, works locally

后端 未结 1 883
执念已碎
执念已碎 2021-01-03 01:12

This is my first SE question. Usually I can find an answer to anything fairly easily through this great website, but unfortunately on this occasion I can\'t find anything on

1条回答
  •  囚心锁ツ
    2021-01-03 01:52

    Ok, I have got it to work, this may be of interest to many so I will post how I did it.

    The problem was that Heroku's architecture is not the same as that on my machine and hence the compiled program simply would not run on Heroku. To get around this I created a makefile to compile the C++ source code and pushed this to Heroku using

    $ git push heroku master
    

    Then

    $ heroku run bash
    

    which essentially sets up a bash shell with access to your Heroku instance.

    From here, compile the executable using

    $ make
    

    Then scp this executable back to your local machine and then

    $ git add .
    $ git commit -m "added working executable"
    

    and

    $ git push heroku master
    

    Then the working executable will be there on the Heroku app and will run just like on local host.

    0 讨论(0)
提交回复
热议问题