Last active
August 29, 2015 14:00
-
-
Save martinhbramwell/a1ed54c14df72f38299e to your computer and use it in GitHub Desktop.
Steps to prep for portable Oerp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Define the identifiers OpenERP will use to connect to postgres | |
export PSQLUSR="psql_user_z" | |
export PSQLUSR_HOME="/srv/site_z/postgres" | |
export PSQLUSRPWD=" FIXME " # Password !!! FIXME | |
# | |
# Define the identifiers OpenERP will use within the OS | |
export OERPUSR="oerp_user_z" | |
export OERPUSR_HOME="/srv/site_z/openerp" | |
# | |
# Specify OpenERP XMLRPC port # | |
export ACCESS_PORT=8019 | |
# | |
if [[ 1 -eq 0 ]] | |
then | |
# | |
source ./aptDependencies.sh | |
source ./ipoerpPrepareUsersAndDirectories.sh | |
# | |
else | |
# | |
source ./ipoerpMakeOerpServerConfigFile.sh # "/srv/site_z/openerp" " password " ";Mkjiu87" "8019" | |
# | |
fi | |
exit 0 | |
- run PrepareVirtualenv.sh (first half) | |
su yourself -c "source child_2.sh" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
apt-get -y install python ghostscript graphviz libfreetype6-dev python-pdftools | |
apt-get -y install libldap2-dev libjpeg-dev libsasl2-dev libpq-dev libxml2 git curl | |
apt-get -y install libxslt1-dev libxml2-dev lptools poppler-utils python-pip expect | |
apt-get -y install postgresql-client python-dateutil bzr gcc make mc python-dev | |
apt-get -y install python-imaging python-pychart python-libxslt1 python-matplotlib | |
apt-get -y install antiword python-reportlab-accel python-zsi zlib1g-dev zip libffi-dev | |
# | |
mkdir -p ~/tmpxxxxxtmp | |
pushd ~/tmpxxxxxtmp | |
# | |
curl -O http://python-distribute.org/distribute_setup.py | |
python distribute_setup.py | |
easy_install pip | |
# | |
pip install virtualenv | |
pip install virtualenvwrapper | |
# | |
popd | |
rm -fr tmpxxxxxtmp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
if [[ -z $OERPUSR_HOME || -z $PSQLUSR || -z $PSQLUSRPWD || -z $ACCESS_PORT ]] | |
then | |
# | |
echo "Usage : ./ipoerpPrepareUsersAndDirectories.sh " | |
echo "With required variables :" | |
echo " - OERPUSR_HOME : $OERPUSR_HOME" | |
echo " - PSQLUSR : $PSQLUSR" | |
echo " - PSQLUSRPWD : $PSQLUSRPWD" | |
echo " - ACCESS_PORT : $ACCESS_PORT" | |
exit 0 | |
# | |
fi | |
# | |
cat <<WRITTEN > $OERPUSR_HOME/../openerp-server.conf | |
[options] | |
; the host address at which connections must arrive | |
db_host = 127.0.0.1 | |
; the port on which connections must arrive | |
xmlrpc_port = $ACCESS_PORT | |
; the password that allows database operations: | |
admin_passwd = $PSQLUSRPWD | |
; the port on which PostgreSQL awaits connections | |
db_port = 5432 | |
; the PostgreSQL user and password authorized to access the database | |
db_user = $PSQLUSR | |
db_password = $PSQLUSRPWD | |
; where modules can be found | |
addons_path = $OERPUSR_HOME/server/openerp/addons,$OERPUSR_HOME/server/openerp/addons/web | |
; log settings | |
logfile = $OERPUSR_HOME/log/site_z_openerp.log | |
log_level = error | |
; special handling required for running behind a front-end server | |
proxy_mode = True | |
WRITTEN |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
if [[ -z $OERPUSR_HOME ]] | |
then | |
# | |
echo "Usage : ./ipoerpPipInstallToVEnv.sh" | |
echo "With required variables :" | |
echo " - OERPUSR_HOME : $OERPUSR_HOME" | |
exit 0 | |
# | |
fi | |
# | |
if [[ 1 -eq 0 ]] | |
then | |
# | |
pip install Babel | |
pip install docutils | |
pip install feedparser | |
pip install jinja2 | |
# pip install matplotlib | |
pip install mock | |
pip install mako | |
pip install paramiko | |
# pip install pdftools | |
pip install pillow | |
pip install psutil | |
pip install psycopg2 | |
pip install pydot | |
pip install PyOpenSSL | |
pip install pyparsing | |
pip install python-ldap | |
pip install python-openid | |
pip install python-webdav | |
pip install pytz | |
pip install pyyaml | |
pip install reportlab | |
pip install setuptools | |
pip install simplejson | |
pip install unittest2 | |
pip install vobject | |
pip install vatnumber | |
pip install werkzeug | |
pip install xlwt | |
# | |
pip install lxml | |
# | |
else | |
# | |
VENV_PATH=$OERPUSR_HOME/server | |
pushd $VENV_PATH | |
pwd | |
if [[ -d "$VENV_PATH/venv" ]] | |
then | |
echo "Found pre-existing virtual environment under $VENV_PATH" | |
else | |
virtualenv venv --system-site-packages | |
echo "Put venv in $VENV_PATH" | |
fi | |
# source venv/bin/activate | |
popd | |
# | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
if [[ -z $PSQLUSR || -z $PSQLUSRPWD || -z $PSQLUSRTBSP || -z $PSQLUSRDB || -z $PSQLUSR_HOME ]] | |
then | |
# | |
echo "Usage : ./ipoerpPreparePgUserAndTablespace.sh " | |
echo "With required variables :" | |
echo " - PSQLUSR : $PSQLUSR" | |
echo " - PSQLUSRPWD : $PSQLUSRPWD" | |
echo " - PSQLUSRTBSP : $PSQLUSRTBSP" | |
echo " - PSQLUSRDB : $PSQLUSRDB" | |
echo " - PSQLUSR_HOME : $PSQLUSR_HOME" | |
exit 0 | |
# | |
fi | |
# | |
echo "Preparing access for : $PSQLUSR" | |
# | |
if [[ 6 -gt $(grep -o "$PSQLUSR" /etc/postgresql/9.3/main/pg_hba.conf | wc -l) ]] | |
then | |
echo "Appending to pg_hba.conf" | |
cat << EOF >> /etc/postgresql/9.3/main/pg_hba.conf | |
local $PSQLUSR $PSQLUSR md5 | |
local $PSQLUSR $PSQLUSR peer | |
local site_z_db $PSQLUSR md5 | |
local site_z_db $PSQLUSR peer | |
EOF | |
fi | |
# | |
[[ $(psql $PSQLUSR -c "" >/dev/null 2>&1 ; echo $?) -gt 0 ]] && \ | |
psql -c "CREATE DATABASE $PSQLUSR;" | |
[[ 1 -gt $(psql -c "\du" | grep -c $PSQLUSR ) ]] && \ | |
psql -c "CREATE USER $PSQLUSR WITH CREATEDB ENCRYPTED PASSWORD '$PSQLUSRPWD';" | |
# | |
if [[ -z $(psql -qtc "SELECT oid FROM pg_catalog.pg_tablespace WHERE spcname='$PSQLUSRTBSP';" | tr -d ' ') ]] | |
then | |
psql -c "CREATE TABLESPACE $PSQLUSRTBSP LOCATION '$PSQLUSR_HOME/data';" | |
psql -c "GRANT ALL ON TABLESPACE $PSQLUSRTBSP to $PSQLUSR;" | |
fi | |
[[ $(psql $PSQLUSRDB -c "" >/dev/null 2>&1 ; echo $?) -gt 0 ]] && \ | |
psql -c "CREATE DATABASE $PSQLUSRDB TABLESPACE $PSQLUSRTBSP;" | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
if [[ -z $PSQLUSR || -z $PSQLUSR_HOME || -z $OERPUSR || -z $OERPUSR_HOME ]] | |
then | |
# | |
echo "Usage : ./ipoerpPrepareUsersAndDirectories.sh " | |
echo "With required variables :" | |
echo " - PSQLUSR : $PSQLUSR" | |
echo " - PSQLUSR_HOME : $PSQLUSR_HOME" | |
echo " - OERPUSR : $OERPUSR" | |
echo " - OERPUSR_HOME : $OERPUSR_HOME" | |
exit 0 | |
# | |
fi | |
# | |
mkdir -p $PSQLUSR_HOME/data | |
mkdir -p $PSQLUSR_HOME/backups | |
touch $PSQLUSR_HOME/.psql_history | |
# | |
if [[ 1 -gt $(getent passwd | grep -c $PSQLUSR) ]] | |
then | |
useradd -d $PSQLUSR_HOME $PSQLUSR | |
usermod -a -G postgres $PSQLUSR | |
fi | |
# | |
chown -R postgres:$PSQLUSR $PSQLUSR_HOME | |
chmod -R 770 $PSQLUSR_HOME | |
# | |
[[ 1 -gt $(getent passwd | grep -c $OERPUSR) ]] && useradd -d $OERPUSR_HOME $OERPUSR | |
# | |
mkdir -p $OERPUSR_HOME/server/ | |
mkdir -p $OERPUSR_HOME/log | |
mkdir -p $OERPUSR_HOME/.local | |
touch $OERPUSR_HOME/.bzr.log | |
chown -R oerp_user_z:oerp_user_z $OERPUSR_HOME/server | |
chown -R oerp_user_z:oerp_user_z $OERPUSR_HOME/log | |
chown -R oerp_user_z:oerp_user_z $OERPUSR_HOME/.bzr.log | |
chown -R oerp_user_z:oerp_user_z $OERPUSR_HOME/.local | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
follow /root/emailREADME.txt instructions | |
as root : | |
- run aptDependencies.sh | |
- run root_tasks.sh | |
- run makeOerpSrvConf.sh "/srv/site_z/openerp" " password " ";Mkjiu87" "8019" | |
as postgres : | |
- run psql_tasks.sh "psql_user_z" " password " "site_z" "site_z_db" | |
as oerp_user_z : | |
- run bzr_update.sh | |
- run patchLauncher.sh "/srv/site_z/openerp" | |
- - cd /srv/site_z/openerp/server | |
virtualenv env --system-site-packages | |
source venv/bin/activate | |
- run pipDependencies.sh | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment