You should install VirtualBox and Vagrant before you start.
You should create a Vagrantfile in an empty directory with the following content:
You should install VirtualBox and Vagrant before you start.
You should create a Vagrantfile in an empty directory with the following content:
| # module list (generated by listmodules.py) | |
| # | |
| # timestamp='20160226T200954Z' | |
| # sys.version='2.7.10 (default, Dec 8 2015, 18:25:23) \n[GCC 4.8.3 20140911 (Red Hat 4.8.3-9)]' | |
| # sys.platform='linux2' | |
| # platform='Linux-4.1.13-19.31.amzn1.x86_64-x86_64-with-glibc2.2.5' | |
| # | |
| BaseHTTPServer | |
| Bastion | |
| CDROM |
| #!/usr/bin/env python | |
| import sys | |
| import os | |
| from_email="" | |
| to_email="" | |
| #AWS total last 12 spendings | |
| aws_budget=200 |
| --- | |
| - include_vars: secrets.yml | |
| - apt: pkg=fuse state=absent | |
| - apt: pkg={{ item }} state=present update_cache=yes | |
| with_items: | |
| - build-essential | |
| - libcurl4-openssl-dev | |
| - libxml2-dev | |
| - mime-support |
| # this script expects $DOTOKEN variable with your digital ocean token | |
| # this script gets or creates smallest DO droplet and remotely executes script on it | |
| # afterwards, droplet is destroyed | |
| DROPLETNAME=example.com | |
| DOHOME="https://api.digitalocean.com/v2" | |
| cat <<EOF > .curlargs | |
| -s | |
| -H "Authorization: Bearer $DOTOKEN" |
| #!/bin/bash | |
| set -e | |
| SECRETFILE=~/.digitalocean | |
| if [[ -z $DIGOCEAN_ID ]] || [[ -z $DIGOCEAN_KEY ]]; then | |
| if [ -e $SECRETFILE ]; then | |
| . $SECRETFILE | |
| fi | |
| fi |
Get this simple Flask app up and running on a Vagrant VM using your known best devops practices as well as the instructions in the guidelines below. You must use Ansible as your provisioner to install and configure everything. When you're done, we should be able to type vagrant up and our app will be running and reachable on http port 80 at http://192.168.33.15 and http://devops.adsnative.com
Guidelines:
/webapps/adsnative| #!/bin/bash | |
| # Sometimes you need to move your existing git repository | |
| # to a new remote repository (/new remote origin). | |
| # Here are a simple and quick steps that does exactly this. | |
| # | |
| # Let's assume we call "old repo" the repository you wish | |
| # to move, and "new repo" the one you wish to move to. | |
| # | |
| ### Step 1. Make sure you have a local copy of all "old repo" | |
| ### branches and tags. |
| # Use Python 3 for easy unicode | |
| $ virtualenv -p python3 .env | |
| $ source .env/bin/activate | |
| $ pip install django | |
| $ deactivate | |
| # Start new django project and app | |
| $ django-admin.py startproject mysite | |
| $ ./manage.py migrate | |
| $ ./manage.py createsuperuser |