Infrastructure Application Deployment

Pre-requisites for Client-Server Setup

Following are the pre-requisites for configuring all the client-servers.

Jamcracker Chef Servers are used for infrastructure deployment on any client-server. So, to communicate between Jamcracker platform and the client-server, it is necessary to configure all the client-servers with a static IP and allow the client-servers to access Jamcracker Chef Server through a dedicated port. Following are the pre-requisites for configuring the client-servers along with Jamcracker Chef Server and Ports:

  • Physical / Virtual Server with operating system Centos Core version 7 installed along with update’s.
  • Server Should have static IP.
  • Client server should able to communicate to Jamcracker Chef Servers along with the Ports.

    Telnet from client-server to the Jamcracker Chef Servers to ensure the communication is established.

    • telnet 35.153.27.29 80
    • telnet 35.153.27.29 443
    • telnet 35.153.27.29 8081
    • telnet 34.229.34.212 80
    • telnet 34.229.34.212 443
  • Client should share their Server IP address and Gateway IP address to the Jamcracker.
Note: If you are using a private IP, then you must have site to site VPN setup between your environment and the Jamcracker Chef Server.
Setup the Client Laptop / Desktop as a Chef Workstation

Workstation

Chef Workstation is a computer that is configured to run Knife (Chef Client), to synchronize with the Jamcracker Chef and repo server, and interact between all the servers for deployment.

User Registration Process

First time user must register as a new user in a Chef Workstation and create a login authentication to access the Jamcracker Chef and repo server.

Register as a user in Chef server using the Chef Server console. Once registration is done you will receive an encrypted reset password link through an email. It is recommended that you must reset your password and login to Chef Server.

Once you complete the registration process, please contact Jamcracker Chef Admin either through E-mail Operations@jamcracker.com or through Service Delivery Manager for:

  • Clients will to receive invitation email upon backend process completion.
  • User should log into Chef server and accept the invitation.
  • Navigate to Administrator > Users page and select the user from the list and click the Actions option available at the right corner and then, click the "Reset Key" link and download the user pem key.
  • Navigate to Administrator > Organization page and select the organization in list of organizations and click theActionsoption available at the right corner and then, click the "Generate Knife Config" link and download the knife.rb file.

Setup the Chef Workstation for Linux Operating System CentOS-7

Follow the below instructions to configure a Chef Workstation in any Linux environment:

Install ChefDK: Login as root user and execute below commands:

cd ~ wget https://packages.chef.io/stable/el/7/chefdk-0.11.2-1.el7.x86_64.rpm
rpm -ivh chefdk-0.11.2-1.el7.x86_64.rpm 
  • Fetch ssl certificate using below commands.
knife ssl fetch
  • Verify ChefDK Installation
knife ssl check
  • Export Editor to modify the cookbook attributes using below syntax:
vi ~root/.bash_profile
export EDITOR=vi
source ~root/.bash_profile
  • Copy downloaded <username>.pem, knife.rb files in User Registration section in the following location /root/chef-repo/.chef
  • Execute the below command to check the connectivity between Chef Client & Jamcracker Chef Server.
knife node list

Setup the Chef Workstation for Windows Operating System

Follow the below instructions to configure a Chef Workstation in any Linux environment:

Download the Chef client package.

  • Run the MSI package and use all the default options:

  • Copy downloaded <username>.pem, knife.rb files in user registration section into following location c:/chef
  • Execute below command to check whether able to connect Chef server or not from Workstation.
knife node list
  • Set the editor to modify the cookbook attributes.
  • Please execute the knife commands from the location of <username>.pem file.
Note: For other operating systems, download rpm files.

Setup the Bootstrap

To establish connection between Chef servers and client-servers, it is recommended to execute bootstrap command from the Chef Workstation (laptop/desktop).

Client should have below information ready:

  • client_server_ip : -(servers IP where we are going to deploy the application)
  • user name :- (client can use root or similar, user should have sudo permission )
  • node_name: -(client can give any unique name of the server)
  • Pem_file_ location: (where you saved the pem file please provide the complete path).

If you have client-server password use Option 1

OR

If you have client-server pem file use Option 2.

Option 1: The system will prompt for a password. Provide a valid password.

knife bootstrap <client_server_ip> --sudo -x <user> -N <node_name> 

Option 2:

knife bootstrap <client_server_ip> --sudo -x <user> -i <<pem_file_ location>> -N <node_name> 

Chef Roles for Single Server Installation

Client should provide proper key value based on their server environment when they are editing Chef server role using client knife as shown below for infrastructure setup.

  1. Postgres Installation: Run the below command in Chef Workstation and provide proper values/cross check the existing values and click Save and Close.
    knife role edit postgres
    {
      "name": "postgres",
      "description": "This role will install postgres",
      "json_class": "Chef::Role",
      "default_attributes": {
    
      },
      "override_attributes": {
        "postgres": {
          "location": "/var/lib",
          "port": "5432",
          "admin_user": "tempadmin",
          "admin_passwd": "jamcracker"
        }
      },
      "chef_type": "role",
      "run_list": [
        "recipe[postgres@0.1.3]"
      ],
      "env_run_lists": {
    
      }
    }
  2. JDK and Ant Installation: Run the below command in Chef Workstation and privide proper values/cross check the existing values and click Save and Close.
    knife role edit jdk
    {
      "name": "jdk",
      "description": "",
      "json_class": "Chef::Role",
      "default_attributes": {
    
      },
      "override_attributes": {
    
      },
      "chef_type": "role",
      "run_list": [
        "recipe[jdk@0.1.0]",
        "recipe[jdk::timezone@0.1.0]"
      ],
      "env_run_lists": {
    
      }
    }
  3. Jboss Installation: Run the below command in Chef Workstation and provide proper values/cross check the existing values and click Save and Close.
    knife role edit jboss
    {
      "name": "jboss",
      "description": "",
      "json_class": "Chef::Role",
      "default_attributes": {
    
      },
      "override_attributes": {
    
      },
      "chef_type": "role",
      "run_list": [
        "recipe[jboss@0.1.0]"
      ],
      "env_run_lists": {
    
      }
    }
  4. Tomcat Installation: Run the below command in Chef Workstation and privide proper values/cross check the existing values and click Save and Close.
    knife role edit tomcat
    {
      "name": "tomcat",
      "description": "",
      "json_class": "Chef::Role",
      "default_attributes": {
    
      },
      "override_attributes": {
        "tomcat": {
          "job_server_ip": "localhost"
        }
      },
      "chef_type": "role",
      "run_list": [
        "recipe[tomcat@0.1.3]"
      ],
      "env_run_lists": {
    
      }
    }
  5. Heat Newton Installation: Run the below command in Chef Workstation and provide proper values/cross check the existing values and click Save and Close.
    knife role edit heat-newton-ops
    {
      "name": "heat-newton-ops",
      "description": "",
      "json_class": "Chef::Role",
      "default_attributes": {
    
      },
      "override_attributes": {
        "heat": {
          "jboss_ip": "localhost",
          "rabbit_hosts": [
            "localhost"
          ],
          "sqlconnection": "postgresql+psycopg2://jcp7125_heat:jcp7125_heat@localhost/jcp7125"
        }
      },
      "chef_type": "role",
      "run_list": [
        "recipe[heat-newton@0.1.1]"
      ],
      "env_run_lists": {
    
      }
    }
  6. Apache Installation: Run the below command in Chef Workstation and provide the proper values/cross check the existing values and click Save and Close.
    Note: Get the JSDNApache_**.tar details from release notes. (For release note please contact service delivery manager).

    Download JSDNApache_*****.tar to the target server /tmp folder.

    knife role edit jsdnapache
    {
      "name": "jsdnapache",
      "description": "",
      "json_class": "Chef::Role",
      "default_attributes": {
    
      },
      "override_attributes": {
        "jc_apache": {
          "jsdnapache_tar": "JSDNApache_7.12.7.0_27-11-2018-09-57.tar",
          "appServer": [
            "localhost"
          ]
        },
        "cms": {
          "db_passwd": "jcpcms7127",
          "database": "jcpcms7127",
          "db_user": "jcpcms7127",
          "db_host": "localhost"
        }
      },
      "chef_type": "role",
      "run_list": [
        "recipe[JC_Apache@0.2.2]"
      ],
      "env_run_lists": {
    
      }
    }

Deploy Infrastructure through Scripts - Single Server

Follow the below instructions to deploy the JSDN Infrastructure in a Single Server using shell script. On the Single Server install all the components such as Postgres, JDK and Ant JBOSS, TOMCAT, Heat Newton and Apache.

Extract/Download the infra.sh script file to your server /home location.

Change the permissions for the downloaded scripts by using below command as root user.

chmod 777 /home/infra.sh

Execute the script in server by using below command as root user.

sh /home/infra.sh
Note: Script execution will take time to complete.

After successfully deployed, the output is displayed as below screen shot.

Chef Roles for Multi Server Installation

Client should provide proper key value based on their server environment when they are editing Chef server role using client knife as shown below for infrastructure setup.

  1. Postgres Installation: Run the below command in Chef Workstation and provide proper values/cross check the existing values and click Save and Close.
    knife role edit postgres
    {
      "name": "postgres",
      "description": "This role will install postgres",
      "json_class": "Chef::Role",
      "default_attributes": {
    
      },
      "override_attributes": {
        "postgres": {
          "location": "/var/lib",
          "port": "5432",
          "admin_user": "tempadmin",
          "admin_passwd": "jamcracker"
        }
      },
      "chef_type": "role",
      "run_list": [
        "recipe[postgres@0.1.3]"
      ],
      "env_run_lists": {
    
      }
    }
  2. JDK and Ant Installation: Run the below command in Chef Workstation and provide proper values/cross check the existing values and click Save and Close.
    knife role edit jdk
    {
      "name": "jdk",
      "description": "",
      "json_class": "Chef::Role",
      "default_attributes": {
    
      },
      "override_attributes": {
    
      },
      "chef_type": "role",
      "run_list": [
        "recipe[jdk@0.1.0]",
        "recipe[jdk::timezone@0.1.0]"
      ],
      "env_run_lists": {
    
      }
    }
  3. Jboss Installation: Run the below command in Chef Workstation and provide proper values/cross check the existing values and click Save and Close.
    knife role edit jboss
    {
      "name": "jboss",
      "description": "",
      "json_class": "Chef::Role",
      "default_attributes": {
    
      },
      "override_attributes": {
    
      },
      "chef_type": "role",
      "run_list": [
        "recipe[jboss@0.1.0]"
      ],
      "env_run_lists": {
    
      }
    }
  4. Tomcat Installation: Run the below command in Chef Workstation and provide proper values/cross check the existing values and click Save and Close.
    knife role edit tomcat
    {
      "name": "tomcat",
      "description": "",
      "json_class": "Chef::Role",
      "default_attributes": {
    
      },
      "override_attributes": {
        "tomcat": {
          "job_server_ip": "<<Job server IP>>"
        }
      },
      "chef_type": "role",
      "run_list": [
        "recipe[tomcat@0.1.3]"
      ],
      "env_run_lists": {
    
      }
    }
  5. Heat Newton Installation: Run the below command in Chef Workstation and provide proper value/cross check the existing values and click Save and Close.
    knife role edit heat-newton-ops
    {
      "name": "heat-newton-ops",
      "description": "",
      "json_class": "Chef::Role",
      "default_attributes": {
    
      },
      "override_attributes": {
        "heat": {
          "jboss_ip": "<<App server IP>>",
          "rabbit_hosts": [
            "localhost"
          ],
          "sqlconnection": "postgresql+psycopg2://jcp71261_heat:jcp71261_heat@<<DB_Server_IP>>/jcp71261"
        }
      },
      "chef_type": "role",
      "run_list": [
        "recipe[heat-newton@0.1.1]"
      ],
      "env_run_lists": {
    
      }
    }
  6. Apache Installation: Run the below command in Chef Workstation and provide the proper values/cross check the existing values and click Save and Close.
    Note: Get the JSDNApache_**.tar details from release notes. (For release note please contact service delivery manager).
    Download JSDNApache_*****.tar to the target server /tmp folder.
    knife role edit jsdnapache
    {
      "name": "jsdnapache",
      "description": "",
      "json_class": "Chef::Role",
      "default_attributes": {
    
      },
      "override_attributes": {
        "jc_apache": {
          "jsdnapache_tar": "JSDNApache_7.12.7.0_27-11-2018-09-57.tar",
          "appServer": [
            "<<AppServerIP>>"
          ]
        },
        "cms": {
          "db_passwd": "jcpcms7127",
          "database": "jcpcms7127",
          "db_user": "jcpcms7127",
          "db_host": "<<DBServerIP>>"
        }
      },
      "chef_type": "role",
      "run_list": [
        "recipe[JC_Apache@0.2.2]"
      ],
      "env_run_lists": {
    
      }
    }

Deploy Infrastructure through Scripts - Multi Server

Follow the below instructions to deploy the JSDN Infrastructure in a Multi-Server using shell script and server detail list. On the Multi Server installation the components will be divided in multi servers as like DB Server, Postgres, App Sever, Web Server, and Job Server.

  • In DB Server, install Postgres
  • In App Server , install JDK, Ant, JBOSS, TOMCAT, and Guacamole
  • In Web Server, install Apache
  • In Job Server, install JDK, Ant, JBOSS, TOMCAT, Guacamole, and Heat Newton

Extract/Download multiserver-app.sh & serverdetail.txt script files to your app1 server /home location.

Change the permissions for the downloaded scripts by using below command as root user as shown below:

chmod 777 /home/serverdetail.txt
chmod 755 /home/multiserver-app.sh

Update the server details in the file serverdetail.txt

Example: As per below screen shot:

Install sshpass tool in app1 server by using below command as root user.
yum install sshpass -y

Execute the script from app1 server by using below command as root user.

sh /home/multiserver-app.sh
Note: The Script execution will take some time to complete.

A Confirmation message is displayed, if all the scripts are executed successfully. If in-case the script fails, you might have to re-execute the scripts.

Services Stop/Start through Scripts - Single Server

Follow the below instructions to stop/start the services in a Single Server using shell script. On the Single Server stop/start all the components such as Postgres, JDK and Ant JBOSS, TOMCAT, Heat Newton and Apache.

Extract/Download the services.sh script file to your server /home location.

Change the permissions for the downloaded scripts by using below command as root user.

chmod 777 /home/services.sh

Execute the script in server by using below command as root user.

sh /home/services.sh status
sh /home/services.sh stop
sh /home/services.sh start

Services Stop/Start through Scripts - Multi Server

Follow the below instructions to stop/start the services in a Multi-Server using shell script and server detail list. On the Multi Server installation the components will be divided in multi servers as like DB Server, Postgres, App Sever, Web Server, and Job Server.

  • In DB Server, install Postgres
  • In App Server , install JDK, Ant, JBOSS, TOMCAT, and Guacamole
  • In Web Server, install Apache
  • In Job Server, install JDK, Ant, JBOSS, TOMCAT, Guacamole, and Heat Newton

Extract/Download masterscript.sh & serverdetail.txt) script to your app1 server /home location.

Change the permissions for the downloaded scripts by using below command as root user as shown below

chmod 777 /home/serverdetail.txt
chmod 755 /home/masterscript.sh

Update the server details in the file serverdetail.txt

Example: As per below screen shot:

Execute the script from app1 server by using below command as root user.

sh /home/masterscript.sh stop (To stop all services)
sh /home/masterscript.sh start (To start all services)

A Confirmation message is displayed, if all the scripts are executed successfully. If in-case the script fails, you might have to re-execute the scripts.

Important: Once the deployment is successfully completed. It is recommended to change the password of the servers.