The process of using Rails Composer to create a rails app using postgreSQL on Cloud9 and deploying on Heroku is fraught with warnings and errors that can confound a new developer. Are there any instructions that can help me get through the process and deploy my starter app?
How to use Rails Composer and postgreSQL on Cloud9 and deploy on Heroku
700 Views Asked by BenU At
1
There are 1 best solutions below
Related Questions in POSTGRESQL
- Best way to pass an environment variable to several config files
- Openshift context path
- KeyStore file is not found in jar, although present in jar
- phpseclib of how to get PID and kill
- Unable to connect database of lamp instance from servlet running on tomcat instance of google cloud
- Spring and Tomcat: Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set
- How can I get a custom header from the client in Tomcat?
- why lost Mysql connection pool after a period?
- Eclipse Java EE + Bitnami Tomcat Stack
- Service not starting using Spring-boot during integration tests
Related Questions in RUBY-ON-RAILS-4
- Best way to pass an environment variable to several config files
- Openshift context path
- KeyStore file is not found in jar, although present in jar
- phpseclib of how to get PID and kill
- Unable to connect database of lamp instance from servlet running on tomcat instance of google cloud
- Spring and Tomcat: Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set
- How can I get a custom header from the client in Tomcat?
- why lost Mysql connection pool after a period?
- Eclipse Java EE + Bitnami Tomcat Stack
- Service not starting using Spring-boot during integration tests
Related Questions in HEROKU
- Best way to pass an environment variable to several config files
- Openshift context path
- KeyStore file is not found in jar, although present in jar
- phpseclib of how to get PID and kill
- Unable to connect database of lamp instance from servlet running on tomcat instance of google cloud
- Spring and Tomcat: Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set
- How can I get a custom header from the client in Tomcat?
- why lost Mysql connection pool after a period?
- Eclipse Java EE + Bitnami Tomcat Stack
- Service not starting using Spring-boot during integration tests
Related Questions in CLOUD9-IDE
- Best way to pass an environment variable to several config files
- Openshift context path
- KeyStore file is not found in jar, although present in jar
- phpseclib of how to get PID and kill
- Unable to connect database of lamp instance from servlet running on tomcat instance of google cloud
- Spring and Tomcat: Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set
- How can I get a custom header from the client in Tomcat?
- why lost Mysql connection pool after a period?
- Eclipse Java EE + Bitnami Tomcat Stack
- Service not starting using Spring-boot during integration tests
Related Questions in RAILS-COMPOSER
- Best way to pass an environment variable to several config files
- Openshift context path
- KeyStore file is not found in jar, although present in jar
- phpseclib of how to get PID and kill
- Unable to connect database of lamp instance from servlet running on tomcat instance of google cloud
- Spring and Tomcat: Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set
- How can I get a custom header from the client in Tomcat?
- why lost Mysql connection pool after a period?
- Eclipse Java EE + Bitnami Tomcat Stack
- Service not starting using Spring-boot during integration tests
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
I believe in the rails composer, cloud9 and heroku and the latter's recommended postgreSQL database though using them all together has a lot of little details that no one source clarifies how to get around. After spending many nights working it out, I've created the following list of instructions which works as of the publish date and time.
Set up a postgreSQL database on your workspace:
$ sudo service postgresql start
$ sudo sudo -u postgres psql
postgres=# CREATE USER username SUPERUSER PASSWORD 'password';
CREATE ROLE
postgres=# \q
Choose a name of the app that is available on heroku since it is either one that you have or one still available on heroku. You can check availability by visiting [potential domain name].herokuapp.com
The current gems used by Rails Composer use ruby version 2.2.3 so that must be installed in rvm with the following code:
Create some local variables and save some values to them.
$ echo "export USERNAME=username" >> ~/.profile
$ echo "export PASSWORD=password" >> ~/.profile
Enter your app's domain name as a local environmental variable with the following code on the cl:
$ echo "export DOMAIN_NAME=[domain name].herokuapp.com" >> ~/.profile
Next, devise requires that a super long secret key be set as an environmental variable. Once a rails app is created, rake can generate such a secret key using the
$ rake secret
command on the cl. Since we've not yet used composer to generate our rails app, rake won't work. We'll do the same thing, though, using irb and securerandom as described by James Badger in his blog post, Generate a New Secret Token for Rails Apps:We (you and me) should use a different one in production.
$ echo "export SECRET_KEY_BASE=137d8b4bf436e670e2eea63372494b84aa25900edb1328eb5c1367f5100fe114fc95313f8772428dbda89ed84086e87a26428ef524951f94fd0375d4e399b613" >> ~/.profile
RESTART TERMINAL so that ENV variables are set. Right-clicking in terminal and selecting ‘restart all terminals’ will do it in cloud9. Restarting your terminals may return you to the root directory. If that's the case, change to your new app directory at the cl using:
Now you're all set to rev up Rails Composer
What follows are my rails composer choices which may be useful to you though yours may vary.
build a starter app?: 3 -- elected to create custom rails app
development server: 4 - puma
production server: 1 - same as development
development database: 2 - PostgresSQL
template engine: 2 - Haml
test enviroment: 2 - rspec with capybara
continuous testing: 1 - none
frontend framework: 2 -- bootstrap 3.3
email support: 1 -- none
authentication: 2 -- devise
devise modules: 1 -- devise with default modules
authorization: 1 -- none
form builder gem: 2 -- simpleform
Add pages: 5 -- Home, About, and Users
Add Bootstrap page templates? [You can check out the options at the startbootstrap.com templates webpage.]
set a local?: [return/nothing for English]
page-view analytics: 2 -- Google Analytics
generated a google analytics ID on google and entered it in.
prepare for deployment: 2 -- heroku
Disable Rails Turbolinks?: n
ban spiders: n
create github repository: n -- I plan on using bitbucket
add gem and file for environmental variables?: 1
reduce assets logger noise during development: y
improve error reporting with ‘better_errors’ during development? y
use ‘pry’ as console replacement during development and test: y
use ‘rubocop’ to ensure that your code conforms to the Ruby Style guide? y
create a project-specific rvm gemset? y
Add ‘therubyracer’? n
[Creating app!]
Username for PostgreSQL (leave blank to use the app name) username # given what I entered above to create the local pg database
Host for PostgreSQL in database.yml? (leave blank to use default socket connection) left blank
password # also given what I entered above to create the local pg database
Okay to drop all existing databases named [your app name]? y
commit final changes on git There's one final commit that Rails Composer seems to skip for some reason... Do the following:
follow directions on bitbucket to create new repository for existing project and push to it from command line
follow instructions for ‘getting started with rails’ on heroku which includes the following:
Enter your heroku credentials at the prompts.
Verify heroku remote was added with the following command:
Now that you've created the app on heroku, you've got to add some environmental variables there, too, with the following commands:
5ed8c7d9a3bda9cec3887b61f22aa95bf430a3a550407642b96751c7ef0ce8946a161506d6739da0dcaaea8c8f4f8b3335b1fb549e3cc54f0a4cec554ede05f8
Cut and paste that new secret key into the command below to set a Heroku environmental variable.
Note: You should use
$ rake secret
to generate a different SECRET_KEY_BASE than the one I've included in the code above.Now you can migrate the heroku databases:
Create a Procfile
[Procfile]
[config/puma.rb]
Because I don't expect my app to get too much traffic and can't guarantee that it's thread-safe:
Commit that Procfile and puma configuration file with:
I hope that these instructions are useful. Please feel free to add to them and improve them.