'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.
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).
ProductionIn production I have the following setup on the server (in .bashrc)
export APP_PATH=/home/users/funkytwig/user/rails/railsappI 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.