- OS: Ubuntu 14.04 Trusty 64
- HTTP Web Server: Nginx
- Database: MySQL
- PHP Server-side Scripting: PHP-FPM
- Ruby Server-side Scripting: Passenger
Part 1: Configuration
- Setup Directory and Vagrant
- Update Ubuntu
- Install MySQL and Nginx
- Install Passenger and Nginx
- Install RVM and Ruby
- Install PHP-FPM
- Install Git
- Add Public Key
Part 2: Default Domain
Part 3: Git Workflow
- Add the Public Key
- Bare Repository on Guest VM
- Create the Hooks in bare repo
- Update Permissions on Guest VM
- Guest VM Git Setup
- Host Git Setup
- Making Updates
Great Nginx Articles
- Martin Fjrdvald Nginx Configuration Primer 1
- Martin Fjrdvald Nginx Configuration Primer 2
- PHP behind Nginx with FastCGI SitePoint's Timothy Boronczyk
- Neal Poole PHP-FastCGI Configuration
- Nginx Structure Overview: Andrew Alexeev
- Nginx.com Doc
REMEMBER! vagrant up with --provider=virtualbox
~/Projects/deploy-tests $ mkdir vagrant-lempp-stack03
~/Projects/deploy-tests $ cd vagrant-lempp-stack03/
~/Projects/deploy-tests/vagrant-lempp-stack03 $ vagrant init
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.network :forwarded_port, guest: 80, host: 9090
config.vm.network "private_network", ip: "192.173.68.15"
end
~/Projects/deploy-tests/vagrant-lempp-stack02 $ vagrant up --provider="virtualbox"
vagrant ssh
vagrant@vagrant-ubuntu-trusty-64:~$ sudo apt-get update
Install MySQL and add root
password admin
vagrant@vagrant-ubuntu-trusty-64:~$ sudo apt-get install -y mysql-server mysql-client
vagrant@vagrant-ubuntu-trusty-64:~$ sudo apt-get install -y nginx
You should be able to browse to the localhost root for the new Guest VM
http://127.0.0.1:9090/
http://localhost:9090/
http://192.173.68.15/
The installation instructions for Passenger on Nginx come from the Phusion Passenger users guide, Nginx version
1. Install PGP key.
Packages are signed by "Phusion Automated Software Signing (auto-software-signing@phusion.nl)", fingerprint 1637 8A33 A6EF 1676 2922 526E 561F 9B9C AC40 B2F7.
vagrant@vagrant-ubuntu-trusty-64:~$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 561F9B9CAC40B2F7
2. Add HTTPS support for APT. Our APT repository is stored on an HTTPS server.
vagrant@vagrant-ubuntu-trusty-64:~$ sudo apt-get install -y apt-transport-https ca-certificates
3. Create a file /etc/apt/sources.list.d/passenger and add this line
vagrant@vagrant-ubuntu-trusty-64:~$ sudo vim /etc/apt/sources.list.d/passenger.list
deb https://oss-binaries.phusionpassenger.com/apt/passenger trusty main
4. Secure passenger.list and update your APT cache
vagrant@vagrant-ubuntu-trusty-64:~$ sudo chown root: /etc/apt/sources.list.d/passenger.list
vagrant@vagrant-ubuntu-trusty-64:~$ sudo chmod 600 /etc/apt/sources.list.d/passenger.list
vagrant@vagrant-ubuntu-trusty-64:~$ sudo apt-get update
You should install nginx-extras even if you have already installed an Nginx package from the official Debian/Ubuntu repository. This is because the Nginx binary that our packages supply is compiled with the Passenger module.
1. Add APT repository
Done in the last step.
2. Install the packages
vagrant@vagrant-ubuntu-trusty-64:~$ sudo apt-get install -y nginx-extras passenger
3. Edit /etc/nginx/nginx.conf and uncomment passenger_root
and passenger_ruby
vagrant@vagrant-ubuntu-trusty-64:~$ sudo vim /etc/nginx/nginx.conf
passenger_root /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini;
passenger_ruby /usr/bin/ruby;
Especially passenger_root is important: Phusion Passenger won’t work without it! If you don’t see a commented version of passenger_root inside nginx.conf, then you need to insert it yourself.
4. Restart Nginx
sudo service nginx restart
If you installed Phusion Passenger through our APT repository, then you should update APT’s keyring from time to time as well:
sudo apt-key adv --refresh-keys --keyserver keyserver.ubuntu.com
I'm going to stick with RVM for now, but both of these Ruby dependency lists from from rbenv related sites. There's some overlap, but I'm going to make my own 'guess' as a list, keeping all of Sam Stephenson's though. I was wondering about the RVM list and found this on StackOverflow
Check this RVM Cheat Sheet as well
Ruby dependencies from rbenv wiki
suod apt-get install autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev
Ruby dependencies from Go Rails
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties
1. Install key for rvm
vagrant@vagrant-ubuntu-trusty-64:~$ gpg --keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3
gpg: directory `/home/vagrant/.gnupg' created
gpg: new configuration file `/home/vagrant/.gnupg/gpg.conf' created
gpg: WARNING: options in `/home/vagrant/.gnupg/gpg.conf' are not yet active during this run
gpg: keyring `/home/vagrant/.gnupg/secring.gpg' created
gpg: keyring `/home/vagrant/.gnupg/pubring.gpg' created
gpg: requesting key D39DC0E3 from hkp server keys.gnupg.net
gpg: /home/vagrant/.gnupg/trustdb.gpg: trustdb created
gpg: key D39DC0E3: public key "Michal Papis (RVM signing) <mpapis@gmail.com>" imported
gpg: no ultimately trusted keys found
gpg: Total number processed: 1
gpg: imported: 1 (RSA: 1)
2. Install rvm and the latest stable version of ruby
\curl -sSL https://get.rvm.io | bash -s stable
or
curl -L get.rvm.io | bash -s stable
3. Source the newly installed version of rvm
* To start using RVM you need to run `source /home/vagrant/.rvm/scripts/rvm`
vagrant@vagrant-ubuntu-trusty-64:~$ source /home/vagrant/.rvm/scripts/rvm
vagrant@vagrant-ubuntu-trusty-64:~$ rvm -v
rvm 1.26.6 (latest) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]
vagrant@vagrant-ubuntu-trusty-64:~$
4. Check the rvm requirements
vagrant@vagrant-ubuntu-trusty-64:~$ rvm requirements
Checking requirements for ubuntu.
Installing requirements for ubuntu.
Updating system.......
Installing required packages: g++, libreadline6-dev, zlib1g-dev, libssl-dev, libyaml-dev, libsqlite3-dev, sqlite3, autoconf, libgdbm-dev, libncurses5-dev, automake, libtool, bison, pkg-config, libffi-dev..................
Requirements installation successful.
You can also set the autolibs to default. I think autolibs is the newest way to manage dependencies.
vagrant@vagrant-ubuntu-trusty-64:~$ rvm autolibs enable
5. Check which rubies, if any, are installed
vagrant@vagrant-ubuntu-trusty-64:~$ ruby -v
ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux]
vagrant@vagrant-ubuntu-trusty-64:~$ rvm list
rvm rubies
# No rvm rubies installed yet. Try 'rvm help install'.
6. Install ruby
vagrant@vagrant-ubuntu-trusty-64:~$ rvm install 2.0.0
vagrant@vagrant-ubuntu-trusty-64:~$ rvm list
rvm rubies
=* ruby-2.0.0-p598 [ x86_64 ]
# => - current
# =* - current && default
# * - default
vagrant@vagrant-ubuntu-trusty-64:~$ which ruby
/home/vagrant/.rvm/rubies/ruby-2.0.0-p598/bin/ruby
7. Set the .gemrc to not install docs
echo "gem: --no-ri --no-rdoc" > ~/.gemrc
From rvm.io:
Phusion Passenger is an application server for Ruby and Python that can integrate into Apache and Nginx, or run standalone. It's currently one of the most popular application servers for Ruby. RVM will allow you to use any of it's MRI/YARV Rubies with Phusion Passenger very easily.
RVM works best with Phusion Passenger version 4.0.0. Phusion Passenger 4 has full integration support for RVM and should work out of the box with no configuration. The only thing you need to tell Phusion Passenger is which Ruby you want to use for which app.
Maybe? Next time try installing RVM and a ruby version before you install Passenger. But for now, these are instructions for using the RVM Ruby. Here's the documentation on Passenger's site.
/home/vagrant/.rvm/rubies/ruby-2.0.0-p598/bin/ruby
vagrant@vagrant-ubuntu-trusty-64:~$ passenger -v
Phusion Passenger version 4.0.56
1. Find out what hte passenger_ruby should be using the RVM helper tool
Phusion Passenger provides the passenger-config --ruby-command
tool for figuring out the correct command for invoking a specific Ruby interpreter. This is especially useful for RVM users. Suppose that you have both Ruby 1.8.7 and Ruby 1.9.3 installed through RVM, and you want to know the correct commands for each Ruby interpreter.
For this purpose we’ll want to invoke passenger-config
using its full path, because each time you rvm use a different Ruby interpreter, RVM changes $PATH
. If you did not install Phusion Passenger through the generic tarball installation method, then here’s how you can figure out where passenger-config
is:
vagrant@vagrant-ubuntu-trusty-64:~$ which passenger-config
/usr/bin/passenger-config
vagrant@vagrant-ubuntu-trusty-64:~$ /usr/bin/passenger-config --ruby-command
passenger-config was invoked through the following Ruby interpreter:
Command: /home/vagrant/.rvm/gems/ruby-2.0.0-p598/wrappers/ruby
Version: ruby 2.0.0p598 (2014-11-13 revision 48408) [x86_64-linux]
To use in Apache: PassengerRuby /home/vagrant/.rvm/gems/ruby-2.0.0-p598/wrappers/ruby
To use in Nginx : passenger_ruby /home/vagrant/.rvm/gems/ruby-2.0.0-p598/wrappers/ruby
To use with Standalone: /home/vagrant/.rvm/gems/ruby-2.0.0-p598/wrappers/ruby /usr/bin/passenger start
## Notes for RVM users
Do you want to know which command to use for a different Ruby interpreter? 'rvm use' that Ruby interpreter, then re-run 'passenger-config --ruby-command'.
vagrant@vagrant-ubuntu-trusty-64:~$
2. Add the To use in Nginx : ...
result from the last step in the nginx config file
There are ways to have different versions of Ruby for different vhosts, but that's more advanced at this point. I think you would put it into the http{ ... } block. The Phusion Passenger site documentation has more info.
vagrant@vagrant-ubuntu-trusty-64:~$ sudo vim /etc/nginx/nginx.conf
# replace the passenger_ruby /usr/bin/ruby with:
passenger_ruby /home/vagrant/.rvm/gems/ruby-2.0.0-p598/wrappers/ruby
vagrant@vagrant-ubuntu-trusty-64:~$ sudo service nginx restart
1. First we need to install PHP5-FPM.
vagrant@vagrant-ubuntu-trusty-64:~$ sudo apt-get install -y php5-fpm
2. Install PHP modules
vagrant@vagrant-ubuntu-trusty-64:~$ sudo apt-get install -y php5-cli php5-mcrypt php5-xdebug php5-gd php5-curl php5-memcache php5-memcached php5-mcrypt php5-imagick
3. In recent versions of php, fpm is set to listen on a unix socket by default. It usually is... ut just in case ... open with
vagrant@vagrant-ubuntu-trusty-64:~$ sudo vim /etc/php5/fpm/pool.d/www.conf
# uncomment this line if it isn't already:
listen = /var/run/php5-fpm.sock
4. Tweak php.ini
vagrant@vagrant-ubuntu-trusty-64:~$ sudo vim /etc/php5/fpm/php.ini
Search for the cgi.fix_pathinfo parameter. This will be commented out and set to "1". We need to uncomment this and set it to "0". I've also been setting the default_charset to UTF-8.
cgi.fix_pathinfo=0
default_charset = "UTF-8"
5. Enable mycrypt and restart PHP5-FPM
The last piece of PHP administration that we need to do is explicitly enable the MCrypt extension, which Laravel depends on. We can do this by using the php5enmod command, which lets us easily enable optional modules:
vagrant@vagrant-ubuntu-trusty-64:~$ sudo php5enmod mcrypt
6. Restart the php5-fpm service in order to implement the changes that we've made:
sudo service php5-fpm restart
Add Markdown to Nginx mime types
You'll want to add markdown to the mime types file to see this followthis.md file in Chrome.
vagrant@ubuntu-14:/var/www/laravel$ sudo vim /etc/nginx/mime.types
# add
text/x-markdown md markdown;
Turn sendfile off for the Vagrant VM Nginx Caching
This will fix the weird caching especially with markdown files (and maybe CSS).
Often times, an issue like this is just client-side caching not requesting an updated resource because it's been told that the old resource will be valid for a long time by expires max; or something similar. – kolbyjack
Found this answer on StackOverflow
vagrant@ubuntu-14:$ sudo vim /etc/nginx/nginx.conf
# vagrant@ubuntu-14:/etc/nginx$ sudo vim nginx.conf
http {
# turn off sendfile with Vagrant, it does weird caching stuff
sendfile off;
}
Restart Nginx
vagrant@ubuntu-14:/var/www/laravel$ sudo service nginx restart
vagrant@vagrant-ubuntu-trusty-64:~$ sudo apt-get install -y git
vagrant@vagrant-ubuntu-trusty-64:~$ git config --global color.ui true
vagrant@vagrant-ubuntu-trusty-64:~$ git config --global user.name "Dave Kaplan"
vagrant@vagrant-ubuntu-trusty-64:~$ git config --global user.email "workalicious@gmail.com"
vagrant@vagrant-ubuntu-trusty-64:~$ git config -l
color.ui=true
user.name=Dave Kaplan
user.email=workalicious@gmail.com
Add your public key to the Guest VM's authorized hosts so that you can access the server through GIT without a password. You can copy your public key by typing on your computer (not the VM):
$ cat ~/.ssh/id_rsa.pub | pbcopy
Paste it onto the server in the file ~/.ssh/authorized_keys:
vagrant@vagrant-ubuntu-trusty-64:~$ sudo vim ~/.ssh/authorized_keys
The basic workflow:
- Make and configure a new vhost file in the
/etc/nginx/sites-available/
- Symlink that new vhost to the
/etc/nginx/sites-enabled/
- Make the public web directory,
/home/stack03.dev
, that's reference in the vhost configuration file - Add the IP and
server_name
to the Host machine's/etc/hosts
file - Restart Nginx
Make a backup of the default
First, make a copy of the default
in /etc/nginx/sites-available/
. Then remove the symlink to the original default
in the /etc/nginx/sites-enabled
. You're going to create a new vhost for the default domain.
vagrant@vagrant-ubuntu-trusty-64:~$ sudo cp /etc/nginx/sites-available/default /etc/nginx/sites-enabled/default_backup
vagrant@vagrant-ubuntu-trusty-64:~$ sudo rm /etc/nginx/sites-enabled/default
Create a new file or make a copy of the default for the stack03.dev
domain, the default domain. Add the domain and IP to the Host machine's /etc/hosts
file as well.
vagrant@vagrant-ubuntu-trusty-64:~$ sudo vim /etc/nginx/sites-available/stack03.dev
# this first block will do a 301 permanent redirect to a non-www version of the domain.
server {
listen 80;
server_name www.stack03.dev;
return 301 $scheme://stack03.dev;
}
server {
listen 80;
server_name stack03.dev;
index index.php index.html;
root /home/stack03.dev;
location / {
try_files $uri $uri/ index.php?query_string;
}
location ~ \.php$ {
try_files $uri /index.php =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
server {
listen 80 default_server;
index index.php index.html;
root /var/www/default;
}
Symlink the new vhost file in sites-available
to the sites-enabled
directory. The idea for sites-enabled
is that you can have several vhosts configured in sites-available
and then enable / disable with symlinks to the sites-enabled
directory, which is included in the http block of the /etc/nginx/ngix.conf
file.
vagrant@vagrant-ubuntu-trusty-64:/etc/nginx$ sudo ln -s /etc/nginx/sites-available/stack03.dev /etc/nginx/sites-enabled/stack03.dev
Make a public web directory on the Guest VM
vagrant@vagrant-ubuntu-trusty-64:/etc/nginx$ sudo mkdir /home/stack03.dev
Change the ownership on the new directory to vagrant:vagrant
You'll want to make this ownership change for the Git workflow later, so doing it now.
vagrant@vagrant-ubuntu-trusty-64:/home$ ls -l
total 12
drwxr-xr-x 2 root root 4096 Dec 27 19:07 stack03.dev
drwxr-xr-x 3 ubuntu ubuntu 4096 Dec 26 20:57 ubuntu
drwxr-xr-x 7 vagrant vagrant 4096 Dec 27 17:59 vagrant
vagrant@vagrant-ubuntu-trusty-64:/home$ sudo chown vagrant:vagrant stack03.dev/
vagrant@vagrant-ubuntu-trusty-64:/home$ ls -l
total 12
drwxr-xr-x 2 vagrant vagrant 4096 Dec 27 19:07 stack03.dev
drwxr-xr-x 3 ubuntu ubuntu 4096 Dec 26 20:57 ubuntu
drwxr-xr-x 7 vagrant vagrant 4096 Dec 27 17:59 vagrant
Make an info.php file and check out the configuration
vagrant@vagrant-ubuntu-trusty-64:/home$ touch stack03.dev/info.php
<?php phpinfo(); ?>
esc + :wq
To verify nginx can communicate with PHP. In the output, you should see the Server API listed as “FPM/FastCGI”.
http://stack03.dev/info.php
This next section comes directly from a sitepoint.com article on Setting Up PHP with FastCGI by Timothy Boronczyk.
Congratulations! You have a basic nginx and PHP install set up and serving files! But there are a few additional configuration steps that I recommend.
A quick check of the web root’s permissions shows that it’s not writable by anyone other than root. Constant sudo-ing grows tiresome, and tinkering around as root is generally a bad idea, so I recommend executing the following:
sudo adduser <username> www-data
sudo chgrp -R www-data /usr/share/nginx/html
sudo chmod -R g+rw /usr/share/nginx/html
sudo chmod g+s /usr/share/nginx/html
adduser adds your username (replace with your own login) to the www-data group, the same group that nginx runs under in the default Ubuntu install. chgrp recursively updates the html directory and its children to belong to the www-data group.
The first chmod command then grants read and write group privileges recursively to html and its children, and the second sets the SGID bit so that any files or directories created in html will take on the www-data group as its group owner. Note that the second chmod is not run recursively.
After the four commands have been run, you’ll need to reload your shell for the group association on your user account to take effect. Log out and then back in again. Once you’re in, you’ll be able to create, edit, and delete files in the web root to your heart’s content under your standard login without any escalated privileges.
I also recommend adding a try_files directive somewhere in the location block you uncommented earlier in the configuration, like this:
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
try_files $uri $uri/ =404;
...
This protects you from a known vulnerability that results from an incorrectly configured system where nginx tries various patterns to satisfy a request. You may want to tweak the exact list of values after reading the documentation for try_files and take into consideration the needs of your application, but the above should provide a minimum level of protection.
Add your public key to the Guest VM's authorized hosts so that you can access the server through GIT without a password. You can copy your public key by typing on your computer (not the VM):
$ cat ~/.ssh/id_rsa.pub | pbcopy
Paste in the file ~/.ssh/authorized_keys on the Guest VM.
vagrant@vagrant-ubuntu-trusty-64:~$ sudo vim ~/.ssh/authorized_keys
By convention, bare repository directories end in .git
vagrant@vagrant-ubuntu-trusty-64:~$ mkdir stack03.git
Make sure the bare .git repository is owned by the vagrant user. Here is a great resource on Linux permissions. If you use the -d
flag with ls
you can get a directory. (found that solution on StackOverflow).
vagrant@vagrant-ubuntu-trusty-64:~$ ls -ld stack03.git/
drwxrwxr-x 2 vagrant vagrant 4096 Dec 28 15:17 stack03.git/
vagrant@vagrant-ubuntu-trusty-64:~$ cd stack03.git/
vagrant@vagrant-ubuntu-trusty-64:~/stack03.git$ git init --bare
Initialized empty Git repository in /home/vagrant/stack03.git/
The presence of that file tells Git that it's OK to serve this project without authentication. You can do this in each repository by creating a file name git-daemon-export-ok.
vagrant@vagrant-ubuntu-trusty-64:~/stack03.git$ touch git-daemon-export-ok
According to Media Temple document the post-receive hook would use git checkout -f master
but that doesn't seem to update the Guest VM working directly as well as the Tuts+ article's direction of using fetch
and reset --hard
. I'm not sure exactly, but I discovered this when I made changes directly on the Guest VM and then tried to make sure the Host and Guest matched up.
vagrant@vagrant-ubuntu-trusty-64:~/stack03.git$ vim hooks/post-receive
#!/bin/sh
GIT_WORK_TREE=/home/stack03.dev
export GIT_WORK_TREE
echo "^[[32m^[[40m>>> repository connection <<<^[[0m"
git --git-dir=/home/stack03.dev/.git --work-tree=/home/stack03.dev/ fetch origin
git --git-dir=/home/stack03.dev/.git --work-tree=/home/stack03.dev/ reset --hard origin/master
echo "^[[32m^[[40m>>> repository reset done <<<^[[0m"
vagrant@vagrant-ubuntu-trusty-64:~/stack03.git$ vim hooks/pre-receive
#!/bin/sh
echo "^[[32m ^[[40m>>> updating repository.. <<<^[[0m"
The hooks are setup, but you need ot make them executable with sudo chmod a+x ...
vagrant@vagrant-ubuntu-trusty-64:~$ sudo chmod a+x ~/stack03.git/hooks/post-receive
vagrant@vagrant-ubuntu-trusty-64:~$ sudo chmod a+x ~/stack03.git/hooks/pre-receive
# check permission of public directory
vagrant@vagrant-ubuntu-trusty-64:~$ ls -ld /home/stack03.dev/
drwxr-xr-x 2 vagrant vagrant 4096 Dec 27 19:33 /home/stack03.dev/
# change ownership to be sure
vagrant@vagrant-ubuntu-trusty-64:~$ sudo chown -R vagrant:vagrant stack03.git/
vagrant@vagrant-ubuntu-trusty-64:~$ sudo chown -R vagrant:vagrant /home/stack03.dev/
vagrant@vagrant-ubuntu-trusty-64:/home/stack03.dev$ git init
Initialized empty Git repository in /home/stack03.dev/.git/
Add the .git directory you created in last set of steps, the --bare
, as a remote and name it origin
.
vagrant@vagrant-ubuntu-trusty-64:/home/stack03.dev$ git remote add origin ~/stack03.git/
Now you'll add the files and commit them.
vagrant@vagrant-ubuntu-trusty-64:/home/stack03.dev$ git add *
vagrant@vagrant-ubuntu-trusty-64:/home/stack03.dev$ git commit -m "initial commit in the Guest VM."
[master (root-commit) 79bbbd2] initial commit in the Guest VM.
vagrant@vagrant-ubuntu-trusty-64:/home/stack03.dev$ git push origin master
# output looks like this:
Counting objects: 4, done.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (4/4), 7.94 KiB | 0 bytes/s, done.
Total 4 (delta 0), reused 0 (delta 0)
remote: >>> updating repository.. <<<
remote: >>> repository connection <<<
remote: From /home/vagrant/stack03
remote: * [new branch] master -> origin/master
remote: HEAD is now at 79bbbd2 initial commit in the Guest VM.
remote: >>> repository reset done <<<
To /home/vagrant/stack03.git/
* [new branch] master -> master
vagrant@vagrant-ubuntu-trusty-64:/home/s
On the Host machine that you're using for local development, you're going to make a directory, git init and add the Guest VM .git as a remote. Then pull the .git repository from the Guest VM. Once that's done, you should be ready to make changes to the files and connect with the Guest VM .git respository.
~/Projects/deploy-tests/vagrant-lempp-stack03 $ mkdir home
~/Projects/deploy-tests/vagrant-lempp-stack03 $ mkdir home/stack03.dev
~/Projects/deploy-tests/vagrant-lempp-stack03 $ cd home/stack03.dev/
~/Projects/deploy-tests/vagrant-lempp-stack03/home/stack03.dev $ git init
Initialized empty Git repository in ...
The convention I've started using is to have the Guest VM be named staging
and the .git directory on the Guest VM that's connected to the --bare
be named origin
~/Projects/deploy-tests/vagrant-lempp-stack03/home/stack03.dev $ git remote add staging vagrant@stack03.dev:~/stack03.git
~/Projects/deploy-tests/vagrant-lempp-stack03/home/stack03.dev $ git remote -v
staging vagrant@stack03.dev:~/stack03.git (fetch)
staging vagrant@stack03.dev:~/stack03.git (push)
~/Projects/deploy-tests/vagrant-lempp-stack03/home/stack03.dev $ git pull staging master
The authenticity of host 'stack03.dev (192.173.68.15)' can't be established.
RSA key fingerprint is 3a:8a:0e:19:c3:e7:51:c0:5e:3a:4c:9e:a6:61:84:c3.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'stack03.dev,192.173.68.15' (RSA) to the list of known hosts.
remote: Counting objects: 4, done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 4 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (4/4), done.
From stack03.dev:~/stack03
* branch master -> FETCH_HEAD
* [new branch] master -> staging/master
~/Projects/deploy-tests/vagrant-lempp-stack03/home/stack03.dev (master)$ git add .
~/Projects/deploy-tests/vagrant-lempp-stack03/home/stack03.dev (master)$ git commit -m "updated the readme_setup markdown to include the full setup details."
[master f838f0d] updated the readme_setup markdown to include the full setup details.
1 file changed, 1 insertion(+)
~/Projects/deploy-tests/vagrant-lempp-stack03/home/stack03.dev (master)$ git push staging master
Counting objects: 5, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 356 bytes | 0 bytes/s, done.
Total 3 (delta 1), reused 0 (delta 0)
remote: >>> updating repository.. <<<
remote: >>> repository connection <<<
remote: From /home/vagrant/stack03
remote: 901f7a7..f838f0d master -> origin/master
remote: HEAD is now at f838f0d updated the readme_setup markdown to include the full setup details.
remote: >>> repository reset done <<<
To vagrant@stack03.dev:~/stack03.git
901f7a7..f838f0d master -> master