Run Go app on Heroku - heroku

I'm trying to follow the tutorial at https://mmcgrana.github.io/2012/09/getting-started-with-go-on-heroku. Initially everything seems to work:
ceiroa-ltm:my_heroku_app ceiroa$ heroku create -b https://github.com/kr/heroku-buildpack-go.git
Creating glacial-badlands-6720... done, stack is cedar-14
BUILDPACK_URL=https://github.com/kr/heroku-buildpack-go.git
https://glacial-badlands-6720.herokuapp.com/ | https://git.heroku.com/glacial-badlands-6720.git
Git remote heroku added
ceiroa-ltm:my_heroku_app ceiroa$ git push heroku master
Counting objects: 10, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (10/10), 925 bytes | 0 bytes/s, done.
Total 10 (delta 0), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Fetching custom git buildpack... done
remote: -----> Go app detected
remote: -----> Installing go1.3.3... done
remote: -----> Running: godep go install -tags heroku ./...
remote: -----> Discovering process types
remote:
remote: -----> Compressing... done, 1.5MB
remote: -----> Launching... done, v4
remote: https://glacial-badlands-6720.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy... done.
To https://git.heroku.com/glacial-badlands-6720.git
* [new branch] master -> master
However, no dynos are spinned:
ceiroa-ltm:my_heroku_app ceiroa$ heroku ps
ceiroa-ltm:my_heroku_app ceiroa$
And the app gives an error:
What am I doing wrong?

