aboutsummaryrefslogtreecommitdiff
path: root/INSTALL
blob: fce9d8a3210cd05d32b921a1e789625b2e392888 (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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
RhodeCode Installation and Setup
================================

RhodeCode is an open soruce git hosting solution written in Python. Linaro
uses its own RhodeCode instance to server git repositories.

Installation
============

TL;DR
-----

There is a script that can automate all the installation and setup process:

* Download the 'rhodecode-config' branch from git.linaro.org
* Move into the 'rhodecode-config' directory
* Modify the file 'config/production.ini' changing at least the PostreSQL
 password at the following line:
 sqlalchemy.db1.url = postgresql://rhodecode:XXXX@localhost/rhodecode
* Run the following command inserting the correct values:
python scritps/rhodecode-setup --rhodecode-config config/production.ini \
--rhodecode-admin-email $EMAIL --rhodecode-admin-pwd $ADMIN_PWD --assume-yes \
--rabbitmq-pwd $PWD --postgres-role-pwd $PWD

The above command will install all the necessary depencencies and setup RhodeCode
with the default provided values. At the end, the script will print all the
installation details.

Dependencies
------------

 * apache2
 * build-essential
 * git-core
 * mercurial (v2.4.1, not in Ubuntu repositories, need to install via pip)
 * pgadmin3
 * postgresql-9.1
 * postgresql-server-dev-9.1
 * python
 * python-amqplib
 * python-anyjson
 * python-babel
 * python-bcrypt
 * python-celery
 * python-dateutil
 * python-dev
 * python-docutils
 * python-formencode
 * python-mailer
 * python-markdown
 * python-nose
 * python-pastescript
 * python-pip
 * python-psycopg2
 * python-pylons
 * python-webhelpers
 * python-webob
 * rabbitmq-server
 * waitress (v0.8.1, not in Ubuntu repositories, need to install via pip)

The package git-core can also be installed via the Ubuntu Git Maintainers PPA
that usually has more updated versions of git. The PPA is: ppa:git-core/ppa

Users Configuration
-------------------

The RhodeCode installation will be done with a dedicated system user and group.

 * System user: rhodecode
 * Group: rhodecode
 * Home: /home/rhodecode

Necessary Directories
---------------------

The following directories need to created and be writable at least by the
'rhodecode' user and/or group:

 * /var/log/celery
 * /var/log/rhodecode
 * /opt/rhodecode
 * /opt/git_repos

The '/opt/rhodecode' directory is where RhodeCode will store its local data and
caches.

The '/opt/git_repos' directory is where RhodeCode will store the git
repositories directories.

PostgreSQL Configuration
------------------------

For PostgreSQL it is necessary to create a role called 'rhodecode' with its
own password and the permit to create databases, and a database always called
'rhodecode'.

Once this is done, modify the file 'config/production.ini' at the line:

    sqlalchemy.db1.url = postgresql://rhodecode:XXXX@localhost/rhodecode

with the correct values.

The default config file assumes PostreSQL to be installed on the same host of
RhodeCode.

Celery and RabbitMQ
-------------------

For better performance with more than 10 repositories hosted on RhodeCode, it
is recommended to use Celery with RabbitMQ.

Once RabbitMQ has been installed, it is necessary to set up the correct user
and vhost. Commands have to be run as root.

 * Add a new user called 'rhodecode' to RabbitMQ, set up its own password:
    rabbitmqctl add_user rhodecode $PASSWORD

 * Create a new RabbitMQ vhost called 'rhodecode-vhost':
    rabbitmqctl add_vhost rhodecode-vhost

 * Set the correct permission to the new user for the created vhost:
    rabbitmqctl set_permissions -p rhodecode-vhost rhodecode ".*" ".*" ".*"

Once RabbitMQ has been configured, modify the file 'config/production.ini' with
the correct values. The lines to modify are:

    broker.vhost = rhodecode-vhost
    broker.user = rhodecode
    broker.password = XXXX

The default config file assumes RabbitMQ to be installed on the same host of
RhodeCode.

For more information about Celery and RabbitMQ configurations:

 http://docs.celeryproject.org/en/master/getting-started/brokers/rabbitmq.html

Download, Setup and Install RhodeCode
-------------------------------------

We install RhodeCode from source, from a Linaro dedicated branch, wich might
contain changes applied by us. All these operation are assumed to be performed
under the 'rhodecode' home directoy.

 * Clone the 'rhodecode' repository from git.linaro.org:

    git clone git://github.com/marcinkuzminski/rhodecode.git

 * Move in the 'rhodecode' directory, checkout the decicated branch and update:

    cd rhodecode && git checkout linaro && git pull origin linaro

 * Set up RhodeCode, always as the 'rhodecode' user and in the 'rhodecode' git
   directory:

    paster setup-rhodecode $CONF_FILE --user=$USER --email=$EMAL \
    --password=$PWD --repos=$REPOS

   The variable means:
   * $CONF_FILE: path to the 'production.ini' file
   * $USER: the name for the administrator user on the website
   * $EMAIL: the email of the administrator
   * $PWD: the password for the administrator
   * $REPOS: the path of the directory where the git repositories will be saved,
     as per these instructions it should be '/opt/git_repos'

 * Install RhodeCode, using the 'rhodecode' user home directory as the base:
    python setup.py install --user

Start the services
------------------

paster serve production.ini