Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Everything as Code: The New Software Development and Delivery Workflow

Samuel
April 24, 2020

Everything as Code: The New Software Development and Delivery Workflow

This talks seeks to share knowledge on software engineering methodology that promotes collaboration, quality and speed in delivering business products.

Samuel

April 24, 2020
Tweet

Other Decks in Technology

Transcript

  1. HashiCorp User Group Lagos Everything as Code The New Software

    Development and Delivery Workflow Copyright © 2019 HashiCorp
  2. VPC Region eu-west-1 Amazon S3 Availability zone eu-west-1b Public subnet

    Public subnet Security group Application Server 80 Services Server 82.1.301.50 AWS Config Users Amazon Route 53 AWS CloudTrail Availability zone eu-west-1a 443 8080 9090 9100 9093 8200 3000 152.179.211.11
  3. Everything as Code The New Software Development and Delivery Workflow

    Presented By Samuel Nwoye @twitter nwoyesamuelc | @github knoxknot
  4. DevOps A software development and delivery methodology that combines cultural

    and operational paradigms in achieving business goals. This talk models an implementation for a startup developing an online presence for her consultancy service.
  5. Business Meeting and Product Requirement Gathering  Requirements and scope

    of the project.  Contract terms and agreement.  Mobilization and Kick-off.
  6. Engineering Team Sprint Planning and Poker Estimation  Project defined

    as tasks.  The weight of each tasks determined.  Timeline set on each task.  Tasks assigned to team members.  The engineering team gets to work.
  7. Op Team Provisions Repositories and Development Environment  Create the

    Repositories and Teams.  Define the Vagrantfile.  Describe the Configuration.  Test and Provision the Environment.  Stores in Version Control System.
  8. resources.tf # Set a Provider provider "github" { token =

    "${var.github_token}" organization = "${var.github_organization}" } # Create Repositories resource "github_repository" "samfil_technohub_landingpage_app" { name = "samfil-technohub-landingpage-app" description = "The Codebase for Samfil Technohub Landing Page Application" has_issues = true has_projects = true default_branch = "development" } # Create Teams resource "github_team" "samfil_technohub_landingpage_dev_team" { name = "${var.project}-dev-team" description = "Samfil Technohub Landing Page Development Team" privacy = "closed" } # Add Users to Teams # Samfil Technohub Landing Page Dev Team Members resource "github_team_membership" "samfil_technohub_landingpage_dev_team_members" { team_id = "${github_team.samfil_technohub_landingpage_dev_team.id}" count = "${length(var.developer_users)}" username = "${element(var.developer_users, count.index)}" role = "${element(var.developer_users, count.index) == "knoxknot" ? "maintainer" : "member"}" } # Assign a Repository to a Team resource "github_team_repository" "dev_team_repo" { team_id = "${github_team.samfil_technohub_landingpage_dev_team.id}" repository = "${github_repository.samfil_technohub_landingpage_app.id}" permission = "push" } Example Code Using github as the hosting service for git versioning, the terraform file creates a repository, team and adds a user and repository to the team.
  9. Vagrantfile Vagrant.configure("2") do |config| # operating system for the vm

    config.vm.box = "ubuntu-xenial64" # ssh settings config.ssh.username = "vagrant" config.ssh.private_key_path = ["~/.ssh/server_key", "~/.vagrant.d/insecure_private_key"] config.ssh.insert_key = false # vm provider config.vm.provider "virtualbox" do |vb| vb.customize [ "modifyvm", :id, "--uartmode1", "disconnected" ] vb.cpus = "1" vb.memory = "1024" end #synchronize folders between host and guest machine config.vm.synced_folder '.', '/usr/share/nginx/html' # upload public key into the machine config.vm.provision "file", source: "~/.ssh/server_key.pub", destination: "~/.ssh/authorized_keys" # configure the development server config.vm.define "development" do |development| development.vm.hostname = "development" development.vm.network "private_network", ip: "192.168.255.9" development.vm.provision :ansible do |ansible| ansible.inventory_path = "configuration/hosts" ansible.playbook = "configuration/server.yml" end development.vm.provision "shell", inline: <<-SHELL echo 'Running Serverspec Tests...' cd /usr/share/nginx/html/configuration/serverspec rake -v -t SHELL end end Example Code Defines the specification of the development machine with vagrant, configures the machine with ansible and tests that the machine is desired with serverspec.
  10. Dev Team Clones the Environment and Starts to Code 

    Clone the Application Repository.  Boot up the Machine.  Fulfill assigned tasks.  Commit to Repository.  Actively Communicates with Op Team.
  11. Op Team Provisions Cloud Resources and Services  Define Appropriate

    Access Policy.  Deploy Monitoring and Compliance.  Provision a Production Environment.  Configure Domain Name Service.  Actively Communicates with Dev Team.
  12. resources.tf # Set a Provider provider "aws" { region =

    "${var.region}" shared_credentials_file = "${var.credentials_path}" profile = "${var.profile}" } # Create User - Samuel resource "aws_iam_user" "samuel" { name = "samuel" } # Create the Web Server resource "aws_instance" "samfil_technohub_landingpage_server" { ami = "${data.aws_ami.ubuntu_xenial_ami.id}" instance_type = "${var.instance_type}" key_name = "${aws_key_pair.samfil_technohub_landingpage_server_key.key_name}" vpc_security_group_ids = ["${aws_security_group.samfil_technohub_landingpage_server_sg.id}"] root_block_device { volume_type = "gp2" volume_size = 10 delete_on_termination = true } tags { Name = "${var.project}-ws" } } # Describe the Inventory Service resource "aws_config_configuration_recorder" "ireland_config_rec" { name = "${var.region}-configrec" role_arn = "${data.aws_iam_role.samfil_technohub_config_role.arn}" recording_group { all_supported = true include_global_resource_types = true } } Example Code Using terraform to provision resources and services on aws.
  13. Stakeholders Release Meeting and Deployment  Identify completed tasks at

    end of sprint.  Deploy to Production.  Monitor Deployed Application.  Rollback in Event of Failure.