Development cycle¶
Getting the code base¶
git clone git://git.curoverse.com/tapestry.git
cd tapestry
git submodule init
git submodule update
Running tests¶
Add these configs to your /etc/mysql/my.cnf, otherwise each "create table" will take ~0.5 seconds, and you'll wait ~3 minutes each time you runrake test
before the tests start running.
innodb_file_per_table = 0 innodb_stats_persistent = 0
- Make sure
/etc/mysql/my.cnf
hasbind-address = 0.0.0.0
or whatever is suitable. - Create a
tapestry
user and atapestry_test
database on your docker host (or somewhere else reachable from a docker container). create database tapestry_test; grant all privileges on tapestry_test.* to tapestry identified by 'secretzzz';
- Create
config/database.yml
(seeconfig/database.yml.example
) make docker-test
$ make docker-test [...] 623 tests, 964 assertions, 228 failures, 88 errors Errors running test:units, test:functionals! Makefile:6: recipe for target 'docker-test' failed make: *** [docker-test] Error 1
Writing and contributing code¶
Start a branch like username/master or username/rails3
git branch example/rails3
git checkout example/rails3
Do something trivial like
- add app/views/pages/specimen_collection.html.erb
- add link to it in app/views/pages/home.html.erb
Commit it. If you refer to the issue# in the comment, redmine will notice this and do smart things (e.g., link to the commit from the issue page).
git add ...
git commit -m 'description of stuff (closes #123)'
Push it
git push
Generate a pull request
git request-pull e68ab19^ git@git.clinicalfuture.com:tapestry.git e68ab19
Send the pull request to someone like Ward
Merging code from other contributors/branches¶
Fetch latest code in other developers branches
git fetch
List remote branches
git branch -a
Switch to the other branch
git checkout origin/example/rails3
(git will complain about being in a detached head state, but that's fine - just don't commit to this state)
Now look around, test
git log
Switch to production branch (set up with git checkout --track origin/rails3
if you haven't already) and make sure it's up-to-date
git checkout rails3
git pull origin rails3
See what hasn't been merged
git cherry -v rails3 origin/example/rails3
Cherry-pick a commit
git cherry-pick e68ab19
Or merge the entire remote tree (this will fetch and merge but not yet commit)
git merge --no-commit origin/tomc/rails3
When you're happy,
git commit
Or rewind
git reset --hard rails3
Finally, push
git push
Deploying to my-dev¶
Basics
sudo gem install capistrano
Make sure "ssh root@www-dev.sum" puts you in root@www-dev and that you have an SSH agent available. You might need in ~/.ssh/config
:
Host www-dev.sum
HostName www-dev
Check out production branch
git checkout rails3
Deploy to www-dev
cap deploy
The capistrano task will run any required db migrations automatically. If you ever need to run them manually, you can do this (on www-dev):
ssh root@www-dev.sum sh -c "'cd /var/www/my-dev.personalgenomes.org/current && RAILS_ENV=staging rake db:migrate'"
Deploying to production server¶
Make sure "ssh root@www-prod.sum" puts you in root@www-prod and that you have a working SSH agent.
Check out production branch
git checkout rails3
Deploy to www-prod
cap deploy -f Capfile.production
The capistrano task will run any required db migrations automatically. If you ever need to run them manually, you can do this (on www-prod):
ssh root@www-prod.sum sh -c "'cd /var/www/my.personalgenomes.org/current && RAILS_ENV=production rake db:migrate'"
Updated by Tom Clegg almost 9 years ago ยท 14 revisions