V4.2 install notes

----------  TinyERP install notes -------------------
Note: as I live in Switzerland, my focus includes the CH accounting modules, and thus C2c modules..

--- Windows install  ---------
Install  tinyerp-allinone-setup-4.2.2.exe

 C:\Program Files\TinyERP Server>tinyerp-server.exe -d ch2 -r tinypg -w tinypgpwd  --update=all
 Modules: base, account, account_payment, c2c_partner_address, account_tax_include, c2c_invoice_layer.
 Then install l10n_ch, then l10n_ch_pcpbl_plangensimpl

--------------- Ubuntu 8.10 #1 ------------
   sudo apt-get update
   apt-get install python-xml python-libxml2 python-libxslt1 python-psycopg python-imaging python-pyparsing python-reportlab graphviz postgresql python-tz python-pyopenssl gs-gpl python-matplotlib python-numeric python-ldap
   # Postgres V8.3 has issues with Terp, so install v8.2:
   apt-get install postgresql-8.2 postgresql-client-8.2 postgresql-contrib-8.2 pgadmin3
   pg_createcluster 8.2 main --start
    su - postgres -c "createdb  --encoding=UNICODE terp"
    su - postgres -c "createuser --createdb --adduser terp"

   Initialise the DB we made above:
   su postgres -c "/usr/lib/python2.5/site-packages/tinyerp-server/tinyerp-server.py --without-demo=all -d terp"

            vi /etc/postgresql/8.2/main/postgresql.conf  
            vi /etc/postgresql/8.2/main/pg_hba.conf
            tail -f /var/log/postgresql/postgresql-8.2-main.log
            /etc/init.d/postgresql-8.2 restart

   Postgres:  port 5432
            /etc/init.d/postgresql-8.2 start
            netstat -an |grep "LISTEN "
                        (enabled on all interfaces)
            vi /etc/postgresql/8.2/main/pg_hba.conf
            tail -f /var/log/postgresql/postgresql-8.2-main.log


cd /opt/install/tinyerp-server-4.2
python setup.py build
sudo python setup.py install

(it is now in "/usr/lib/python2.5/site-packages/tinyerp-server")
chmod 755 /usr/lib/python2.5/site-packages/tinyerp-server/tinyerp-server.py


./tinyerp-server.py --port=8069 --interface= --database=terp --db_user=terp --db_password='' --db_host=localhost --db_port=5432

ln -s /usr/lib/python2.5/site-packages/tinyerp-server /tiny

vi /etc/init.d/tinyerp-server
su postgres -c "/usr/lib/python2.5/site-packages/tinyerp-server/tinyerp-server.py --verbose --config=/etc/tinyerp-server.conf"

/usr/bin/tinyerp-server  --init=all         

-------------  Terp via bazaar -----------------
Bazaar stable branch
cd /opt/install/bzr.openerp.42
bzr branch lp:~openerp/openobject-server/4.2 server
bzr branch lp:~openerp/openobject-client/4.2 client
bzr branch lp:~openerp/openobject-addons/4.2 addons
cd server/bin/addons
ln -s ../../../addons/* .

-------------  eTiny web interface install -----------------
     cd /opt/install/
     wget http://peak.telecommunity.com/dist/ez_setup.py
     python ez_setup.py
     easy_install TurboGears==    
     apt-get install python-matplotlib python-profiler python-imaging
     easy_install eTiny
     vi /usr/lib/python2.5/site-packages/eTiny-1.0-py2.5.egg/config/default.cfg
     [no changes needed]


   Automate startup
   cp /usr/lib/python2.5/site-packages/eTiny-1.0-py2.5.egg/scripts/etiny-server /etc/init.d
   cp /usr/lib/python2.5/site-packages/eTiny-1.0-py2.5.egg/config/default.cfg /etc/etiny-server.cfg
   update-rc.d etiny-server defaults
   chmod 755 /etc/init.d/etiny-server
   vi /etc/init.d/etiny-server /etc/etiny-server.cfg  
   /etc/init.d/etiny-server start

   Config: /etc/etiny-server.cfg
   Log:  /var/log/etiny-server.log
   TinyERP is on port 8060/70, eTiny on 8080
    netstat -an | grep 80
    tcp        0      0*               LISTEN
    tcp        0      0  *               LISTEN

   Problem: its only runs as root
        /usr/bin/start-tinyerp /etc/etiny-server.cfg &
        or start-tinyerp
   but not
        su terp -c "/usr/bin/start-tinyerp /etc/etiny-server.cfg"
        /etc/init.d/etiny-server start

   Connect to http://_MY_IP_ADDRESS:8080/

---------------- Updates -----------------
Pour les mise à jour (c2c_partner_address, c2c_invoice_layer, l10n_ch, l10n_ch_pcpbl_plangensimpl)
- je arrête Tiny
- copie les répertoires de SVN dans addons (après avoir effacé les anciens),
- redémarre tiny, et fait un "update" de ces modules (ils sont 'bleu dans la liste des modules)
- redémarre Tiny à nouveau

------- Addons --------
svn co https://tinyerp.saas-camptocamp.com/svn/tinyerp svn.camptocamp
            cd /data/tinyerp/svn.camptocamp/trunk/swisslocalisation
            cp -r l10n_ch l10n_ch_pcpbl_plangensimpl /tiny/addons/
            cp -r c2c_partner_address c2c_invoice_layer /tiny/addons   

--- Sysadmin notes
su postgres
pg_dumpall -o > /tmp/db.out
pg_dump --clean --column-inserts --attribute-inserts --file=/tmp/prod_isp.$$  prod_isp
su postgres -c "export LANG=C; pg_dump --clean --column-inserts --attribute-inserts --file=/var/backups/postgres/prod_isp.`date +%y%m%d`  prod_isp"

  tinyerp-server has by default two accounts:
    - User: admin; password: admin
    - User: demo; password; demo  

SCREEN: Use screen to attach/detach the console. Use one screen to start eting, the other to start the tiny server, both providing debug to the console.
apt-get install screen
   screen -list
   screen -S etiny
     To detach, type CTRL+a, d
   screen -S tiny.log
   screen -list
     screen -R tiny.log

--- Monitoring ----
/etc/init.d/tinyerp-server start
tail -f /var/log/tinyerp-server.log  

/etc/init.d/postgresql-8.2 restart
tail -f /var/log/postgresql/postgresql-8.2-main.log
screen -S etiny
    /usr/bin/start-tinyerp /etc/etiny-server.cfg &
    To detach, type CTRL+a, d
    screen -list
    To resttach: screen -R etiny