aboutsummaryrefslogtreecommitdiff
path: root/README
blob: c0fd040f9b10e4fd6101b0b8b1b2d4e50012fa91 (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
DIRS
====

dbgenerator: stuff to generate a pgo.db file
template:    the initial template contributed by cla
web:         web-frontend to the pgo.db file
pkgcore:     pkgcore version in case you don't have one set up 
             and use PYTHONPATH=.
snakeoil:    same as pkgcore, both are taken from post-0.3.1 HEAD
etc:         Minimal /etc/ used to tell pkgcore where the PORTDIR is, and the
             base make.conf/global/profile settings.
todo:        TODO list for the site. Look here before suggesting something.


REQUIREMENTS
============

dbgenerator:
------------
- up-to-date portage tree
  (non-unionfs'ed as it might give weird mtimes)
- Python 2.5 with sqlite or Python 2.4 with pysqlite2
- optional: pkgcore and snakeoil (both shipped)

frontend:
---------
CherryPy 3.0.2 or later
Genshi 0.4.3 or later
- Python 2.5 with sqlite or Python 2.4 with pysqlite2

it can be used both standalone or together with mod_python

Database Generation Time:
=========================
Jokey:
------
3GHz P4, UDMA100 HDD, partly cluttered fs
DB generation takes about 3 minutes
robbat2, infra:
---------------
- 2x Dual-core Opteron 2210 (4 cores total)
- 4Gb RAM, cluttered FS
- RAID1 WD2500JS
Initial DB generation: 3 minutes
Subsequent passes: 25 seconds

GETTING IT GOING
================

APPROOT = the directory you checked out of Git

0) Add the following to your /etc/portage/package.keywords:
   =dev-python/genshi-0.4*
   =dev-python/cherrypy-3.0*
   dev-python/dbutils
   dev-python/formencode

1) emerge cherrypy genshi dbutils formencode

2) emerge pysqlite || emerge mysql-python

3) 'cp etc/database_config.py{.example,}'. 
   Edit 'etc/database_config.py'
   If you want to use SQLite, set mode='sqlite' and 
   choose a path for the file. 
   If you want to use MySQL, edit the other settings as needed. 
   If you are lazy, you can use a single MySQL user, but
   you should seperate RW and RO users for security!

4) 'cp etc/make.conf{.example,}'.
   Edit 'etc/make.conf'
   If you want a copy of the tree in a specific location, set 
   it here.

5) Generate the initial database:
   cd $APPROOT && \
   time /bin/sh ./run-update.sh

6) start CherryPy standalone:
   cd $APPROOT && PYTHONPATH=. python web/controller.py

   this should give you something like
   "HTTP Serving HTTP on http://0.0.0.0:8081/"

7) now point a webbrowser at http://localhost:8081/
   and you should see the packages.gentoo.org site

PRIVILEGE SEPARATION
====================
You can run packages2 with privileges seperated to enhance security.
1. You should have the following users:
webuser (eg: apache, lighttpd)
pkguser (eg: gpackages)
realuser (eg: bob)

2. You should have the following groups:
pkggroup (eg: gpackages)

3. Place all 3 users into the group.

4. chown -R realuser:pkggroup $APPROOT

5. chown -R pkguser:pkggroup $PORTDIR 
(the PORTDIR in packages2 etc/make.conf!)

6. chmod o-rwx,g+rX $APPROOT $PORTDIR

TESTING
BITE