Ruby on Rails
Sunday, September 10, 2017
I've been googling for this for a while wit little joy. Maybe I'm using the wrong search terms but I'm very surprised there is not a howto guide;(,
What I am trying to work out it how to take a project from development to test (and test) and then to production. I will make the environments the same so I don't need a staging environment. I am using git(bitbucket) unicorn, Nginx and rbevn. Currently I am actually using vanilla 'rails server' in development and realise I need to setup unicorn/Ngnix on my development box (but am not asking about this here as there seems to be good guides for this.
Test
I've seen in a few places that I can basically clone by rails development environment to test (including database). I gather this means going to git test branch and running some type of rails command to do this (not sure what or what I need to setup). All I can work out is I need to setup config/environments/test.rb/ & config/database.yml. Then run the tests (I'm looking at http://guides.rubyonrails.org/testing.html so again am not asking for help with testing).
Production
In production I have the following setup on the server (in .bashrc)
export RAILS_ENV=production
export APP_PATH=/home/users/funkytwig/user/rails/railsapp
I only have the master git branch on the production server (so I just need to 'git pull').
The first time I move app to production I will have to create the database (rails db:migrate? ro do I need to do something else to create from scratch). Then I need to load some app configuration data, think I know how to do this, see below.
Then when take a new version of the app I also do git pull, 'rails db:migrate' and reload the configuration data.
Exporting config Data
Bit more googling and I found out about 'rails db:seed:dump' (http://www.rubydoc.info/gems/seed_dump/0.5.3). So I guess I use something like
-- What I am trying to work out it how to take a project from development to test (and test) and then to production. I will make the environments the same so I don't need a staging environment. I am using git(bitbucket) unicorn, Nginx and rbevn. Currently I am actually using vanilla 'rails server' in development and realise I need to setup unicorn/Ngnix on my development box (but am not asking about this here as there seems to be good guides for this.
Test
I've seen in a few places that I can basically clone by rails development environment to test (including database). I gather this means going to git test branch and running some type of rails command to do this (not sure what or what I need to setup). All I can work out is I need to setup config/environments/test.rb/ & config/database.yml. Then run the tests (I'm looking at http://guides.rubyonrails.org/testing.html so again am not asking for help with testing).
Production
In production I have the following setup on the server (in .bashrc)
export RAILS_ENV=production
export APP_PATH=/home/users/funkytwig/user/rails/railsapp
I only have the master git branch on the production server (so I just need to 'git pull').
The first time I move app to production I will have to create the database (rails db:migrate? ro do I need to do something else to create from scratch). Then I need to load some app configuration data, think I know how to do this, see below.
Then when take a new version of the app I also do git pull, 'rails db:migrate' and reload the configuration data.
Exporting config Data
Bit more googling and I found out about 'rails db:seed:dump' (http://www.rubydoc.info/gems/seed_dump/0.5.3). So I guess I use something like
rake db:seed:dump MODELS=User, RefValue
Seem to make seance to create a bump_db_app_config.bash to create this file, although not sure exactly where to put it in the file-system (should put the script and created file in rails app structure some-ware or outside it)
Lastly alter I have migrated the db I just run the script.You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/0af7f431-401e-4edc-b2cc-6e594af382ac%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment