Dieses Blog durchsuchen

Sonntag, 14. Februar 2016

Setup Magento with Vagrant and Puppet as a local enviroment

You will say. Not yet another Vagrant Puppet Magento tutorial.
But I want to share my experience in that context with you.

After 3 Weeks playing arround with Vagrant and Puppet and hours of horrible config-hells in puppet I got my lokal dev enviroment smootly running.

Here is the result:
Lets bring it up running.

At first you need Virtualbox and Vagrant + Hostmanagerplugin

VirtualBox
https://www.virtualbox.org/

Vagrant
https://www.vagrantup.com/downloads.html
  
Vagrant Hostmanager Plugin
https://github.com/smdahlen/vagrant-hostmanager

I don't explain this 3 components here, that is a little bit off topic.


Lets start

1) Checkout the project:

$ git clone https://github.com/pboethig/vagrant_puppet_magento

$ cd vagrant_puppet_magento

$ vagrant up

After that the shop is running

surf to magento.dev

Thats it

Look into the console or read the readme for logindata

add a phpscript to .bashrc as an alias reboot save

Sometimes you want to add a phpscript to your linux enviroment, so that you can do something fancy on your shell console or even in a shell / bash script like:
ini-config -p all -a fancyparameter 

 The most common way to call a php script on the console is

/usr/bin/php /ugly/long/path/to/your/script.php -p all -a fancyparameter 

Noone wants to rember this path all the time.

The community tells me to put an alias in the ./bashrc. But that wont work, if you want to use your php script as a cmdtool in a shellscript without putting the path to the script in an echo like that:

echo "php /path/to/your/long/ugly/network/php/script.php -a all -p parameter"

You have to do some more.

The shellscripts become ugly and unmaintainable.
To get your phpscripts running as an alias cmdtool  you can just add an exportfunction to your ~/.bash_profile or ~/.bashrc and export this function instead of defining an alias, wich is deprecated, as I know.


now you can simlpy enter

fancyscript -p parametername

on your console.

The function in the ./bashrc is rebootsave, so, that you can use it after rebooting the whole wide world.




Montag, 1. Februar 2016

Vagrant 1.8.0 and 1.8.1 throws error on rsync folders

In version 1.8.01.8.1 a rsync error occures.

There was an error when attempting to rsync a synced folder.
Please inspect the error message below for more info.
Host path: /cygdrive/c/ibrams/webroot/merck.magento.current/magento/html/
Guest path: /home/vagrant/www
Command: rsync -avzO --delete --chmod=Dug=rwx,o=rx,Fug=rw,o=r --no-owner --no-group --rsync-path sudo rsync -e ssh -p 2222 -o ControlMaster=auto -o ControlPath=C:/cygwin/tmp/ssh.348 -o ControlPersist=10m -o StrictHostKeyChecking=no -o IdentitiesOnly=true -o UserKnownHostsFile=/dev/null -i 'C:/ibrams/webroot/merck.magento.current/magento/.vagrant/machines/default/virtualbox/private_key' --exclude .vagrant/ --exclude .git/ --exclude /media/ --exclude /var/ --exclude app/etc/local.xml /cygdrive/c/ibrams/webroot/merck.magento.current/magento/html/ vagrant@127.0.0.1:/home/vagrant/www
Error: Warning: Permanently added '[127.0.0.1]:2222' (ECDSA) to the list of known hosts.
mm_receive_fd: no message header
process_mux_new_session: failed to receive fd 0 from slave
mux_client_request_session: read from master failed: Connection reset by peer
Failed to connect to new control master
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(226) [sender=3.1.2]

To fix that you have to patch your vagrant installation manualy.
This fix is for vagrant 1.8.0 and 1.8.1
vagrant -version shows you version
This is the fix:
Edit $VAGRANT_HOME\embedded\gems\gems\vagrant-1.8.0\plugins\synced_folders\rsync\helper.rb

Remove the following codes (line 77~79):


"-o ControlMaster=auto " +
"-o ControlPath=#{controlpath} " +
"-o ControlPersist=10m " +


at next you can run "vagrant reload" and the error is solved