Skip to content

Commit 523a697

Browse files
author
Benjamin Calef
authored
Merge pull request #41 from zepgram/develop
Develop
2 parents 4678972 + b76325b commit 523a697

File tree

4 files changed

+61
-32
lines changed

4 files changed

+61
-32
lines changed

Readme.md

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@
33
[![vagrant](https://img.shields.io/badge/vagrant-debian:stretch-blue.svg?longCache=true&style=flat&label=vagrant&logo=vagrant)](https://app.vagrantup.com/debian/boxes/stretch64)
44
[![dev-box](https://img.shields.io/badge/git/composer-blue.svg?longCache=true&style=flat&label=setup&logo=magento)](https://github.com/zepgram/magento2-fast-vm/blob/master/config.yaml.example)
55
[![mount](https://img.shields.io/badge/nfs/rsync-blue.svg?longCache=true&style=flat&label=mount)](https://github.com/zepgram/magento2-fast-vm/releases)
6-
[![release](https://img.shields.io/badge/release-v1.3.0-blue.svg?longCache=true&style=flat&label=release)](https://github.com/zepgram/magento2-fast-vm/releases)
6+
[![release](https://img.shields.io/badge/release-v1.3.1-blue.svg?longCache=true&style=flat&label=release)](https://github.com/zepgram/magento2-fast-vm/releases)
77
[![license](https://img.shields.io/badge/license-MIT-blue.svg?longCache=true&style=flat&label=license)](https://github.com/zepgram/magento2-fast-vm/blob/master/LICENSE)
88

99
![windows](https://img.shields.io/badge/windows-ok-green.svg?longCache=true&style=flat&label=windows&logo=windows)
1010
![apple](https://img.shields.io/badge/mac-ok-green.svg?longCache=true&style=flat&label=mac&logo=apple)
1111
![linux](https://img.shields.io/badge/linux-ok-green.svg?longCache=true&style=flat&label=linux&logo=linux)
1212

13+
![image](https://user-images.githubusercontent.com/16258478/68086496-0d43e100-fe4d-11e9-95ea-2bce3bee9884.png)    ![image](https://user-images.githubusercontent.com/16258478/68086436-70814380-fe4c-11e9-8ef4-6e39388cc679.png)    ![image](https://user-images.githubusercontent.com/16258478/68086442-7545f780-fe4c-11e9-8c5e-518ddba8735d.png)    ![image](https://user-images.githubusercontent.com/16258478/68086695-ba6b2900-fe4e-11e9-8f4f-68feb9bb0db2.png)    ![image](https://user-images.githubusercontent.com/16258478/68086427-62cbbe00-fe4c-11e9-83d5-24aec5b7c686.png)
14+
1315
[![associate-developer](https://u.magento.com/media/catalog/product/cache/17/small_image/92x165/9df78eab33525d08d6e5fb8d27136e95/a/s/assoc_dev-l.png)](https://u.magento.com/certification/directory/dev/2504796/)
1416

1517
## Requirements
@@ -162,6 +164,13 @@ Disable cron:
162164
./bin/magento cron:remove
163165
```
164166

167+
### Elasticsearch
168+
Only version 6.0 of Elasticsearch is available.<br>
169+
If you use version 5.0 or simply doesn't want Elasticsearch, you can disable it and fall back to mysql:
170+
```
171+
./bin/magento config:set catalog/search/engine mysql
172+
```
173+
165174
## Configuration
166175

167176
### Package & Software
@@ -170,19 +179,20 @@ Disable cron:
170179
- git
171180
- gitflow
172181
- vim
173-
- mariadb
182+
- composer
174183
- nginx
175184
- php-fpm
185+
- percona
176186
- redis-server
177-
- composer
178-
- magento-cloud CLI
179-
- magento bash completion
180-
- pestle
181-
- magereun
182-
- adminer
187+
- elasticsearch6
183188
- grunt
184189
- postfix
185190
- mailcatcher
191+
- pestle
192+
- magereun
193+
- adminer
194+
- magento-cloud cli
195+
- bin/magento bash completion
186196

187197
### Credentials
188198
* User bash terminal

provision/010-system-packages.sh

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,24 +19,34 @@ debconf-set-selections <<< "mysql-server mysql-server/root_password_again passwo
1919
debconf-set-selections <<< "postfix postfix/mailname string $PROJECT_URL"
2020
debconf-set-selections <<< "postfix postfix/main_mailer_type string 'Internet Site'"
2121

22-
# Configure default locale
22+
# Set default locale
2323
cp /etc/locale.gen /etc/locale.gen.old
2424
sed -i "s/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/g" /etc/locale.gen
2525
/usr/sbin/locale-gen
26-
export LANG=en_US.UTF-8*
26+
echo 'export LANG=en_US.UTF-8' | tee -a ~/.bashrc >> /home/vagrant/.bashrc
27+
echo 'export LC_CTYPE=en_US.UTF-8' | tee -a ~/.bashrc >> /home/vagrant/.bashrc
28+
echo 'export LC_ALL=en_US.UTF-8' | tee -a ~/.bashrc >> /home/vagrant/.bashrc
2729

2830
# Required packages
2931
apt-get install -y \
30-
curl graphviz htop net-tools rsync sudo tree wget unzip zip \
32+
curl graphviz htop net-tools rsync sudo tree wget unzip zip g++ \
3133
libsqlite3-dev libxml2-utils build-essential software-properties-common \
3234
postfix mailutils libsasl2-2 libsasl2-modules ca-certificates libnss3-tools \
33-
apt-transport-https mysql-client mysql-server redis-server \
34-
openssl nginx \
35-
g++ vim git git-flow
35+
apt-transport-https openssl redis-server nginx \
36+
python ruby ruby-dev openjdk-8-jdk openjdk-8-jre \
37+
vim git git-flow
3638

37-
# Sury Repository
38-
wget -q https://packages.sury.org/php/apt.gpg -O- | sudo apt-key add -
39-
echo "deb https://packages.sury.org/php/ stretch main" | sudo tee /etc/apt/sources.list.d/php.list
39+
# Php Repository
40+
wget -q https://packages.sury.org/php/apt.gpg -O- | apt-key add -
41+
echo "deb https://packages.sury.org/php/ stretch main" | tee /etc/apt/sources.list.d/php.list
42+
43+
# Percona repository
44+
wget https://repo.percona.com/apt/percona-release_latest.$(lsb_release -sc)_all.deb
45+
dpkg -i percona-release_latest.$(lsb_release -sc)_all.deb
46+
47+
# Elasticsearch repository
48+
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | apt-key add -
49+
echo "deb https://artifacts.elastic.co/packages/6.x/apt stable main" | tee /etc/apt/sources.list.d/elastic-6.x.list
4050

4151
# Set php version
4252
MAGENTO_PHP_VERSION='7.2';
@@ -57,21 +67,21 @@ fi
5767
sed -i '/export PROJECT_PHP_VERSION*/c\'"export PROJECT_PHP_VERSION=${MAGENTO_PHP_VERSION}" /etc/profile.d/env.sh
5868
source /etc/profile.d/env.sh
5969

60-
# PHP packages
70+
# PHP and aditionals
6171
apt-get update -y && apt-get install -y \
6272
php${PROJECT_PHP_VERSION} php${PROJECT_PHP_VERSION}-common php${PROJECT_PHP_VERSION}-cli \
6373
php${PROJECT_PHP_VERSION}-curl php${PROJECT_PHP_VERSION}-gd php${PROJECT_PHP_VERSION}-intl \
6474
php${PROJECT_PHP_VERSION}-mbstring php${PROJECT_PHP_VERSION}-soap php${PROJECT_PHP_VERSION}-zip \
6575
php${PROJECT_PHP_VERSION}-xml php${PROJECT_PHP_VERSION}-xml php${PROJECT_PHP_VERSION}-bcmath \
6676
php${PROJECT_PHP_VERSION}-mysql php${PROJECT_PHP_VERSION}-sqlite3 php${PROJECT_PHP_VERSION}-fpm \
6777
php${PROJECT_PHP_VERSION}-memcache php${PROJECT_PHP_VERSION}-redis php${PROJECT_PHP_VERSION}-opcache \
68-
python ruby ruby-dev
78+
percona-server-server-5.7 elasticsearch
6979
if $(dpkg --compare-versions "${PROJECT_PHP_VERSION}" "lt" "7.2"); then
7080
apt-get install -y php${PROJECT_PHP_VERSION}-mcrypt
7181
fi
7282

7383
# Composer
74-
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
84+
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
7585

7686
# Prestissimo speed up installation
7787
sudo -u vagrant composer global require hirak/prestissimo
@@ -86,7 +96,7 @@ gem install mime-types --version "< 3" --no-ri --no-rdoc
8696
gem install mailcatcher --no-ri --no-rdoc
8797

8898
# Grunt
89-
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
99+
curl -sL https://deb.nodesource.com/setup_8.x | -E bash -
90100
apt-get install -y nodejs
91101
npm install -g grunt-cli
92102

@@ -104,7 +114,7 @@ mv /root/.magento-cloud/bin/magento-cloud /usr/local/bin
104114
chmod +x /usr/local/bin/magento-cloud
105115

106116
# Bash completion for magento cli
107-
sudo curl -o /etc/bash_completion.d/magento2-bash-completion https://raw.githubusercontent.com/yvoronoy/magento2-bash-completion/master/magento2-bash-completion
117+
curl -o /etc/bash_completion.d/magento2-bash-completion https://raw.githubusercontent.com/yvoronoy/magento2-bash-completion/master/magento2-bash-completion
108118
source /etc/bash_completion.d/magento2-bash-completion
109119

110120
# Clean

provision/020-system-services.sh

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ export DEBIAN_FRONTEND=noninteractive
1212
echo '--- Configure system services ---'
1313

1414
# Create db user
15-
sed -i 's/bind-address/#bind-address/' /etc/mysql/mariadb.conf.d/50-server.cnf
16-
sed -i 's/skip-external-locking/#skip-external-locking/' /etc/mysql/mariadb.conf.d/50-server.cnf
17-
1815
mysql -u root -ppassword -e "CREATE USER IF NOT EXISTS 'vagrant'@'localhost' IDENTIFIED BY 'vagrant';"
1916
mysql -u root -ppassword -e "CREATE USER IF NOT EXISTS 'vagrant'@'%' IDENTIFIED BY 'vagrant';"
2017
mysql -u root -ppassword -e "GRANT ALL PRIVILEGES ON * . * TO 'vagrant'@'localhost';"
@@ -26,7 +23,7 @@ mysql -u root -ppassword -e "FLUSH PRIVILEGES;"
2623

2724

2825
# Add binary entry
29-
sudo ln -sfn /usr/sbin/sendmail /usr/local/bin/
26+
ln -sfn /usr/sbin/sendmail /usr/local/bin/
3027

3128
# First, remove old relayhost entry
3229
sed -i.bak '/relayhost/,/^/d' /etc/postfix/main.cf
@@ -185,21 +182,31 @@ cp /home/vagrant/ssl/www.${PROJECT_URL}.crt /etc/ssl/certs/www.${PROJECT_URL}.cr
185182
cp /home/vagrant/ssl/www.${PROJECT_URL}.key /etc/ssl/private/www.${PROJECT_URL}.key
186183
rm -rf /home/vagrant/ssl && cd /home/vagrant
187184

188-
189-
# -----------------------------------------------------------------------------------------------------
190-
191-
192-
# Nginx default conf
193-
sudo perl -ne 'if ( m|\#location.*php\$ \{| .. m|^\s*#\}| ) { s/#//g; } print' -i /etc/nginx/sites-available/default
185+
# Nginx
186+
perl -ne 'if ( m|\#location.*php\$ \{| .. m|^\s*#\}| ) { s/#//g; } print' -i /etc/nginx/sites-available/default
194187
sed -i "s|fastcgi_pass unix:/var/run/php/.*|fastcgi_pass unix:/var/run/php/php${PROJECT_PHP_VERSION}-fpm.sock;|" /etc/nginx/sites-available/default
195188
sed -i "s/With php-.*//" /etc/nginx/sites-available/default
196189
sed -i "s/fastcgi_pass 127.0.0.1:9000;//" /etc/nginx/sites-available/default
197190
sed -i 's/index index.html index.htm index.nginx-debian.html;/index index.php index.html index.htm index.nginx-debian.html;/' /etc/nginx/sites-available/default
198191

192+
# Fpm
193+
sed -i 's/pm.max_children = .*/pm.max_children = 10/' /etc/php/"$PROJECT_PHP_VERSION"/fpm/pool.d/www.conf
194+
sed -i 's/pm.start_servers = .*/pm.start_servers = 2/' /etc/php/"$PROJECT_PHP_VERSION"/fpm/pool.d/www.conf
195+
sed -i 's/pm.min_spare_servers = .*/pm.min_spare_servers = 2/' /etc/php/"$PROJECT_PHP_VERSION"/fpm/pool.d/www.conf
196+
sed -i 's/pm.max_spare_servers = .*/pm.max_spare_servers = 5/' /etc/php/"$PROJECT_PHP_VERSION"/fpm/pool.d/www.conf
197+
199198

200199
# -----------------------------------------------------------------------------------------------------
201200

202201

202+
# Elastic search
203+
sed -i "s/#network.host: .*/network.host: 127.0.0.1/" /etc/elasticsearch/elasticsearch.yml
204+
sed -i "s/#http.port: .*/http.port: 9200/" /etc/elasticsearch/elasticsearch.yml
205+
sed -i "s|#JAVA_HOME.*|JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java|" /etc/default/elasticsearch
206+
/bin/systemctl daemon-reload
207+
/bin/systemctl enable elasticsearch.service
208+
/bin/systemctl start elasticsearch.service
209+
203210
# Server permissions
204211
mkdir -p /var/www/html
205212

provision/120-magento-post.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ if [ "$PROJECT_MOUNT" == "nfs" ] && [ "$PROJECT_MOUNT_PATH" != "app" ]; then
5555
fi
5656

5757
# Magento config
58+
redis-cli flushall
5859
if $(dpkg --compare-versions "${PROJECT_VERSION}" "gt" "2.2"); then
5960
sudo -u vagrant "$PROJECT_PATH"/bin/magento setup:config:set \
6061
--cache-backend=redis \
@@ -80,6 +81,7 @@ if $(dpkg --compare-versions "${PROJECT_VERSION}" "gt" "2.2"); then
8081
sudo -u vagrant "$PROJECT_PATH"/bin/magento config:set "web/secure/use_in_adminhtml" "1"
8182
sudo -u vagrant "$PROJECT_PATH"/bin/magento config:set "web/secure/use_in_frontend" "1"
8283
sudo -u vagrant "$PROJECT_PATH"/bin/magento config:set "web/secure/enable_hsts" "1"
84+
sudo -u vagrant "$PROJECT_PATH"/bin/magento config:set "catalog/search/engine" "elasticsearch6"
8385
else
8486
# Force https on unsecure request for older versions
8587
mysql -u vagrant -pvagrant -e "USE ${PROJECT_NAME}; UPDATE core_config_data set value='https://${PROJECT_URL}/' where path='web/unsecure/base_url';"

0 commit comments

Comments
 (0)