Heroku Redis To Go - node.js

From command prompt I try adding Redis as heroku addons:create redistogo:nano
I get the following error
Creating redistogo:nano on MyProjectName... !!
Couldn't find that app.
I tried logging-in & installing from Heroku/Redistogo
But Heroku ask for CC information even if I select free version of RedisToGo.
Is this normal on Heroku site?

You should use this command:
$ heroku addons:create redistogo:nano --app YourAPPName
... Creating redistogo:nano on ⬢ YourAPPName... free
... Created redistogo-URL-for-your-APP as REDISTOGO_URL
... Use heroku addons:docs redistogo to view documentation

Related

heroku - buildpacks generate slug size too heavy

I've started to create a very simple nodeJS server,
For now, the server do nothing.
I'm trying to install many buildpacks on my heroku server (The purpose of my server is a document convertor)
so this is my .buildpacks :
https://github.com/rishihahs/heroku-buildpack-libreoffice.git
https://github.com/elbongurk/heroku-buildpack-ghostscript.git
https://github.com/GetJobber/heroku-buildpack-poppler.git
https://github.com/ello/heroku-buildpack-imagemagick
So when I try to git push heroku, everything is installed, but when it's the compression times, I got this message :
remote: ! Compiled slug size: 321.1M is too large (max is 300M).
How can I avoid that ?
(nb: there is nothing I can't send from my code, so no slugfile)
Here are some things to try.
Get the heroku repo plugin and use heroku repo:purge_cache -a <app name>. Sometimes that helps.
Carefully go through the buildpacks and check for redundancy. For example, sometimes different buildpacks will both install the same package, which takes up extra space.
Sometimes static files are the problem. You could try a CDN.
Contact Heroku directly.
Go to a different platform, or perhaps use an IaaS platform.

(remote rejected) master -> master (pre-receive hook declined), Push rejected, failed to compile Node.js app

I know that there's couple posts like this one, but solution of any of them works for me.
Here is what I receive when I go for git push heroku master:
Please support. Ignoring node_modules is not working.
Docpad app - package.json file is updated according to docpad's manual.
I also have Procfile set up as in the link above.
PS. I have tried to deploy docpad app via openshift, but while Im going with manual from http://docpad.org/docs/deploy/ I receive error at step 5.
The application 'appname' is configured for git reference deployments but the
artifact provided ('https://github.com/myusername/appname#master') is a url.
Please provide a git reference to deploy (branch, tag or commit SHA1) or
configure your app to deploy from binaries with 'rhc configure-app appname
--deployment-type binary'.
If I configure myapp to deployment-type binary it isnt working neither.
The plugin which heroku tries to install returned 404 and the installation fails due to that.
Verify that the plugin is indeed public and not something you have wrote or used locally.
There is no package with this name hosted on the registry you use.
Remove the line with "docpad-plugin-blah": "2" from your package.json file. That line was provided in the docs simply to show you how to install plugins, but there's no such plugin as blah.
"dependencies": {
"docpad": "6"
},
I strongly recommend that you read through the Getting Started on OpenShift to get an overview of the development workflow using Git.
That being said, and if you really meant to use git reference deployments and you know why you are using them, then read through the Managing Deployments section on the developers page of OpenShift and find out how to properly set up git reference deployments. For instance, 'https://github.com/myusername/appname#master' is not a valid git url and therefore it cannot be cloned.

Deploying a mean.io app to Heroku

I'm having trouble with the deployment of a mean.io application to Heroku. This post describes the steps I've taken to create the application and to try to deploy it. What am I doing wrong?
First, I start a Mongo daemon process:
$ mongod
Then create a mean.io application:
$ npm install -g mean-cli
$ mean init myNewApp
> app name? myNewApp
> help us improve the mean network? n
> set up first admin user? y
> email: user#example.com
> pass: mypassword
$ cd myNewApp
$ mean postinstall
$ npm install
$ bower install
$ gulp
The default mean.io gulp task starts a local webserver, and I'm able to login to the application. The next step is to create a Heroku application:
$ heroku create # this creates https://shrouded-stream-2828.herokuapp.com
And add a MongoDB add-on from compose.io. This was accomplished following these steps:
# In the Heroku web console, select the Heroku application.
# Click edit Add-ons, find Compose MongoDB, and press save.
# Click on "Compose MongoDB" link, click the "Admin" tab
# Click the "Users" tab, click the "Add user" button, adding the user:
db.addUser('​meanadmin','​mypassword')
# And hit the "Add user" button to actually add the user.
# Copy the URL from the Overview tab:
mongodb://meanadmin:mypassword#candidate.2.mongolayer.com:10479,candidate.3.mongolayer.com:10419/app15307042
With this URL, navigate to /path/to/myNewApp/config/env/production.js in a text editor and replace the values of the "db" property with the Mongo URL above, as in:
db: 'mongodb://' + (process.env.DB_PORT_27017_TCP_ADDR || 'localhost') + '/mean-prod',
becomes...
db: 'mongodb://meanadmin:mypassword#candidate.2.mongolayer.com:10479,candidate.3.mongolayer.com:10419/app15307042',
Commit the changes, and push to Heroku:
$ git add .
$ git commit -m 'adding mongodb'
$ git fetch --unshallow
$ git push heroku master
$ heroku open
After a long pause, this results in the following error:
Application Error
An error occurred in the application and your page could not be served. Please try again in a few moments.
If you are the application owner, check your logs for details.
How do I deploy this application to Heroku? I'm not sure if I copied the Mongo URL to the correct place, for instance. What am I doing wrong?

Set `process.env.commit` on Heroku push

I'm using NPM's scripts.postinstall to build our application using GulpJS when we push it to Heroku:
"postinstall": "./node_modules/.bin/gulp build --require coffee-script/register"
I want to be able to set an environment variable at this time with the value of the commit hash. This will then be referenced in files as a cachebuster, e.g.:
<script type="text/javascript" src="/index.{{ process.env.commit }}.js"></script>
I can use git-rev to easily get this value asynchronously but I want it stored on an environment level. How can I set a custom Node environment variable?
If I'm going about this the wrong way and there's a better solution please let me know (I can only find methods to set NODE_ENV and not the process.env object itself).
You cannot do this via a postinstall script: the heroku command won't be available in the build environment. You can create your own lightweight deployment script that runs the command on your machine when a successful build occurs however:
#!/bin/sh
git push heroku master && heroku config:set COMMIT=$(git rev-parse --short HEAD)
To note, I got confirmation of this from Heroku support directly. This was their response:
There isn't an installation of heroku toolbelt on the slug compiler. If you need to set an environment variable as part of the push then you'll have to do it on your machine rather than the Heroku compiler.
Solution I've found is to use the heroku config system to set custom environment variables:
git = require "git-rev"
exec = require "exec-sync"
gulp.task "commit", ->
git.long (hash) ->
exec "heroku config:set COMMIT=#{ hash }"
Needs further testing but for now it works (also, because the command is run on the server there's no need to use heroku config:push).
You can now add this metadata with this labs feature from heroku !
heroku labs:enable runtime-dyno-metadata -a <app name>

Heroku reports "no app specified" on Windows command line

I have a node.js application running on Heroku. I've used the (Windows) command line to initialize the app with heroku create, and I can hit the production website and see that it's running correctly. All's good.
But when I try to run simple commands, like heroku ps, from the directory in which the app lives, Heroku responds with a "no app specified" error:
C:\dev\iq>heroku ps
! No app specified.
! Run this command from an app folder or specify which app to use with --app APP.
I've read in other posts that you can avoid having to use the --app APP syntax with every command if you configure git like so:
git config heroku.remote heroku
However, after doing so, Heroku still complains that the app wasn't specified for simple command line requests. I've verified that .git/config has been updated appropriately:
C:\dev\iq>type .git\config
[core]
repositoryformatversion = 0
filemode = false
bare = false
logallrefupdates = true
symlinks = false
ignorecase = true
hideDotFiles = dotGitOnly
[remote "heroku"]
url = git#heroku.com:aqueous-mountain-xxxx.git
fetch = +refs/heads/*:refs/remotes/heroku/*
[heroku]
remote = heroku
I've just reinstalled the latest version of Heroku:
C:\dev\iq>heroku --version
heroku/toolbelt/3.2.2 (i386-mingw32) ruby/1.9.3
What am I missing?
The 'heroku' command requires the '--app' parameter to target a given application, unless you run it from a application folder (clone of the Git repo containing your application).
From my experience, this error occurs when the code is not pushed to heroku (git push heroku master) before running heroku ps.

Resources