source: trunk/doc/src/docbook/admindoc/installation_upgrade.xml @ 3917

Last change on this file since 3917 was 3917, checked in by Nicklas Nordborg, 15 years ago

Fixes #717: Make initdb, updatedb and other scripts accept a username

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 43.7 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<!DOCTYPE chapter PUBLIC
3    "-//Dawid Weiss//DTD DocBook V3.1-Based Extension for XML and graphics inclusion//EN"
4    "../../../../lib/docbook/preprocess/dweiss-docbook-extensions.dtd">
5<!--
6  $Id: installation_upgrade.xml 3917 2007-11-06 13:43:30Z nicklas $
7
8  Copyright (C) 2007 Jari Hakkinen, Peter Johansson, Nicklas Nordborg, Martin Svensson
9
10  This file is part of BASE - BioArray Software Environment.
11  Available at http://base.thep.lu.se/
12
13  BASE is free software; you can redistribute it and/or
14  modify it under the terms of the GNU General Public License
15  as published by the Free Software Foundation; either version 2
16  of the License, or (at your option) any later version.
17
18  BASE is distributed in the hope that it will be useful,
19  but WITHOUT ANY WARRANTY; without even the implied warranty of
20  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21  GNU General Public License for more details.
22
23  You should have received a copy of the GNU General Public License
24  along with this program; if not, write to the Free Software
25  Foundation, Inc., 59 Temple Place - Suite 330,
26  Boston, MA  02111-1307, USA.
27-->
28
29<chapter id="installation_upgrade">
30  <?dbhtml dir="installation_upgrade"?>
31
32  <title>Installation, setup, migration, and upgrade instructions</title>
33
34  <note>
35    These instructions apply only to the BASE release which this
36    document is a part of.
37  </note>
38
39  <para>
40    This chapter is divided into four parts. First, the process of
41    upgrading a BASE 2 server is described. Followed by set up of job
42    agents. (For these two first parts it is assumed that there is a
43    running server.) Then, the first time installation instructions
44    follows, and the chapter is concluded with information on how to
45    migrate data from a BASE 1.2.17 server to a BASE 2 server.
46  </para>
47
48  <para>
49    The first time installation is only to be performed once,
50    optionally followed by a migration. The migration can only be done
51    to a pristine (empty) BASE 2 server with one exception; The
52    migration can be restarted if it fails during the RawBioAssaysData
53    transfer, for all other failure points the migration has to be
54    restarted with an empty database. Migration from several BASE 1
55    installations to one BASE 2 server is not supported.
56  </para>
57
58  <para>
59    The instructions here assume
60    that <ulink url="http://tomcat.apache.org/">tomcat</ulink> is used
61    on the server side. Other servlet engines may work but we only
62    test tomcat.
63  </para>
64
65
66  <sect1 id="installation_upgrade.upgrade">
67    <title>Upgrade instructions</title>
68
69    <important id="dropindexes">
70      <title>Upgrading from BASE 2.4.3 or lower to 2.4.4 or higher</title>
71      <para>
72        Older releases of BASE 2 used to create indexes for many columns
73        in the dynamic database. The same columns are part of the primary
74        key for the tables so the indexes are not really needed. The
75        result is very bad performance since the database engine sometimes
76        get stuck in "index update" mode making the entire server
77        very slow. BASE 2.4.4 no longer creates the indexes. Indexes on
78        existing tables should be dropped to increase the performance.
79        Tests have shown a 50-90% decrease in execution time for some
80        plug-ins
81        (<ulink url="http://base.thep.lu.se/ticket/294">http://base.thep.lu.se/ticket/294</ulink>).
82      </para>
83      <para>
84        Removing the indexes is very simple. <emphasis>After the server
85        has been upgraded</emphasis> following the usual instructions below, issue the
86        the following commands:
87      </para>
88   
89      <programlisting>
90cd &lt;basedir&gt;/bin
91./dynamicdb.sh -v -dropindexes
92</programlisting>
93
94      <para>
95        Skip the <option>-dropindexes</option> option to do a dry
96        run without actually deleting the indexes.
97      </para>
98    </important>
99
100    <para>
101      As always, backup your database before attempting an
102      upgrade. The BASE team performs extensive testing before
103      releasing a new version of BASE but there are always a
104      possibility for unexpected events during upgrades. In upgrades
105      requiring a change in the underlying database there is no
106      (supported) way to revert to a previous version of BASE using
107      BASE tools, you need to use your backup for this use case.
108    </para>
109
110    <para>
111      The strategy here is to install the new BASE release to another
112      directory than the one in use. This requires transfer of
113      configuration settings to the new install but more on that
114      below.
115    </para>
116
117    <variablelist>
118      <varlistentry>
119        <term>Shut down the tomcat server</term>
120        <listitem>
121          <para>
122            If the BASE application is not shut down already, it is
123            time to do it now. Do something like <command>sudo
124            /etc/init.d/tomcat5.5 stop</command>
125          </para>
126        </listitem>
127      </varlistentry>
128
129      <varlistentry>
130        <term>Rename your current server</term>
131        <listitem>
132          <para>
133            Rename your current BASE 2 installation <command>mv
134              /path/to/base /path/to/base_old</command>.
135          </para>
136        </listitem>
137      </varlistentry>
138
139      <varlistentry>
140        <term>Download and unpack BASE</term>
141        <listitem>
142          <para>
143            There are several ways to download BASE. Please refer to
144            section <xref linkend="resources.home_page.download"/> for
145            information on downloading BASE, and select the item
146            matching your download option:
147          </para>
148
149          <variablelist>
150            <varlistentry>
151              <term><emphasis>Pre-compiled package</emphasis></term>
152              <listitem>
153                <para>
154                  If you selected to download a pre-compiled package,
155                  unpack the downloaded file with <command>tar zxpf
156                  base-...tar.gz</command>.
157                </para>
158              </listitem>
159            </varlistentry>
160
161            <varlistentry>
162              <term><emphasis>Source package</emphasis></term>
163              <listitem>
164                <para>
165                  If you selected to download a source package, unpack
166                  the downloaded file with <command>tar zxpf
167                  base-...src.tar.gz</command>. Change to the new
168                  directory, and issue <command>ant
169                  package.bin</command>. This will create a binary
170                  package in the current directory. Unpack this new
171                  package (outside of the source file hierarchy).
172                </para>
173              </listitem>
174            </varlistentry>
175
176            <varlistentry>
177              <term><emphasis>Subversion checkout</emphasis></term>
178              <listitem>
179                <para>
180                  This option is for advanced users only and is not
181                  covered here. Please refer to
182                  <xref linkend="core_ref.build"/> for information on
183                  this download option.
184                </para>
185              </listitem>
186            </varlistentry>
187
188          </variablelist>
189        </listitem>
190
191      </varlistentry>
192
193      <varlistentry>
194        <term>Transfer files and settings</term>
195        <listitem>
196          <para>
197            Settings from the previous installation must be
198            transferred to the new installation. This is most easily
199            done by comparing the configuration files from the
200            previous install with the new files. Do not just copy the
201            old files to the new install since new options may have
202            appeared.
203          </para>
204          <para>
205            In the main BASE configuration file,
206            <filename>&lt;base-dir&gt;/www/WEB-INF/classes/base.config</filename>,
207            fields that needs to be transferred are usually
208            <emphasis>db.username</emphasis>,
209            <emphasis>db.password</emphasis>,
210            and <emphasis>userfiles</emphasis>.
211          </para>
212          <para>
213            Local settings in the raw data
214            tables, <filename>&lt;base-dir&gt;/www/WEB-INF/classes/raw-data-types.xml</filename>,
215            may need to be transferred.
216          </para>
217        </listitem>
218      </varlistentry>
219
220      <varlistentry>
221        <term>Updating database schema</term>
222        <listitem>
223          <para>
224            It is recommended that you also perform an update of your
225            database schema.  Running the update scripts are not
226            always necessary when upgrading BASE, but the running the
227            update scripts are safe even in cases when there is no
228            need to run them. Change directory
229            to <filename
230            class="directory">&lt;base-dir&gt;/bin/</filename> and issue
231<programlisting>
232sh ./updatedb.sh [base_root_login] <emphasis>base_root_password</emphasis>
233sh ./updateindexes.sh <emphasis>base_root_password</emphasis>
234</programlisting>
235            where <emphasis>base_root_login</emphasis> is the login
236            for the root user and <emphasis>base_root_password</emphasis> is the
237            password. The login is optional. If not specified,
238            <constant>root</constant> is used as the login.
239          </para>
240        </listitem>
241      </varlistentry>
242
243      <varlistentry>
244        <term>Remove tomcat cache</term>
245        <listitem>
246          <para>
247            As tomcat user, remove cached files and directories. Do
248            something like
249<programlisting>cd /usr/share/apache-tomcat-5.5.15/
250rm -rf work/Catalina</programlisting>
251          </para>
252        </listitem>
253      </varlistentry>
254
255      <varlistentry>
256        <term>Start tomcat</term>
257        <listitem>
258          <para>
259            Start the tomcat server: <command>sudo
260              /etc/init.d/tomcat5.5 start</command>
261          </para>
262        </listitem>
263      </varlistentry>
264
265    </variablelist>
266
267    <para>
268      Done! Upgrade of BASE is finished.
269    </para>
270
271  </sect1>      <!-- Upgrade instructions -->
272
273
274  <sect1 id="installation_upgrade.jobagents">
275    <title>Installing job agents</title>
276
277    <para>
278      It is important to understand that the BASE application can be
279      spread on to several computers. The main BASE application is
280      serving HTTP requests, the underlying database engine is
281      providing storage and persistence of data, and job agents can be
282      installed on computers that will serve the BASE installation
283      with computing power and perform analysis and run plug-in. In a
284      straight forward setup one computer provides all services needed
285      for running BASE. From this starting point it is easy to add
286      computers to shares load from the BASE server by installing job
287      agents on these additional computers.
288    </para>
289
290    <para>
291      A job agent is a program running on a computer regularly
292      checking the BASE job queue for jobs awaiting execution. When
293      the job agent finds a job that it is enabled to execute, it
294      loads the plug-in and executes it. Job agents will in this way
295      free up resources on the BASE application server, and thus allow
296      the BASE server to concentrate on serving web pages. Job agents
297      are optional and must be installed and setup
298      separately. However, BASE is prepared for job agent setup and to
299      utilize the agents, but the agent are not required.
300    </para>
301
302    <para>
303      A job agent supports many configuration options that are not
304      supported by the internal job queue. For example, you can
305      <itemizedlist>
306        <listitem>
307          <para>
308            Specify exactly which plug-ins each job agent should be
309            able to execute.
310          </para>
311        </listitem>
312        <listitem>
313          <para>
314            Give some plug-ins higher priority than other plug-ins.
315          </para>
316        </listitem>
317        <listitem>
318          <para>
319            Specify which users/groups/projects should be able to use
320            a specific job agent.
321          </para>
322        </listitem>
323        <listitem>
324          <para>
325            Override memory settings and more for each plug-in.
326          </para>
327        </listitem>
328        <listitem>
329          <para>
330            Execute plug-ins in separate processes. Thus, a misbehaving
331            plug-in cannot bring the main application server down.
332          </para>
333        </listitem>
334        <listitem>
335          <para>
336            Add more computers with job agents as needed.
337          </para>
338        </listitem>
339      </itemizedlist>
340      All these options make it possible to create a very flexible
341      setup. For example one job agent can be assigned for importing
342      data only, another job agent can be assigned for running
343      analysis plug-ins for specific project only, and a third may be a
344      catch-all job agent that performs all low-priority jobs.
345    </para>
346
347    <sect2 id="installation_upgrade.jobagents.serverside">
348      <title>BASE application server side setup</title>
349      <para>
350        <variablelist>
351          <varlistentry>
352            <term>Make sure the internal job queue doesn't execute all plug-ins</term>
353            <listitem>
354              <para>
355                The setting <command>jobqueue.internal.runallplugins</command>
356                should be set to <command>false</command> for the
357                BASE server. This setting is found in
358                the <filename>&lt;base-dir&gt;/www/WEB-INF/classes/base.config</filename>
359                file. The changes will not take effect until the
360                application server is restarted.
361              </para>
362             
363              <note>
364                Prior to BASE 2.5 the internal job queue had to be disabled
365                completely. This is no longer the case since it is possible to
366                enable/disable the internal job queue separately for
367                each plug-in.
368              </note>
369             
370            </listitem>
371          </varlistentry>
372          <varlistentry id="installation_upgrade.jobagent.user_account">
373            <term>Enable the job agent user account</term>
374            <listitem>
375              <para>
376                During installation of BASE a user account is created
377                for the job agent. This account is used by the job
378                agents to log on to BASE. The account is disabled by
379                default and must be enabled. Enable the account and
380                set a password. This password is set in the
381                <filename>jobagent.properties</filename> file, see
382                item
383                <xref linkend="installation_upgrade.jobagent.client.properties"/>
384                below.
385              </para>
386            </listitem>
387          </varlistentry>
388        </variablelist>
389      </para>
390    </sect2>
391
392    <sect2 id="installation_upgrade.jobagents.database">
393      <title>Database server setup</title>
394      <para>
395        <variablelist>
396          <varlistentry id="installation_upgrade.jobagent.database">
397            <term>Create a user account on the database</term>
398            <listitem>
399              <para>
400                This is the similar to granting database access for
401                the BASE server user in the in the regular BASE
402                installation, cf.
403                <xref
404                linkend="installation_upgrade.installation.database"/>.
405                You must create an account in the database that is
406                allowed to connect from the job agent server. MySQL
407                example:
408<programlisting>GRANT ALL ON base2.* TO db_user@job.agent.host IDENTIFIED BY 'db_password';
409GRANT ALL ON base2dynamic.* TO db_user@job.agent.host;</programlisting>
410
411                Replace <command>job.agent.host</command> with the
412                host name of the server that is going to run the job
413                agent. You should also set password. This password is
414                used in item
415                <xref linkend="installation_upgrade.jobagent.client.config"/>
416                below in job agent server setup. You can use the same
417                database user and password as in the regular database
418                setup.
419              </para>
420            </listitem>
421          </varlistentry>
422        </variablelist>
423      </para>
424    </sect2>
425
426    <sect2 id="installation_upgrade.jobagents.client">
427      <title>Job agent client setup</title>
428      <para>
429        <variablelist>
430          <varlistentry>
431            <term>Download and unpack a regular BASE 2 distribution</term>
432            <listitem>
433              <para>
434                You <emphasis>must</emphasis> use the same version on
435                the web server and all job agents. You find the
436                downloads at
437                <ulink
438                url="http://base.thep.lu.se/wiki/DownloadPage">http://base.thep.lu.se/wiki/DownloadPage</ulink>
439              </para>
440            </listitem>
441          </varlistentry>
442          <varlistentry id="installation_upgrade.jobagent.client.config">
443            <term>Edit the <filename>base.config</filename> file</term>
444            <listitem>
445              <para>
446                The <filename>&lt;base-dir&gt;/www/WEB-INF/classes/base.config</filename>
447                file must be configured as in regular BASE
448                installation, cf.
449                <xref
450                linkend="installation_upgrade.installation.configuration"/>,
451                to use the same database as the web server
452                application. The most important settings are
453                <itemizedlist>
454                  <listitem>
455                    <para>
456                      <command>db.username</command>: The database
457                      user you created in item
458                      <xref
459                      linkend="installation_upgrade.jobagent.database"/>
460                      above.
461                    </para>
462                  </listitem>
463                  <listitem>
464                    <para>
465                      <command>db.password</command>: The password for
466                      the user.
467                    </para>
468                  </listitem>
469                  <listitem>
470                    <para>
471                      <command>db.url</command>: The connection url to
472                      the database.
473                    </para>
474                  </listitem>
475                  <listitem>
476                    <para>
477                      <command>userfile</command>: The path to the
478                      directory where user files are located. This
479                      directory must be accessible from all job
480                      agents, i.e., by nfs or other file system
481                      sharing method.
482                    </para>
483                  </listitem>
484                </itemizedlist>
485                See the <xref linkend="appendix.base.config"/> for
486                more information about the settings in
487                the <filename>base.config</filename> file.
488              </para>
489            </listitem>
490          </varlistentry>
491          <varlistentry id="installation_upgrade.jobagent.client.properties">
492            <term>Edit
493            the <filename>jobagent.properties</filename> file</term>
494            <listitem>
495              <para>
496                The <filename>&lt;base-dir&gt;/www/WEB-INF/classes/jobagent.properties</filename>
497                file contains settings for the job agent. The most
498                important ones to specify value for are
499                <itemizedlist>
500                  <listitem>
501                    <para>
502                      <command>agent.password</command>: The password
503                      you set for the job agent user account in item
504                      <xref
505                      linkend="installation_upgrade.jobagent.user_account"/>
506                      above.
507                    </para>
508                  </listitem>
509                  <listitem>
510                    <para>
511                      <command>agent.id</command>: An ID that must be
512                      unique for each job agent accessing the BASE application.
513                    </para>
514                  </listitem>
515                  <listitem>
516                    <para>
517                      <command>agent.remotecontrol</command>: The
518                      name/ip address of the web server if you want it
519                      to be able to display info about running
520                      jobs. The job agent will only allow connections
521                      from computers specified in this setting.
522                    </para>
523                  </listitem>
524                </itemizedlist>
525              </para>
526              <para>
527                The <filename>jobagent.properties</filename> file
528                contains many more configuration options. See
529                the <xref linkend="appendix.jobagent.properties"/> for
530                more information.
531              </para>
532            </listitem>
533          </varlistentry>
534          <varlistentry>
535            <term>Register the job agent</term>
536            <listitem>
537              <para>
538                From the <filename>bin</filename> directory, register
539                the job agent with
540                <programlisting>./jobagent.sh register</programlisting>
541              </para>
542            </listitem>
543          </varlistentry>
544          <varlistentry>
545            <term>Start the job agent</term>
546            <listitem>
547              <para>
548                From the <filename>bin</filename> directory, start the
549                job agent with
550                <programlisting>./jobagent.sh start &amp;</programlisting>
551              </para>
552              <para>
553                See the <xref linkend="appendix.jobagent.sh"/>
554                for more information about what you can do
555                with the job agent command line interface.
556              </para>
557            </listitem>
558          </varlistentry>
559        </variablelist>
560      </para>
561    </sect2>
562
563    <sect2 id="installation_upgrade.jobagents.configuration">
564      <title>Configuring the job agent</title>
565      <para>
566        Before the job agent starts executing jobs for you it must be
567        configured. The configuration is done through the BASE web
568        interface. See <xref linkend="plugins.jobagents" />
569        <variablelist>
570          <varlistentry>
571            <term>Configure the plug-ins the job agent should handle</term>
572            <listitem>
573              <para>
574                <itemizedlist>
575                  <listitem>
576                    <para>
577                      Go to the
578                      <menuchoice>
579                        <guimenu>Administrate</guimenu>
580                        <guisubmenu>Plugins</guisubmenu>
581                        <guimenuitem>Job agents</guimenuitem>
582                      </menuchoice> menu.
583                    </para>
584                  </listitem>
585                  <listitem>
586                    <para>
587                      Select the job agent and click on the &gbEdit;
588                      button.
589                    </para>
590                  </listitem>
591                  <listitem>
592                    <para>
593                      On the <guilabel>Plugins</guilabel> tab you can
594                      specify which plug-ins the job agent should
595                      handle. Note that if you have installed external
596                      plug-ins on the web server, those plug-ins must be
597                      installed on the job agent as well. It is
598                      possible to specify different paths to the JAR
599                      file for each job agent.
600                    </para>
601                  </listitem>
602                </itemizedlist>
603              </para>
604            </listitem>
605          </varlistentry>
606          <varlistentry>
607            <term>Grant users access to the job agent</term>
608            <listitem>
609              <para>
610                Use the regular <guilabel>Share</guilabel>
611                functionality to specify which users/groups/projects
612                should be able to use the job agent. You must give
613                them at least <command>USE</command> permission.
614              </para>
615            </listitem>
616          </varlistentry>
617        </variablelist>
618      </para>
619    </sect2>
620
621  </sect1>      <!-- job agent setup -->
622
623
624  <sect1 id="installation_upgrade.installation">
625    <title>Installation instructions</title>
626
627    <variablelist>
628
629      <varlistentry>
630        <term>Java</term>
631        <listitem>
632          <para>
633            Download and install Java SDK 1.5, available from
634            <ulink url="http://java.sun.com/" />. Make sure that you
635            download the JDK version (<emphasis>not</emphasis> the JRE
636            version). <command>Java 6 is currently not
637            supported</command> (this will change starting with
638            BASE version 2.5 whereafter only Java 6 will be supported).
639          </para>
640        </listitem>
641      </varlistentry>
642
643      <varlistentry>
644        <term>Tomcat</term>
645        <listitem>
646          <para>
647            Download and install tomcat 5.5.16 or later, available
648            from <ulink
649            url="http://jakarta.apache.org/tomcat/" />
650            <important>
651              You MUST make sure that Tomcat uses the SERVER mode of
652              the Java run time engine
653              (see <ulink
654              url="http://lev.thep.lu.se/trac/base/ticket/99">ticket:99</ulink>).
655            </important>
656            On Linux you do this by setting the environment variable:
657            <code>CATALINA_OPTS</code> to <code>-server</code>. It is
658            also a good idea to specify the maximum allowed memory to
659            use: <code>-server -Xmx500m</code> sets it to 500
660            megabytes. Basically add the next line close to the top of
661            the <filename>catalina.sh</filename> script that comes
662            with tomcat
663            (directory <filename
664            class="directory">bin</filename>):
665<programlisting>CATALINA_OPTS="-server -Xmx500m"</programlisting>
666          </para>
667          <para>
668            For more information about Tomcat options see
669            <ulink url="http://www.chemaxon.com/jchem/doc/admin/tomcat.html" />.
670          </para>
671        </listitem>
672      </varlistentry>
673
674      <varlistentry>
675        <term>Set up SQL database</term>
676        <listitem>
677          <para>
678            BASE 2
679            utilize <ulink
680            url="http://www.hibernate.org/">Hibernate</ulink> for
681            object persistence to a relational database. Hibernate
682            supports many database engines, but so far we only work
683            with <ulink url="http://www.mysql.com">MySQL</ulink>
684            and <ulink
685            url="http://www.postgresql.org/">PostgreSQL</ulink>.
686          </para>
687
688          <variablelist>
689            <varlistentry>
690              <term>MySQL</term>
691              <listitem>
692                <para>
693                  Download and install MySQL (tested with version
694                  5.0), available from
695                  <ulink url="http://www.mysql.com/" />. You need to
696                  be able to connect to the server over TCP, so
697                  the <emphasis>skip-networking</emphasis> option
698                  must <command>not</command> be used. The InnoDB
699                  table engine is also needed, so do not disable them
700                  (not that you would) but you may want to tune the
701                  InnoDB behaviour before creating BASE
702                  databases. BASE comes pre-configured for MySQL so
703                  there is no need to change database settings in the
704                  BASE configuration files.
705                </para>
706              </listitem>
707            </varlistentry>
708            <varlistentry>
709              <term>PostgreSQL</term>
710              <listitem>
711                <para>
712                  PostgreSQL 8.2 seems to be working very well with
713                  BASE and Hibernate. Download and install PostgreSQL,
714                  available from
715                  <ulink url="http://www.postgresql.org/" />. you must
716                  edit
717                  your <filename>&lt;base-dir&gt;/www/WEB-INF/classes/base.config</filename>
718                  file. Uncomment the settings for Postgres and
719                  comment out the settings for MySQL.
720                </para>
721               
722                <note>
723                  <para>
724                  Postgres versions prior to 8.2 have a non-optimal solution
725                  for locking rows in certain situations. This may cause two
726                  seemingly independent transactions to lock if they just
727                  reference a common database row. This may happen, for example,
728                  when importing raw data that have references to the same
729                  reporters. The problem has been solved in Postgres 8.2.
730                  </para>
731                </note>
732               
733              </listitem>
734            </varlistentry>
735          </variablelist>
736
737        </listitem>
738      </varlistentry>
739
740      <varlistentry>
741        <term>BASE (download and unpacking)</term>
742        <listitem>
743          <para>
744            <ulink
745            url="http://base.thep.lu.se/wiki/DownloadPage">Download
746            BASE</ulink> and unpack the downloaded file,
747            i.e. <command>tar zxpf base-...tar.gz</command>. If you
748            prefer to have the bleeding edge version of BASE, perform
749            a checkout of the source from the subversion repository
750            (subversion checkout instructions at
751            <ulink url="http://base.thep.lu.se/wiki/DownloadPage">BASE
752            trac site</ulink>).
753          </para>
754          <para>
755            If you choose to download the binary package, skip to the
756            next item. The rest of us, read on and compile BASE 2. If
757            you downloaded a source distribution, unpack the
758            downloaded file <command>tar zxpf
759            base-...src.tar.gz</command>, or you may have performed a
760            subversion checkout.  Change to the 'root' base2
761            directory, and issue <command>ant
762            package.bin</command>. This will create a binary package
763            in the base2 'root' directory. Unpack this new package
764            (outside of the source file hierarchy), and from now on
765            the instructions are the same irrespective where you got
766            the binary package.
767          </para>
768          <para>
769            <emphasis>This section is intended for advanced users and
770              programmers only. In cases when you want to change the
771              BASE code and try out personalized features it may be
772              advantageous to run the tweaked BASE server against the
773              development tree. Instructions on how to accomplish this
774              is available in the
775              <ulink
776              url="http://base.thep.lu.se/chrome/site/doc/development/build.html">building
777              BASE document</ulink>. When you return back after
778              compiling in the subversion tree you can follow the
779              instruction here (with obvious changes to
780              paths).</emphasis>
781          </para>
782        </listitem>
783      </varlistentry>
784
785      <varlistentry id="installation_upgrade.installation.database">
786        <term>BASE (database engine)</term>
787        <listitem>
788          <para>
789            Instructions for MySQL and PostgreSQL are available
790            below. The database names (base2 and base2dynamic is used
791            here), the <emphasis>db_user</emphasis>, and
792            the <emphasis>db_password</emphasis> can be changed during
793            the creation of the databases. It is recommended to change
794            the <emphasis>db_password</emphasis>, the other changes
795            can be made if desired. The database names,
796            the <emphasis>db_user</emphasis>, and
797            the <emphasis>db_password</emphasis> are needed in a later
798            step below when configuring BASE.
799          </para>
800          <note>
801            Note that the <emphasis>db_user</emphasis> name
802            and <emphasis>db_password</emphasis> set here is used
803            internally by BASE in communication with the database and
804            is never used to log on to the BASE application.
805          </note>
806          <variablelist>
807            <varlistentry>
808              <term>MySQL</term>
809              <listitem>
810                <para>
811                  Create a new database for BASE, and add a
812                  <emphasis>db_user</emphasis> with at least
813                  <emphasis>SELECT</emphasis>, <emphasis>INSERT</emphasis>,
814                  <emphasis>UPDATE</emphasis>, <emphasis>DELETE</emphasis>,
815                  <emphasis>CREATE</emphasis>, <emphasis>DROP</emphasis>,
816                  <emphasis>INDEX</emphasis>,
817                  and <emphasis>ALTER</emphasis> permission for the
818                  new database. To do this, connect to your MySQL
819                  server and issue the next lines:
820<programlisting>CREATE DATABASE base2;
821CREATE DATABASE base2dynamic;
822GRANT ALL ON base2.* TO db_user@localhost IDENTIFIED BY 'db_password';
823GRANT ALL ON base2dynamic.* TO db_user@localhost;</programlisting>
824                </para>
825                <para>
826                  The <filename>&lt;base-dir&gt;/misc/sql/createdb.mysql.sql</filename>
827                  file contains the above statements and can be used
828                  by the <filename>mysql</filename> command-line tool
829                  (remember to edit
830                  the <emphasis>db_user</emphasis>,
831                  <emphasis>db_password</emphasis>,
832                  and the database names in the script file before
833                  executing the command): <command>mysql -uroot -p
834                  &lt; ./misc/sql/createdb.mysql.sql</command>. The
835                  header in the script file contains further
836                  information about the script.
837                </para>
838              </listitem>
839            </varlistentry>
840            <varlistentry>
841              <term>PostgreSQL</term>
842              <listitem>
843                <para>
844                  Create a new database for BASE, and add a
845                  <emphasis>db_user</emphasis> with the proper
846                  privileges. To do this, log in as your PostgreSQL
847                  user and issue these lines (omit comments):
848<programlisting>createuser db_user -P
849  # this will prompt for an password for the new user, and issue two
850  # more question that should be answered with character 'n' for no.
851createdb --owner db_user --encoding UNICODE base2
852psql base2
853  # this will start the psql command line tool. Issue the next line
854  # within the tool and quit with a '\q'.
855CREATE SCHEMA "dynamic" AUTHORIZATION "db_user";</programlisting>
856                  The <filename>&lt;base-dir&gt;/misc/sql/createdb.postgresql.sql</filename>
857                  file contains the above statements and can be used
858                  by the <filename>psql</filename> command-line tool:
859                  <command>psql -f ./misc/sql/createdb.posgres.sql
860                    template1</command> The header in the script file
861                  contains further information about the script.
862                </para>
863              </listitem>
864            </varlistentry>
865          </variablelist>
866        </listitem>
867      </varlistentry>
868
869      <varlistentry>
870        <term>BASE (file storage setup)</term>
871        <listitem>
872          <para>
873            An area for file storage must be setup. Create an empty
874            directory in a proper location in your file system, and
875            set the owner to be the same as the one that the tomcat
876            server will be running as. Remember this location for
877            later use.
878          </para>
879        </listitem>
880      </varlistentry>
881
882      <varlistentry id="installation_upgrade.installation.configuration">
883        <term>BASE (configuration)</term>
884        <listitem>
885          <para>
886            Basic BASE configuration is done in
887            <filename>&lt;base-dir&gt;/www/WEB-INF/classes/base.config</filename>:
888            <itemizedlist>
889              <listitem>
890                Uncomment the database engine section that match your setup.
891              </listitem>
892              <listitem>
893                Modify the <emphasis>db.url</emphasis>,
894                <emphasis>db.dynamic.catalog</emphasis>,
895                <emphasis>db.username</emphasis>,
896                and <emphasis>db.password</emphasis> settings to match
897                your choice above. (<emphasis>database host and
898                database name (e.g. base2)</emphasis>,
899                <emphasis>e.g. base2dynamic</emphasis>,
900                <emphasis>db_user</emphasis>, and
901                <emphasis>db_password</emphasis>, respectively.)
902              </listitem>
903              <listitem>
904                Modify the <emphasis>userfiles</emphasis> setting to
905                match your choice above.
906              </listitem>
907            </itemizedlist>
908            See the <xref linkend="appendix.base.config"/> for more
909            information about the settings in
910            the <filename>base.config</filename> file.
911          </para>
912          <para>
913            <emphasis>Optional but recommended.</emphasis> You may want
914            to modify extended properties to fit your needs. Extended
915            properties are defined in
916            <filename>&lt;base-dir&gt;/www/WEB-INF/classes/extended-properties.xml</filename>.
917            There is an
918            administrator <ulink
919            url="http://base.thep.lu.se/chrome/site/doc/admin/extended-properties.html">document
920            discussing extended properties</ulink> available. If you
921            plan to perform a migration of a BASE 1.2 database you
922            should probably not remove any extended properties
923            columns (this is not tested so the outcome is currently
924            undefined). However, adding columns does not affect
925            migration.
926          </para>
927        </listitem>
928      </varlistentry>
929
930      <varlistentry>
931        <term>BASE (database initialization)</term>
932        <listitem>
933          <para>
934            Change directory to
935            <filename class="directory">&lt;base-dir&gt;/bin</filename>
936            and run <filename>initdb.sh</filename> as
937<programlisting>./initdb.sh [base_root_login] base_root_password</programlisting>
938
939            <important>
940            <para>
941            The <emphasis>base_root_login</emphasis> and
942            <emphasis>base_root_password</emphasis> you use here
943            is given to the BASE web application root user account.
944            The <emphasis>base_root_login</emphasis> is optional. If
945            not specified, <constant>root</constant> is used for
946            the login.
947            </para>
948            </important>
949            If the initialisation script fail, it is most probably a
950            problem related to the underlying database. Make sure that
951            the database accepts network connection and make sure that
952            <emphasis>db_user</emphasis> has proper credentials.
953          </para>
954        </listitem>
955      </varlistentry>
956
957      <varlistentry>
958        <term>BASE and tomcat</term>
959        <listitem>
960          <para>
961            Either move the <filename
962            class="directory">&lt;base-dir&gt;/www</filename> directory
963            to the tomcat <filename class="directory">webapps</filename>
964            directory or create a symbolic link from the tomcat
965            <filename class="directory">webapps</filename> directory to
966            the <filename class="directory">&lt;base-dir&gt;/www</filename>
967            directory
968<programlisting>cd /path/to/tomcat/webapps
969ln -s /path_to_base/www base2</programlisting>
970            Start/restart tomcat, and try http://hostname:8080/base2
971            (change <emphasis>hostname</emphasis> to your hostname) in
972            your favourite browser. BASE log-in page should appear
973            after a few seconds.
974          </para>
975        </listitem>
976      </varlistentry>
977
978      <varlistentry>
979        <term>BASE, apache, and apache/tomcat connector</term>
980        <listitem>
981          <para>
982            <emphasis>This step is optional</emphasis>.
983          </para>
984          <para>
985            If you want run the tomcat server through the apache web
986            server, you need to install the apache version 2 web
987            server, available
988            from <ulink
989            url="http://www.apache.org/">http://www.apache.org/</ulink>,
990            and a apache-tomcat connector, available
991            from <ulink
992            url="http://jakarta.apache.org/tomcat/connectors-doc/index.html">http://jakarta.apache.org/tomcat/connectors-doc/index.html</ulink>.
993            So, we got you there;-) To be honest, this step is not
994            really well documented since we previously used SuSE 9.3
995            on our demo/test server, and apache/tomcat/mod_jk comes
996            pre-installed. The current server does not use the
997            apache/tomcat connector. What you need to do is something
998            like this
999            <itemizedlist>
1000              <listitem>
1001                Get that tomcat server running in stand-alone
1002                mode.
1003              </listitem>
1004              <listitem>
1005                Get the apache 2 server running.
1006              </listitem>
1007              <listitem>
1008                Install mod_jk. Note, different version are used for
1009                apache 1.3 and 2. In SuSE 9.3 this step is done by
1010                installing <filename>mod_jk-ap20</filename>.
1011              </listitem>
1012              <listitem>
1013                Create a <filename>workers.properties</filename> file
1014                in the
1015                tomcat <filename class="directory">base</filename>
1016                directory (commonly copied from a template).
1017              </listitem>
1018              <listitem>
1019                Create a <filename>jk.conf</filename> file in the
1020                apache <filename class="directory">conf</filename>
1021                directory (commonly copied from a template), and make
1022                sure that <emphasis>jk</emphasis> is added to the
1023                modules to be loaded when apache starts.
1024              </listitem>
1025              <listitem>
1026                In <filename>jk.conf</filename> add the lines below
1027                and change paths appropriately.
1028<programlisting># The following lines makes apache aware of the location of
1029# the /base2 context
1030Alias /base2 "/srv/www/tomcat5/base/webapps/base2"
1031&lt;Directory "/srv/www/tomcat5/base/webapps/base2"&gt;
1032Options Indexes FollowSymLinks
1033allow from all
1034&lt;/Directory&gt;
1035# The following lines mounts all base2 jsp files to tomcat
1036JkMount /base2 ajp13
1037JkMount /base2/* ajp13
1038# The following lines prohibits users from directly accessing WEB-INF
1039&lt;Location "/base2/WEB-INF/"&gt;
1040AllowOverride None
1041deny from all
1042&lt;/Location&gt;</programlisting>
1043              </listitem>
1044            </itemizedlist>
1045            You must restart the apache and the tomcat server after above steps.
1046          </para>
1047        </listitem>
1048      </varlistentry>
1049
1050      <varlistentry>
1051        <term>Setup done!</term>
1052        <listitem>
1053          <para>
1054            Happy BASEing. Now you can log on to your BASE 2 server as
1055            user <emphasis>root</emphasis> (use
1056            the <emphasis>base_root_password</emphasis> from the
1057            database initialization step above). You should begin with
1058            creating a couple user accounts, for more information on
1059            how to create user accounts please refer to
1060            <xref linkend="user_administration"/>.
1061          </para>
1062          <para>
1063            If you are planning to perform a migration of data from
1064            BASE 1.2.x please perform the steps in
1065            <xref linkend="installation_upgrade.migration"/> before
1066            doing anything else with your new BASE installation.
1067          </para>
1068        </listitem>
1069      </varlistentry>
1070
1071    </variablelist>
1072
1073  </sect1>      <!-- Installation instructions -->
1074
1075
1076  <sect1 id="installation_upgrade.migration">
1077    <title>Migration instructions</title>
1078
1079    <caution>
1080      <title>The disclaimer section</title>
1081      <para>
1082        We have made extensive testing of the migration from BASE1.2
1083        to BASE2. To our knowledge the migration works but we cannot
1084        guarantee perfect functionality. The migration tool is
1085        supplied as is and usage is done at your risk. We are
1086        committed to solve migration problems at the level of
1087        transferring data from BASE 1.2 to 2.2.x, but cannot resolve
1088        data loss issues in a running BASE 2 server due to imperfect
1089        migration. When you start the migration tool you are required
1090        to pass parameter <emphasis>"disclaimer_understood"</emphasis>
1091        to the <filename>migrate_from_1.2.sh</filename>
1092        script. Remember to check that the migration performed well
1093        before you decide to delete your 1.2 installation.
1094      </para>
1095      <para>
1096        Migration from the latest BASE 1.2.x release to the latest is
1097        supported.
1098      </para>
1099    </caution>
1100
1101    <para>
1102      Verify that your BASE 2 installation is up and running before
1103      attempting migration. Preferably try to log in using the root
1104      user through the web interface.
1105    </para>
1106
1107    <para>
1108      Make sure your BASE 1.2 runs with the latest
1109      (<emphasis>pristine</emphasis>) schema
1110      version, <emphasis>i.e.,</emphasis> the migration will only
1111      support an unmodified BASE 1.2 installation. If you have an out
1112      of date schema version, please upgrade to the latest schema
1113      using BASE 1.2 tools before migrating. If you have made local
1114      changes to the BASE 1.2 schema you need to patch the BASE 2
1115      schema as well as make proper changes to the migration program.
1116      If there are added columns to the reporter table in your BASE
1117      1.2 database you need to transfer the additional information
1118      after migration (even if you modified the BASE
1119      2 <filename>extended-properties.xml</filename> file).
1120    </para>
1121
1122    <para>
1123      The behaviour of migration is controlled
1124      through <filename>migration.properties</filename> file (see
1125      <xref linkend="appendix.migrate.properties"/>), but you should
1126      know what you do when you change parameters in this file.
1127    </para>
1128
1129    <para>
1130      Migration can be restarted in one specific case only; If the
1131      migration fails during the RawBioAssaysData transfer simply
1132      restart the migration and the script will ask you to verify that
1133      a restart should be attempted. For all other failure points the
1134      migration has to be restarted with an empty database.
1135    </para>
1136
1137    <para>
1138      Migration is performed with the following steps:
1139      <orderedlist>
1140
1141        <listitem>
1142          <para>
1143            To transfer files from BASE 1.2 (default migration
1144            behaviour), you must have file system access to BASE 1.2
1145            files, <emphasis>i.e.,</emphasis> the <filename
1146            class="directory">/ 1.2/data</filename>
1147            directory containing directories
1148            <filename class="directory">rawdata</filename>,
1149            <filename class="directory">uploads</filename>,
1150            <filename class="directory">protocols</filename>, ...
1151          </para>
1152        </listitem>
1153
1154        <listitem>
1155          <para>
1156            Change settings in the file
1157            <filename>&lt;base-dir&gt;/dist/www/WEB-INF/classes/migrate.properties</filename>.
1158            The available options are commented:
1159            <itemizedlist>
1160              <listitem>
1161                <para>
1162                  Modify <emphasis>db1.*</emphasis> parameters to
1163                  match your BASE 1.2 installation.
1164                </para>
1165              </listitem>
1166              <listitem>
1167                <para>
1168                  Set <emphasis>userfiles</emphasis> (note, this is
1169                  not the same parameter as
1170                  in <filename>base.config</filename>) to point to the
1171                  directory containing the BASE 1.2 files (defined in a
1172                  previous step above).
1173                </para>
1174              </listitem>
1175              <listitem>
1176                <para>
1177                  Set the <emphasis>pluginDir</emphasis> to point to
1178                  the directory where your BASE 1.2 plug-ins are
1179                  installed. The default is
1180                  <filename
1181                  class="directory">/usr/local/base/plugins</filename>.
1182                </para>
1183              </listitem>
1184              <listitem>
1185                <para>
1186                  Modify <emphasis>root.password</emphasis>.
1187                </para>
1188              </listitem>
1189              <listitem>
1190                <para>
1191                  Change the <emphasis>deletefiles</emphasis> setting
1192                  wisely. If you
1193                  set <emphasis>deletefiles=yes</emphasis> all BASE
1194                  1.2 files will be physically removed when copied to
1195                  BASE 2. Leave this options
1196                  as <emphasis>deletefiles=no</emphasis> unless you
1197                  are absolutely sure of what you are doing.
1198                </para>
1199              </listitem>
1200            </itemizedlist>
1201          </para>
1202        </listitem>
1203
1204        <listitem>
1205          <para>
1206            Run migration utility:
1207<programlisting>cd /path_to_base/dist/bin
1208./migrate_from_1.2.sh</programlisting>
1209          </para>
1210          <para>
1211            If the migration fails during the RawBioAssaysData
1212            transfer you can restart the migration at the point of
1213            failure. Simply restart the migration and the script will
1214            ask you to verify that a restart should be attempted. For
1215            all other failure points the migration has to be restarted
1216            with an empty database.
1217          </para>
1218        </listitem>
1219
1220        <listitem>
1221          <para>
1222            <emphasis>Optional, depends on your BASE 1.2 reporter
1223            table.</emphasis> Additional columns (as compared with a
1224            pristine database schema) in the reporter table in the
1225            BASE 1.2 schema are not transferred during migration. You
1226            have to perform the transfer manually after
1227            migration. Simply export the reporter information from
1228            BASE 1.2, and import the data into BASE 2. In BASE 1.2: i)
1229            View the reporters, ii) Use `Get as tab-separated text` to
1230            create a tab separated file (right click and save). In
1231            BASE 2, to import the file follow the instructions in
1232            <xref linkend="reporters.import"/>.
1233          </para>
1234        </listitem>
1235
1236        <listitem>
1237          <para>
1238            Migration done! Happy BASEing.
1239          </para>
1240        </listitem>
1241
1242      </orderedlist>
1243
1244    </para>
1245
1246  </sect1>      <!-- Migration instructions -->
1247
1248</chapter>
Note: See TracBrowser for help on using the repository browser.