Giter Site home page Giter Site logo

devops-exercise's Introduction

DevOps Exercise

Use chef-solo to develop an automated deployment and configuration system

Chef-solo is used in combination with Vagrant to complete the following tasks:

  • Deploy and daemonize a static web server available from npm.
  • Configure the webserver to serve only a single file by default, the chef-solo installation log that is a result of the installation.
  • Install and configure Nginx with access through "https" and "http basic authentication".
  • Issue an http post to a given endpoint, easily configured when executing the chef script (e.g. https://arterys.com/install-complete). It should not post if the endpoint is not configured when the script is run.

Prerequisites

Installation

Clone repository:

$ git clone https://github.com/lvaylet/devops-exercise

Install Vagrant plugins to simplify provisioning with Chef Solo. Berkshelf is a tool for managing cookbook dependencies (i.e. Chef's dependency management system). Omnibus can install any version of Chef or ensure we're using the latest one.

$ vagrant plugin install vagrant-berkshelf
$ vagrant plugin install vagrant-omnibus

Usage

Fire up and provision VM with IP 192.168.50.4 on private network:

$ cd devops-exercise
$ vagrant up

Display Chef log. Use basic authentication over HTTPS and SSL with unsecured self-signed certificate (for test purposes). When using a browser, you might have to add an exception on every new instance created by vagrant up because of the automatically generated self-signed certificate.

$ curl -X GET --user sammy:pass --insecure https://192.168.50.4

You should get something like:

# Logfile created on 2017-09-14 13:12:07 +0000 by logger.rb/44203
[2017-09-14T13:12:07+00:00] INFO: Forking chef instance to converge...
[2017-09-14T13:12:07+00:00] INFO: *** Chef 12.7.2 ***
[2017-09-14T13:12:07+00:00] INFO: Chef-client pid: 1865
[2017-09-14T13:12:08+00:00] INFO: Setting the run_list to ["recipe[apt_update]", "recipe[nodejs]", "recipe[node_static_server]", "recipe[nginx_ssl_auth]"] from CLI options
...
[2017-09-14T13:13:14+00:00] INFO: service[nginx] restarted
[2017-09-14T13:13:14+00:00] INFO: Chef Run complete in 65.634720772 seconds
[2017-09-14T13:13:14+00:00] INFO: Skipping removal of unused files from the cache
[2017-09-14T13:13:14+00:00] INFO: Running report handlers
[2017-09-14T13:13:14+00:00] INFO: Report handlers complete

When you are done, gracefully shut down the VM with:

$ vagrant halt

In case you need to provision the VM again after making some changes, you can use:

$ vagrant reload --provision

Finally, to delete the VM and restart from scratch, you can use:

$ vagrant destroy

Extra

  1. Explain various options available to email the chef-solo log file when the installation is complete.

I would probably use an SMTP server available in Ubuntu, like postfix. It can easily be configured to send emails through an existing third-party email provider (e.g. [email protected] with Google services under the hood). Another option is to configure postfix as a local send-only SMTP server to remove any dependency on an external provider. Finally, this tutorial explains how to send email notifications from Chef when the run fails. It could be adjusted to send emails when the installation completes successfully.

  1. Explain various options available to monitor the system logs on this server remotely.

Monitoring the logs manually could be as simple as logging in through SSH and tail -f the relevant log file(s). Nagios or an Elasticsearch + Logstash + Kibana stack are good options if the process needs to be automated, with alerts and notifications when something goes wrong.

devops-exercise's People

Contributors

lvaylet avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.