= '''How to update bbmri app''' = == Export war & mysql file == 1. Run the app on your molgenis-legacy workspace (using tomcat, not standalone) 1. Export the war file 1. In eclipse: File--> export --> Web --> war file 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. == Deploy to server == 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/) . 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. 1. Deploy at test molgenis14 (Take a look here also http://www.molgenis.org/wiki/SopCreateMolgenisVM#SopDeploymentForDevs ) : 1. Ask credentials for molgenis35, molgenis14 from Pieter or Morris. 1. Copy the war file and the mysql migration script to the server as follows: 1. scp .war [mailto:molgenis@molgenis35.target.rug.nl:./ molgenis@molgenis14.target.rug.nl:./] 1. Ssh to the server: * ssh [mailto:molgenis@molgenis35.target.rug.nl molgenis AT molgenis14.target.rug.nl] * You are now at /srv/molgenis/ where your files where copied. * The database is bbmri, so in order to apply the migration steps you created: * '''BACKUP your DATABASE FIRST''': * mysqldump bbmri -u molgenis –pmolgenis > ~/databaseDumps/bbmriDB.mysql * Check the dumbed file if it is not just an error file … * Apply migration steps: * mysql -u molgenis –pmolgenis * use bbmri * * '''Backup & replace the war file on server''': * The war file is in /usr/share/tomcat6/webapps/biobanks.war * cp /usr/share/tomcat6/webapps/biobanks.war ~/warFiles/ * Now replace the file there with your recent file uploaded in the server. This will OVERWITE the old file and tomcat will take affect immediately. Do not delete the old first, that won’t work! Just overwrite it! * cp .war /usr/share/tomcat6/webapps/biobanks.war * You can check the tomcat & mysql service with: * sudo service tomcat6 status * sudo service mysqld status * Check your deployment at: [https://molgenis14.target.rug.nl/biobanks/ https://molgenis35.target.rug.nl/biobanks/] == ''' The same steps apply to the production server molgenis14 . ''' == == '''Appendix ''' == * Find miscellaneous issues here: http://www.molgenis.org/wiki/DespoinaLog * An old example migration file: {{{ CREATE TABLE !`BiobankSubCategory` (   !`id` int(11) NOT NULL,   PRIMARY KEY (!`id`),   CONSTRAINT !`biobanksubcategory_ibfk_1` FOREIGN KEY (!`id`) REFERENCES !`OntologyTerm` (!`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;     INSERT INTO !BiobankSubCategory (id) SELECT id FROM !BiobankCategory WHERE id  NOT IN ("281", "284", "285") ;   CREATE TABLE !BiobankPersonRole (             id INTEGER NOT NULL             , PRIMARY KEY(id) );   alter table !OntologyTerm modify   column !__Type enum('!OntologyTerm','!PersonRole','Species','!AlternateId','!BiobankCategory','!BiobankTopic','!BiobankDataType', '!BiobankSubCategory','!BiobankPersonRole');     ALTER TABLE Biobank DROP FOREIGN KEY biobank_ibfk_5;   ALTER TABLE !BiobankSubCategory ADD FOREIGN KEY (id) REFERENCES !OntologyTerm (id) ON DELETE CASCADE;   ALTER TABLE !`BiobankSubCategory`  ADD CONSTRAINT !`biobank_ibfk_5`     FOREIGN KEY (!`id`) REFERENCES !OntologyTerm (id) ON DELETE CASCADE; AUTO UPARXEI HDH APO THN DHMIOURGIA TOU)   ALTER TABLE Biobank ADD FOREIGN KEY (!SubCategory) REFERENCES !BiobankSubCategory (id) ON DELETE RESTRICT;   ALTER TABLE !`Biobank`  ADD CONSTRAINT !`biobank_ibfk_885`     FOREIGN KEY (!`SubCategory`) REFERENCES !BiobankSubCategory (id)  ON DELETE CASCADE;       DELETE FROM !BiobankCategory WHERE id  NOT IN ("281", "284", "285") ;         ALTER TABLE !BiobankPersonRole ADD FOREIGN KEY (id) REFERENCES !PersonRole (id) ON DELETE CASCADE;     ALTER TABLE !`BiobankPersonRole`  ADD CONSTRAINT !`BiobankPersonRole_ibfk_33`     FOREIGN KEY (!`id`) REFERENCES !PersonRole (id)  ON DELETE CASCADE;   UPDATE !OntologyTerm  SET !__Type="!BiobankSubCategory" WHERE id='282'; UPDATE !OntologyTerm  SET !__Type="!BiobankSubCategory" WHERE id='283'; UPDATE !OntologyTerm  SET !__Type="!BiobankSubCategory" WHERE id='286'; UPDATE !OntologyTerm  SET !__Type="!BiobankSubCategory" WHERE id='287'; UPDATE !OntologyTerm  SET !__Type="!BiobankSubCategory" WHERE id='288'; UPDATE !OntologyTerm  SET !__Type="!BiobankSubCategory" WHERE id='289'; UPDATE !OntologyTerm  SET !__Type="!BiobankSubCategory" WHERE id='290'; UPDATE !OntologyTerm  SET !__Type="!BiobankSubCategory" WHERE id='291'; UPDATE !OntologyTerm  SET !__Type="!BiobankSubCategory" WHERE id='292'; UPDATE !OntologyTerm  SET !__Type="!BiobankSubCategory" WHERE id='293'; UPDATE !OntologyTerm  SET !__Type="!BiobankSubCategory" WHERE id='295'; UPDATE !OntologyTerm  SET !__Type="!BiobankSubCategory" WHERE id='296'; UPDATE !OntologyTerm  SET !__Type="!BiobankSubCategory" WHERE id='297'; UPDATE !OntologyTerm  SET !__Type="!BiobankSubCategory" WHERE id='298'; UPDATE !OntologyTerm  SET !__Type="!BiobankSubCategory" WHERE id='564'; UPDATE !OntologyTerm  SET !__Type="!BiobankSubCategory" WHERE id='299'; UPDATE !OntologyTerm  SET !__Type="!BiobankSubCategory" WHERE id='294';       select * from !OntologyTerm where name="Software Engineer"; delete from !OntologyTerm where id=561; select * from !BiobankPersonRole; insert into !BiobankPersonRole values(561);   select * from !OntologyTerm where name="coordinator"; delete from !OntologyTerm where id=593; select * from !BiobankPersonRole; insert into !BiobankPersonRole values(277);   select * from !OntologyTerm where name="postdoc"; delete from !OntologyTerm where id=594;  select * from !BiobankPersonRole; insert into !BiobankPersonRole values(278);   select * from !OntologyTerm where name="administrator"; delete from !OntologyTerm where id=595; select * from !BiobankPersonRole; insert into !BiobankPersonRole values(279);     select * from !OntologyTerm where name="IT responsible"; delete from !OntologyTerm where id=596; select * from !BiobankPersonRole; insert into !BiobankPersonRole values(280);   //how to make values of Person Role appear in ui , you have to delete some old from DB :   create a new Coordinator Role in the ui and remember the id 591 (select * from !PersonRole; --> the latest one, or check from ui ) correct the Person table with t he new entry(that is not show in the ui) :   update Person set Roles=591 where Roles=277   delete the old one :    delete from !PersonRole where id=277; delete from  !BiobankPersonRole  where id=277; delete from !OntologyTerm  where id=277;   repeat the same step for all of them     COMMIT;   =========================================================== !SubCategory biobank_ibfk_1   CONSTRAINT !`biobank_ibfk_5` FOREIGN KEY (!`SubCategory`) REFERENCES !`BiobankSubCategory` (!`id`)   CONSTRAINT !`biobank_ibfk_5` FOREIGN KEY (!`SubCategory`) REFERENCES !`BiobankSubCategory` (!`id`),     CREATE TABLE !BiobankPersonRole (             id INTEGER NOT NULL             , PRIMARY KEY(id) );   ALTER TABLE !BiobankPersonRole ADD FOREIGN KEY (id) REFERENCES !PersonRole (id) ON DELETE CASCADE;   alter table !OntologyTerm modify   column !__Type enum('!OntologyTerm','!PersonRole','Species','!AlternateId','!BiobankCategory','!BiobankTopic','!BiobankDataType', '!BiobankSubCategory','!BiobankPersonRole');   UPDATE !OntologyTerm  SET !__Type="!BiobankSubCategory" WHERE id='282'; UPDATE !OntologyTerm  SET !__Type="!BiobankSubCategory" WHERE id='283'; UPDATE !OntologyTerm  SET !__Type="!BiobankSubCategory" WHERE id='286'; UPDATE !OntologyTerm  SET !__Type="!BiobankSubCategory" WHERE id='287'; UPDATE !OntologyTerm  SET !__Type="!BiobankSubCategory" WHERE id='288'; UPDATE !OntologyTerm  SET !__Type="!BiobankSubCategory" WHERE id='289'; UPDATE !OntologyTerm  SET !__Type="!BiobankSubCategory" WHERE id='290'; UPDATE !OntologyTerm  SET !__Type="!BiobankSubCategory" WHERE id='291'; UPDATE !OntologyTerm  SET !__Type="!BiobankSubCategory" WHERE id='292'; UPDATE !OntologyTerm  SET !__Type="!BiobankSubCategory" WHERE id='293'; UPDATE !OntologyTerm  SET !__Type="!BiobankSubCategory" WHERE id='295'; UPDATE !OntologyTerm  SET !__Type="!BiobankSubCategory" WHERE id='296'; UPDATE !OntologyTerm  SET !__Type="!BiobankSubCategory" WHERE id='297'; UPDATE !OntologyTerm  SET !__Type="!BiobankSubCategory" WHERE id='298'; UPDATE !OntologyTerm  SET !__Type="!BiobankSubCategory" WHERE id='564';   /*below we resolve the problem of duplicate entries in ontology term for !PersonRole*/   select * from !OntologyTerm where name="Software Engineer"; delete from !OntologyTerm where id=561; select * from !BiobankPersonRole; insert into !BiobankPersonRole values(561);   select * from !OntologyTerm where name="coordinator"; delete from !OntologyTerm where id=593; select * from !BiobankPersonRole; insert into !BiobankPersonRole values(277);   select * from !OntologyTerm where name="postdoc"; delete from !OntologyTerm where id=594;  select * from !BiobankPersonRole; insert into !BiobankPersonRole values(278);   select * from !OntologyTerm where name="administrator"; delete from !OntologyTerm where id=595; select * from !BiobankPersonRole; insert into !BiobankPersonRole values(279);     select * from !OntologyTerm where name="IT responsible"; delete from !OntologyTerm where id=596; select * from !BiobankPersonRole; insert into !BiobankPersonRole values(280);     COMMIT; }}}