A small coding challenge for our open devops position. This is intended to be completed independently, without consulting other developers or any Plotly employees. Consulting online references is fine! If you're really unsure about something, make an assumption and state it when you submit the pull request.
Two playbooks are given. Production.yml deploys nginx with reverse proxy, using vars.yml and proxy.conf.tpl Development.yml deploys a regular nginx web server, using nginx.conf.tpl
No testing has been done yet. To test:
- deploy two free-tier Ubuntu 14.04 VMs on gcp or aws
- get static IPs of VMs, and replace -i "host" argument in playbook command
- verify that placekitten.com loads static html from nginx served site /meow/
- verify that development site loads static html at static IP
To deploy production nginx: /meow/ redirects to http://placekitten.com/
ansible-playbook -i "gcphost" -u root production.yml
ansible-playbook -i "localhost" -u root development.yml
/////////////////////
- Fork this repo.
- Create and test your solution.
- Update this README to explain how to deploy to various environments with this solution.
- Open a pull request on our repo. Explain how you've tested it, and what further testing you feel would be needed before putting this into production. (We realize you may not have the servers set up to test this as much as you'd like in a reasonable amount of time.)
This repo uses Ansible to install and configure nginx to serve static content from a directory. The target host is expected to be running Ubuntu 14.04 (but other Ubuntu versions will likely work).
We need to add a reverse proxy to the site, but only for our production site. When the code is deployed on a development or test site, the reverse proxy should be disabled. The location /meow/ on the production site should proxy requests to http://placekitten.com/ .
To deploy to a machine, run:
ansible-playbook playbook.yml -i "HOST," --extra-vars="user=USER"
Replace HOST by the hostname or IP address, and USER by the username (must have sudo access).
For example, for a machine with IP 52.0.228.95
and a username of ubuntu
:
ansible-playbook playbook.yml -i "52.0.228.95," --extra-vars="user=ubuntu"
- Ansible Documentation
- nginx Documentation
- Google Cloud Platform Free Tier - one way to test your work (other ways are totally fine). Note that Plotly uses GCP for most of our hosting.
- Amazon Web Services Free Tier - another way to test.