]> git.evergreen-ils.org Git - working/Evergreen.git/blob - 1.6/admin/AdminMisc.xml
Merge branch 'master' of http://github.com/rsoulliere/Evergreen-DocBook
[working/Evergreen.git] / 1.6 / admin / AdminMisc.xml
1 <?xml version='1.0' encoding='UTF-8'?>\r
2 <chapter xmlns="http://docbook.org/ns/docbook" xmlns:xi="http://www.w3.org/2001/XInclude"\r
3             xmlns:xl="http://www.w3.org/1999/xlink" version="5.0" xml:id="adminmisc">\r
4         <info>\r
5                 \r
6         <title>Server Operations and Maintenance</title>\r
7                 <abstract>\r
8                         <para>This chapter deals with basic server operations such as starting and stopping Evergreen as well wall security, backing up and troubleshooting Evergreen.</para>\r
9                 </abstract>\r
10         </info>    \r
11         <section xml:id="startingopensrf">\r
12                 <title>Starting, Stopping and Restarting</title>\r
13                 <para>Occasionally, you may need to restart Evergreen. It is imperative that you understand the basic \r
14                 commands to stop and start the Evergreen server. You can start and stop Evergreen from the command line of \r
15                 the server using the <filename >osrf_ctl.sh</filename> script located in the \r
16                 <filename class="directory">openils/bin</filename> directory.</para>   \r
17                 <note><para>The osrf_ctl.sh script must be run as the <emphasis>opensrf</emphasis> user.</para></note>\r
18                 <para>To view help on <filename>osrf_ctl.sh</filename> and get all of its options, \r
19                 run:</para>\r
20                 <screen>osrf_ctl.sh -h</screen>\r
21                 <para>To start Evergreen, run:</para>\r
22                 <screen>osrf_ctl.sh -l -a start_all</screen>\r
23                 <para>The -l flag is used to indicate that Evergreen is configured to use <emphasis>localhost</emphasis> as \r
24                 the host. If you have configured opensrf.xml to use your real hostname, do not use the -l flag. The -a \r
25                 option is required and indicates the <emphasis>action</emphasis> of the command. In this case \r
26                 <emphasis>start_all</emphasis>.    \r
27                 </para> \r
28                 <note>\r
29                         <para>If you receive the error message bash: osrf_ctl.sh: \r
30                         command not found, then your environment variable PATH does not include the \r
31                         <filename class="directory">/openils/bin</filename> directory. \r
32                         You can set it using the following command:</para>\r
33                         <screen>export PATH=$PATH:/openils/bin</screen>\r
34                         <para>If you receive the error message Can't locate OpenSRF/System.pm in @INC … BEGIN \r
35                         failed–compilation aborted, then your environment variable <emphasis>PERL5LIB</emphasis> does not \r
36                         include the <filename class="directory">/openils/lib/perl5</filename> directory.  You can set it \r
37                         using the following command:</para>\r
38                         <screen>export PERL5LIB=$PERL5LIB:/openils/lib/perl5</screen>\r
39                 </note>         \r
40                 <para>It is also possible to start a specific service. For example:</para>\r
41                 <screen>osrf_ctl.sh -l -a start_router</screen>\r
42                 <para>will only start the router service.</para>\r
43                 <caution>\r
44                         <para>If you decide to start each service individually, you need to start them in a specific order \r
45                         for Evergreen to start correctly. Run the commands in this exact order:</para>\r
46                         <screen>osrf_ctl.sh -l -a start_router</screen>\r
47                         <screen>osrf_ctl.sh -l -a start_perl</screen>\r
48                         <screen>osrf_ctl.sh -l -a start_c</screen>\r
49                 </caution>      \r
50                 <para>After starting or restarting Evergreen, it is also necessary to restart the Apache web server for the \r
51                 OPAC to work correctly.</para>  \r
52                 <para>To stop Evergreen, run:</para>\r
53                 <screen>osrf_ctl.sh -l -a stop_all</screen>\r
54                 <para>As with starting, you can choose to stop one service</para>\r
55                 <para>To restart Evergreen, run:</para>\r
56                 <screen>osrf_ctl.sh -l -a restart_all</screen>\r
57         </section>\r
58         <section xml:id="backingup">\r
59                 <title>Backing Up</title>\r
60                 <para>Backing up your system files and data is a critical task for server and database administrators. \r
61                 Having a strategy for backing up and recovery could be the difference between a minor annoyance for users and\r
62                 a a complete catastrophe.</para>   \r
63                 <simplesect>\r
64                         <title>Backing up the Evergreen Database</title>\r
65                         <para>Most of the critical data for an Evergreen system – patrons, bibliographic records, holdings, \r
66                         transactions, bills – is stored in the PostgreSQL database. You can therefore use normal PostgreSQL \r
67                         backup procedures to backup this data. For example, the simplest method of backing up the Evergreen\r
68                         database is to use the pg_dump command to create a live backup of the database without having to \r
69                         interrupt any Evergreen services as follows:</para>\r
70                         <screen># pg_dump -U [username] -h [hostname] -f [output-file] [database-name]</screen> \r
71                         <screen>pg_dump -U evergreen -h localhost -f evergreen_db.backup evergreen</screen>\r
72                         <para>To restore the backed up database into a new database, create a new database using the \r
73                         template0 database template and the UTF8 encoding, and run the psql command, specifying the new \r
74                         database as your target:</para>\r
75                         <screen>createdb -T template0 -E UTF8 -U evergreen -h localhost new_evergreen</screen>\r
76                         <screen>psql -U evergreen -h localhost -f evergreen_db.backup new_evergreen</screen>\r
77                         <note>\r
78                                 <para>This method of backup is only suitable for small Evergreen instances. Larger sites \r
79                                 should consider implementing continuous archiving (also known as “log shipping”) to provide \r
80                                 more granular backups with lower system overhead. More information on backing up PostgreSQL \r
81                                 databases can be found in the official PostgreSQL documentation.</para>\r
82                         </note>\r
83                 </simplesect>\r
84                 <simplesect>\r
85                         <title>Backing up Evergreen Files</title>\r
86                         <para>When you deploy Evergreen, you will probably customize many aspects of your system including \r
87                         the system configuration files, Apache configuration files, OPAC and Staff Client. In order to \r
88                         protect your investment of time, you should carefully consider the best approach to backing up \r
89                         files.</para>\r
90                         <para>There are a number of ways of tackling this problem. You could create a script that regularly \r
91                         creates a time-stamped tarball of all of these files and copies it to a remote server - but that \r
92                         would build up over time to hundreds of files. You could use rsync to ensure that the files of \r
93                         interest are regularly updated on a remote server - but then you would lose track of the changes to \r
94                         the files, should you make a change that introduces a problem down the road.</para>\r
95                         <para>Perhaps one of the best options is to use a version control system like Bazaar, git, \r
96                         Subversion, or CVS to regularly push updates of the files you care about to a repository on a \r
97                         remote server. This gives you the advantage of quickly being able to run through the history of the \r
98                         changes you made, with a commenting system that reminds you why each change was made, combined with \r
99                         remote storage of the pertinent files in case of disaster on site. In addition, your team can create \r
100                         local copies of the repository and test their own changes in isolation from the production \r
101                         system. Using a version control system also helps to recover system customizations after an \r
102                         upgrade.</para>\r
103                 </simplesect>\r
104                 <simplesect>\r
105                         <title>Full System Backup</title>\r
106                         <para>A full system backup archives every file on the file system. Some basic methods require you \r
107                         to shut down most system processes; other methods can use mirrored RAID setups or SAN storage to \r
108                         take “snapshot” backups of your full system while the system continues to run. The subject of how \r
109                         to implement full system backups is beyond the scope of this documentation.</para>\r
110                 </simplesect>\r
111         </section>\r
112         <section xml:id="security">\r
113                 <title>Security</title>\r
114                 <para>As with an ILS and resource accessible from the world wide web careful consideration needs to be \r
115                 given to the security of your Evergreen servers and database. While it is impossible to cover all aspects \r
116                 of security, it is important to take several precautions when setting up production Evergreen site.</para>\r
117                 <orderedlist>\r
118                         <listitem>\r
119                                 <para>Change the Evergreen <emphasis>Admin</emphasis> password and keep it secure. The \r
120                                 default Admin password is known by anyone who has installed Evergreen. It is not a secret \r
121                                 and needs to be changed by the Administrator. It should also only be shared by those who \r
122                                 need the highest level access to Evergreen.</para>\r
123                         </listitem>\r
124                         <listitem>\r
125                                 <para>Create strong passwords using a combination of numerical and alphabetical characters \r
126                                 for all of the Administrative passwords used by Evergreen including the Evergreen \r
127                                 postgresql user, opensrf Linux account, and Admin evergreen users, and of course, any\r
128                                 superusers on your server.</para>     \r
129                         </listitem>\r
130                         <listitem>\r
131                                 <para>Open ports in the firewall with Caution - It is necessary to open some ports to the \r
132                                 server such as port 80 for http and  443 for ssl, and it can be helpful to open ports for \r
133                                 remote access to the database or staff client. It is also critical for an administrator to \r
134                                 understand the concepts of network security and take precautions to not allow the server to \r
135                                 be vulnerable to the outside world. \r
136                                 </para>\r
137                         </listitem>\r
138                         <listitem>\r
139                                 <para>Use permissions and permission groups wisely - it is important to understand the \r
140                                 purpose of the permissions and to only give users the level of access that they require.\r
141                                 </para> \r
142                         </listitem>\r
143                                         </orderedlist>  \r
144         </section>\r
145         <section xml:id="logfiles">\r
146                 <title>Managing Log Files</title>\r
147                 <para>Evergreen comes with a sophisticated logging system, but it is important to manage the OpenSRF and Evergreen logs. This section will provide a couple of log management techniques \r
148                 and tools.</para>       \r
149                 <simplesect>\r
150                         <title>Using the Log Rotate Utility to Manage Log Size</title> \r
151                          <para>Fortunately, this is not a new problem for Unix administrators, and there are a number of ways of keeping your logs under control. On Debian and Ubuntu, for example, \r
152                         the logrotate utility controls when old log files are compressed and a new log file is started. logrotate runs once a day and checks all log files that it knows about to see if a \r
153                         threshold of time or size has been reached and rotates the log files if a threshold condition has been met.</para>\r
154                         <para>To teach logrotate to rotate Evergreen logs on a weekly basis, or if they are > 50MB in size, create a new file <filename>/etc/logrotate.d/evergreen</filename> with the \r
155                         following contents: </para>\r
156                         <screen>compress</screen>\r
157                         <screen>/openils/var/log/*.log {</screen>\r
158                         <screen> # keep the last 4 archived log files along with the current log file</screen>\r
159                         <screen> # log log.1.gz log.2.gz log.3.gz log.4.gz</screen>\r
160                         <screen> # and delete the oldest log file (what would have been log.5.gz)</screen>\r
161                         <screen>rotate 5</screen>\r
162                         <screen># if the log file is > 50MB in size, rotate it immediately</screen>\r
163                         <screen> size 50M</screen>\r
164                         <screen> # for those logs that don't grow fast, rotate them weekly anyway</screen>\r
165                         <screen>  weekly</screen>\r
166                         <screen>}</screen>\r
167                 </simplesect>\r
168                 <simplesect>\r
169                         <title>Changing Logging Level for Evergreen</title>\r
170                         <para>Change the Log Levels in your config files. Changing the level of logging will help \r
171                         narrow down errors.</para> \r
172                         <tip>\r
173                                 <para>A high logging level is not wise to do in a production environment since  it \r
174                                 will produce vastly larger log files and thus reduce server performance.</para>\r
175                         </tip>\r
176                         <para>Change logging levels by editing the configuration file \r
177                         <filename>/openils/conf/opensrf_core.xml</filename></para>\r
178                         <para>you will want to search for lines containing &lt;loglevel&gt;.</para>\r
179                         <para> the default setting for loglevel is 3 which will log <emphasis>errors</emphasis>, \r
180                         <emphasis>warnings</emphasis> and <emphasis>information</emphasis>.</para>\r
181                         <para>The next level is 4 which is for debugging and provides additional information \r
182                         helpful for the debugging process.</para>\r
183                         <para>Thus, lines with:</para>\r
184                         <screen>&lt;loglevel&gt;3&lt;/loglevel&gt;</screen>\r
185                         <para>Should be changed to:</para>\r
186                         <screen>&lt;loglevel&gt;4&lt;/loglevel&gt;</screen>\r
187                         <para>to allow debugging level logging</para>\r
188                         <para>Other logging levels include <emphasis>0</emphasis> for no logging, \r
189                         <emphasis>1</emphasis> for logging errors and <emphasis>2</emphasis> for logging warnings \r
190                         and errors.</para>\r
191                 </simplesect>\r
192         </section>\r
193 </chapter>\r