[Tutorial] Step-by-Step Guide on Installing and Configuring WSO2 App Factory Puppet Master Using Virtualbox
- Anuruddha Premalal
- Software Engineer - WSO2
A separate puppetmaster can make a developer’s life easy because it offers flexibility in terms of altering the puppetmaster and testing new features. Having a puppetmaster in the same host virtualbox will also reduce network latencies. This tutorial provides a step-by-step guide to installing and configuring WSO2 App Factory puppet master in a virtualbox.
Follow the steps below to install and configure WSO2 App Factory puppet master using virtualbox.
Create a new linux instance in virtualbox (we have used Ubuntu 14.04 instance for this tutorial)
Follow this tutorial to create an Ubuntu VM.Configure networking interfaces in VM to access the Internet and communicate with the local machine.
2.1 Configure VM to access Internet.
Figure 01
This will allow the VM to access the broader internet through your host’s connection. You’ll be able to download packages; however, you will not be able to access any VM resources from your host machine just yet.
2.2 Add a host-only network interface
We’ll need to add another network adapter to the VM; this time, it’ll be a Host-Only Adapter. By using this type of adapter, you’ll be able to access a private, virtual network consisting solely of your host and any guests. Any of the member VMs can access each other, but nothing outside of this self-contained can get in.
You might need to create a host-only network from File > Preferences > VirtualBox > Settings
Figure 02
Figure 03
2.3 Configure an IP address to host-only network
We need to have a static IP for the puppet master server. Login to the server and execute the following command:
>ifconfig eth1 192.168.56.101 netmask 255.255.255.0 up
Use whatever IP on your host-only network you wish to. This binds a network interface to one of the IP addresses on your host-only network (eth0 was bound to the NAT adapter). Now you should be able to SSH into your guest from your host (for instance) using this IP address.
This is just temporary; however, once you reboot, this configuration will disappear. To make it permanent, add this to your / etc/ network/ interfaces file (as root):
# The host-only network interface auto eth1 iface eth1 inet static address 192.168.56.101 netmask 255.255.255.0 network 192.168.56.0 broadcast 192.168.56.255
Start the eth1 network interface
>eth1 up
and this interface should now show up when you type ifconfig.
Optional: Configuring ssh access to the VM
Sometime you’ll find that it’s easier to use the VM terminal from your host machine. In that case, you’ll need to install a ssh server in the VM.
>sudo apt-get install openssh-server
Configuring a hostname for puppet master
We will be using puppet.apfactory.wso2.com as the puppetmaster hostname. Execute the following command as the root user
> hostname puppet.appfactory.wso2.com > /etc/hostname > echo "192.168.56.101 puppet.appfactory.wso2.com" >gt; /etc/hosts
Make sure you’ve used the IP address of the host-only interface for the above command.
Install puppet master
Note: Be sure to use Puppet Master version 3.7 or above
4.1 Enable the repository for Ubuntu 14.04 Trusty Tahr
>wget https://apt.puppetlabs.com/puppetlabs-release-trusty.deb
>sudo dpkg -i puppetlabs-release-precise.deb
>sudo apt-get update4.2 Install puppet master
>sudo apt-get install puppetmaster
Configuring a file server to manage appfactory distribution packs. We use apache2 for this tutorial.
>sudo apt-get install apache2
We need this file server to manage the distribution packs of all products involved in an App Factory deployment, such as WSO2 App Factory, API manager, ELB, application server, etc.
Create a folder named software inside the Apache document root (/var/www) and download the following distribution packs to the /var/www/software folder:
WSO2 products Other products wso2appfactory-2.1.0.zip apache-maven-3.0.5-bin.tar.gz wso2as-5.2.1.zip apache-activemq-5.9.1-bin.tar.gz wso2bam-2.4.1.zip apache-stratos-4.0.0-wso2v1.zip wso2bps-3.2.0.zip apache-stratos-cartridge-agent-4.0.0-wso2v1-bin.zip wso2mb-2.2.0.zip apache-stratos-load-balancer-4.0.0-wso2v1.zip wso2ss-1.1.0.zip gitblit-1.4.1.zip wso2ues-1.1.0.zip jdk-7u51-linux-x64.tar.gz wso2-private-paas-4.0.0-installer.zip mysql-connector-java-5.1.29-bin.jar
Configure apache2 to point to /var/www/software as document root
Edit the /etc/apache2/sites-enabled/000-default.conf with the following configuration<VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /var/www/software ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost>
Restart the apache2 service
>sudo service apache2 restart
- Configuring puppet master
6.1 Install git
>sudo apt-get install git
6.2 Clone appfactory code-base
>git clone https://github.com/wso2/product-af.git
6.3 Copy the puppet manifest to a desired location
>cp product-af/modules/puppet-manifests /home/master
6.4 Carry out the configuration changes in nodes.pp
Update the following parameters of the puppet-manifests/appfactory/manifests/nodes.pp
$package_repo = 'https://192.168.56.101'
Add the correct package repository url created in step 5
$domain = 'appfactory.wso2.com'
Just update the first occurrence of this parameter
$hosts_mapping = [ "192.168.56.101,puppet.${domain}",
In $hosts_mapping there’s hard coded IP change it to the puppet master IP
## Private paas configurations $stratos_domain = "paas.${wso2_env_domain}" #Private paas IAAS configuration $iaas = "os" $iaas_region = "RegionOne" $iaas_cartridge_image = "34dd924f-ef3d-49ae-884a-4784f0330f1b" $os_identity = "openstackDemo:admin" $os_credentials = "password" $os_jclouds_endpoint = "https://appfactorycloud.private.wso2.com:5000/v2.0" $os_keypair_name = "appfackey" $os_security_groups = "default"
6.5 Edit /etc/puppet/puppet.conf file with the following configurations
puppet.conf is the main configuration file of the puppet. We’ll need to point appfactory puppet manifest via this configuration file. Additional configurations are highlighted in green.
[main] logdir=/var/log/puppet vardir=/var/lib/puppet ssldir=/var/lib/puppet/ssl rundir=/var/run/puppet factpath=$vardir/lib/facter templatedir=$confdir/templates [master] # These are needed when the puppetmaster is run by passenger # and can safely be removed if webrick is used. ssl_client_header = SSL_CLIENT_S_DN ssl_client_verify_header = SSL_CLIENT_VERIFY autosign=true [appfactory] environment=appfactory modulepath=/home/master/puppet-manifests/appfactory/modules templatedir=/home/master/puppet-manifests/appfactory/templates manifest=/home/master/puppet-manifests/appfactory/manifests/site.pp manifestdir=/home/master/puppet-manifests/appfactory/manifests/
The additional configs compared to the default puppet.conf are;
autosign=true in [master]
This configuration allows to sign the certificates requests without manual intervention (use this configuration only in a development environment to prevent security vulnerabilities)[appfactory] environment=appfactory modulepath=
/appfactory/modules templatedir= /appfactory/templates manifest= /appfactory/manifests/site.pp manifestdir= /appfactory/manifests/ Now if you browse the 192.168.56.101 URL from your host machine web browser you should be able to see the packages we have copied to /var/www/software folder. Note that you cannot proceed without this step.
That’s all you need to setup WSO2 App Factory with minimal configurations. To install WSO2 App Factory follow the on-premise installation guide [4]. Here, instead of pointing to an external puppet master, you could point it to the configured virtual machine IP.