92 lines
2.7 KiB
YAML
Executable File
92 lines
2.7 KiB
YAML
Executable File
#cloud-config
|
|
# Run 'apt-get update' on first boot
|
|
apt_update: true
|
|
|
|
# Run 'apt-get upgrade' on first boot
|
|
apt_upgrade: true
|
|
|
|
packages:
|
|
- curl
|
|
- git
|
|
- python3-pip
|
|
- build-essential
|
|
- wget
|
|
- python3-dev
|
|
- python3-venv
|
|
- python3-wheel
|
|
- libxslt-dev
|
|
- libzip-dev
|
|
- libldap2-dev
|
|
- libsasl2-dev
|
|
- python3-setuptools
|
|
- node-less
|
|
- postgresql
|
|
|
|
write_files:
|
|
- content: |
|
|
[options]
|
|
db_host = False
|
|
db_port = False
|
|
db_user = ubuntu
|
|
db_password = False
|
|
addons_path = /opt/odoo/odoo12/addons,/opt/odoo/custom-addons/zdc-oca-addons
|
|
path: /etc/odoo12.conf
|
|
- content: |
|
|
[Unit]
|
|
Description=Odoo
|
|
Requires=postgresql.service
|
|
After=network.target postgresql.service
|
|
|
|
[Service]
|
|
Type=simple
|
|
SyslogIdentifier=odoo
|
|
PermissionsStartOnly=true
|
|
User=ubuntu
|
|
Group=ubuntu
|
|
ExecStart=/opt/odoo/venv-odoo12/bin/python3 /opt/odoo/odoo12/odoo-bin -c /etc/odoo12.conf
|
|
StandardOutput=journal+console
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
path: /etc/systemd/system/odoo12.service
|
|
|
|
# boot commands
|
|
# These are like 'runcmd', but run very early in the boot process & run on every boot by default.
|
|
bootcmd:
|
|
- echo $(whoami) > /root/boot.txt
|
|
|
|
runcmd:
|
|
#- [ wget, "http://slashdot.org", -O, /run/mydir/index.html ]
|
|
# install wkhtmltopdf
|
|
#- wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.bionic_amd64.deb -O /run/wkhtmltox_0.12.6-1.bionic_amd64.deb
|
|
#- apt install /run/wkhtmltox_0.12.6-1.bionic_amd64.deb -y
|
|
- systemctl enable --now postgresql.service
|
|
- su - postgres -c "createuser -s ubuntu"
|
|
# setup odoo installation
|
|
- mkdir /opt/odoo
|
|
- chown ubuntu:ubuntu /opt/odoo/
|
|
- sudo -u ubuntu mkdir /opt/odoo/custom-addons
|
|
- sudo -u ubuntu wget https://github.com/OCA/OCB/raw/12.0/requirements.txt -O /opt/odoo/requirements.txt
|
|
#- sudo -u ubuntu /usr/bin/git clone https://www.github.com/OCA/OCB --depth 1 --branch 12.0 /opt/odoo/odoo12
|
|
# setup python3 virtualenv
|
|
- sudo -u ubuntu /usr/bin/python3 -m venv /opt/odoo/venv-odoo12
|
|
- sudo -u ubuntu cat /opt/odoo/venv-odoo12/bin/activate > /opt/odoo/venv-install.sh
|
|
- sudo -u ubuntu echo "pip3 install wheel" >> /opt/odoo/venv-install.sh
|
|
- sudo -u ubuntu echo "pip3 install -r /opt/odoo/requirements.txt" >> /opt/odoo/venv-install.sh
|
|
#- sudo -u ubuntu /bin/bash /opt/odoo/venv-install.sh
|
|
|
|
- systemctl daemon-reload
|
|
- systemctl enable odoo12
|
|
|
|
# set the locale
|
|
locale: en_US.UTF-8
|
|
|
|
# timezone: set the timezone for this instance
|
|
timezone: UTC
|
|
|
|
# Log all cloud-init process output (info & errors) to a logfile
|
|
output: {all: ">> /var/log/cloud-init-output.log"}
|
|
|
|
# final_message written to log when cloud-init processes are finished
|
|
final_message: "System boot (via cloud-init) is COMPLETE, after $UPTIME seconds. Finished at $TIMESTAMP"
|