Child pages
  • Creating Virtual Environments for different Tryton installations
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 7 Next »

Created by Ivan (capiscuas@gmail.com)

Description

Due that the auroville modules had an installation file dependent for Tryton2.4 and the latest stable Tryton was already 2.6, I decided to create 3 different virtual environments in 3 diferent folders.

~/workspace/tryton2.4/ -> Tryton2.4 with old auroville modules and the health module(not supported yet Nov 2012 for 2.6)

~/workspace/tryton2.6/ -> Tryton2.6 to migrate the auroville modules and continue development

~/workspace/tryton2.7/ -> Tryton2.7 Development code , to check the latest features and be able to improve/send patches to the main Tryton project.

The following script will create the different environment depending on the variable version.

trytond.conf (attachment)

Bash code
#!/bin/bash 
version=2.4 #you can choose from 2.4,2.6 or 2.7
#In case you want to work with 2.6, delete the trytond_health module (from modules folder and local/lib/python2.7/site-packages/ folder)
sudo apt-get -y --force-yes install python-setuptools python-pip libxml2-dev libxslt1-dev python-gtk2 python-dev

#choose which backend to use, for testing go for sqlite
#sudo apt-get -y install libpq-dev #postgresql
sudo apt-get -y install sqlite3 libsqlite3-dev # sqlite

sudo pip install virtualenv
sudo pip install --upgrade pytz
mkdir -p ~/workspace/tryton$version/db
mkdir -p ~/workspace/tryton/log
cp trytond.conf ~/workspace/tryton$version/ #Download trytond.conf from the attachment.
cd ~/workspace/tryton$version
virtualenv --system-site-packages env
source env/bin/activate
ln -s env/lib/python$version/site-packages/trytond/modules .
if [ "$version" = "2.4" ]
then
 pip install --upgrade http://downloads2.tryton.org/2.4/tryton-2.4.2.tar.gz
 pip install --upgrade http://downloads2.tryton.org/2.4/trytond-2.4.3.tar.gz
 pip install --upgrade http://downloads2.tryton.org/2.4/trytond_account-2.4.3.tar.gz
 pip install --upgrade http://downloads2.tryton.org/2.4/trytond_company-2.4.0.tar.gz
 pip install --upgrade http://downloads2.tryton.org/2.4/trytond_country-2.4.0.tar.gz
 pip install --upgrade http://downloads2.tryton.org/2.4/trytond_currency-2.4.0.tar.gz
 pip install --upgrade http://downloads2.tryton.org/2.4/trytond_product-2.4.1.tar.gz
 #Copy the auroville modules into the modules folder
 
elif [ "$version" = "2.6" ] 
then
 pip install --upgrade http://downloads2.tryton.org/2.6/tryton-2.6.0.tar.gz
 pip install --upgrade http://downloads2.tryton.org/2.6/trytond-2.6.1.tar.gz
 pip install --upgrade http://downloads2.tryton.org/2.6/trytond_account-2.6.1.tar.gz
 pip install --upgrade http://downloads2.tryton.org/2.6/trytond_company-2.6.0.tar.gz
 pip install --upgrade http://downloads2.tryton.org/2.6/trytond_country-2.6.0.tar.gz
 pip install --upgrade http://downloads2.tryton.org/2.6/trytond_currency-2.6.1.tar.gz
 pip install --upgrade http://downloads2.tryton.org/2.6/trytond_product-2.6.0.tar.gz
 
elif [ "$version" = "2.7" ] #from Mercurial repository
then
 #Read this http://code.google.com/p/tryton/wiki/HowtoContribute
 #http://code.google.com/p/tryton/wiki/InstallationMercurial
 sudo apt-get install mercurial
 hg clone http://hg.tryton.org/tryton/
 #Download the mercurial extensions
 #Get the hgnested from trunk (mercurial)
 mkdir downloads
 cd downloads
 hg clone https://code.google.com/p/hgnested/
 
 pip install --upgrade hgreview
 cat<<EOF >> ~/.hgrc
[extensions]
hgnested = ~/workspace/tryton2.7/downloads/hgnested-trunk/hgnested
hgreview = 
[review]
server = http://codereview.tryton.org
send_email = True
EOF
 cd ~/workspace/tryton$version/
 hg nclone http://hg.tryton.org/trytond/
 #Install Tryton and Trytond in virtual environment
 cd ~/workspace/tryton$version/tryton/
 python setup.py install
 cd ~/workspace/tryton$version/trytond/
 python setup.py install
 ln -s env/local/lib/python2.7/site-packages/trytond-2.7.0-py2.7.egg/trytond/modules .
else
 echo 'Wrong Version number'
 exit 1 
fi
touch db/tryton.sqlite #the db file needs to exist to initialize it
trytond -c trytond.conf -d tryton --init=all #Initialize all the current modules of trytond
#we create some launcher trytond/tryton at the same time
cat<<EOF > tryton.sh
#!/bin/bash
source env/bin/activate
trytond -c trytond.conf &
tryton
killall trytond
EOF
chmod +x ~/workspace/tryton$version/tryton.sh
mkdir -p ~/.config/tryton/$version/
cat<<EOF > ~/.config/tryton/$version/profiles.cfg 
[DEFAULT]
port = 8000
[local]
host = localhost
port = 8000
database = tryton
username = admin
EOF
exit 0

If you want to use different Trytond(server) instances at the same time, you should change the PORT number at the tytrond.conf file.

  • No labels