98 | | '''How to update bbmri app''' |
99 | | }}} |
100 | | ''' Quick tutorial''' |
101 | | |
102 | | 1) Copy the mysqldump from the live server to the test server [[BR]] 2) Deploy the new war file on the testserver[[BR]] 2.1) Check if there are errors according to changes in the model. There are 2 ways: |
103 | | |
104 | | * compare the mysql from the live and the testserver |
105 | | * check in the application if there are errors |
106 | | |
107 | | 2.2) If there are changes, make the migration script[[BR]] |
108 | | |
109 | | '''Detailed tutorial''' |
110 | | |
111 | | '''1. Export war & mysql file locally''' |
112 | | |
113 | | '''1.1 Run the app on your molgenis-legacy workspace (using tomcat, not standalone)''' |
114 | | |
115 | | 1. Export the war file |
116 | | 1. In eclipse: File--> export --> Web --> war file |
117 | | 1. The database is updated as follows: apply the mysql changes that you have made locally to the database on the server, so that you have the latest version of data for the server and the changes you want applied there. About the database changes you need to track them in a migration a file like one in the end of this document. |
118 | | |
119 | | '''2. Deploy to test server''' |
120 | | |
121 | | 1. As also listed here: http://www.molgenis.org/wiki/MolgenisServers the '''test server''' is at molgenis35(https://molgenis35.target.rug.nl/biobanks/) and the '''production server''' at molgenis14(https://catalogue.bbmri.nl/biobanks/) . |
122 | | 1. First deploy at test server, notify [mailto:david.van.enckevort@nbic.nl david.van.enckevort AT nbic.nl]. He will notify BBMRI office, they will review the changes and if everything is ok proceed to updating bbmri production server. |
123 | | 1. Deploy at test server: molgenis35 (Take a look here also http://www.molgenis.org/wiki/SopCreateMolgenisVM#SopDeploymentForDevs ) : |
124 | | 1. Ask credentials for molgenis35/molgenis14 from Pieter or Morris. |
125 | | |
126 | | '''2.1 Create migration script according to data in live server''' |
127 | | |
128 | | 1. If you know the exact changes of the database, compared to the old version in live server, then the migration script is consisted of the commands that synchornize the two versions. |
129 | | 1. You do not know, you can can compare the mysql dump files between the live and the local version. This is easier if you dump only the schemas (not the data) . |
130 | | 1. First ssh to molgenis14, create file & copy it |
131 | | 1. ssh molgenis@molgenis14.target.rug.nl |
132 | | 1. create a dump file: mysqldump --no-data, -d bbmri -u molgenis –pmolgenis > ~/databaseDumps/<date>bbmriDBlive.mysql |
133 | | 1. LOCALLY : scp molgenis@molgenis14.target.rug.nl:./databaseDumps/<date>bbmriDB.mysql ./mysql<date>LIVEdata.mysql |
134 | | 1. create a local dump file: mysqldump --no-data, -d bbmri -u molgenis –pmolgenis > ~/databaseDumps/<date>bbmriDBlocal.mysql |
135 | | 1. diff <date>bbmriDBlive.mysql <date>bbmriDBlocal.mysql |
136 | | |
137 | | '''2.2 Copy war file & migration script from your computer to test server''' |
138 | | |
139 | | 1. Copy the war file and the mysql migration script from your computer to the server as follows: |
140 | | 1. scp <filename>.war molgenis@molgenis35.target.rug.nl:./ |
141 | | 1. scp <migrationScriptFilename> molgenis@molgenis35.target.rug.nl:./ |
142 | | |
143 | | '''2.3 Copy live data from your computer to test server''' |
144 | | |
145 | | 1. scp ./mysql<date>LIVEdata.mysql molgenis@molgenis35.target.rug.nl:./databaseDumps/mysql<date>LIVEdata.mysql |
146 | | |
147 | | '''2.4 Deploy at test server''' |
148 | | |
149 | | 1. Ssh to the server: |
150 | | * ssh molgenis@molgenis35.target.rug.nl |
151 | | * You are now at /srv/molgenis/ where your files where copied. |
152 | | |
153 | | '''2.5 Backup Database''' |
154 | | |
155 | | 1. mysqldump bbmri -u molgenis –pmolgenis > ~/databaseDumps/<date>bbmriDB.mysql |
156 | | 1. Check the dumbed file if it is not just an error file … |
157 | | |
158 | | '''2.6 Insert the data from live server to test server''' |
159 | | |
160 | | * '''Insert live data (copied from your computer previously)''' |
161 | | * mysql -u molgenis -pmolgenis bbmri < ./databaseDumps/mysql<date>LIVEdata.mysql |
162 | | |
163 | | '''2.7 Apply migration steps:''' |
164 | | |
165 | | * mysql -u molgenis –pmolgenis |
166 | | * use bbmri |
167 | | * <apply mysql commands> |
168 | | |
169 | | '''2.8 Backup & replace the war file on server:''' |
170 | | |
171 | | * The war file is in /usr/share/tomcat6/webapps/biobanks.war |
172 | | * BACKUP : cp /usr/share/tomcat6/webapps/biobanks.war ~/warFiles/<date_bbmri.war> |
173 | | * Delete the old *.war (Do NOT stop tomcat; leave it running): rm /usr/share/tomcat6/webapps/biobanks.war |
174 | | * Wait a few seconds; Tomcat will notice the *.war is gone and then it will remove the unzipped folder. |
175 | | * Copy the the new *.war to the webapps dir; Tomcat will detect the new *.war and unzip it. |
176 | | * cp <filename>.war /usr/share/tomcat6/webapps/biobanks.war |
177 | | * You can check the tomcat & mysql service with: |
178 | | * sudo service tomcat6 status |
179 | | * sudo service mysqld status |
180 | | |
181 | | '''3. Check your deployment''' |
182 | | |
183 | | * Check your deployment at: https://molgenis35.target.rug.nl/biobanks/ |
184 | | |
185 | | '''4. Inform bbmri office''' |
186 | | |
187 | | * Email David [mailto:david.van.enckevort@nbic.nl david.van.enckevort AT nbic.nl]. and wait till they test the server. When that step is done you can deploy to live server. |
188 | | |
189 | | '''5. Deploy at live server''' |
190 | | |
191 | | '''Copy war & db from test to live''' |
192 | | |
193 | | * From your computer: |
194 | | * scp molgenis@molgenis35.target.rug.nl:./usr/share/tomcat6/webapps/biobanks.war biobanksLatestTest.war |
195 | | * scp molgenis@molgenis35.target.rug.nl:../databaseDumps/mysql<date>LIVEdata.mysql LIVEdataSynchonized.mysql |
196 | | * To live server: |
197 | | * scp biobanksLatestTest.war molgenis@molgenis14.target.rug.nl:./biobanksLatestTest.war |
198 | | * scp LIVEdataSynchonized.mysql molgenis@molgenis14.target.rug.nl:../databaseDumps/LIVEdataSynchonized.mysql |
199 | | * in live server : |
200 | | * backup your database & application before moving the new files: |
201 | | * cp /usr/share/tomcat6/webapps/biobanks.war ~/warFiles/biobanks<date>.war |
202 | | * mysqldump bbmri -u molgenis –pmolgenis > ~/databaseDumps/<date>bbmriDB.mysql |
203 | | * Replace the war file on server as in step 2.8 |
204 | | * check your deployment at !https://catalogue.bbmri.nl/biobanks/molgenis.do |
205 | | |
206 | | '''Appendix''' |
207 | | |
208 | | * Find miscellaneous issues here: http://www.molgenis.org/wiki/DespoinaLog |
209 | | * An old example migration file: |
210 | | |
211 | | |
212 | | {{{ |