This repository has been archived on 2021-03-15. You can view files and clone it, but cannot push or open issues or pull requests.
Files
zdc-tools/zdc-odoo-vm.sh
2020-10-30 13:19:28 +01:00

33 lines
1.8 KiB
Bash
Executable File
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env bash
NAME=$1
echo "### Create Ubuntu 18.04 LTS VM"
multipass launch bionic --name $NAME --cpus 2 --mem 2048M --disk 12G --cloud-init ./cloud-init/zdc-odoo-init.yaml
echo "### Install wkhtmltopdf"
multipass exec $NAME -- sudo wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.bionic_amd64.deb -O /tmp/wkhtmltox_0.12.6-1.bionic_amd64.deb
multipass exec $NAME -- sudo apt install /tmp/wkhtmltox_0.12.6-1.bionic_amd64.deb -y
echo "### Install Python Environment"
multipass exec $NAME -- sudo -u ubuntu /bin/bash /opt/odoo/venv-install.sh
echo "### Install OCB Odoo 12"
#multipass exec $NAME -- sudo -u ubuntu /usr/bin/git clone https://www.github.com/OCA/OCB --depth 1 --branch 12.0 /opt/odoo/odoo12
multipass exec $NAME -- sudo -u ubuntu /usr/bin/git clone https://gitea.egroup.sk/development/zdc-odoo --depth 1 --branch master /opt/odoo/odoo12
multipass exec $NAME -- sudo -u ubuntu /usr/bin/git clone https://gitea.egroup.sk/development/zdc-oca-addons --depth 1 --branch master /opt/odoo/custom-addons/zdc-oca-addons
multipass exec $NAME -- sudo systemctl restart odoo12
echo "### Create ZDC Template DB"
multipass exec $NAME -- sudo -u postgres wget https://gitea.egroup.sk/development/zdc-tools/raw/branch/master/db/zdc-template-db.sql -O /var/lib/postgresql/zdc-template-db.sql
multipass exec $NAME -- sudo -u postgres psql -c "CREATE DATABASE zdcbasedb10 WITH OWNER=ubuntu;"
multipass exec $NAME -- sudo -u postgres psql -d zdcbasedb10 -f /var/lib/postgresql/zdc-template-db.sql
echo "### Check VM"
multipass list | grep $NAME
URL_IP=`multipass info $NAME | grep IPv4 | sed -e 's/ //g' -e '/^$/d' | sed -e 's/IPv4://g' -e '/^$/d'`
echo "###"
echo "### Odoo database manager on $NAME server: http://$URL_IP:8069/web/database/selector"