Commit 28cae9c7 by Yvon

add step by step script to migrate cagette env to new env

parent b0a8758e
Pipeline #3139 failed with stage
in 1 minute 6 seconds
//Ces notes ont été prises lors de la conversion de l\'architecture cagette préprod vers la nouvelle architecture.
//Elles peuvent servir à faire de même sur la prod !
//USERS, HOME DIRS, FILES, RIGHTS
useradd -m odoo
usermod -s /bin/bash odoo
useradd -m django
usermod -s /bin/bash django
cd /home/lacagette
mv Odoo odoo-server.conf odoo-server.log odoo-server.log.1 odoo-server.log.2 scripts .local /home/odoo/.
//un nouveau odoo-server.log a été créé automatiquement, il faudra gérer ça
mv -f third-party cronlogs .virtualenvs /home/django/.
mkdir /home/odoo/cronlogs
cp -r /home/odoo/scripts /home/django/scripts
chown -R odoo:odoo /home/odoo
chown -R django:django /home/django
chown -R django:django /shared_dir/django_static
//PYTHON VENV
cd /home/django/.virtualenvs
rm -rf third-party .gitignore bin lib pyvenv.cfg
source /usr/local/bin/virtualenvwrapper.sh
mkvirtualenv -p python3.8 -r /home/django/third-party/requirements.txt third-party
//PSQL
//key to understand : "A user is a role with the ability to log in (the role has the LOGIN attribute)."
su postgres
psql
create role odoo login;
grant lacagette to odoo;
alter database lacagette owner to odoo;
select pg_terminate_backend(pid) from pg_stat_activity where pid <> pg_backend_pid() and datname = 'lacagette';
alter database lacagette rename to odoo;
exit
exit
//CONFIGS
sed -i -e 's/\/lacagette\//\/odoo\//g' /home/odoo/odoo-server.conf
sed -i -e 's/db_name = lacagette/db_name = odoo/g' /home/odoo/odoo-server.conf
sed -i -e 's/db_user = lacagette/db_user = odoo/g' /home/odoo/odoo-server.conf
sed -i -e 's/dbfilter = lacagette/dbfilter = odoo/g' /home/odoo/odoo-server.conf
sed -i -e "s/'lacagette'/'odoo'/g" /home/django/third-party/outils/settings_secret.py
sed -i -e 's/lacagette/django/g' /etc/scripts/django.sh
sed -i -e 's/lacagette/django/g' /etc/init.d/django
sed -i -e 's/lacagette/odoo/g' /etc/init.d/odoo
//CRONS
crontab -l -u lacagette | grep -v "sync_files.sh" | crontab -u django -
crontab -l -u lacagette | grep "sync_files.sh" | crontab -u odoo -
crontab -r -u lacagette
//FILESTORE ISSUE
su postgres
psql
\c odoo
delete from ir_attachment where mimetype in ('text/css','application/javascript');
//puis deux restarts nécessaires... de odoo
restart django.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment