Jenkins: Get a grip on the Butler

Kevin Flanagan…
Feb272020
 
 
 
 
 
 

Jenkins automates Continous Integration from developers to the front end of a website, ensuring backups are done on live data on the front end while also keeping development version organized and accessible for easy deployment if necessary.

Your Drupal site could be collecting important information at any point. Whether it be that lead for the sales team that is going to be the next big account you work with or a fresh story that's being created by someone in marketing that has 20 other things to do today but is writing a story on the fly on the site and is going to be really pissed when they find that its missing tomorrow for some bizarre reason to them. Any updates to its architecture must be seamless, even if it's getting done at 2pm in the afternoon, so that everyone is happy, right up to the CTO. Jenkins sets up and executes the automation necessary for this to happen minute and minute and month after month. 

Tasks for March 4th,

Note:

  • things in purple outside the scope of this task, but recorded here as a log of daily progress. 
  • things in green are actual steps recorded for either a UI admin update or something performed from a command line.

 

  1. KearsargeNH.com ... finish styling of the 21  warrant article block; match the book title page styling to the book page styling
    1. Location: ping kearrsargnh.com
      1. open cmd do a ping kearsargnh.com
      2. returns: 69.30.211.106
  2. NEW SWAGGER DEMO SYSTEM 
    1. Location: create a new demo space called swagger.mwvTECH.com, and password-protect (w/i apache) for access only by invited folks
      1. open cmd do a ping mwvtech.com
      2. returns: 69.30.211.106
    2. get IP address
      1. 69.30.211.106
    3. use IP address to index the right server to work with
      1. Open Webmin and
        1. (update LINUX/CentOS source modules as an administrative task for the Webmin server instance)
          • create a new URL for a site w/i BIND
            • ​​​​​​​make a CNAME record for swagger.mwvtech.com
              • name = swagger; real name = @
              • apply the configuration
              • test the new domain name with a ping
              • WORKS
          • create a new MYSQL database to use for the new URL
            • (maintenance for me) within this Drupal instance, add the ability to add color text to the body field;
              •  /admin/config/content/formats/manage/full_html
              • turns out it is not there, by default, add the module for adding the button;
                • open SSH window
                • go the webroot dir for the instance of this site
                  • /var/www/html-virt/mwvtech.com
                  • run composer require drupal/colorbutton
                    • ​​​​​​​this will install the module as well as the dependent libraries
                    • enable the button for rich text, and then return to editing notes here.
            • name it swagger.mwvtech.com
          • create a new filespace folder within the webroot index for the apache server
            • mkdir /var/www/html-virt/swagger.mwvtech.com
          • create a new .conf file for the URL, or add a definition to an existing .comf file; include just a:80 directive
            • see updates in /etc/httpd/conf.d/mwvtech.com.conf
          • return to Webmin and restart apache
            • open a browser and test to see if swagger.mwvtech.com exists on the internet: SUCCESS
          • add a letsencrypt SSL cert to it with certbot
            • goto a command line and run certbot
            • restart apache so that the SSL cert is recognized 
            • test the https://swagger.mwvtech.com URL to see if it works: SUCCESS
          • (admin) enable strike through text w/i this editor
          • restart server, or restart BIND; MYSQL and APACHE servers
          • test the new URL: su
          • run composer and install a Drupal instance
            • let's pick the APIGEE distribution ( https://www.drupal.org/project/apigee_devportal_kickstart
            • rename the webroot folder for swagger.mwvtech.com to swagger2.mwvtech.com folder
            • open an SSH window, go to the webroot directory parent folder and run :
              • composer create-project apigee/devportal-kickstart-project:8.x-dev swagger.mwvtech.com --no-interaction
            • This will install APIGEE Drupal into https://swagger.mwvtech.com's root directory
            • after composer has finished, run a chown on the newly installed swagger.mwvtech.com folder.
              • chown -R apache:apache /var/www/html-virt/swagger.mwvtech.com
            • delete the renamed swagger2.mwvtech.com folder
            • change the apache config so that the root is now in the 'web' directory as opposed to the 'docroot' directory;

              •   DocumentRoot "/var/www/html-virt/swagger.mwvtech.com/web"
                  ServerName swagger.mwvtech.com
                ...
              • restart apache
              • verify within Webmin's apache UI that the proper webroots are being used for the new swagger.mwvtech.com website; fix any issues; ...
              • restart if necessary (within webmin's UI)
              • go to https://swagger.mwvtech.com/ in a web browser and launch the Drupal install; gstandard Drupal Install UI, customized for APIGEE integration
                • Skipping the APIGEE registration step w/i the install, complete later
                • fill in the registration page for Drupal
                  • Note, when tabbing through the country list, hit 'U' , 7 times to get to the US. " U-U-U-U-U-U-U "
                  • Note, when tabbing through the Time Zone list, hit 'N' 7 times to get to the New York time zone. "N N N N N N N"
                • Enable the 'Demo content' w/i install
                • Install is complete!
              • Add in a few extra modules for convenience's sake.
              • go to the command line for this instance and use composer to install those modules
              • composer require drupal/realname drupal/module_filter composer require drupal/force_password_change drupal/name drupal/ds drupal/migrate_plus drupal/migrate_tools
              • update file permissions across directories
              • return to the admin UI and enable the new modules;
                • enable module filter, names field, and the Display Suite modules (see UI after logging in - https://swagger.mwvtech.com/admin/modules
                • before enabling the APIGEE modules, we will need to perform the skipped step above and create an APIGEE portal account; jump ahead and create the JSON example for uploading;
            •  
          • open an SSH connection and assign ownership and permissions to the files
          • save it
    4. within the new instance, swagger.mwvtech.com, make the site appealing and invite Simon, Dan, Mike and Nick to view it.  the password will be ??????? on all accounts, and then they will be required to change the password after initial login.
      1. enable the 'Enforce Password Change, Name Field and Display Suite modules
      2. Customize the Profile form so that users have real names. 
        1. https://swagger.mwvtech.com/admin/config/people/accounts/fields/add-field
          1. this adds a field called 'Name' to the user profile
          2. check off the 'synchronize with ApiGee Edge' box
          3. Goto the UI for forcing password changes and fill out the appropriate fields so that people need to change their password on login;
            1. https://swagger.mwvtech.com/admin/modules
          4. enable the real name module and configure it
            1. https://swagger.mwvtech.com/admin/modules
            2. https://swagger.mwvtech.com/admin/config/people/realname
            3. We had added the Name field previously, this will make it so that people's displayed names are their real name rather than their user name ... more polite in my opinion.
          5. Create an APIGEE Edge account so that the credentials can be used within APIGEE DRUPAL
          6. go to the APIGEE edge registration form and fill it out
            1. ????
            2. enable the APIGEE modules in the extend modules section
              1. https://swagger.mwvtech.com/admin/modules/list/confirm?filter=apigee
          7. create accounts for the 4 users
            1. DONE

 

CREATE THE DEMO 

create a content type called 

https://swagger.mwvtech.com/admin/structure/types/add

 

 

 

 

 

    1. create a git repository for the new instance, and set it up for maintaining the codebase
    2. setup a database backup system for the MySQL portion of the system, export to SQL files into a defined folder
    3. setup a bacula system for storing the drupal instance's /files directory, and save them as a paired set
    4. verify that the backup system is functioning
    5. setup a content type and form display for importing a JSON file
    6. setup a 
    7. consider the ability to pull the bacula backup info into an admin view within the same drupal instance
      • see if there is a contrib module for doing this already
      • otherwise, create a new content type for defining nodes for the bacula records;
      • set up rules to look for new backup records within the bacula table;
        •  install rules and workflow contrib modules with Composer to the Drupal instance
        • enable rules and workflow modules (among others) in the Drupal instance's admin UI
      • create a view for displaying the informational nodes that were generated in step 1.1.8(2 o o ) above
        • sort the view in ascending order, set the filtering to only show those nodes of content type ([content type]) above 
        • display the proper fields for showing a running log of the imported nodes
    8. consider displaying the imported nodes in JSON format
    9.  
  1. Swagger: create a new instance for a SWAGGER demo;
    • Set up a content type for uploading a JSON file
    • Demonstrate the use of RULES in looking for any new .jsom files that are located at a specific URL;
    • https://jsonformatter.org/json-editor