Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 12692de

Browse files
author
Steve Johnson
authored
Merge pull request magento#77 from magento/2.0_vagrant_update
Vagrant clones devdocs repository using VM
2 parents 02682da + 4c58982 commit 12692de

File tree

3 files changed

+72
-38
lines changed

3 files changed

+72
-38
lines changed

vagrant/README.md

Lines changed: 32 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,38 @@
1-
# Deploy devdocs locally
1+
# Overview of this Vagrant project
22

3-
You can deploy devdocs site locally using this vagrant project. Vagrant enables you to create a virtual machine with all the software needed to build the devdocs project on a virtual machine. The generated web-site is accessible through browser from your machine as localhost using IP: **127.0.0.1:4000** by default.
3+
You can deploy devdocs site locally using this vagrant project. Vagrant will do the following:
4+
5+
1. Create a virtual machine with Ubuntu
6+
7+
2. Install all the software needed
8+
9+
3. Clone `devdocs` repo to the virtual machine in a shared folder (on VM: `/vagrant/devdocs`, on your machine: in the `vagrant/devdocs` directory)
10+
11+
4. Run Jekyll to generate `magento.devdocs` website locally
12+
13+
The generated web-site is accessible through browser from your machine as localhost using IP: **127.0.0.1:4000** by default.
414

515
## Setup
616

