Ruby muß installiert sein
Git muß istalliert sein
Als Provider für Vagrant installieren wir VirtualBox
https://www.virtualbox.org/wiki/Downloads
Vagrant auf den Windows-Rechner installieren
https://www.vagrantup.com/
downloaden und installieren. Den Rechner neu starten.
Wir erstellen ein Projekt.
z.B.: c:\vagrant\symfony-test\
Hole dir das Vagrantfile mit dem du die VM aufsetzt und ausserdem den bootstrap für jenkins steuerst bzw. includest
[code filename=“Vagrantfile“]
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "precise32"
# The url from where the 'config.vm.box' box will be fetched if it
# doesn't already exist on the user's system.
config.vm.box_url = "http://files.vagrantup.com/precise32.box"
config.vm.provision :shell, :path => "bootstrap.sh"
# 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: 8080, 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"
# 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 "../../xampp_backup/htdocs/fashionsymfony", "/vagrant_data"
end
[/code]
Dann den bootstrap für die ci mit jenkins
darin enthalten sind diverse tools die wir für unser project benötigen
[code filename=“bootstrap.sh“]
#!/usr/bin/env bash # Setup apt-get so we can install jenkins later on wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add - sudo echo 'deb http://pkg.jenkins-ci.org/debian binary/' >> /etc/apt/sources.list sudo apt-get update sudo apt-get install -y jenkins # Install git sudo apt-get install -y git # Install Node.js sudo apt-get install -y python-software-properties python g++ make sudo add-apt-repository ppa:chris-lea/node.js sudo apt-get update sudo apt-get install -y nodejs # Install global node modules sudo npm install -g grunt-cli sudo npm install -g karma sudo npm install -g bower # Install Compass sudo gem install compass # Install jenkins sudo apt-get install -y jenkins sleep 30 # Get client adapter to install plugins wget http://localhost:8080/jnlpJars/jenkins-cli.jar chmod +x jenkins-cli.jar # Install plugins here. java -jar jenkins-cli.jar -s http://localhost:8080/ install-plugin http://updates.jenkins-ci.org/download/plugins/git/1.4.0/git.hpi # Restart jenkins for plugins to take affect. java -jar jenkins-cli.jar -s http://localhost:8080/ restart
[/code]
auf der windows konsole
$ cd c:\vagrant\symfony-test\
$ vagrant up
die VM wird jetzt gebaut und jenkins wird aufgesetzt
im browser http://localhost:8080/
jenkins will ein unlock mit einem passwort
dazu gehe per git.sh in das projekt
$ cd c:\vagrant\symfony-test\
$ sudo cat /var/lib/jenkins/secrets/initialAdminPassword
das passwort für den jenkins unlock wird angezeigt
Dieses eingeben und loslegen