I tried a bunch of things that didn't work:
downgrade go version (to match the one defined in https://github.com/kr/go-heroku-example/blob/master/Godeps/Godeps.json)
move from default Eclipse Go structure to one without src, bin, or pkg inside project
use hyphens instead of underscores (for project name and in Procfile and Godeps.json)
define full identifier in Godeps.json
At the end and started from scratch again, creating the project from the command line instead of from Eclipse, and this worked.
From the things above, I can rule out #1 and #4 as fixes, as I'm back to using the same config I initially had.
Another thing that was throwing me off was references to ".godir" in different websites and posts. I don't know what this file used to be used for, but it doesn't seem necessary any more.
I'm going to point to Eclipse and its Go plugin as the culprits, for now.

Heroku now officially supports Go and has a Getting Started guide.

Related

How to deploy openbazaar-go to heroku

How can I deploy openbazaar-go to heroku?
I got the go project go get github.com/OpenBazaar/openbazaar-go
Created heroku git heroku create
Push git changes git push heroku master
But getting error
remote: -----> Checking Godeps/Godeps.json file.
remote: parse error: Invalid numeric literal at line 2504, column 8
remote: !! Bad Godeps/Godeps.json file
remote: ! Push rejected, failed to compile Go app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to pacific-stream-51465.
Structure go
github.com
└──OpenBazaar
└── openbazaar-go
└──`heroku create` (this I created git project)
This project have any subrepository
What version of Golang are you using? OpenBazaar runs predominantly on 1.11 and isn't currently set up to work well on 1.13 and above.

Difficulties deploying Flask app to Heroku

I am trying to deploy a Flask app to Heroku and I keep getting this error. Anyone who can help me with this?
Enumerating objects: 9, done.
Counting objects: 100% (9/9), done.
Delta compression using up to 4 threads
Compressing objects: 100% (7/7), done.
Writing objects: 100% (9/9), 3.06 KiB | 184.00 KiB/s, done.
Total 9 (delta 0), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: ! No default language could be detected for this app.
remote: HINT: This occurs when Heroku cannot detect the buildpack to use for this application automatically.
remote: See https://devcenter.heroku.com/articles/buildpacks
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to expensetracker-api-heroku.
remote:
To https://git.heroku.com/expensetracker-api-heroku.git
! [remote rejected] secret-branchh -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/expensetracker-api-heroku.git'
Based on the UPDATED question, the error message is hinting at the problem:
No default language could be detected for this app.
You need to tell Heroku what kind of app you are deploying. For Python apps (i.e. Flask), you need to have one of the following files in your top-level git directory, as described in the Expected files for Python section of Deploying Python and Django Apps on Heroku docs:
Heroku automatically identifies your app as a Python app if any of the
following files are present in its root directory:
requirements.txt
setup.py
Pipfile
If none of these files is present in your app’s root directory, the
Python buildpack will fail to identify your application correctly.
Take note of the the warning at the end that if none of the files are present, the Python buildpack will faill.
The simplest here is to add a requirements.txt file. You can generate this by doing:
pip freeze > requirements.txt
and it looks like this:
Flask==1.0.2
Flask-Scss==0.5
gunicorn==19.7.1
isort==4.3.3
itsdangerous==0.24
Jinja2==2.10.1
...
Add that to the top-level of your git directory.
Then, for Flask, you need to add a couple more files:
runtime.txt
This specifies the Python version of your app, as described in Specifying a Python Runtime
python-3.7.3
Procfile
This is described in this post Heroku Flask Tutorial Procfile Meaning and I suggest you take a look. The contents depends on how you instantiated your Flask app instance, and it looks like this:
web: gunicorn app:app --log-file=-
If you're still having problems, I highly recommend going through the Heroku tutorial docs, especially Getting Started on Heroku with Python.

How to deploy a Suave.IO project with Heroku

This is my first time using heroku and I'm having some troubles deploying my small Suave web app. After reviewing the docs here, I understand that I need to set up a Procfile so that heroku knows how to run my application.
Here's a picture of my basic file structure:
And my Procfile contains only a single line:
web: mono /bin/Debug/SuaveTest.exe
After pushing these files to heroku, I get an error when trying to view the application.
I'm obviously doing something wrong here and I definitely would appreciate any and all help to get this running.
EDIT
I've changed my project settings to target .NET 4.5 instead of 4.5.1. This removed some warnings during my build. After changing my Procfile to the following :
web: mono bin/Release/SuaveTest.exe
I'm still receiving the same application error when visiting the site, even though the build says everything went well. I am suspicious that the root cause of all my issues is because heroku is unable to discover what process types I'm using in my project (which you can see below).
remote: Build succeeded.
remote: 0 Warning(s)
remote: 0 Error(s)
remote:
remote: Time Elapsed 00:00:04.4188560
remote: -----> Discovering process types
remote: Procfile declares types -> (none)
remote:
remote: -----> Compressing...
remote: Done: 69.2M
remote: -----> Launching...
remote: Released v15

Heroku run binary version of web(golang)

I'm trying to use https://github.com/ryandotsmith/null-buildpack
and have compiled web process version(linux x64)
but when i'm doing git push heroku master process hangs on
remote: Compressing source files... done.
remote: Building source:
remote:
remote: Build stream timed out, reverting to polling...............
Procfile:
web: /app/bin/www
Was caused by a heroku issue, resolved now
https://status.heroku.com/

Errors deploying Go Revel app on Heroku using buildpack

I'm trying to use Go and Revel on Heroku using this buildpack https://github.com/robfig/heroku-buildpack-go-revel but it doesn't seem to work:
I'm getting an error trying to use the basic revel helloworld example.
$ go get github.com/robfig/helloworld
$ cd $GOPATH/src/github.com/robfig/helloworld
$ echo "github.com/robfig/helloworld" > .godir
$ git add .godir
$ git commit -a -m ".godir"
$ heroku create -b https://github.com/robfig/heroku-buildpack-go-revel.git
$ git push heroku master
Counting objects: 34, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (23/23), done.
Writing objects: 100% (34/34), 57.41 KiB | 0 bytes/s, done.
Total 34 (delta 1), reused 0 (delta 0)
-----> Fetching custom git buildpack... done
-----> Revel app detected
-----> Installing Go 1.1.2... done
Installing Virtualenv... done
Installing Mercurial... done
Installing Bazaar... done
-----> Running: go get -tags heroku ./...
mv: cannot stat `/tmp/build_86bd3433-7925-4ae9-b4bf-f5466525aef1/.go/bin/*': No such file or directory
! Push rejected, failed to compile Revel app
To git#heroku.com:peaceful-hamlet-6152.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git#heroku.com:peaceful-hamlet-6152.git'
I forked the heroku-buildpack-go-revel and was able to fix the error that was moving the non-existent directory (I changed it to conditionally move it).
Fixed buildpack:
https://github.com/dougnukem/heroku-buildpack-go-revel/commit/d0d17027b981248062fa46098ce3c2e9b8559a76
I was then able to deploy a helloworld revel app to heroku:
export GOPATH=$HOME/go
mkdir $GOPATH
go get github.com/dougnukem/revel-helloworld
cd $GOPATH/src/github.com/dougnukem/revel-helloworld
heroku create
heroku config:set BUILDPACK_URL=https://github.com/dougnukem/heroku-buildpack-go-revel.git
git push heroku master
heroku open
I submitted a pull request with that fix:
https://github.com/robfig/heroku-buildpack-go-revel/pull/4

Resources