WAG the Blog

download WAG the Blog

of 14

  • date post

    16-Apr-2017
  • Category

    Technology

  • view

    708
  • download

    0

Embed Size (px)

Transcript of WAG the Blog

  • WAG the Blog*Using WordPress, Ansible, and Git to Build Your Website

    WordCamp Atlanta 2016 || Evan Volgas || Developer Track

    * Ha! A pun.

  • Who the heck is this guy?Evan.

    Recently started as a data engineer at MailChimp

    Has used WordPress off and on for about 6-7 years

    Has used Ansible for about a two years now

    Probably drinks more coffee than you*

    Definitely has written more bad code than you**

    More Snark @EvanVolgas

    Less Snark https://evan.is/

    * No seriously, he has a problem** See above

    https://twitter.com/EvanVolgashttps://evan.is/

  • Important DisclaimersI believe. Google Exists You can use it Reading code in slides is boring Working with servers is fun Elvis is still alive*

    * Youre not fooling anybody Matt or should I say Elvis?

  • Who cares about servers? (bias / opinion alert)

    Think about the question:

    How does the internet work?*

    https://ma.ttias.be/the-best-tech-question-to-ask-in-a-job-interview/

    My opinion: As professionals who earn a living on the internet, we owe it to ourselves and the people we work with to understand the technologies we are using on a deep level.

    That includes understanding more about servers than most people would ever stop and think about in the first place.

    * Laws, sausages, and software all things you dont want to see get made

    https://ma.ttias.be/the-best-tech-question-to-ask-in-a-job-interview/

  • Ansible Ansible is OSS that was written to make configuring

    and managing servers less of a pain in the neck The name Ansible comes from a sci-fi novel by

    Ursula K. Le Guin. The term was popularized by Orson Scott-Card in Enders Game.

    In many sci-fi books, an Ansible is a device that can remotely control large fleets of ships all across the galaxy

    In our world, Ansible can connect to an arbitrarily large number of servers over SSH and run commands on them, commands that you yourself could run if you were SSHd into all of the machines yourself

    We read sci-fi all day. Its a hard NOC life for those of us in software

  • How Ansible Works in a NutshellAnsible Runs playbooks or plays against groups of servers Each play may be compromised of one or more roles. Roles are groups of

    things you want to do on your servers and are usually where all the work in Ansible really happens

    Appropriate role scoping is subjective but an example of a role might be Install and configure Nginx for example or Install and configure IP Tables. Dont worry about defining an appropriate scope for a role just yet. Instead, read Other Peoples Code and start forming opinions on what works and what doesnt

    Every role may have variables, tasks, templates, and/or defaults associated with it. Here again, OPC will be very helpful.

    The hosts in your Ansible inventory can also have variables assigned to them. This is some serious secret sauce right here and you should definitely pay attention to this

    Using footnotes in slides is a terrible idea isnt it?

  • Ansible: Examples / Discussion TLR*: https://github.com/evanv/tlr

    Trellis: https://github.com/roots/trellis

    WordPress Ansible: https://github.com/lamosty/wordpress-ansible

    AnsiPress: https://github.com/codeablehq/AnsiPress

    Ansible-WordPress: https://github.com/Oefenweb/ansible-wordpress

    * Whoever owns this repo is probably very smart, funny, attractive, & great at at giving presentations

    https://github.com/evanv/tlrhttps://github.com/roots/trellishttps://github.com/lamosty/wordpress-ansiblehttps://github.com/codeablehq/AnsiPresshttps://github.com/Oefenweb/ansible-wordpress

  • Ansible: Examples ReviewRoles may include variables, which have different levels of precedence

    For example, host variables win against role defaults

    See http://docs.ansible.com/ansible/playbooks_variables.html for info about the rules

    You can (and often do) break your inventory into different host groups that you can target with different playbooks

    Can you believe they let this guy speak at WordCamp?

    http://docs.ansible.com/ansible/playbooks_variables.html#variable-precedence-where-should-i-put-a-variable

  • Git Git is an open source Version Control System (VCS) Git is distributed developers have full copies of the

    code and its history on their local environments and then push changes to a central shared location

    Workflows (eg https://www.atlassian.com/git/tutorials/comparing-workflows/centralized-workflow and http://blog.endpoint.com/2014/05/git-workflows-that-work.html) and opinions about them abound.

    Ignore the flame wars. Just do what works for you and your team.

    He probably doesnt know anything about Linux either

    https://www.atlassian.com/git/tutorials/comparing-workflows/centralized-workflowhttp://blog.endpoint.com/2014/05/git-workflows-that-work.html

  • WordPress and Git If you read one article, read this: http://

    stevegrunwell.github.io/wordpress-git/

    If you read two articles, read https://deliciousbrains.com/storing-wordpress-in-git/

    If you read three articles, read https://markjaquith.wordpress.com/2011/06/24/wordpress-local-dev-tips/

    * Whatever you do, dont read four articles. Four is natures limit. Watch Monty Python. That shalt read three articles. Five is right out.

    http://stevegrunwell.github.io/wordpress-git/https://deliciousbrains.com/storing-wordpress-in-git/https://markjaquith.wordpress.com/2011/06/24/wordpress-local-dev-tips/

  • Whats Git Got to Do with This?

    You *definitely* want to keep your Ansible playbooks and roles under version control

    You can use Ansible to install Git on your servers.

    You can also (and will, probably, once you suffer the pain of learning to use them) use Ansible in connection with CI tools like Travis / Circle / BuildBot / etc.

    Jedi mind trick? Nope. Continuous integration. Not sure what that is? See slide 4.

  • Why are we here again?

    You should absolutely take a look at Trellis: https://github.com/roots/trellis and VVV (https://github.com/Varying-Vagrant-Vagrants/VVV)

    You should also take a look at provision.sh in VVV (https://github.com/Varying-Vagrant-Vagrants/VVV/blob/develop/provision/provision.sh) and compare that to Trellis. Quite a bit different, no? But awfully similar too.

    * Learning how the internet works is a lot like learning emacs except people who know how the internet works still get invited to parties sometimes

    The internet is not magic. But it is complicated. And the more you work with servers, the more you will be exposed to its complexity and the more you will start* to understand it

    https://github.com/roots/trellishttps://github.com/Varying-Vagrant-Vagrants/VVVhttps://github.com/Varying-Vagrant-Vagrants/VVV/blob/develop/provision/provision.sh

  • The moment weve all been waiting for.

    Lets provision a server!

    Wheres Wapuu?

  • Concluding remarks Earlier I mentioned role scoping in Ansible and also claimed that

    you definitely want your Ansible scripts in Git Lets decimate look at OPC https://www.digitalocean.com/

    community/tutorials/how-to-automate-installing-wordpress-on-ubuntu-14-04-using-ansible

    Your server config will change. Youll make mistakes. Make your config a living document. Use Git.

    https://github.com/MisfitIdeas/wag-the-blog

    Hell is OPC unless OPC is Rich Hickeys

    https://www.digitalocean.com/community/tutorials/how-to-automate-installing-wordpress-on-ubuntu-14-04-using-ansiblehttps://github.com/MisfitIdeas/wag-the-blog