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
710 Views Asked by BenU At
1
There are 1 best solutions below
Related Questions in POSTGRESQL
- Why does adding a JOIN completely modify the query planner behaviour?
- When dealing with databases, does adding a different table when we can use a simple hash a good thing?
- Aggregate and count in PostgreSQL
- Rails HABTM: Select everything a that a record 'has'
- Trigger using data from inserted row
- Select results where joined table contains records with an attribute, but without another
- DB candidate as CouchDB/Schema replacement
- How do I properly add data in SQLAlchemy?
- Postgres in Conda Environment (Ubuntu 14.04)
- How to customize the output of the Postgres Pseudo Encrypt function?
- Split a large query (2 days) into pieces to increase the speed in Postgres
- Why does pg_search prefix not work like I expect?
- extracting meta info from a table psql using information_schema
- How to query a table in the database and copy it's data into one one?
- Update a table using info from a second table and a condition from a third table in Postgresql
Related Questions in RUBY-ON-RAILS-4
- How to create dynamic pages without form_for helper in Rails?
- ActiveRecord, Rails 4: has_many :through with scoped conditions failure
- HTML partial rendered in JS view is empty
- Why does pg_search prefix not work like I expect?
- Building a simple calculator form in Rails 4
- Rsepc-rails output Capybarra best practice for learning
- Two Association Label Elements in Simple Form
- Can your controller methods route to different pages other than the default in Ruby on Rails
- How do I update create route from rails 3 to 4
- authorize with a parent resource in Pundit
- How to make different development and production declaration of my rails engine in a gemset
- Devise throws 401 unauthorized and redirects only in Production/Staging
- How to distinguish method from attribute in rails 4
- Using Rspec should_receive to test that a controller calls a method on an object correctly
- Rails: Customising SimpleForm Association Wrapper
Related Questions in HEROKU
- NoMethodError: undefined method `update_average_rating' for nil:NilClass
- Using Amazon KMS service on Heroku
- How to have Heroku build my development branch on a staging server?
- Heroku not fetching from DB when scheduler running
- Search for a key in django.core.cache
- Ruby app fails in https request on heroku.com
- Rails: NameError: uninitialized constant Rails::Application::YAML
- clojure worker-only app on heroku fails with Error R10
- Clockwork not logging to Heroku console
- Javascript working in development locally but not production on Heroku
- Heroku PostgreSQL Studio not finding databases
- Heroku : Username for 'https://git.heroku.com': git
- Pg backups curl latest dump from Heroku
- How do you deploy build artifacts to Heroku from Codeship?
- Custom validation message (in model file) that includes a path not working
Related Questions in CLOUD9-IDE
- Err: install Couldn't read dependencies - While executing command npm install
- Issues updating Heroku to a newer version on Cloud9 IDE
- bash: :command not found Cloud9 Enviroment
- Cloud9 keyboard shortcut for going to workspace tree
- Error: Cannot GET /
- Debug coffeescript source in Cloud-9 ide?
- module.js 340 error Cannot find module 'bonescript'
- Is it possible to run gitk in cloud9
- Cloud9 Node js Express jade IDE: file structure
- how does one configure xdebug nginx and cloud9ide
- Connect to Google Cloud SQL
- bash: :command not found on Cloud9 not resolving
- How to increase the indent size in (Cloud9)
- Why isn't bin/www command not working in my cloud9 (c9) new run configuration?
- Cloud9 ide img not working
Related Questions in RAILS-COMPOSER
- Rails Composer generated app, adding dynamic pages, not yielding from application view
- Using Rails Composer, getting error "-bash: rails: command not found" using "learn-rails" gemset
- Rails_apps_composer. Generate an application from defaults. error :undefined method `add_builtin_type' for Psych:Module (NoMethodError)
- Railsapps template crashing
- Rails: notice: messages won't disappear Using rails_layout gem?
- Rails Composer not loading completed files
- How to get rid of uninitialized constant Omniauth (NameError)?
- Thor empty_directory command raises 'permission denied' when cloning from repo in rails composer custom recipe
- getting postgresql to work on cloud9
- How to use Rails Composer and postgreSQL on Cloud9 and deploy on Heroku
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 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" >> ~/.profileEnter 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" >> ~/.profileNext, 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 secretcommand 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" >> ~/.profileRESTART 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:
5ed8c7d9a3bda9cec3887b61f22aa95bf430a3a550407642b96751c7ef0ce8946a161506d6739da0dcaaea8c8f4f8b3335b1fb549e3cc54f0a4cec554ede05f8Cut and paste that new secret key into the command below to set a Heroku environmental variable.
Note: You should use
$ rake secretto 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.