You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

169 lines
4.2 KiB

  1. #!/bin/bash
  2. set -eux # -x for verbose logging to juju debug-log
  3. cat <<EOF >> /etc/fstab
  4. lxc-nfs-datastore:/srv/lxc-datastore/data/git/var/git /var/git nfs4 timeo=14,intr,bootwait,auto 0 0
  5. EOF
  6. mkdir -p /var/git
  7. mount /var/git || exit 1
  8. [ -d "/var/git/0k" ] || exit 1
  9. apt-get install sudo libxml2-dev libxslt-dev libpq-dev libyaml-dev \
  10. zlib1g-dev libfreetype6-dev \
  11. libjpeg-dev libmysqlclient-dev -y --force-yes
  12. set +eux
  13. source /srv/virtualenv/default/bin/activate
  14. set -eux
  15. ## install deps for PIL compilations
  16. ## from http://www.sandersnewmedia.com/why/2012/04/16/installing-pil-virtualenv-ubuntu-1204
  17. if ! [ -e "/usr/lib/libjpeg.so" ]; then
  18. apt-get build-dep python-imaging -y --force-yes
  19. ln -s /usr/lib/`uname -i`-linux-gnu/libfreetype.so /usr/lib/
  20. ln -s /usr/lib/`uname -i`-linux-gnu/libjpeg.so /usr/lib/
  21. ln -s /usr/lib/`uname -i`-linux-gnu/libz.so /usr/lib/
  22. fi
  23. ## Installing PIL with our archive is safer.
  24. #pip install pil
  25. (cd /tmp &&
  26. cp /var/git/archives/PIL-1.1.7.tar.gz . &&
  27. tar xvzf PIL-1.1.7.tar.gz &&
  28. cd PIL-1.1.7 &&
  29. python setup.py install
  30. )
  31. pip install lxml pyparsing==1.5.7 psycopg2 pyyaml reportlab mako \
  32. pywebdav==0.9.4 feedparser caldav pytz pydot \
  33. python-dateutil==1.5 cherrypy==3.1.2 formencode==1.2.2 \
  34. babel simplejson==2.0.9 python-openid mysql-python vatnumber \
  35. mock unittest2 fudge docutils jinja2 gdata
  36. ## Install pychart... from our repo as :
  37. ## download link in PyPi is dead,
  38. ## and gna.org was down recently
  39. cp /var/git/archives/PyChart-1.39.tar.gz /tmp
  40. (cd /tmp ; tar xvzf PyChart*.tar.gz
  41. cd PyChart*
  42. python setup.py install
  43. )
  44. ## Install OOOP... from our git repo as:
  45. ## we have some bug correction and custom features
  46. if ! [ -d "/opt/apps/ooop" ]; then
  47. (
  48. cd /opt/apps &&
  49. git clone -s /var/git/0k/ooop.git &&
  50. cd /opt/apps/ooop &&
  51. git checkout 0k/prod/master &&
  52. ## beurk
  53. ln -sf /opt/apps/ooop/ooop.py /srv/virtualenv/default/lib/python2.7/ooop.py
  54. )
  55. fi
  56. ##
  57. ## Install openobject-server from 0k GIT version
  58. ##
  59. (
  60. cd /opt/apps
  61. git clone -s /var/git/0k/openobject-server.git
  62. cd /opt/apps/openobject-server
  63. git checkout 6.1/0k/prod/master
  64. )
  65. adduser --system --home=/var/lib/openerp --group openerp
  66. ## XXXvlab: warning password in charm !!
  67. cp -i etc/openerp-server.conf /etc/
  68. cp -i etc/init.d/openerp-server /etc/init.d/
  69. chown openerp /etc/openerp-server.conf
  70. chmod 600 /etc/openerp-server.conf
  71. chown openerp /etc/init.d/openerp-server
  72. update-rc.d openerp-server defaults
  73. mkdir /var/log/openerp
  74. touch /var/log/openerp/openerp-server.log
  75. chown openerp /var/log/openerp -R
  76. ## Install add-ons
  77. ## make a better way for installing add-ons
  78. #addons_path=/opt/apps/openobject-addons/0k
  79. #if ! [ -d "$addons_path" ]; then
  80. # mkdir -p $addons_path
  81. # for addons in $(/var/git/list-addons 0k/dev/master | grep ^0k); do
  82. # git clone -s /var/git/$addons /opt/apps/openobject-addons/${addons%.git}
  83. # (cd /opt/apps/openobject-addons/${addons%.git}
  84. # git checkout 6.1/0k/prod/master ||
  85. # git checkout 0k/prod/master ||
  86. # git checkout 0k/dev/master ||
  87. # git checkout 6.1/simplee/prod/master ||
  88. # git checkout simplee/prod/master ||
  89. # git checkout simplee/dev/master ||
  90. # git checkout master
  91. # )
  92. # done
  93. #else
  94. # echo 'WARNING: skipping modules installation as directory was already existent !'
  95. #fi
  96. ## install addons
  97. (
  98. mkdir -p /opt/apps/openobject-addons/ &&
  99. cd /opt/apps/openobject-addons/ &&
  100. git clone -s /var/git/0k/openobject-addons legacy &&
  101. cd /opt/apps/openobject-addons/legacy &&
  102. git checkout 6.1/0k/dev/master
  103. )
  104. ## Install from 0k GIT version
  105. ## because we have bug corrections and new features
  106. (
  107. cd /opt/apps &&
  108. git clone -s /var/git/0k/openerp-web.git &&
  109. cd /opt/apps/openerp-web &&
  110. git checkout 6.1/0k/dev/master
  111. )
  112. ## Install werkzeug from github last version
  113. ## because last PyPi version is 8.4 and we need the 9.0+
  114. (
  115. cd /tmp &&
  116. git clone https://github.com/mitsuhiko/werkzeug.git &&
  117. cd werkzeug &&
  118. python setup.py install
  119. )
  120. ##
  121. ## Linking with external filestore !
  122. ##
  123. (
  124. cd /opt/apps/openobject-server/openerp &&
  125. ln -sf /var/openerp-filestore filestore &&
  126. cd /var/openerp-filestore &&
  127. chown openerp .
  128. )