Install Ubuntu Server.
Update Ubuntu with the commands:
sudo apt-get update sudo apt-get upgrade
Install pip and virtualenv with the commands:
sudo apt-get install python-pip sudo pip install virtualenv
Install RabbitMQ:
sudo apt-get install rabbitmq-server
Create RabbitMQ user:
sudo rabbitmqctl add_user rhodeuser rhodepass sudo rabbitmqctl add_vhost rhodevhost sudo rabbitmqctl set_permissions -p rhodevhost rhodeuser ".*" ".*" ".*"
Install Python sources:
sudo apt-get install python-dev
Create the base directory and temporarily give yourself ownership:
sudo mkdir /rhode sudo chown myusername /rhode
Create the data directory, virtual environment, and install RhodeCode:
virtualenv --no-site-packages /rhode/venv source /rhode/venv/bin/activate (venv) pip install pastescript (venv) pip install rhodecode
Create directories and the production configuraton:
mkdir /rhode/repos mkdir /rhode/data cd /rhode/data (venv) paster make-config RhodeCode production.ini
Edit at least the following settings in production.ini:
[server:main] host = 0.0.0.0 [app:main] use_celery = true broker.vhost = rhodevhost broker.user = rhodeuser broker.password = rhodepass
Generate the RhodeCode database and create the initial admin account:
(venv) paster setup-rhodecode production.ini
Test the system by starting Celery and RhodeCode (access the server via http://127.0.0.1:5000):
(venv) paster celeryd production.ini & (venv) paster serve production.ini
Create a crontab file for the
rhodecode
user withsudo crontab -e -u rhodecode
. Add this line to the crontab file:@hourly /rhode/venv/bin/paster make-index /rhode/data/production.ini
Create the user to run the RhodeCode daemons and set ownership on the RhodeCode directory:
sudo adduser --no-create-home \ --disabled-login \ --disabled-password \ --system --group rhodecode sudo chown -R rhodecode:rhodecode /rhode
Download the init.d script and modify USER, VENV_DIR, and DATA_DIR as necessary:
wget http://raw.github.com/gist/2866413/rhodecode-init.d.sh vim ./rhodecode-init.d.sh
Test the script:
chmod +x ./rhodecode-init.d.sh sudo ./rhodecode-init.d.sh start ## access RhodeCode via web browser sudo ./rhodecode-init.d.sh stop ## verify that the Python processes have stopped
Install the script:
sudo cp ./rhodecode-init.d.sh /etc/init.d/rhodecode cd /etc/init.d sudo update-rc.d rhodecode defaults
Test the script once more:
sudo service rhodecode start sudo service rhodecode stop
Install python-ldap:
sudo apt-get install libldap2-dev libsasl2-dev (venv) pip install python-ldap
Log in to RhodeCode as an administrator and open
Settings --> LDAP
. Add the following settings:- Enable LDAP
Checked
- Host
dc.mydomain.local
- Port
389
- Account
<username>
- Password
<password>
- Connection Security
None
- Certificate Checks
DEMAND
- Base DN
CN=People,DC=mydomain,DC=local
- LDAP Filter
<blank>
- LDAP Search Scope
SUBTREE
- Login Attribute
sAMAccountName
- First Name Attribute
givenName
- Last Name Attribute
sn
- E-mail Attribute
mail
Install the PCRE headers and essential build tools:
sudo apt-get install libpcre3-dev build-essential
Create the user for nginx:
sudo adduser --no-create-home \ --disabled-login \ --disabled-password \ --system --group nginx
Download and extract Nginx:
wget http://nginx.org/download/nginx-1.2.1.tar.gz tar -zxcf nginx-1.2.1.tar.gz cd nginx-1.2.1 ./configure --prefix=/opt/nginx --with-http_ssl_module make sudo make install
Create SSL keys:
cd /opt/nginx/conf sudo openssl genrsa -des3 -out server.key 1024 sudo openssl req -new -key server.key -out server.csr sudo cp server.key server.key.orig sudo openssl rsa -in server.key.orig -out server.key sudo openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt sudo rm server.csr sudo chmod 600 server.crt server.key
Replace
/opt/nginx/conf/nginx.conf
withnginx.conf
from this repository.Place
rhodecode.conf
from this repository into/opt/nginx/conf/rhodecode.conf
.Start and stop Nginx with the commands:
/opt/nginx/sbin/nginx /opt/nbinx/sbin/nginx -s stop
Download the init.d script and modify PREFIX:
wget http://raw.github.com/gist/2866413/nginx-init.d.sh vim ./nginx-init.d.sh
Test the script:
chmod +x ./nginx-init.d.sh sudo ./nginx-init.d.sh start ## access Nginx via web browser sudo ./nginx-init.d.sh stop ## verify that the Nginx processes have stopped
Install the script:
sudo cp ./nginx-init.d.sh /etc/init.d/nginx cd /etc/init.d sudo update-rc.d nginx defaults
Test the script once more:
sudo service nginx start sudo service nginx stop
Thank you for writing this up!
Unfortunately in section "Installing RhodeCode" #6 ((venv) paster setup-rhodecode production.ini) doesn't work. It exits with .. setup-app unknown rhodecode, or similar. After running "easy_install.py rhodecode" it worked.
If I understood it right, you add the cron job for the user rhodecode, but at this point the user doesn't exist. You create the user in the next step. Should it not be the opposite?
But the major problem here is the init.d script. If I run it with
$ sudo ./rhodecode-init.d.sh start
everything works perfect. As soon as I run it as root
./rhodecode-init.d.sh start
no service starts. The same if installing it in /etc/init.d and update-rc.d. ...,
service rhodecode start
doesn't work, nor does the service start at boot.
Can you give any hint how to accomplish that, please?
Thank you!!!
framartini