-
Notifications
You must be signed in to change notification settings - Fork 64
Setting up the Development Environment
Follow these steps to setup the development environment to easily test Puppet modules.
- Install VirtualBox
- Install Vagrant
- Clone wso2/puppet-modules
- Setup
PUPPET_HOME
wso2/puppet-modules
includes a testing environment based on Vagrant. When the VM starts, it copies the Puppet folder located by the environment variable PUPPET_HOME
to a location inside the VM and runs a puppet apply
based the given information. This information is specified in the config.yaml
file and mainly includes,
- Product name
- Product version
- Product profile
The Vagrant testing environment can be found in the vagrant
folder.
PUPPET_HOME
is the location of where the Puppet modules exist. For example, in a typical Puppet Master, this is at /etc/puppet
. The distribution from wso2/puppet-modules
can directly be extracted to a target folder to be used as the PUPPET_HOME
.
git clone https://github.com/wso2/puppet-modules.git
cd puppet-modules
mvn clean install
# PUPPET_HOME=/etc/puppet
unzip target/wso2-puppet-modules-{VERSION}.zip -o /etc/puppet
# do any modifications to Puppet modules, README files can be found in /etc/puppet/modules/<module-name>
# copy packs, ex: for WSO2 ESB
cd /etc/puppet
cp <PACKS_PATH>/wso2esb-4.9.0.zip modules/wso2esb/files
cp <PACKS_PATH>/jdk-7u80-linux-x64.tar.gz modules/wso2base/files/
# optional files like MySQL connector etc should also be copied
# cp <PACKS_PATH>/mysql-connector-java-5.1.38.jar modules/wso2esb/files/config/repository/components/lib/
-
config.yaml
contains all the required information for the Dev environment. -
servers section list down the puppet module that needs to be tested.
-
you can add more servers with the same structure
-
make it to false in enabled section if you do not want to spin a VM for that particular server.
-
You can use the following commands to spin VMs.
-
vagrant up
: Will spin all the servers mentioned in theconfig.yaml
(enabled flag should be true or not present) -
vagrant up hostname
: Will spin a server which has the mentioned hostname (eg :vagrant up dev-sandbox-apim.local.dev.wso2.org
)
- Prepare the WSO2 ESB module with the relevant packs and the configuration changes, at the
PUPPET_HOME
(ex:/etc/puppet
).- Copy
wso2esb-4.9.0.zip
to<PUPPET_HOME>/modules/wso2esb/files/
folder. - Copy
jdk-7u80-linux-x64.tar.gz
to<PUPPET_HOME>/modules/wso2base/files/
folder.
- Copy
- Open
<PUPPET_SOURCE>/vagrant/config.yaml
and edit with the relevant details to look like the following. export PUPPET_HOME=/your/puppet/home
---
servers:
-
enabled: true
hostname: wso2esb.4.9.0.dev.wso2.org
facters:
product_name: wso2esb
product_version: 4.9.0
product_profile: default
environment: dev
platform: default
box: ubuntu/trusty64
ip: 192.168.100.2
ram: 2048
cpu: 1
- Navigate to
<PUPPET_SOURCE>/vagrant/
and run the following command.
vagrant up
- You will see an output similar to the following while Vagrant starts a VM with the Puppet provisioner. Wait until the Puppet modules are applied, and the
Finished catalog run in xx.xx seconds
message is displayed.
Provisioning VirtualBox with hostname:
wso2esb.4.9.0.dev.wso2.org
Bringing machine 'wso2esb.4.9.0.dev.wso2.org' up with 'virtualbox' provider...
==> wso2esb.4.9.0.dev.wso2.org: Box 'ubuntu/trusty64' could not be found. Attempting to find and install...
wso2esb.4.9.0.dev.wso2.org: Box Provider: virtualbox
wso2esb.4.9.0.dev.wso2.org: Box Version: >= 0
==> wso2esb.4.9.0.dev.wso2.org: Loading metadata for box 'ubuntu/trusty64'
wso2esb.4.9.0.dev.wso2.org: URL: https://atlas.hashicorp.com/ubuntu/trusty64
==> wso2esb.4.9.0.dev.wso2.org: Adding box 'ubuntu/trusty64' (v20160406.0.0) for provider: virtualbox
wso2esb.4.9.0.dev.wso2.org: Downloading: https://atlas.hashicorp.com/ubuntu/boxes/trusty64/versions/20160406.0.0/providers/virtualbox.box
==> wso2esb.4.9.0.dev.wso2.org: Successfully added box 'ubuntu/trusty64' (v20160406.0.0) for 'virtualbox'!
==> wso2esb.4.9.0.dev.wso2.org: Importing base box 'ubuntu/trusty64'...
==> wso2esb.4.9.0.dev.wso2.org: Matching MAC address for NAT networking...
==> wso2esb.4.9.0.dev.wso2.org: Checking if box 'ubuntu/trusty64' is up to date...
==> wso2esb.4.9.0.dev.wso2.org: Setting the name of the VM: wso2esb.4.9.0.dev.wso2.org
==> wso2esb.4.9.0.dev.wso2.org: Clearing any previously set forwarded ports...
==> wso2esb.4.9.0.dev.wso2.org: Clearing any previously set network interfaces...
==> wso2esb.4.9.0.dev.wso2.org: Preparing network interfaces based on configuration...
wso2esb.4.9.0.dev.wso2.org: Adapter 1: nat
wso2esb.4.9.0.dev.wso2.org: Adapter 2: hostonly
==> wso2esb.4.9.0.dev.wso2.org: Forwarding ports...
wso2esb.4.9.0.dev.wso2.org: 22 (guest) => 2222 (host) (adapter 1)
==> wso2esb.4.9.0.dev.wso2.org: Running 'pre-boot' VM customizations...
==> wso2esb.4.9.0.dev.wso2.org: Booting VM...
==> wso2esb.4.9.0.dev.wso2.org: Waiting for machine to boot. This may take a few minutes...
wso2esb.4.9.0.dev.wso2.org: SSH address: 127.0.0.1:2222
wso2esb.4.9.0.dev.wso2.org: SSH username: vagrant
wso2esb.4.9.0.dev.wso2.org: SSH auth method: private key
wso2esb.4.9.0.dev.wso2.org: Warning: Remote connection disconnect. Retrying...
wso2esb.4.9.0.dev.wso2.org:
wso2esb.4.9.0.dev.wso2.org: Vagrant insecure key detected. Vagrant will automatically replace
wso2esb.4.9.0.dev.wso2.org: this with a newly generated keypair for better security.
wso2esb.4.9.0.dev.wso2.org:
wso2esb.4.9.0.dev.wso2.org: Inserting generated public key within guest...
wso2esb.4.9.0.dev.wso2.org: Removing insecure key from the guest if it's present...
wso2esb.4.9.0.dev.wso2.org: Key inserted! Disconnecting and reconnecting using new SSH key...
==> wso2esb.4.9.0.dev.wso2.org: Machine booted and ready!
==> wso2esb.4.9.0.dev.wso2.org: Setting hostname...
==> wso2esb.4.9.0.dev.wso2.org: Configuring and enabling network interfaces...
==> wso2esb.4.9.0.dev.wso2.org: Rsyncing folder: /home/chamilad/dev/puppet/hieradata/ => /puppet/hieradata
==> wso2esb.4.9.0.dev.wso2.org: Rsyncing folder: /home/chamilad/dev/wso2/puppet-modules/vagrant/ => /vagrant
==> wso2esb.4.9.0.dev.wso2.org: Rsyncing folder: /home/chamilad/dev/puppet/manifests/ => /tmp/vagrant-puppet/manifests-db4088d0e4924f872c01da56d1d7d863
==> wso2esb.4.9.0.dev.wso2.org: Rsyncing folder: /home/chamilad/dev/puppet/modules/ => /tmp/vagrant-puppet/modules-337941db17f91deaff5fe8a40d80f2d9
==> wso2esb.4.9.0.dev.wso2.org: Running provisioner: shell...
wso2esb.4.9.0.dev.wso2.org: Running: inline script
==> wso2esb.4.9.0.dev.wso2.org: stdin: is not a tty
==> wso2esb.4.9.0.dev.wso2.org: Notice: Preparing to install into /etc/puppet/modules ...
==> wso2esb.4.9.0.dev.wso2.org: Notice: Downloading from https://forge.puppetlabs.com ...
==> wso2esb.4.9.0.dev.wso2.org: Notice: Installing -- do not interrupt ...
==> wso2esb.4.9.0.dev.wso2.org: /etc/puppet/modules
==> wso2esb.4.9.0.dev.wso2.org: └── puppetlabs-stdlib (v4.11.0)
==> wso2esb.4.9.0.dev.wso2.org: Notice: Preparing to install into /etc/puppet/modules ...
==> wso2esb.4.9.0.dev.wso2.org: Notice: Downloading from https://forge.puppetlabs.com ...
==> wso2esb.4.9.0.dev.wso2.org: Notice: Installing -- do not interrupt ...
==> wso2esb.4.9.0.dev.wso2.org: /etc/puppet/modules
==> wso2esb.4.9.0.dev.wso2.org: └── 7terminals-java (v0.0.8)
==> wso2esb.4.9.0.dev.wso2.org: Running provisioner: puppet...
==> wso2esb.4.9.0.dev.wso2.org: Running Puppet with site.pp...
==> wso2esb.4.9.0.dev.wso2.org: stdin: is not a tty
==> wso2esb.4.9.0.dev.wso2.org: Notice: Scope(Wso2base::Server[/mnt/10.0.2.15/wso2esb-4.9.0]): Starting WSO2 product [name] wso2esb, [version] 4.9.0, [CARBON_HOME] /mnt/10.0.2.15/wso2esb-4.9.0
==> wso2esb.4.9.0.dev.wso2.org: Notice: Scope(Wso2base::Clean[/mnt/10.0.2.15/wso2esb-4.9.0]): Cleaning WSO2 product [name] wso2esb, [version] 4.9.0, [mode] zero
==> wso2esb.4.9.0.dev.wso2.org: Notice: Scope(Wso2base::Install[/mnt/10.0.2.15/wso2esb-4.9.0]): Installing WSO2 product [name] wso2esb, [version] 4.9.0, [CARBON_HOME] /mnt/10.0.2.15/wso2esb-4.9.0
==> wso2esb.4.9.0.dev.wso2.org: Notice: Scope(Wso2base::Patch[/mnt/10.0.2.15/wso2esb-4.9.0]): Patching WSO2 product [name] wso2esb, [version] 4.9.0, [PATCH_DIR] /mnt/10.0.2.15/wso2esb-4.9.0/repository/components/patches
==> wso2esb.4.9.0.dev.wso2.org: Notice: Scope(Wso2base::Configure[/mnt/10.0.2.15/wso2esb-4.9.0]): Configuring WSO2 product [name] wso2esb, [version] 4.9.0, [CARBON_HOME] /mnt/10.0.2.15/wso2esb-4.9.0
....
....
Finished catalog run in 23.87 seconds
- To destroy the test VM, simply run
vagrant destroy -f
.