Created
June 28, 2018 20:03
-
-
Save vitaminac/a69d692f774bc0f37075371c1ace77c3 to your computer and use it in GitHub Desktop.
Vagrant configuration for odoo-prestashop-php-apache-MySQL
This file contains hidden or 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
#Define Global Variables | |
WebSite=prestashop.com | |
WebSite_Path=/vagrant/${WebSite} | |
WebSite_Config=/etc/apache2/sites-available/${WebSite}.conf | |
PHP_Config_Path=/etc/php/7.0/apache2/php.ini | |
PrestaShop_Version="1.6.1.11" | |
# Install all component | |
sudo apt-get update | |
sudo apt-get install -y postgresql apache2 unzip php libapache2-mod-php php-common php-mbstring php-xmlrpc php-soap php-gd php-xml php-intl php-mysql php-cli php-mcrypt php-ldap php-zip php-curl | |
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password password QEw6qlJdcguSI3r42Xdx' | |
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password QEw6qlJdcguSI3r42Xdx' | |
sudo apt update | |
sudo apt install -y mysql-server python-pip | |
sudo mysql_secure_installation | |
# Configure Apache | |
sudo systemctl restart apache2 | |
sudo ufw allow in "Apache Full" | |
sudo mkdir ${WebSite_Path} | |
sudo chown www-data: ${WebSite_Path} | |
sudo rm ${WebSite_Config} | |
sudo echo "<VirtualHost *:80>" | sudo tee -a ${WebSite_Config} | |
sudo echo "DocumentRoot "${WebSite_Path} | sudo tee -a ${WebSite_Config} | |
sudo echo "<Directory "${WebSite_Path}">" | sudo tee -a ${WebSite_Config} | |
sudo echo "Options +FollowSymlinks" | sudo tee -a ${WebSite_Config} | |
sudo echo "AllowOverride All" | sudo tee -a ${WebSite_Config} | |
sudo echo "Require all granted" | sudo tee -a ${WebSite_Config} | |
sudo echo "</Directory>" | sudo tee -a ${WebSite_Config} | |
sudo echo "</VirtualHost>" | sudo tee -a ${WebSite_Config} | |
sudo a2dissite 000-default.conf | |
sudo a2ensite ${WebSite}.conf | |
sudo systemctl restart apache2.service | |
# Configure PHP | |
sudo rm ${PHP_Config_Path} | |
sudo echo "file_uploads = On" | sudo tee -a ${PHP_Config_Path} | |
sudo echo "allow_url_fopen = On" | sudo tee -a ${PHP_Config_Path} | |
sudo echo "memory_limit = 256M" | sudo tee -a ${PHP_Config_Path} | |
sudo echo "upload_max_filesize = 64M" | sudo tee -a ${PHP_Config_Path} | |
sudo a2enmod rewrite | |
sudo systemctl restart apache2.service | |
# Configure MySQL | |
sudo mysql -u root -pQEw6qlJdcguSI3r42Xdx --execute="CREATE DATABASE prestashop; CREATE USER 'prestashopuser'@'localhost' IDENTIFIED BY 'new_password_here'; GRANT ALL ON prestashop.* TO 'prestashopuser'@'localhost' IDENTIFIED BY 'user_password_here' WITH GRANT OPTION; FLUSH PRIVILEGES;" | |
# Configure PrestaShop | |
wget https://download.prestashop.com/download/releases/prestashop_${PrestaShop_Version}.zip | |
sudo unzip prestashop_${PrestaShop_Version}.zip -d ${WebSite_Path} | |
# Configure Odoo | |
sudo systemctl start postgresql | |
sudo systemctl enable postgresql | |
sudo -H -u postgres bash -c "createuser -s odoo" | |
sudo -H -u postgres bash -c "createuser -s vagrant" | |
sudo -H -u postgres bash -c "createuser -s root" | |
wget http://nightly.odoo.com/9.0/nightly/deb/odoo_9.0c.latest_all.deb -O odoo_9.0c.latest_all.deb | |
sudo apt install -f -y ./odoo_9.0c.latest_all.deb | |
ServiceFile="/etc/init.d/openerp" | |
sudo cp /vagrant/openerp ${ServiceFile} | |
sudo chmod 755 ${ServiceFile} | |
sudo chown root:root ${ServiceFile} | |
sudo mkdir /etc/rc.d/ | |
sudo ln -s ${ServiceFile} /etc/rc.d/ | |
sudo systemctl daemon-reload | |
sudo systemctl start openerp | |
# open 127.0.0.1:8069 | |
# Configure Odoo connector | |
Odoo_Addons_Path="/usr/lib/python2.7/dist-packages/openerp/addons" | |
wget https://apps.odoo.com/loempia/download/connector/9.0.1.1.0/5G1U0ZeK6YIRVEyOmjendF.zip?deps -O connector.zip | |
wget https://apps.odoo.com/loempia/download/connector_prestashop/9.0.1.0.6/5VEwL4W4rtJezkShRBHYWa.zip?deps -O prestashop-connector.zip | |
sudo unzip connector.zip -d ${Odoo_Addons_Path} | |
sudo unzip prestashop-connector.zip -d ${Odoo_Addons_Path} | |
sudo -H pip install cachetools | |
sudo pip install prestapyt html2text freezegun vcrpy | |
# now you have to update app list and install connector in 127.0.0.1:8069/web?debug=1 |
This file contains hidden or 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/sh | |
stdbuf -oL /usr/bin/python -c 'from openerp.cli import main;main()' 2>>/home/vagrant/log.out |
This file contains hidden or 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
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
# All Vagrant configuration is done below. The "2" in Vagrant.configure | |
# configures the configuration version (we support older styles for | |
# backwards compatibility). Please don't change it unless you know what | |
# you're doing. | |
Vagrant.configure("2") do |config| | |
# The most common configuration options are documented and commented below. | |
# For a complete reference, please see the online documentation at | |
# https://docs.vagrantup.com. | |
# Every Vagrant development environment requires a box. You can search for | |
# boxes at https://vagrantcloud.com/search. | |
config.vm.box = "ubuntu/xenial64" | |
# Disable automatic box update checking. If you disable this, then | |
# boxes will only be checked for updates when the user runs | |
# `vagrant box outdated`. This is not recommended. | |
# config.vm.box_check_update = false | |
# Create a forwarded port mapping which allows access to a specific port | |
# within the machine from a port on the host machine. In the example below, | |
# accessing "localhost:8080" will access port 80 on the guest machine. | |
# NOTE: This will enable public access to the opened port | |
# config.vm.network "forwarded_port", guest: 80, host: 8080 | |
# Create a forwarded port mapping which allows access to a specific port | |
# within the machine from a port on the host machine and only allow access | |
# via 127.0.0.1 to disable public access | |
config.vm.network "forwarded_port", guest: 80, host: 80, host_ip: "127.0.0.1" | |
config.vm.network "forwarded_port", guest: 8069, host: 8069, host_ip: "127.0.0.1" | |
# Create a private network, which allows host-only access to the machine | |
# using a specific IP. | |
# config.vm.network "private_network", ip: "192.168.33.10" | |
# Create a public network, which generally matched to bridged network. | |
# Bridged networks make the machine appear as another physical device on | |
# your network. | |
# config.vm.network "public_network" | |
# Share an additional folder to the guest VM. The first argument is | |
# the path on the host to the actual folder. The second argument is | |
# the path on the guest to mount the folder. And the optional third | |
# argument is a set of non-required options. | |
# config.vm.synced_folder "../data", "/vagrant_data" | |
# Provider-specific configuration so you can fine-tune various | |
# backing providers for Vagrant. These expose provider-specific options. | |
# Example for VirtualBox: | |
# | |
# config.vm.provider "virtualbox" do |vb| | |
# # Display the VirtualBox GUI when booting the machine | |
# vb.gui = true | |
# | |
# # Customize the amount of memory on the VM: | |
# vb.memory = "1024" | |
# end | |
# | |
# View the documentation for the provider you are using for more | |
# information on available options. | |
# Enable provisioning with a shell script. Additional provisioners such as | |
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the | |
# documentation for more information about their specific syntax and use. | |
config.vm.provision :shell, path: "bootstrap.sh" | |
# apt-get update | |
# apt-get install -y apache2 | |
# SHELL | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment