1421825741heroku-deployment

Simply Deploy React.js App to Heroku

If you have read my another post about creating a ToDo app in react you are good to go; if not see this post.

You know that React App is a single page application containing only static assets. So, you only need to setup a mechanism to serve your static assets like CSS, JS, HTML, IMAGE, etc. files when clients ask for. Either you can use market leader HTTP servers like Apache, Nginx, etc or simple Express server that runs in Node.js.

Continue reading

heroku

Heroku : Update Cedar

The legacy Cedar-10 stack has been deprecated and reached its end-of-life on November 4, 2015. Applications may continue running, however you will not be able to push to your application without upgrading to Cedar-14 first.

Due to changes in the glibc library on Cedar-14, apps may see different memory consumption behavior on that stack. See the Performance Differences section for details. Continue reading

Rails : Heroku : Production ActionController :: InvalidAuthenticityToken

 

So I’m not sure if this is 100% causing it but I was able to replicate the error

To reproduce:
1) Open two browser windows of the same browser type (ie. 2 chrome windows)
2) Go to the login page in both windows
3) Login on one of the windows and then logout
4) Login on the other browser window and you’ll see the error

Logging out updates the csrf token but if the other login page isn’t refreshed it doesn’t get the updated token. Shouldn’t devise be handling this situation gracefully?

Continue reading

Cron jobs in Rails : Whenever gem or Scheduler in Heroku

To use autotriggered background processes in Ruby On Rails, we normally user gem like ‘Whenever‘. Its very easy to use.

Using single command like `whenever -i` will update your cron tab. To see your current Cron status you can simply use command like `whenever -l` or `crontab -l`.

Cron In Heroku

Continue reading

Heroku : PostGreSQL : Dump production / staging database to localhost

$ heroku pg:backups capture -a app_name

this will be echoed in your screen

curl -oUse Ctrl-C at any time to stop monitoring progress; the backup
will continue running. Use heroku pg:backups info to check progress.
Stop a running backup with heroku pg:backups cancel.
DATABASE ---backup---> b001
Backup completed

 

then you need to download the dump using curl

$ curl -o latest.dump `heroku pg:backups public-url -a app_name`

 

then create a database in PG and make the dump import to that database

$ pg_restore --verbose --clean --no-acl --no-owner -h localhost -U [username] -d [database name] latest.dump
Example
$ pg_restore --verbose --clean --no-acl --no-owner -h localhost -U john -d new_dump_database_name latest.dump
$ pg_restore --verbose --clean --no-acl --no-owner -h localhost -U john -d production-dump prod

now config Rails’s Database.yml

development:
  <<: *default
  #  database: rails-app_development
  database: new_dump_database_name

 

Heroku : Rails : Compiled slug size: 325.0MB is too large

What is slug?

Slugs are compressed and pre-packaged copies of your application optimized for distribution to thedyno manager. When you git push to Heroku, your code is received by the slug compiler which transforms your repository into a slug. Scaling an application then downloads and expands the slug to a dyno for execution.

What is this error about?

It means you code base is huge and compressing it should not exceed size 300 MB; Continue reading