Disclaimer: This topic is actually under intensive rewrite

Fast to set-up VM developer environment with Vagrant provisioning

Global description

Why? : EasyDevelopment aims to encourage to get new contributors, and hopefully core or plugin developers.

What? The following Vagrant provisionning, enable user to get in one command the source code (and source control), all dependencies for developpment. It's an other manner than the classical way, see GettingStarted.

For who? To correct/purposed a minor change, developp new plugin, or for a core developper.

In future? Could be useful for set-up special developpment environnment for testing, reproduce bug and then enable to correct them.

Detailed explanation

Take advantage of VirtualBox and Vagrant to quickly create a development environment. The environment will use git to grab the latest release and trunk code. Developer will still develop on preferred platform and familiar tools, but Foswiki standard build tools and git will be set-up ready to go in a recommended configuration.
  • see the latest github project page: https://github.com/Jlevens/FoswikiVagrantNginx
  • Basically, it install all what it needs for accessing source code and submit it to GitHub. For doing this in a platform independent way, It's used an virtual machine for running all stuff and Vagrant do the provisioning for set up, start this installation.

Get started !

Prerequisite

install

  • as simple as the following commands:
 
git clone https://github.com/Jlevens/FoswikiVagrantNginx.git
cd FoswikiVagrantNginx
vagrant up 
  • this command launch all the installation process, download all dependencies. You need to be ready to download lot of content from web.
  • After install completed, go to http://localhost:8080

use your development environment

  • connect over ssh on this VM instance
  • then, go to the /var/www/fw-prod/ directory
  • you have access to the source code of foswiki and you have all the git command
  • for summary the commands are the following:
ssh vagrant@localhost -p 2220 
cd /var/www/fw-prod/

issue and well working environment known

  • it has been tested and reported under this different environment:
    • Ubuntu XXX TODO add version
    • Debian Jessie (stable, 8.0) with the latest vagrant package (available, without any dependencies on their download page in a debian format)

History

During FoswikiCamp2011 work was started on this primarily to provide JulianLevens a development environment.

OlivierRaginel had already created a VirtualBox with Vagrant provisioning to provide a test environment. It was a natural extension to use this technology to create an easy to set-up dev environment for anybody.

The main development is actually on the host computer (Windows for me) where the main git repository is located.

Work has progressed to the point where I have two web-sites for Release01x01 and master. The directories which hold these web-sites are also git repositories. Changes are pulled into master or Release01x01 as appropriate.

See https://github.com/Babar/foswiki-vagrant

Then for several reason, JulianLevens has restarted the project from scratch and providing his implementation: https://github.com/Jlevens/FoswikiVagrantNginx.git

Current Issues and To Do

  • add option to control if you want access only in localhost or in your Host public IP

most of things are outdated, rewrite in progress TODO wip
  1. I cannot actually git pull into master or Release01x01: permission denied
    • I don't understand. If you sudo -Hsu foswiki then you should be able to git pull.
    • WARNING: Vagrant creates a deploy branch by default, so checkout the proper one before doing anything
  2. Configure shows various errors and warnings (same for both) need to fix: ideally during provisioning
    • Fixed everything I could fix. Rest are warnings which don't apply, not worth fixing.
    • Btw, default configure passwd is admin/foswiki, and configure password is foswiki
  3. As a git newbie need to better understand what I'm doing smile
    • I wrote some docs too, and many people completed them
  4. Capture info from IRC logs which explains what the VM and Vagrant do
    • Basically, the VM (so VirtualBox) runs a virtual machine with Linux (Debian squeeze) on it, and everything pre-installed. vagrant is only a framework around it to boot the VM, and then use chef to provision it, which means it runs some scripts to ensure it's installed and configure the way we (I) tell it it should be.

Recent Notes and Qs

most of things are outdated, rewrite in progress TODO wip
  1. Some docs to write: I needed to 'vagrant destroy' followed by 'vagrant up' to start afresh, but received an error, which suggested runnig VBoxManage to debug
    • Result was: VBoxManage.exe: error: Machine settings file 'C:\Users\JulianMark\VirtualBox VMs\Debian64\Debian64.vbox' already exists
    • I had somehow left behind 4 old VBoxes, so I deleted the lot. That fixed things
  2. Questions for Babar:
    1. What users are set up and why?
      • vagrant: user used by vagrant to run provisionning
      • foswiki: user used for foswiki, owns all the application
      • www-data: user used by apache, owns the files when running the application
    2. What's the group structure and why?
      • I don't think I've setup any group. vagrant and foswiki have their own group because that's how Debian creates users
    3. What's the sudo set-up and why?
      • both vagrant and foswiki have full sudo access. It is not supposed to be secure, it's a development environment
    4. There are scripts now (to switch between dev/git/apache states or some such), again why?
      • Apache runs as www-data, but it needs to be able to write logs and files (data), so in order to run Foswiki, one needs to chown a few directories. The dev.sh script takes care of that. When one wants to commit back, git doesn't like extra files, and need full write access, so dev.sh puts back the rights. I don't know an apache state.
    5. I messed up things before by using chmod when I should have chown'ed. I also copied over test data, including my own Main and System webs and keeping the same name
      • Hindsight says copy my Main as Main1 and then replace all Main. references in my other webs to Main. Also, just leave System alone, my version is probably not important
        • Keeps these extra dirs .ignored by git
        • Config USERSWEB as Main1
          • I could extend to config SYSTEMWEB as System1 (and change references to System), but I shouldn't need to
        • Does this make sense, or am I missing a better way?
      • I'm not sure what you're trying to achieve. I always clear the
      • setup, and I think the dev.sh script takes care of adding one user... oops, need to fix that.
    6. What's the best way to set-up a new extension?
      • create_new_extension.pl works, but should we require the host to have perl installed
        • minimal host requirements the goal, right?
          • Agreed.
        • only an issue for Windows (and we've already installed Ruby)
          • If the rex stuff that Sven keeps harping on about, becomes a viable vagrant then we would need perl and no ruby, but ...
          • I still really don't see how Rex competes with vagrant. For me it competes with chef, but I haven't looked into it much
        • if so, then only Strawberry perl for Windows? (Everything else is Unix based so perl comes for free?)
    7. Overall, I'm trying to get into a proper rhythm, I've hacked around just to make progress, but ultimately that's rubbish
      • Suggestions please

Discussion

Topic revision: r7 - 09 Jul 2015, GuilainCabannes - This page was cached on 23 Jan 2021 - 18:23.

The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy