aboutsummaryrefslogtreecommitdiff
path: root/boca-1.5.0/doc/INSTALL.txt
blob: a9d3bc365b007a1b8162c8a68cecc75b1b8671ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
(Last modified 13/oct/2011 by cassio@ime.usp.br. See Copyright note below.)

Requirements
------------
The system was tested with:
* postgresql 7.4+ / 8.2+
* apache 2.2+
* php 5.3+ (and some extensions)

Installation
------------

Before following the steps, you must be sure of:
* your php are integrated with your web server, 
* the php extension module for the postgresql (php_pgsql.so or 
php_pgsql.dll) is installed and configured,
* the postgresql database management system is running.

Usually that is true if you have installed the following
ubuntu/debian packages:
postgresql, postgresql-contrib, postgresql-client, apache2,
libapache2-mod-php5, php5, php5-cli, php5-cgi, php5-gd,
php5-mcrypt, php5-pgsql

It may be needed to configure some parameters in php.ini, 
postgresql.conf and pg_hba.conf files. The following lines
show some important attributes for BOCA:

********* apache boca config file (to be included in /etc/apache2/conf.d/): **********
<Directory /var/www/boca>
       AllowOverride Options AuthConfig Limit
       Order Allow,Deny
       Allow from all
       AddDefaultCharset utf-8
</Directory>
<Directory /var/www/boca/private>
       AllowOverride Options AuthConfig Limit
       Deny from all
</Directory>
<Directory /var/www/boca/doc>
       AllowOverride Options AuthConfig Limit
       Deny from all
</Directory>
<Directory /var/www/boca/tools>
       AllowOverride Options AuthConfig Limit
       Deny from all
</Directory>


********* postgresql.conf: *********
tcpip_socket = true #if using tcp to connect to database (older postgresql's)
listen_addresses = '*' #newer postgresql's

# THE FOLLOWING MAY BE GOOD FOR PERFORMANCE
max_connections = 100
maintenance_work_mem = 64MB 
shared_buffers = 32MB
work_mem = 3MB


********* pg_hba.conf: *********
#this is the access control file
#restricting connections from unixsocket or localhost is
#the best choice, but it could not enough if the
#database is not in the same machine.
host    all   all 127.0.0.1 255.255.255.255 md5
host    all   all 0.0.0.0   0.0.0.0         md5
# this last line will allow connection from everywhere. If you
# know the IP address of the machines that will serve as autojudging,
# then you may restrict the access to only such machine. Anyway,
# if you have a good password, that should not be a problem.



Steps for installing boca:

1) Unpack the boca file into a internet world readable directory,
e.g.:
> mkdir -p /var/www/boca
> cd /var/www/boca
> tar xvzf boca-x.y.z.tar.gz

2) create a postgresql account with permission to create new
databases (you need database admin privilegies to do that),
e.g.:
> psql -h 127.0.0.1 -U postgres -d template1
template1=# create user bocauser with password 'boca' createdb;
template1=# \q

3) edit the file private/conf.php (placed where you unpacked boca), 
setting up the correct values. Ex:
  $conf["dblocal"]="true"; // use unix socket to connect?
  $conf["dbhost"]="localhost"; // ip address of the db
  $conf["dbname"]="bocadb"; // name of the boca database
			    // it should be any name

  $conf["dbuser"]="bocauser"; // unpriviligied boca user
  $conf["dbpass"]="boca";     // unpriviligied boca password
  $conf["dbsuperuser"]="bocauser"; // priviligied boca user
  $conf["dbsuperpass"]="boca";	   // priviligied boca password
       // note that it is just fine to use the same user for
       // unpriv and priv access, but you can separate them 
       // for increasing local security

  // secret key to be used in HTTP headers
  // you MUST set it with any random large enough sequence
  // DONT LEAVE IT AS YOU GOT WHEN UNPACKED THE SOFTWARE
  // CHOOSE ANOTHER NUMBER/STRING AND REPLACE BELOW
  $conf["key"]="secretKey:23894091237589234759234723489";
  
  // the following field is used by the autojudging script
  // set it with IP address (or other short description)
  // of the computer allocated for
  // autojudging during the competition
  $conf["ip"]='10.10.10.10';

4) run the php script to initialize the boca database
> cd /var/www/boca/
> php private/createdb.php

5) It's all done. Now you have to manage the contest with a 
browser and boca. Proceed to the ADMIN.TXT file.

Security Issues
---------------
It is strongly recommended that BOCA be installed on a computer
with no other users. If the computer where you are installing BOCA
is used by others (with command line shells), it is essential
that you change the permission of the file private/conf.php to be
readable just by the user which the apache server runs and set 
safe_mode=On in the php.ini file (furthermore, the database access
must be strictly restricted by passwords). Do it before configuring the 
private/conf.php file, so no one will be able to see your passwords.
Moreover, the private/conf.php file must be in a directory owned by the
bocauser or www-data or apache (all this combination implies that the only 
way to read the private/conf.php is from a php script owned by bocauser in 
the same directory). 

Contacts and Copyrights
-----------------------
BOCA Copyright (c) 2003- Cassio Polpo de Campos (cassio@ime.usp.br)
http://www.ime.usp.br/~cassio/boca

////////////////////////////////////////////////////////////////////////////////
//BOCA Online Contest Administrator
//    Copyright (C) 2003-2012 by BOCA Development Team (bocasystem@gmail.com)
//
//    This program is free software: you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation, either version 3 of the License, or
//    (at your option) any later version.
//
//    This program is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//    You should have received a copy of the GNU General Public License
//    along with this program.  If not, see <http://www.gnu.org/licenses/>.
////////////////////////////////////////////////////////////////////////////////