Skip to content

Instantly share code, notes, and snippets.

@theskillwithin
Created July 22, 2016 15:10
Show Gist options
  • Save theskillwithin/1b60033b7100270ecf1565d74d83521d to your computer and use it in GitHub Desktop.
Save theskillwithin/1b60033b7100270ecf1565d74d83521d to your computer and use it in GitHub Desktop.
#!/bin/sh
# Show what we execute
set -x
cd /var/www/html/
# Wipe out all caches
/bin/rm -rf var/*
# Set up, rebuilding database from scratch.
# Port 8080 must match what you expose via Vagrantfile.
php bin/magento setup:install \
--cleanup-database \
--db-host=localhost \
--db-name=magento \
--db-user=magento \
--db-password=secret \
--backend-frontname=admin \
--base-url=http://127.0.0.1:8080/ \
--language=en_US \
--timezone=America/Los_Angeles \
--currency=USD \
--admin-lastname=Smith \
--admin-firstname=John \
[email protected] \
--admin-user=admin \
--admin-password=admin123 \
--use-secure=0
#!/usr/bin/env bash
sudo apt-get update
# Install MySQL
# Setting Locales
echo "###########################"
echo "##### Setting Locales #####"
echo "###########################"
export LANGUAGE=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
locale-gen en_US.UTF-8
dpkg-reconfigure locales
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password password secret'
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password secret'
sudo apt-get install -y mysql-server-5.6 mysql-client-5.6
#
# Configure MySQL Remote Access
#
MYSQLAUTH="--user=root --password=secret"
mysql $MYSQLAUTH -e "GRANT ALL ON *.* TO root@'localhost' IDENTIFIED BY 'secret' WITH GRANT OPTION;"
mysql $MYSQLAUTH -e "CREATE USER 'magento'@'localhost' IDENTIFIED BY 'secret';"
mysql $MYSQLAUTH -e "GRANT ALL ON *.* TO 'magento'@'localhost' IDENTIFIED BY 'secret' WITH GRANT OPTION;"
mysql $MYSQLAUTH -e "GRANT ALL ON *.* TO 'magento'@'%' IDENTIFIED BY 'secret' WITH GRANT OPTION;"
mysql $MYSQLAUTH -e "FLUSH PRIVILEGES;"
mysql $MYSQLAUTH -e "CREATE DATABASE magento;"
# Install PHP
sudo apt-get install python-software-properties
sudo add-apt-repository -y ppa:ondrej/php
sudo apt-get update
sudo apt-get install -y php7.0-fpm php7.0-mysql php7.0-cli php7.0-mcrypt php7.0-curl php7.0-gd 7.0-intl 7.0-xsl 7.0-zip 7.0-mbstring curl git
sudo add-apt-repository -y ppa:nginx/stable
sudo apt-get update
sudo apt-get install -y nginx
# Install Composer.
cd /tmp
curl -sS https://getcomposer.org/installer | php
sudo cp composer.phar /usr/local/bin/composer
sudo chmod +x /usr/local/bin/composer
sudo mkdir /etc/nginx/ssl
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/nginx/ssl/magento-self.key -out /etc/nginx/ssl/magento-self.crt
# append AllowOverride to nginx Config File
echo "#######################################"
echo "##### CREATING NGINX CONFIG FILE #####"
echo "#######################################"
echo "
upstream fastcgi_backend {
server unix:/var/run/php/php7.0-fpm.sock;
}
server {
listen 443 ssl;
server_name YOUR-IP-OR-URL;
set $MAGE_ROOT /var/www/html;
set $MAGE_MODE developer;
ssl_certificate /etc/nginx/ssl/magento-self.crt;
ssl_certificate_key /etc/nginx/ssl/magento-self.key;
include /var/www/html/nginx.conf.sample;
}
server {
listen 80;
server_name intelliamor.dev;
set $MAGE_ROOT /var/www/html;
set $MAGE_MODE default;
include /var/www/html/nginx.conf.sample;
}
" > /etc/nginx/sites-available/default
wget https://files.magerun.net/n98-magerun2.phar
sudo cp ./n98-magerun2.phar /usr/local/bin/
sudo chmod +x /usr/local/bin/n98-magerun2.phar
# sudo crontab -u vagrant -e
# */1 * * * * /usr/bin/php -c /etc/php/7.0/cli/php.ini /var/www/magento/bin/magento cron:run > /var/www/magento/var/log/magento.cron.log&
# */1 * * * * /usr/bin/php -c /etc/php/7.0/cli/php.ini /var/www/magento/update/cron.php > /var/www/magento/var/log/update.cron.log&
# */1 * * * * /usr/bin/php -c /etc/php/7.0/cli/php.ini /var/www/magento/bin/magento setup:cron:run > /var/www/magento/var/log/setup.cron.log&
# -*- 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://atlas.hashicorp.com/search.
config.vm.box = "ubuntu/trusty64"
# 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.
config.vm.network "forwarded_port", guest: 80, host: 8080
# 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 "html", "/var/www/html", :mount_options => ["dmode=777","fmode=666"]
# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
#
config.ssh.forward_agent = true
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 = 4096
vb.cpus = 4
vb.name = "Intelliamor"
end
#
# View the documentation for the provider you are using for more
# information on available options.
# Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
# such as FTP and Heroku are also available. See the documentation at
# https://docs.vagrantup.com/v2/push/atlas.html for more information.
# config.push.define "atlas" do |push|
# push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
# end
# 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", inline: <<-SHELL
# sudo apt-get update
# sudo apt-get install -y apache2
# SHELL
config.vm.provision "shell", path: "scripts/install.sh"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment