Lab 6: Deploy an Online Store

Scenario

IT administrators are regulary tasked with server setup, installation of full application stacks, configuration of various files, and permission management. To optimize IT operational efficiency and mitigates misconfiguration risks, configuration automation emerges as a strategic solution to handle these tasks accurately and reliably. You’ll learn how to use Automation Config to automate application configuration.

Task A. Create Server User - Online Store

  1. Click Configurations > File Server from the side menu
  2. Expand base folder in the file server folder tree
  3. Locate /POV/config-management/linux/opencart/install_opencart.sls
  4. Click install_opencart.sls open its SaltStack State File Install OpenCart State File
  5. Locate the beginning lines of the state file and also the # Creating User section, examine its YAML
    {% set username = salt['pillar.get']('user') %}
    {% set password = salt['pillar.get']('pass') %}
    
    # Creating User
    {{username}}:
        user.present:
            - fullname: {{username}}
            - shell: /bin/bash
            - home: /home/{{username}}
            - groups:
                - sudo
    

Task B. Install Packages - Online Store

  1. Stay opening /POV/config-management/linux/opencart/install_opencart.sls
  2. Locate the # Packages Needed for Install section and examine its YAML
    # Packages Needed for Install
    needed-pkgs:
        pkg.installed:
            - pkgs:
                - mysql-server-8.0
                - mysql-client
                - unzip
                - open-vm-tools
                - apache2
                - php
                - php-mysql
                - libapache2-mod-php
                - php-cli
                - php-common
                - php-intl
                - php-gd
                - php-mbstring
                - php-xml
                - php-zip
                - php-curl
                - php-xmlrpc
                - python3-mysqldb
                - python3-pyinotify
    

Task C. Manage Configuration - Online Store

  1. Stay opening /POV/config-management/linux/opencart/install_opencart.sls
  2. Locate the # Final Script Configuration section and examine its YAML
    # Final Script Configuration
    opencart:
        cmd.script:
            - name: setup.sh {{username}} {{password}}
            - source: "salt://POV/config-management/linux/opencart/setup_opencart.sh" 
            - onlyif: 'test ! -e /var/www/opencart'
    
  3. Locate /POV/config-management/linux/opencart/setup_opencart.sh
  4. Click setup_opencart.sh open its Linux Shell Script Setup OpenCart Shell Script

Task D. Create Job - Online Store

  1. Click Configurations > Jobs in the side menu
  2. Click Create Job button
  3. Input the following details for the new job and save the job
    • Name = Deploy OpenCart for Linux
    • Description = Install OpenCart and run setup script
    • Command = salt
    • Targets = Linux
    • Function = state.apply
    • Environments = base
    • States = POV.config-management.linux.opencart.install_opencart
    • Arguments = (Blank)
    • Job Inputs = (Blank)
    • Pillar override =
      {
          "user": "holuser",
          "pass": "VMware1!"
      }
      
    A new job that apply baseline configuration A new job that apply baseline configuration
  4. Click SAVE button
  5. Now that you’ve created a job

Task E. Run Job - Online Store

  1. In the side menu, click Targets to open the Targets workspace and view your targets
  2. Open Linux minions target
  3. Locate the first Ubuntu server, click the button besides the first column, and select Run job
  4. In the Run Job dialog box
    • Input the following details
      • Job = Deploy OpenCart for Linux (the job you have created in the previous task)
      • States = (Unchanged)
      • Run as Test = false
      • Environments = base
      • Options = (Unchanged) Run Job dialog box
  5. Click RUN NOW button
  6. Click Activity > Completed in the side menu
  7. The job will appear on the list once it is done. If not, Refresh the page in your browser
  8. Check if this job is completed successfully without error
    • Check Success is 1 or higher, and Failed is 0

Task F. Check Results - Online Store

  1. Locate the IP address of the Ubuntu server
  2. Open the IP address in the browser
  3. Check if OpenCart has been successfully installed and configured

Summary

Automation Config automates application deployment reliably:

  • Automating application configuration, spanning application stack setup, file configuration and user management
  • Simplify configuration tasks using State Files
  • File Server in Automation Config facilitate centralized configuration management
  • Run Job for one-click deployment of full application stack and configurations with ease