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 answers
Related Questions in POSTGRESQL
- Only the first SQL script gets executed inside Docker Postgres container
- Compare fields in two tables
- Hibernate ClobJdbcType bindings: what are the diferences?
- Postgres && statement Error in Mybatis Mapper?
- Can this query be optimized? (Choosing a random row to insert, that excludes previously inserted Rows)
- Connection terminated unexpectedly while performing multi row insert using pg-promise
- Processing multiple forms in nodejs and postgresql
- How to copy data from SQLite to postgreSQL?
- PGAdmin4 configured behind a reverse proxy but unable to connect to Postgresql server
- Updates to pgsodium encrypted values don't use specified key_id
- Connecting to Postgres running in a Docker container using psql
- Can't connect to local postgresql server from my docker container
- Django Arrayfield migration to cloud sql (Postgresql) not creating the column
- Get list of matching keywords for each post
- docker-compose can't reset postgresql database
Related Questions in RUBY-ON-RAILS-4
- How to fix error in model with gem lockbox
- POST data then navigate to a new page and persist said data in Rails, without using the database?
- is there a way to write this clean?
- HTML to pdf conversion using wickedpdf with page count
- Can we view PostgreSQL tables in django admin or in rails admin, I saw one day my QA colleague viewing tables from rails admin, was that SQL tables?
- ruby-kafka idle timeout handler to call deliver_messages
- I do not know why I get the following error:uninitialized constant Games Object.const_get(camel_cased_word) ^
- Execute a ruby script in scala or convert logic in scala
- Ruby Version Manager
- Rails Rspec tests only intermittently recognizing polymorphic associations
- Holizontally alighning two sets of data using Prawn in Rails
- Beanstream::InternalServerException: on rails 4.2 using gem "beanstream"
- "Bundle update rails" is failing with multiple dependencies error
- How to fix "Your Ruby version is 3.0.6, but your Gemfile specified 2.6.10" running rake command?
- How to handle the params for accepts_nested_attributes_for for has_many association containing a lot of fields on both associated table
Related Questions in HEROKU
- How to get Heroku Support to answer an email?
- Duplicate GET requests - Rails & Heroku
- I am struggling to get a 200 success request for my Heroku-hosted API on Rapid API for GET requests. I only receive a '404 page not found' error
- Heroku Deployment Error: Failed to Push Some Refs to Git Repository
- NOT WORKING domain.com/cv WORK domain.com/cv/ www.bluetrendy.com/cv www.bluetrendy.com/cv/ any ideas?
- I'm going nuts with Heroku session management issues
- Images stored on google drive are not loading on a website hosted on heroku
- Deploy Springboot app on heroku which is using google storage services
- How to run mitmproxy in Heroku?
- Celery Task Tracing ValueError: Unpacking Issue in a Flask Web App Migration, python backend
- Unable to push changes via git behind Proxy with Heroku
- Failed docker deployment: Cannot find module '/app/heroku'
- Request timeout error (H12) on Heroku deployment for website scraping and Excel generation
- Stripe doesn't work after deploying on Heroku by Django
- I got CORS error when trying to do a request in my app in Heroku
Related Questions in CLOUD9-IDE
- AWS Cloud9 editor Typescript issues
- How to provide access of cloud9 environment to multiple users?
- Python script from Cloud9 IDE trying to upload to AWS s3 bucket showing "No such file or directory"
- how to connect managed aws apache airflow with cloud9?
- How can I Connect a postgres Database Inside Cloud9 IDE to Grafana and pgAdmin?
- How to debug a Lambda function in Cloud9?
- AWS Cloud9 showing `no access` under permission, any idea?
- How to install python3.11 and update Pylint on Amazon Cloud9 IDE?
- deploy lambda function using cloud9 and IAM identity center
- How can I permanently change my Ruby version in AWS Cloud9 IDE CLI
- AWS Cloud9 - Screen recording
- Is it possible to use cloud formation to deploy a Cloud9 ide on an EC2 image that is not obsolete?
- AWS Cloud9 creates .c9 folder automatically?
- CDK cloud9 - How to attach preconstructed instance profile to Cloud9 instance iam role in cdk?
- Unable to Paste a PAT from GitHub to Cloud9 Ruby on Rails
Related Questions in RAILS-COMPOSER
- Thor empty_directory command raises 'permission denied' when cloning from repo in rails composer custom recipe
- How to use Rails Composer and postgreSQL on Cloud9 and deploy on Heroku
- getting postgresql to work on cloud9
- How to get rid of uninitialized constant Omniauth (NameError)?
- Rails Composer not loading completed files
- Rails_apps_composer. Generate an application from defaults. error :undefined method `add_builtin_type' for Psych:Module (NoMethodError)
- Using Rails Composer, getting error "-bash: rails: command not found" using "learn-rails" gemset
- Rails Composer generated app, adding dynamic pages, not yielding from application view
- Rails: notice: messages won't disappear Using rails_layout gem?
- Railsapps template crashing
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?
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)
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.