Project

General

Profile

Development cycle » History » Version 13

Tom Clegg, 03/17/2016 09:22 PM

1 1 Tom Clegg
h1. Development cycle
2
3 4 Tom Clegg
h2. Getting the code base
4
5 13 Tom Clegg
 git clone git://git.curoverse.com/tapestry.git
6
cd tapestry
7
git submodule init
8
git submodule update
9
10
h2. Running tests
11
12
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 run @rake test@ before the tests start running.
13
* <pre>
14
innodb_file_per_table = 0
15
innodb_stats_persistent = 0
16
</pre>
17
18
You can run tests in a docker container.
19
* Make sure @/etc/mysql/my.cnf@ has @bind-address = 0.0.0.0@ or whatever is suitable.
20
* Create a @tapestry@ user and a @tapestry_test@ database on your docker host (or somewhere else reachable from a docker container).
21
* <pre>create database tapestry_test;
22
grant all privileges on tapestry_test.* to tapestry identified by 'secretzzz';
23
</pre>
24
* Create @config/database.yml@ (see @config/database.yml.example@)
25
* @make docker-test@
26 4 Tom Clegg
27 1 Tom Clegg
h2. Writing and contributing code
28
29
Start a branch like username/master or username/rails3
30
31
 git branch example/rails3
32
git checkout example/rails3
33
34
Do something trivial like
35
36
* add app/views/pages/specimen_collection.html.erb
37
* add link to it in app/views/pages/home.html.erb
38
39 3 Tom Clegg
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).
40 1 Tom Clegg
41
 git add ...
42 3 Tom Clegg
git commit -m 'description of stuff (closes #123)'
43 1 Tom Clegg
44
Push it
45
46
 git push
47
48
Generate a pull request
49
50 12 Ward Vandewege
 git request-pull e68ab19^ git@git.clinicalfuture.com:tapestry.git e68ab19
51 1 Tom Clegg
52
Send the pull request to someone like Ward
53
54 2 Ward Vandewege
h2. Merging code from other contributors/branches
55 1 Tom Clegg
56 4 Tom Clegg
Fetch latest code in other developers branches
57 1 Tom Clegg
58 4 Tom Clegg
 git fetch
59 1 Tom Clegg
60 4 Tom Clegg
List remote branches
61
62
 git branch -a
63
64 1 Tom Clegg
Switch to the other branch
65 2 Ward Vandewege
66 1 Tom Clegg
 git checkout origin/example/rails3
67 2 Ward Vandewege
68
(git will complain about being in a detached head state, but that's fine - just don't commit to this state)
69
70
Now look around, test
71 1 Tom Clegg
72 2 Ward Vandewege
 git log
73
74 4 Tom Clegg
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
75 2 Ward Vandewege
76
 git checkout rails3
77 4 Tom Clegg
git pull origin rails3
78 2 Ward Vandewege
79 5 Tom Clegg
See what hasn't been merged
80
81
 git cherry -v rails3 origin/example/rails3
82
83 1 Tom Clegg
Cherry-pick a commit
84
85
 git cherry-pick e68ab19
86
87 2 Ward Vandewege
Or merge the entire remote tree (this will fetch and merge but not yet commit)
88
89
 git merge --no-commit origin/tomc/rails3
90
 
91
When you're happy, 
92
93
 git commit
94
95
Or rewind
96
97
 git reset --hard rails3
98
99
Finally, push
100 1 Tom Clegg
101
 git push
102 5 Tom Clegg
103
h2. Deploying to my-dev
104
105 6 Tom Clegg
Basics
106
107
 sudo gem install capistrano
108
109 10 Tom Clegg
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@:
110 1 Tom Clegg
111 6 Tom Clegg
 Host www-dev.sum
112 1 Tom Clegg
  HostName www-dev
113 6 Tom Clegg
114
Check out production branch
115
116
 git checkout rails3
117
118
Deploy to www-dev
119
120
 cap deploy
121
122 11 Ward Vandewege
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):
123 6 Tom Clegg
124 1 Tom Clegg
 ssh root@www-dev.sum sh -c "'cd /var/www/my-dev.personalgenomes.org/current && RAILS_ENV=staging rake db:migrate'"
125 9 Tom Clegg
126 7 Tom Clegg
h2. Deploying to production server
127
128 10 Tom Clegg
Make sure "ssh root@www-prod.sum" puts you in root@www-prod and that you have a working SSH agent.
129 7 Tom Clegg
130
Check out production branch
131
132
 git checkout rails3
133
134
Deploy to www-prod
135
136
 cap deploy -f Capfile.production
137
138 11 Ward Vandewege
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):
139 7 Tom Clegg
140 9 Tom Clegg
 ssh root@www-prod.sum sh -c "'cd /var/www/my.personalgenomes.org/current && RAILS_ENV=production rake db:migrate'"