7-
1. Download or clone [devdocs repository](https://github.com/magento/devdocs).
8-
2. [Install VirtualBox](https://www.virtualbox.org/wiki/Downloads).
9-
3. [Install Vagrant](https://www.vagrantup.com/).
17+
1. Download [`devdocs/vagrant` directory](https://github.com/magento/devdocs/vagrant).
18+
19+
2. Install [VirtualBox](https://www.virtualbox.org/wiki/Downloads).
20+
21+
3. Install [Vagrant](https://www.vagrantup.com/).
22+
23+
## Run Vagrant
24+
25+
1. In your terminal, open the downloaded directory `vagrant` on your host. (The directory where this README is located.)
26+
27+
2. Enter `vagrant up`.
1028

11-
## Create VM and environment
29+
3. Wait for some time while vagrant is creating a virtual machine, sets up environment, and runs Jekyll. You'll se the following test in your terminal:
1230

13-
1. Using a terminal, change a directory to `devdocs/vagrant` on your host. (The directory where this README is located.)
14-
Example: `cd ~/devdocs/vagrant`
15-
2. Enter in your terminal `vagrant up`
16-
3. Wait for some time until vagrant created a virtual machine with ready-to-go environment.
31+
Configuration file: /vagrant/devdocs/_config.yml
32+
Server address: http://0.0.0.0:4000//
33+
Server running... press ctrl-c to stop.
1734

18-
## Browse devdocs site
35+
## Browse magento.devdocs site locally
1936

2037
In your browser, visit http://127.0.0.1:4000/
2138

@@ -34,15 +51,15 @@ All commands must be run in the terminal from the directory that contains `Vagra
3451

3552
### Scripts
3653

37-
- Stop Jekyll server. (Stops devdocs site generation.)
54+
- Stop Jekyll server. (Stops magento.devdocs site generation.)
3855

3956
vagrant ssh -c "kill $(ps aux | grep '[j]ekyll' | awk '{print $2}')"
4057

41-
- Run Jekyll server. (Generates devdocs site.)
58+
- Run Jekyll server. (Generates magento.devdocs site.)
4259

4360
vagrant ssh -c 'cd /jekyll/devdocs; jekyll serve --host=0.0.0.0'
4461

45-
- Reload Jekyll server. (Regenerates devdocs site.)
62+
- Reload Jekyll server. (Regenerates magento.devdocs site.)
4663

4764
vagrant ssh -c "kill $(ps aux | grep '[j]ekyll' | awk '{print $2}'); cd /jekyll/devdocs; jekyll serve --host=0.0.0.0"
4865

@@ -53,7 +70,7 @@ All commands must be run in the terminal from the directory that contains `Vagra
5370

5471
vagrant ssh
5572

56-
To terminate the connection, run the command:
73+
To terminate the SSH connection, run the command:
5774

5875
exit
5976

vagrant/Vagrantfile

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,34 @@
11
# -*- mode: ruby -*-
22
# vi: set ft=ruby :
33

4-
NAME="magento-devdocs"
5-
HOST_PORT="4000"
6-
RAM="1024"
7-
CPU="50"
4+
# Customization parameters
5+
NAME='magento-devdocs'
6+
HOST_PORT='4000'
7+
RAM='1024'
8+
CPU='50'
89

9-
# All Vagrant configuration is done below. The "2" in Vagrant.configure
10+
# All Vagrant configuration is done below. The '2' in Vagrant.configure
1011
# configures the configuration version (we support older styles for
1112
# backwards compatibility). Please don't change it unless you know what
1213
# you're doing.
1314
Vagrant.configure(2) do |config|
14-
config.vm.box = "ubuntu/trusty64"
15+
16+
# Create a virtual machine with Official Ubuntu Server 14.04 LTS (Trusty Tahr) build.
17+
config.vm.box = 'ubuntu/trusty64'
18+
19+
# Set a name for the host on the created virtual machine. NAME must be set as a customisation parameter on top of this file.
1520
config.vm.hostname = NAME
16-
config.vm.provision :shell, path: "bootstrap.sh"
17-
config.vm.network :forwarded_port, guest: "4000", host: HOST_PORT
18-
config.vm.synced_folder "../.", "/jekyll/devdocs"
19-
config.vm.provider "virtualbox" do |v|
20-
v.customize ['modifyvm', :id, '--name', NAME, '--memory', RAM, "--cpuexecutioncap", CPU]
21+
22+
# Set a provisioner and file with provision to automate software installation.
23+
config.vm.provision :shell, path: 'bootstrap.sh'
24+
25+
# Jekyll uses the 4000 port by default. This declaration forwards output from the 4000 port on VM to the port on your host that is set in Customization parameters as HOST_PORT on top of the file.
26+
config.vm.network :forwarded_port, guest: '4000', host: HOST_PORT
27+
28+
# VirtualBox specific configuration settings.
29+
config.vm.provider 'virtualbox' do |v|
30+
v.customize ['modifyvm', :id, '--name', NAME, '--memory', RAM, '--cpuexecutioncap', CPU]
31+
v.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/v-root", "1"]
2132
end
33+
2234
end

vagrant/bootstrap.sh

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
#!/usr/bin/env bash
22

3-
# Customization parameters
4-
RUBY_VERSION=2.2
3+
# Customization parameters.
4+
RUBY_VERSION=2.1
55
RVM_PATH=/usr/local/rvm
66
GEMS=bundler
77

8-
# Get information on the newest versions of Ubuntu packages
8+
# Get information about the newest versions of Ubuntu packages.
99
sudo apt-get update
1010

11-
# Install Ubuntu packages
12-
sudo apt-get install nodejs -y
11+
# Install Ubuntu packages.
12+
sudo apt-get install nodejs git -y
1313

14-
# Install Ruby
14+
# Install Ruby.
1515
if [ ! -e $RVM_PATH ]; then
1616
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
1717
curl -sSL https://get.rvm.io | bash -s
@@ -21,15 +21,20 @@ source $RVM_PATH/scripts/rvm
2121

2222
rvm use --install $RUBY_VERSION --default
2323

24-
# Install gems
24+
# Install ruby gems specified in Customization parameters on top of this file.
2525
gem install $GEMS
2626

27-
# Clean up
27+
# Clean up Ubuntu system after software installation.
2828
sudo apt-get autoremove -y
2929

30-
# Install gems and dependencies from Gemfile
31-
cd /jekyll/devdocs
30+
# Clone the 'devdocs' repo from GitHub in a shared directory.
31+
cd /vagrant/
32+
git clone https://github.com/magento/devdocs.git
33+
34+
# Install gems and dependencies from 'devdocs/Gemfile'
35+
cd devdocs/
3236
bundle install
3337

34-
# Run devdocs in Jekyll
35-
cd /jekyll/devdocs && bundle exec jekyll serve --host=0.0.0.0
38+
# Run Jekyll to generate the devdocs site
39+
40+
bundle exec jekyll serve --host=0.0.0.0

0 commit comments

Comments
 (0)