{"id":7321,"date":"2018-04-06T08:55:50","date_gmt":"2018-04-06T00:55:50","guid":{"rendered":"http:\/\/rmohan.com\/?p=7321"},"modified":"2018-04-06T08:55:50","modified_gmt":"2018-04-06T00:55:50","slug":"continuous-delivery-using-docker-and-ansible","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=7321","title":{"rendered":"Continuous Delivery Using Docker And Ansible"},"content":{"rendered":"<p><strong>Continuous Delivery Using Docker And Ansible<\/strong><\/p>\n<p>Continuous Delivery<br \/>\nRelease Often<br \/>\nRelease Faster<br \/>\nGreat Reliable<\/p>\n<p>Continuous Delivery workflow\/pipeline<\/p>\n<p>With which we can Test,Build,Release,&amp; Deploy a simple application.<\/p>\n<p>Application will be of any technology ex:python based.<\/p>\n<p>The work flow will be Based upon using docker &amp; docker-compose which is a emerging technology. With a goal to release our application as docker image.<\/p>\n<p>So that it can be tested, building application artefacts, creating docker-release images, and running acceptance test, by external functionality, and finally publish docker image.<\/p>\n<p>First we can run it locally, &amp; then set in popular jenkins continuous delivery system, we will configure integration with GitHub, allowing continuous delivery work flow to be triggered on each application source code commit.<\/p>\n<p>Assuming application passes all unit,integration &amp; acceptance tests. Our pipeline will release images to docker hub, which will deployed to Aws with ansible using IAAC(S) approach with aws cloud formation and leveraging ec2 container service for running docker container is production.<\/p>\n<p>rmohan@root:~$ mkdir docker-ansible<\/p>\n<p>rmohan@root:~$ cd docker-ansible\/<\/p>\n<p>rmohan@root:~\/docker-ansible$ django-admin startproject todobackend<\/p>\n<p>rmohan@root:~\/docker-ansible$ tree<br \/>\n.<br \/>\n`\u2013 todobackend<br \/>\n|\u2013 manage.py<br \/>\n`\u2013 todobackend<br \/>\n|\u2013 __init__.py<br \/>\n|\u2013 settings.py<br \/>\n|\u2013 urls.py<br \/>\n`\u2013 wsgi.py<\/p>\n<p>2 directories, 5 files<\/p>\n<p>rmohan@root:~\/docker-ansible$ cd todobackend\/<\/p>\n<p>rmohan@root:~\/docker-ansible\/todobackend$ mkdir src<\/p>\n<p>rmohan@root:~\/docker-ansible\/todobackend$ mv manage.py src\/<\/p>\n<p>rmohan@root:~\/docker-ansible\/todobackend$ mv todobackend\/ src<\/p>\n<p>rmohan@root:~\/docker-ansible\/todobackend$ tree<br \/>\n.<br \/>\n`\u2013 src<br \/>\n|\u2013 manage.py<br \/>\n`\u2013 todobackend<br \/>\n|\u2013 __init__.py<br \/>\n|\u2013 settings.py<br \/>\n|\u2013 urls.py<br \/>\n`\u2013 wsgi.py<\/p>\n<p>2 directories, 5 files<\/p>\n<p>rmohan@root:~\/docker-ansible\/todobackend$ git init<br \/>\nInitialized empty Git repository in \/home\/rmohan\/docker-ansible\/todobackend\/.git\/<\/p>\n<p>rmohan@root:~\/docker-ansible\/todobackend$ vim .gitignore<br \/>\n#Ignore the virtual environment<br \/>\nvenv<\/p>\n<p>#Ignore compiled python source files<br \/>\n*.pyc<\/p>\n<p>#Ignore SQLite database files<br \/>\n*.sqlite3<\/p>\n<p>rmohan@root:~\/docker-ansible\/todobackend$ git add -A<br \/>\nrmohan@root:~\/docker-ansible\/todobackend$ git commit -a -m \u201cInitial commit\u201d<br \/>\n[master (root-commit) edface9] Initial commit<br \/>\n6 files changed, 177 insertions(+)<br \/>\ncreate mode 100644 .gitignore<br \/>\ncreate mode 100755 src\/manage.py<br \/>\ncreate mode 100644 src\/todobackend\/__init__.py<br \/>\ncreate mode 100644 src\/todobackend\/settings.py<br \/>\ncreate mode 100644 src\/todobackend\/urls.py<br \/>\ncreate mode 100644 src\/todobackend\/wsgi.py<\/p>\n<p>rmohan@root:~\/docker-ansible\/todobackend$ pip install virtualenv<br \/>\nRequirement already satisfied (use \u2013upgrade to upgrade): virtualenv in \/usr\/local\/lib\/python2.7\/dist-packages<br \/>\nCleaning up..<\/p>\n<p>rmohan@root:~\/docker-ansible\/todobackend$ virtualenv venv<br \/>\nNew python executable in \/home\/rmohan\/docker-ansible\/todobackend\/venv\/bin\/python<br \/>\nInstalling setuptools, pip, wheel\u2026done.<\/p>\n<p>rmohan@root:~\/docker-ansible\/todobackend$ ls<br \/>\nsrc venv<\/p>\n<p>rmohan@root:~\/docker-ansible\/todobackend$ ls venv\/<br \/>\nbin include lib local pip-selfcheck.json<\/p>\n<p>rmohan@root:~\/docker-ansible\/todobackend$ source venv\/bin\/activate<br \/>\n(venv) rmohan@root:~\/docker-ansible\/todobackend$<\/p>\n<p>(venv) rmohan@root:~\/docker-ansible\/todobackend$ pwd<br \/>\n\/home\/rmohan\/docker-ansible\/todobackend<\/p>\n<p>(venv) rmohan@root:~\/docker-ansible\/todobackend$ pip install pip \u2013upgrade<br \/>\nRequirement already up-to-date: pip in .\/venv\/lib\/python2.7\/site-packages<\/p>\n<p>(venv) rmohan@root:~\/docker-ansible\/todobackend$ pip install django<br \/>\nCollecting django<br \/>\n\/home\/rmohan\/docker-ansible\/todobackend\/venv\/local\/lib\/python2.7\/site-packages\/pip\/_vendor\/requests\/packages\/urllib3\/util\/ssl_.py:318: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https:\/\/urllib3.readthedocs.io\/en\/latest\/security.html#snimissingwarning.<br \/>\nSNIMissingWarning<br \/>\n\/home\/rmohan\/docker-ansible\/todobackend\/venv\/local\/lib\/python2.7\/site-packages\/pip\/_vendor\/requests\/packages\/urllib3\/util\/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https:\/\/urllib3.readthedocs.io\/en\/latest\/security.html#insecureplatformwarning.<br \/>\nInsecurePlatformWarning<br \/>\nDownloading Django-1.11.5-py2.py3-none-any.whl (6.9MB)<br \/>\n100% |????????????????????????????????| 7.0MB 139kB\/s<br \/>\nCollecting pytz (from django)<br \/>\nDownloading pytz-2017.2-py2.py3-none-any.whl (484kB)<br \/>\n100% |????????????????????????????????| 491kB 1.2MB\/s<br \/>\nInstalling collected packages: pytz, django<br \/>\nSuccessfully installed django-1.11.5 pytz-2017.2<\/p>\n<p>(venv) rmohan@root:~\/docker-ansible\/todobackend$ pip install djangorestframework<br \/>\nCollecting djangorestframework<br \/>\n\/home\/rmohan\/docker-ansible\/todobackend\/venv\/local\/lib\/python2.7\/site-packages\/pip\/_vendor\/requests\/packages\/urllib3\/util\/ssl_.py:318: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https:\/\/urllib3.readthedocs.io\/en\/latest\/security.html#snimissingwarning.<br \/>\nSNIMissingWarning<br \/>\n\/home\/rmohan\/docker-ansible\/todobackend\/venv\/local\/lib\/python2.7\/site-packages\/pip\/_vendor\/requests\/packages\/urllib3\/util\/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https:\/\/urllib3.readthedocs.io\/en\/latest\/security.html#insecureplatformwarning.<br \/>\nInsecurePlatformWarning<br \/>\nDownloading djangorestframework-3.6.4-py2.py3-none-any.whl (1.5MB)<br \/>\n100% |????????????????????????????????| 1.5MB 453kB\/s<br \/>\nInstalling collected packages: djangorestframework<br \/>\nSuccessfully installed djangorestframework-3.6.4<\/p>\n<p>(venv) rmohan@root:~\/docker-ansible\/todobackend$ pip install django-cors-headers<br \/>\nCollecting django-cors-headers<br \/>\n\/home\/rmohan\/docker-ansible\/todobackend\/venv\/local\/lib\/python2.7\/site-packages\/pip\/_vendor\/requests\/packages\/urllib3\/util\/ssl_.py:318: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https:\/\/urllib3.readthedocs.io\/en\/latest\/security.html#snimissingwarning.<br \/>\nSNIMissingWarning<br \/>\n\/home\/rmohan\/docker-ansible\/todobackend\/venv\/local\/lib\/python2.7\/site-packages\/pip\/_vendor\/requests\/packages\/urllib3\/util\/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https:\/\/urllib3.readthedocs.io\/en\/latest\/security.html#insecureplatformwarning.<br \/>\nInsecurePlatformWarning<br \/>\nDownloading django_cors_headers-2.1.0-py2.py3-none-any.whl<br \/>\nInstalling collected packages: django-cors-headers<br \/>\nSuccessfully installed django-cors-headers-2.1.0<\/p>\n<p>(venv) rmohan@root:~\/docker-ansible\/todobackend\/src$ python manage.py startapp todo<br \/>\n(venv) rmohan@root:~\/docker-ansible\/todobackend\/src$ tree<br \/>\n.<br \/>\n|\u2013 manage.py<br \/>\n|\u2013 todo<br \/>\n| |\u2013 admin.py<br \/>\n| |\u2013 apps.py<br \/>\n| |\u2013 __init__.py<br \/>\n| |\u2013 migrations<br \/>\n| | `\u2013 __init__.py<br \/>\n| |\u2013 models.py<br \/>\n| |\u2013 tests.py<br \/>\n| `\u2013 views.py<br \/>\n`\u2013 todobackend<br \/>\n|\u2013 __init__.py<br \/>\n|\u2013 __init__.pyc<br \/>\n|\u2013 settings.py<br \/>\n|\u2013 settings.pyc<br \/>\n|\u2013 urls.py<br \/>\n`\u2013 wsgi.py<\/p>\n<p>3 directories, 14 files<\/p>\n<p>(venv) rmohan@root:~\/docker-ansible\/todobackend\/src$ vim todobackend\/settings.py<br \/>\nINSTALLED_APPS = [<br \/>\n.<br \/>\n.<\/p>\n<p>\u2018rest_framework\u2019,<br \/>\n\u2018corsheaders\u2019,<br \/>\n\u2018todo\u2019<br \/>\n]<br \/>\n.<br \/>\n.<br \/>\nMIDDLEWARE_CLASSES = [<br \/>\n\u2018django.middleware.security.SecurityMiddleware\u2019,<br \/>\n\u2018corsheaders.middleware.CorsMiddleware\u2019,<br \/>\n]<\/p>\n<p>#Cors Settings do not do it in production<br \/>\nCORS_ORIGIN_ALLOW_ALL = True<br \/>\nCreating Models<\/p>\n<p>(venv) rmohan@root:~\/docker-ansible\/todobackend\/src$ vim todo\/models.py<br \/>\n# Create your models here.<br \/>\nclass TodoItem(models.Model):<br \/>\ntitle = models.CharField(max_length=256, null=True, blank=True)<br \/>\ncompleted = models.BooleanField(blank=True, default=False)<br \/>\nurl = models.CharField(max_length=256, null=True, blank=True)<br \/>\norder = models.IntegerField(null=True, blank=True)<\/p>\n<p>(venv) rmohan@root:~\/docker-ansible\/todobackend\/src$ python manage.py makemigrations todo<br \/>\nMigrations for \u2018todo\u2019:<br \/>\ntodo\/migrations\/0001_initial.py<br \/>\n\u2013 Create model TodoItem<\/p>\n<p>(venv) rmohan@root:~\/docker-ansible\/todobackend\/src$ tree<br \/>\n.<br \/>\n|\u2013 db.sqlite3<br \/>\n|\u2013 manage.py<br \/>\n|\u2013 todo<br \/>\n| |\u2013 admin.py<br \/>\n| |\u2013 admin.pyc<br \/>\n| |\u2013 apps.py<br \/>\n| |\u2013 __init__.py<br \/>\n| |\u2013 __init__.pyc<br \/>\n| |\u2013 migrations<br \/>\n| | |\u2013 0001_initial.py<br \/>\n| | |\u2013 __init__.py<br \/>\n| | `\u2013 __init__.pyc<br \/>\n| |\u2013 models.py<br \/>\n| |\u2013 models.pyc<br \/>\n| |\u2013 tests.py<br \/>\n| `\u2013 views.py<br \/>\n`\u2013 todobackend<br \/>\n|\u2013 __init__.py<br \/>\n|\u2013 __init__.pyc<br \/>\n|\u2013 settings.py<br \/>\n|\u2013 settings.pyc<br \/>\n|\u2013 urls.py<br \/>\n|\u2013 urls.pyc<br \/>\n`\u2013 wsgi.py<\/p>\n<p>3 directories, 21 files<\/p>\n<p>(venv) rmohan@root:~\/docker-ansible\/todobackend\/src$ python manage.py migrate<br \/>\nOperations to perform:<br \/>\nApply all migrations: admin, auth, contenttypes, sessions, todo<br \/>\nRunning migrations:<br \/>\nApplying contenttypes.0001_initial\u2026 OK<br \/>\nApplying auth.0001_initial\u2026 OK<br \/>\nApplying admin.0001_initial\u2026 OK<br \/>\nApplying admin.0002_logentry_remove_auto_add\u2026 OK<br \/>\nApplying contenttypes.0002_remove_content_type_name\u2026 OK<br \/>\nApplying auth.0002_alter_permission_name_max_length\u2026 OK<br \/>\nApplying auth.0003_alter_user_email_max_length\u2026 OK<br \/>\nApplying auth.0004_alter_user_username_opts\u2026 OK<br \/>\nApplying auth.0005_alter_user_last_login_null\u2026 OK<br \/>\nApplying auth.0006_require_contenttypes_0002\u2026 OK<br \/>\nApplying auth.0007_alter_validators_add_error_messages\u2026 OK<br \/>\nApplying auth.0008_alter_user_username_max_length\u2026 OK<br \/>\nApplying sessions.0001_initial\u2026 OK<br \/>\nApplying todo.0001_initial\u2026 OK<\/p>\n<p>(venv) rmohan@root:~\/docker-ansible\/todobackend\/src$ ls<br \/>\ndb.sqlite3 manage.py todo todobackend<br \/>\nCreating Serializers<\/p>\n<p>http:\/\/www.django-rest-framework.org\/api-guide\/serializers\/<\/p>\n<p>(venv) rmohan@root:~\/docker-ansible\/todobackend\/src$ vim todo\/serializers.py<br \/>\nfrom rest_framework import serializers<br \/>\nfrom todo.models import TodoItem<\/p>\n<p>class TodoItemSerializer(serialisers.HyperlinkedModelSerializer):<br \/>\nurl = serializers.ReadOnlyField()<br \/>\nclass Meta:<br \/>\nmodel = TodoItem<br \/>\nfields = (\u2018url\u2019, \u2018title\u2019, \u2018completed\u2019, \u2018order\u2019)<br \/>\nCreate Views<\/p>\n<p>http:\/\/www.django-rest-framework.org\/api-guide\/views\/<\/p>\n<p>(venv) rmohan@root:~\/docker-ansible\/todobackend\/src$ vim todo\/views.py<br \/>\n# -*- coding: utf-8 -*-<br \/>\n#from __future__ import unicode_literals<br \/>\n#from django.shortcuts import render<br \/>\nfrom todo.models import TodoItem<br \/>\nfrom todo.serializers import TodoItemSerializer<br \/>\nfrom rest_framework import status<br \/>\nfrom rest_framework import viewsets<br \/>\nfrom rest_framework.reverse import reverse<br \/>\nfrom rest_framework.decorators import list_route<br \/>\nfrom rest_framework.response import Response<br \/>\n# Create your views here.<br \/>\nclass TodoItemViewSet(viewsets.ModelViewSet):<br \/>\nqueryset = TodoItem.objects.all()<br \/>\nserializer_class = TodoItemSerializer<br \/>\nConfigure Routing<\/p>\n<p>(venv) rmohan@root:~\/docker-ansible\/todobackend\/src$ vim todobackend\/urls.py<br \/>\nfrom django.conf.urls import url<br \/>\nfrom django.conf.urls import include<br \/>\nfrom django.contrib import admin<\/p>\n<p>urlpatterns = [<br \/>\nurl(r\u2019^admin\/\u2019, admin.site.urls),<br \/>\nurl(r\u2019^\u2019, include(\u2018todo.urls\u2019)),<br \/>\n]<\/p>\n<p>(venv) rmohan@root:~\/docker-ansible\/todobackend\/src$ vim todo\/urls.py<br \/>\nfrom django.conf.urls import url, include<br \/>\nfrom todo import views<br \/>\nfrom rest_framework.routers import DefaultRouter<\/p>\n<p>#create a router and registry our viewsets with it .<br \/>\nrouter = DefaultRouter(trailing_slash=False)<br \/>\nrouter.registry(r\u2019todos\u2019, views.TodoItemViewSet)<\/p>\n<p># the APi urls are now determined automatically by the router<br \/>\nurlpatterns = [<br \/>\nurl(r\u2019^\u2019, include(router.urls)) ,<br \/>\n]<br \/>\nTest Driving the application<\/p>\n<p>(venv) rmohan@root:~\/docker-ansible\/todobackend\/src$ python manage.py runserver<br \/>\nPerforming system checks\u2026<\/p>\n<p>System check identified no issues (0 silenced).<br \/>\nSeptember 14, 2017 \u2013 09:12:44<br \/>\nDjango version 1.11.5, using settings \u2018todobackend.settings\u2019<br \/>\nStarting development server at http:\/\/127.0.0.1:8000\/<br \/>\nQuit the server with CONTROL-C.<\/p>\n<p>python1.png<br \/>\nCreating Tests<\/p>\n<p>(venv) rmohan@root:~\/docker-ansible\/todobackend\/src$ vim todo\/tests.py<br \/>\nfrom django.core.urlresolvers import reverse<br \/>\nfrom rest_framework import status<br \/>\nfrom rest_framework.test import APITestCase<br \/>\nfrom todo.models import TodoItem<\/p>\n<p># Create your tests here.<br \/>\ndef createItem(client):<br \/>\nurl = reverse(\u2018todoitem-list\u2019)<br \/>\ndata = {\u2018title\u2019: \u2018Walk the dog\u2019}<br \/>\nreturn client.post(url, data, format=\u2019json\u2019)<\/p>\n<p>class TestCreateTodoItem(APITestCase):<br \/>\n\u201c\u201d\u201d<br \/>\nEnsure we can create a new todo item<br \/>\n\u201c\u201d\u201d<br \/>\ndef setUp(self):<br \/>\nself.response = createItem(self.client)<\/p>\n<p>def test_received_201_created_status_code(self):<br \/>\nself.assertEqual(self.response.status_code, status.HTTP_201_CREATED)<\/p>\n<p>def test_received_location_header_hyperlink(self):<br \/>\nself.assertRegexpMatches(self.response[\u2018Location\u2019], \u2018^http:\/\/.+\/todos\/[\\d]+$\u2019)<\/p>\n<p>def test_item_was_created(self):<br \/>\nself.assertEqual(TodoItem.objects.count(), 1)<\/p>\n<p>def test_item_has_correct_title(self):<br \/>\nself.assertEqual(TodoItem.objects.get().title, \u2018Walk the dog\u2019)<\/p>\n<p>class TestUpdateTodoItem(APITestCase):<br \/>\n\u201c\u201d\u201d<br \/>\nEnsure we can update an existing todo item using PUT<br \/>\n\u201c\u201d\u201d<br \/>\ndef setUp(self):<br \/>\nresponse = createItem(self.client)<br \/>\nself.assertEqual(TodoItem.objects.get().completed, False)<br \/>\nurl = response[\u2018Location\u2019]<br \/>\ndata = {\u2018title\u2019: \u2018Walk the dog\u2019, \u2018completed\u2019: True}<br \/>\nself.response = self.client.put(url, data, format=\u2019json\u2019)<\/p>\n<p>def test_received_200_created_status_code(self):<br \/>\nself.assertEqual(self.response.status_code, status.HTTP_200_OK)<\/p>\n<p>def test_item_was_updated(self):<br \/>\nself.assertEqual(TodoItem.objects.get().completed, True)<\/p>\n<p>class TestPatchTodoItem(APITestCase):<br \/>\n\u201c\u201d\u201d<br \/>\nEnsure we can update an existing todo item using PATCH<br \/>\n\u201c\u201d\u201d<br \/>\ndef setUp(self):<br \/>\nresponse = createItem(self.client)<br \/>\nself.assertEqual(TodoItem.objects.get().completed, False)<br \/>\nurl = response[\u2018Location\u2019]<br \/>\ndata = {\u2018title\u2019: \u2018Walk the dog\u2019, \u2018completed\u2019: True}<br \/>\nself.response = self.client.patch(url, data, format=\u2019json\u2019)<\/p>\n<p>def test_received_200_ok_status_code(self):<br \/>\nself.assertEqual(self.response.status_code, status.HTTP_200_OK)<\/p>\n<p>def test_item_was_updated(self):<br \/>\nself.assertEqual(TodoItem.objects.get().completed, True)<\/p>\n<p>class TestDeleteTodoItem(APITestCase):<br \/>\n\u201c\u201d\u201d<br \/>\nEnsure we can delete a todo item<br \/>\n\u201c\u201d\u201d<br \/>\ndef setUp(self):<br \/>\nresponse = createItem(self.client)<br \/>\nself.assertEqual(TodoItem.objects.count(), 1)<br \/>\nurl = response[\u2018Location\u2019]<br \/>\nself.response = self.client.delete(url)<\/p>\n<p>def test_received_204_no_content_status_code(self):<br \/>\nself.assertEqual(self.response.status_code, status.HTTP_204_NO_CONTENT)<\/p>\n<p>def test_the_item_was_deleted(self):<br \/>\nself.assertEqual(TodoItem.objects.count(), 0)<\/p>\n<p>class TestDeleteAllItems(APITestCase):<br \/>\n\u201c\u201d\u201d<br \/>\nEnsure we can delete all todo items<br \/>\n\u201c\u201d\u201d<br \/>\ndef setUp(self):<br \/>\ncreateItem(self.client)<br \/>\ncreateItem(self.client)<br \/>\nself.assertEqual(TodoItem.objects.count(), 2)<br \/>\nself.response = self.client.delete(reverse(\u2018todoitem-list\u2019))<\/p>\n<p>def test_received_204_no_content_status_code(self):<br \/>\nself.assertEqual(self.response.status_code, status.HTTP_204_NO_CONTENT)<\/p>\n<p>def test_all_items_were_deleted(self):<br \/>\nself.assertEqual(TodoItem.objects.count(), 0)<\/p>\n<p>(venv) rmohan@root:~\/docker-ansible\/todobackend\/src$ python manage.py test<br \/>\nCreating test database for alias \u2018default\u2019\u2026<br \/>\nSystem check identified no issues (0 silenced).<br \/>\n\u2026\u2026\u2026\u2026<br \/>\n\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014-<br \/>\nRan 12 tests in 0.201s<\/p>\n<p>OK<br \/>\nDestroying test database for alias \u2018default\u2019\u2026<\/p>\n<p>Unit Vs Integration Tests<\/p>\n<p>(venv) rmohan@root:~\/docker-ansible\/todobackend\/src$ mkdir todobackend\/settings<\/p>\n<p>(venv) rmohan@root:~\/docker-ansible\/todobackend\/src$ touch todobackend\/settings\/__init__.py<\/p>\n<p>(venv) rmohan@root:~\/docker-ansible\/todobackend\/src$ cp todobackend\/__init__.py todobackend\/settings\/base.py<\/p>\n<p>(venv) rmohan@root:~\/docker-ansible\/todobackend\/src$ vim todobackend\/settings\/base.py<br \/>\n\u201c\u201d\u201d<br \/>\nDjango settings for todobackend project.<\/p>\n<p>Generated by \u2018django-admin startproject\u2019 using Django 1.9.<\/p>\n<p>For more information on this file, see<br \/>\nhttps:\/\/docs.djangoproject.com\/en\/1.9\/topics\/settings\/<\/p>\n<p>For the full list of settings and their values, see<br \/>\nhttps:\/\/docs.djangoproject.com\/en\/1.9\/ref\/settings\/<br \/>\n\u201c\u201d\u201d<\/p>\n<p>import os<\/p>\n<p># Build paths inside the project like this: os.path.join(BASE_DIR, \u2026)<br \/>\nBASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))<\/p>\n<p># Quick-start development settings \u2013 unsuitable for production<br \/>\n# See https:\/\/docs.djangoproject.com\/en\/1.9\/howto\/deployment\/checklist\/<\/p>\n<p># SECURITY WARNING: keep the secret key used in production secret!<br \/>\nSECRET_KEY = \u2018#%8=y*l-+z*+mot(0+17@lm%!_yt4zb*j69fag-x((vz^zif(l\u2019<\/p>\n<p># SECURITY WARNING: don\u2019t run with debug turned on in production!<br \/>\nDEBUG = True<\/p>\n<p>ALLOWED_HOSTS = []<\/p>\n<p># Application definition<\/p>\n<p>INSTALLED_APPS = [<br \/>\n\u2018django.contrib.admin\u2019,<br \/>\n\u2018django.contrib.auth\u2019,<br \/>\n\u2018django.contrib.contenttypes\u2019,<br \/>\n\u2018django.contrib.sessions\u2019,<br \/>\n\u2018django.contrib.messages\u2019,<br \/>\n\u2018django.contrib.staticfiles\u2019,<br \/>\n\u2018rest_framework\u2019,<br \/>\n\u2018corsheaders\u2019,<br \/>\n\u2018todo\u2019<br \/>\n]<\/p>\n<p>MIDDLEWARE_CLASSES = [<br \/>\n\u2018django.middleware.security.SecurityMiddleware\u2019,<br \/>\n\u2018corsheaders.middleware.CorsMiddleware\u2019,<br \/>\n\u2018django.contrib.sessions.middleware.SessionMiddleware\u2019,<br \/>\n\u2018django.middleware.common.CommonMiddleware\u2019,<br \/>\n\u2018django.middleware.csrf.CsrfViewMiddleware\u2019,<br \/>\n\u2018django.contrib.auth.middleware.AuthenticationMiddleware\u2019,<br \/>\n\u2018django.contrib.auth.middleware.SessionAuthenticationMiddleware\u2019,<br \/>\n\u2018django.contrib.messages.middleware.MessageMiddleware\u2019,<br \/>\n\u2018django.middleware.clickjacking.XFrameOptionsMiddleware\u2019,<br \/>\n]<\/p>\n<p>ROOT_URLCONF = \u2018todobackend.urls\u2019<\/p>\n<p>TEMPLATES = [<br \/>\n{<br \/>\n\u2018BACKEND\u2019: \u2018django.template.backends.django.DjangoTemplates\u2019,<br \/>\n\u2018DIRS\u2019: [],<br \/>\n\u2018APP_DIRS\u2019: True,<br \/>\n\u2018OPTIONS\u2019: {<br \/>\n\u2018context_processors\u2019: [<br \/>\n\u2018django.template.context_processors.debug\u2019,<br \/>\n\u2018django.template.context_processors.request\u2019,<br \/>\n\u2018django.contrib.auth.context_processors.auth\u2019,<br \/>\n\u2018django.contrib.messages.context_processors.messages\u2019,<br \/>\n],<br \/>\n},<br \/>\n},<br \/>\n]<\/p>\n<p>WSGI_APPLICATION = \u2018todobackend.wsgi.application\u2019<\/p>\n<p># Database<br \/>\n# https:\/\/docs.djangoproject.com\/en\/1.9\/ref\/settings\/#databases<\/p>\n<p>DATABASES = {<br \/>\n\u2018default\u2019: {<br \/>\n\u2018ENGINE\u2019: \u2018django.db.backends.sqlite3\u2019,<br \/>\n\u2018NAME\u2019: os.path.join(BASE_DIR, \u2018db.sqlite3\u2019),<br \/>\n}<br \/>\n}<\/p>\n<p># Password validation<br \/>\n# https:\/\/docs.djangoproject.com\/en\/1.9\/ref\/settings\/#auth-password-validators<\/p>\n<p>AUTH_PASSWORD_VALIDATORS = [<br \/>\n{<br \/>\n\u2018NAME\u2019: \u2018django.contrib.auth.password_validation.UserAttributeSimilarityValidator\u2019,<br \/>\n},<br \/>\n{<br \/>\n\u2018NAME\u2019: \u2018django.contrib.auth.password_validation.MinimumLengthValidator\u2019,<br \/>\n},<br \/>\n{<br \/>\n\u2018NAME\u2019: \u2018django.contrib.auth.password_validation.CommonPasswordValidator\u2019,<br \/>\n},<br \/>\n{<br \/>\n\u2018NAME\u2019: \u2018django.contrib.auth.password_validation.NumericPasswordValidator\u2019,<br \/>\n},<br \/>\n]<\/p>\n<p># Internationalization<br \/>\n# https:\/\/docs.djangoproject.com\/en\/1.9\/topics\/i18n\/<\/p>\n<p>LANGUAGE_CODE = \u2018en-us\u2019<\/p>\n<p>TIME_ZONE = \u2018UTC\u2019<\/p>\n<p>USE_I18N = True<\/p>\n<p>USE_L10N = True<\/p>\n<p>USE_TZ = True<\/p>\n<p># Static files (CSS, JavaScript, Images)<br \/>\n# https:\/\/docs.djangoproject.com\/en\/1.9\/howto\/static-files\/<\/p>\n<p>STATIC_URL = \u2018\/static\/\u2019<\/p>\n<p># CORS Settings<\/p>\n<p>CORS_ORIGIN_ALLOW_ALL = True<\/p>\n<p>(venv) rmohan@root:~\/docker-ansible\/todobackend\/src$ rm -rf todobackend\/settings.py<\/p>\n<p>(venv) rmohan@root:~\/docker-ansible\/todobackend\/src$ vim manage.py<br \/>\nos.environ.setdefault(\u201cDJANGO_SETTINGS_MODULE\u201d, \u201ctodobackend.settings.base\u201d)<\/p>\n<p>(venv) rmohan@root:~\/docker-ansible\/todobackend\/src$ vim todobackend\/wsgi.py<br \/>\nos.environ.setdefault(\u201cDJANGO_SETTINGS_MODULE\u201d, \u201ctodobackend.settings.base\u201d)<\/p>\n<p>(venv) rmohan@root:~\/docker-ansible\/todobackend\/src$ vim todobackend\/settings\/test.py<br \/>\nfrom base import *<br \/>\nimport os<\/p>\n<p># Installed Apps<br \/>\nINSTALLED_APPS += (\u2018django_nose\u2019, )<br \/>\nTEST_RUNNER = \u2018django_nose.NoseTestSuiteRunner\u2019<br \/>\nTEST_OUTPUT_DIR = os.environ.get(\u2018TEST_OUTPUT_DIR\u2019,\u2019.\u2019)<br \/>\nNOSE_ARGS = [<br \/>\n\u2018\u2013verbosity=2\u2019, # verbose output<br \/>\n\u2018\u2013nologcapture\u2019, # don\u2019t output log capture<br \/>\n\u2018\u2013with-coverage\u2019, # activate coverage report<br \/>\n\u2018\u2013cover-package=todo\u2019, # coverage reports will apply to these packages<br \/>\n\u2018\u2013with-spec\u2019, # spec style tests<br \/>\n\u2018\u2013spec-color\u2019,<br \/>\n\u2018\u2013with-xunit\u2019, # enable xunit plugin<br \/>\n\u2018\u2013xunit-file=%s\/unittests.xml\u2019 % TEST_OUTPUT_DIR,<br \/>\n\u2018\u2013cover-xml\u2019, # produce XML coverage info<br \/>\n\u2018\u2013cover-xml-file=%s\/coverage.xml\u2019 % TEST_OUTPUT_DIR,<br \/>\n]<\/p>\n<p># Database<br \/>\n# https:\/\/docs.djangoproject.com\/en\/1.8\/ref\/settings\/#databases<br \/>\nDATABASES = {<br \/>\n\u2018default\u2019: {<br \/>\n\u2018ENGINE\u2019: \u2018django.db.backends.mysql\u2019,<br \/>\n\u2018NAME\u2019: os.environ.get(\u2018MYSQL_DATABASE\u2019,\u2019todobackend\u2019),<br \/>\n\u2018USER\u2019: os.environ.get(\u2018MYSQL_USER\u2019,\u2019todo\u2019),<br \/>\n\u2018PASSWORD\u2019: os.environ.get(\u2018MYSQL_PASSWORD\u2019,\u2019password\u2019),<br \/>\n\u2018HOST\u2019: os.environ.get(\u2018MYSQL_HOST\u2019,\u2019localhost\u2019),<br \/>\n\u2018PORT\u2019: os.environ.get(\u2018MYSQL_PORT\u2019,\u20193306?),<br \/>\n}<br \/>\n}<\/p>\n<p>Installing Mysql<\/p>\n<p>(venv) rmohan@root:~\/docker-ansible\/todobackend\/src$ sudo apt-get install mysql-server<\/p>\n<p>(venv) rmohan@root:~\/docker-ansible\/todobackend\/src$ sudo mysql_secure_installation<\/p>\n<p>(venv) rmohan@root:~\/docker-ansible\/todobackend\/src$ mysql -u root -p<br \/>\nEnter password:<br \/>\nWelcome to the MySQL monitor. Commands end with ; or \\g.<br \/>\nYour MySQL connection id is 48<br \/>\nServer version: 5.5.57-0ubuntu0.14.04.1 (Ubuntu)<\/p>\n<p>Copyright (c) 2000, 2017, Oracle and\/or its affiliates. All rights reserved.<\/p>\n<p>Oracle is a registered trademark of Oracle Corporation and\/or its<br \/>\naffiliates. Other names may be trademarks of their respective<br \/>\nowners.<\/p>\n<p>Type \u2018help;\u2019 or \u2018\\h\u2019 for help. Type \u2018\\c\u2019 to clear the current input statement.<\/p>\n<p>mysql&gt;<br \/>\nmysql&gt; create database todobackend;<br \/>\nQuery OK, 1 row affected (0.00 sec)<\/p>\n<p>mysql&gt; grant all privileges on *.* to \u2018todo\u2019@\u2019localhost\u2019 identified by \u2018password\u2018;<\/p>\n<p>Query OK, 0 rows affected (0.00 sec)<\/p>\n<p>mysql&gt; quit<br \/>\nBye<\/p>\n<p>(venv) rmohan@root:~\/docker-ansible\/todobackend\/src$ pip install mysql-python<br \/>\nCollecting mysql-python<br \/>\n\/home\/rmohan\/docker-ansible\/todobackend\/venv\/local\/lib\/python2.7\/site-packages\/pip\/_vendor\/requests\/packages\/urllib3\/util\/ssl_.py:318: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https:\/\/urllib3.readthedocs.io\/en\/latest\/security.html#snimissingwarning.<br \/>\nSNIMissingWarning<br \/>\n\/home\/rmohan\/docker-ansible\/todobackend\/venv\/local\/lib\/python2.7\/site-packages\/pip\/_vendor\/requests\/packages\/urllib3\/util\/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https:\/\/urllib3.readthedocs.io\/en\/latest\/security.html#insecureplatformwarning.<br \/>\nInsecurePlatformWarning<br \/>\nUsing cached MySQL-python-1.2.5.zip<br \/>\nComplete output from command python setup.py egg_info:<br \/>\nsh: 1: mysql_config: not found<br \/>\nTraceback (most recent call last):<br \/>\nFile \u201c\u201d, line 1, in<br \/>\nFile \u201c\/tmp\/pip-build-dmghKR\/mysql-python\/setup.py\u201d, line 17, in<br \/>\nmetadata, options = get_config()<br \/>\nFile \u201csetup_posix.py\u201d, line 43, in get_config<br \/>\nlibs = mysql_config(\u201clibs_r\u201d)<br \/>\nFile \u201csetup_posix.py\u201d, line 25, in mysql_config<br \/>\nraise EnvironmentError(\u201c%s not found\u201d % (mysql_config.path,))<br \/>\nEnvironmentError: mysql_config not found<\/p>\n<p>\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014-<br \/>\nCommand \u201cpython setup.py egg_info\u201d failed with error code 1 in \/tmp\/pip-build-dmghKR\/mysql-python\/<\/p>\n<p>(venv) rmohan@root:~\/docker-ansible\/todobackend\/src$ sudo apt-get install python-pip python-dev libmysqlclient-dev<\/p>\n<p>(venv) rmohan@root:~\/docker-ansible\/todobackend\/src$ pip install mysql-python<br \/>\nCollecting mysql-python<br \/>\nUsing cached MySQL-python-1.2.5.zip<br \/>\nBuilding wheels for collected packages: mysql-python<br \/>\nRunning setup.py bdist_wheel for mysql-python \u2026 done<br \/>\nStored in directory: \/home\/rmohan\/.cache\/pip\/wheels\/38\/a3\/89\/ec87e092cfb38450fc91a62562055231deb0049a029054dc62<br \/>\nSuccessfully built mysql-python<br \/>\nInstalling collected packages: mysql-python<br \/>\nSuccessfully installed mysql-python-1.2.5<\/p>\n<p>(venv) rmohan@root:~\/docker-ansible\/todobackend\/src$ export DJANGO_SETTINGS_MODULE=todobackend.settings.test<\/p>\n<p>(venv) rmohan@root:~\/docker-ansible\/todobackend\/src$ python manage.py \u2013settings=todobackend.settings.test<br \/>\nTraceback (most recent call last):<br \/>\nFile \u201cmanage.py\u201d, line 10, in<br \/>\nexecute_from_command_line(sys.argv)<br \/>\nFile \u201c\/home\/rmohan\/docker-ansible\/todobackend\/venv\/local\/lib\/python2.7\/site-packages\/django\/core\/management\/__init__.py\u201d, line 364, in execute_from_command_line<br \/>\nutility.execute()<br \/>\nFile \u201c\/home\/rmohan\/docker-ansible\/todobackend\/venv\/local\/lib\/python2.7\/site-packages\/django\/core\/management\/__init__.py\u201d, line 338, in execute<br \/>\ndjango.setup()<br \/>\nFile \u201c\/home\/rmohan\/docker-ansible\/todobackend\/venv\/local\/lib\/python2.7\/site-packages\/django\/__init__.py\u201d, line 27, in setup<br \/>\napps.populate(settings.INSTALLED_APPS)<br \/>\nFile \u201c\/home\/rmohan\/docker-ansible\/todobackend\/venv\/local\/lib\/python2.7\/site-packages\/django\/apps\/registry.py\u201d, line 85, in populate<br \/>\napp_config = AppConfig.create(entry)<br \/>\nFile \u201c\/home\/rmohan\/docker-ansible\/todobackend\/venv\/local\/lib\/python2.7\/site-packages\/django\/apps\/config.py\u201d, line 94, in create<br \/>\nmodule = import_module(entry)<br \/>\nFile \u201c\/usr\/lib\/python2.7\/importlib\/__init__.py\u201d, line 37, in import_module<br \/>\n__import__(name)<br \/>\nImportError: No module named django_nose<\/p>\n<p>(venv) rmohan@root:~\/docker-ansible\/todobackend\/src$ pip install django_nose<\/p>\n<p>(venv) rmohan@root:~\/docker-ansible\/todobackend\/src$ pip install pinocchio coverage<\/p>\n<p>(venv) rmohan@root:~\/docker-ansible\/todobackend\/src$ python manage.py runserver<br \/>\nPerforming system checks\u2026<\/p>\n<p>System check identified no issues (0 silenced).<\/p>\n<p>You have 14 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions, todo.<br \/>\nRun \u2018python manage.py migrate\u2019 to apply them.<\/p>\n<p>September 14, 2017 \u2013 15:14:06<br \/>\nDjango version 1.11.5, using settings \u2018todobackend.settings.test\u2019<br \/>\nStarting development server at http:\/\/127.0.0.1:8000\/<br \/>\nQuit the server with CONTROL-C.<\/p>\n<p>(venv) rmohan@root:~\/docker-ansible\/todobackend\/src$ python manage.py migrate<br \/>\nSystem check identified some issues:<\/p>\n<p>WARNINGS:<br \/>\n?: (mysql.W002) MySQL Strict Mode is not set for database connection \u2018default\u2019<br \/>\nHINT: MySQL\u2019s Strict Mode fixes many data integrity problems in MySQL, such as data truncation upon insertion, by escalating warnings into errors. It is strongly recommended you activate it. See: https:\/\/docs.djangoproject.com\/en\/1.11\/ref\/databases\/#mysql-sql-mode<br \/>\nOperations to perform:<br \/>\nApply all migrations: admin, auth, contenttypes, sessions, todo<br \/>\nRunning migrations:<br \/>\nApplying contenttypes.0001_initial\u2026 OK<br \/>\nApplying auth.0001_initial\u2026 OK<br \/>\nApplying admin.0001_initial\u2026 OK<br \/>\nApplying admin.0002_logentry_remove_auto_add\u2026 OK<br \/>\nApplying contenttypes.0002_remove_content_type_name\u2026 OK<br \/>\nApplying auth.0002_alter_permission_name_max_length\u2026 OK<br \/>\nApplying auth.0003_alter_user_email_max_length\u2026 OK<br \/>\nApplying auth.0004_alter_user_username_opts\u2026 OK<br \/>\nApplying auth.0005_alter_user_last_login_null\u2026 OK<br \/>\nApplying auth.0006_require_contenttypes_0002\u2026 OK<br \/>\nApplying auth.0007_alter_validators_add_error_messages\u2026 OK<br \/>\nApplying auth.0008_alter_user_username_max_length\u2026 OK<br \/>\nApplying sessions.0001_initial\u2026 OK<br \/>\nApplying todo.0001_initial\u2026 OK<br \/>\n(venv) rmohan@root:~\/docker-ansible\/todobackend\/src$<br \/>\n(venv) rmohan@root:~\/docker-ansible\/todobackend\/src$ python manage.py runserver<br \/>\nPerforming system checks\u2026<\/p>\n<p>System check identified no issues (0 silenced).<br \/>\nSeptember 14, 2017 \u2013 15:14:56<br \/>\nDjango version 1.11.5, using settings \u2018todobackend.settings.test\u2019<br \/>\nStarting development server at http:\/\/127.0.0.1:8000\/<br \/>\nQuit the server with CONTROL-C.<\/p>\n<p>(venv) rmohan@root:~\/docker-ansible\/todobackend\/src$ deactivate<br \/>\nrmohan@root:~\/docker-ansible\/todobackend\/src$<\/p>\n<p>rmohan@root:~\/docker-ansible\/todobackend\/src$ cd ..\/..\/<\/p>\n<p>rmohan@root:~\/docker-ansible$ mkdir todobackend-specs<\/p>\n<p>rmohan@root:~\/docker-ansible$ cd todobackend-specs\/<\/p>\n<p>rmohan@root:~\/docker-ansible\/todobackend-specs$ git init<br \/>\nInitialized empty Git repository in \/home\/rmohan\/docker-ansible\/todobackend-specs\/.git\/<\/p>\n<p>rmohan@root:~\/docker-ansible\/todobackend-specs$ touch .gitignore<br \/>\nnode_module<\/p>\n<p>rmohan@root:~\/docker-ansible\/todobackend-specs$ npm init<br \/>\nThis utility will walk you through creating a package.json file.<br \/>\nIt only covers the most common items, and tries to guess sane defaults.<\/p>\n<p>See `npm help json` for definitive documentation on these fields<br \/>\nand exactly what they do.<\/p>\n<p>Use `npm install \u2013save` afterwards to install a package and<br \/>\nsave it as a dependency in the package.json file.<\/p>\n<p>Press ^C at any time to quit.<br \/>\nname: (todobackend-specs)<br \/>\nversion: (0.0.0) 0.1.0<br \/>\ndescription: \u201cTodo Backend Acceptence Test\u201d<br \/>\nentry point: (index.js) app.js<br \/>\ntest command: mocha<br \/>\ngit repository:<br \/>\nkeywords:<br \/>\nauthor: mshaik<br \/>\nlicense: (BSD-2-Clause)<br \/>\nAbout to write to \/home\/rmohan\/docker-ansible\/todobackend-specs\/package.json:<\/p>\n<p>{<br \/>\n\u201cname\u201d: \u201ctodobackend-specs\u201d,<br \/>\n\u201cversion\u201d: \u201c0.1.0\u201d,<br \/>\n\u201cdescription\u201d: \u201c\\\u201dTodo Backend Acceptence Test\\\u201d\u201d,<br \/>\n\u201cmain\u201d: \u201capp.js\u201d,<br \/>\n\u201cscripts\u201d: {<br \/>\n\u201ctest\u201d: \u201cmocha\u201d<br \/>\n},<br \/>\n\u201cauthor\u201d: \u201cmshaik\u201d,<br \/>\n\u201clicense\u201d: \u201cBSD-2-Clause\u201d<br \/>\n}<\/p>\n<p>Is this ok? (yes)<br \/>\nrmohan@root:~\/docker-ansible\/todobackend-specs$ ls<br \/>\npackage.json<br \/>\nrmohan@root:~\/docker-ansible\/todobackend-specs$ cat package.json<br \/>\n{<br \/>\n\u201cname\u201d: \u201ctodobackend-specs\u201d,<br \/>\n\u201cversion\u201d: \u201c0.1.0\u201d,<br \/>\n\u201cdescription\u201d: \u201c\\\u201dTodo Backend Acceptence Test\\\u201d\u201d,<br \/>\n\u201cmain\u201d: \u201capp.js\u201d,<br \/>\n\u201cscripts\u201d: {<br \/>\n\u201ctest\u201d: \u201cmocha\u201d<br \/>\n},<br \/>\n\u201cauthor\u201d: \u201cmshaik\u201d,<br \/>\n\u201clicense\u201d: \u201cBSD-2-Clause\u201d<br \/>\n}<\/p>\n<p>rmohan@root:~\/docker-ansible\/todobackend-specs$ sudo npm install -g n<br \/>\nnpm http GET https:\/\/registry.npmjs.org\/n<br \/>\nnpm http 200 https:\/\/registry.npmjs.org\/n<br \/>\nnpm http GET https:\/\/registry.npmjs.org\/n\/-\/n-2.1.8.tgz<br \/>\nnpm http 200 https:\/\/registry.npmjs.org\/n\/-\/n-2.1.8.tgz<br \/>\n\/usr\/local\/bin\/n -&gt; \/usr\/local\/lib\/node_modules\/n\/bin\/n<br \/>\nn@2.1.8 \/usr\/local\/lib\/node_modules\/n<\/p>\n<p>rmohan@root:~\/docker-ansible\/todobackend-specs$ sudo n stable<\/p>\n<p>install : node-v8.4.0<br \/>\nmkdir : \/usr\/local\/n\/versions\/node\/8.4.0<br \/>\nfetch : https:\/\/nodejs.org\/dist\/v8.4.0\/node-v8.4.0-linux-x64.tar.gz<br \/>\n######################################################################## 100.0%<br \/>\ninstalled : v8.4.0<\/p>\n<p>rmohan@root:~\/docker-ansible\/todobackend-specs$ sudo npm install bluebird chai chai-as-promised mocha superagent superagent-promise<br \/>\nnpm notice created a lockfile as package-lock.json. You should commit this file.<br \/>\nnpm WARN todobackend-specs@0.1.0 No repository field.<\/p>\n<p>+ superagent-promise@1.1.0<br \/>\n+ superagent@3.6.0<br \/>\n+ chai@4.1.2<br \/>\n+ chai-as-promised@7.1.1<br \/>\n+ mocha@3.5.3<br \/>\n+ bluebird@3.5.0<br \/>\nadded 66 packages in 9.374s<\/p>\n<p>rmohan@root:~\/docker-ansible\/todobackend-specs$ cat package.json<br \/>\n{<br \/>\n\u201cname\u201d: \u201ctodobackend-specs\u201d,<br \/>\n\u201cversion\u201d: \u201c0.1.0\u201d,<br \/>\n\u201cdescription\u201d: \u201c\\\u201dTodo Backend Acceptence Test\\\u201d\u201d,<br \/>\n\u201cmain\u201d: \u201capp.js\u201d,<br \/>\n\u201cscripts\u201d: {<br \/>\n\u201ctest\u201d: \u201cmocha\u201d<br \/>\n},<br \/>\n\u201cauthor\u201d: \u201cmshaik\u201d,<br \/>\n\u201clicense\u201d: \u201cBSD-2-Clause\u201d,<br \/>\n\u201cdependencies\u201d: {<br \/>\n\u201cbluebird\u201d: \u201c^3.5.0\u201d,<br \/>\n\u201cchai\u201d: \u201c^4.1.2\u201d,<br \/>\n\u201cchai-as-promised\u201d: \u201c^7.1.1\u201d,<br \/>\n\u201cmocha\u201d: \u201c^3.5.3\u201d,<br \/>\n\u201csuperagent\u201d: \u201c^3.6.0\u201d,<br \/>\n\u201csuperagent-promise\u201d: \u201c^1.1.0\u201d<br \/>\n}<br \/>\n}<\/p>\n<p>rmohan@root:~\/docker-ansible\/todobackend-specs$ sudo apt-get install nodejs-legacy<\/p>\n<p>Building Base Image<\/p>\n<p>rmohan@root:~\/docker-ansible$ mkdir todobackend-base<br \/>\nrmohan@root:~\/docker-ansible$ cd todobackend-base\/<\/p>\n<p>rmohan@root:~\/docker-ansible\/todobackend-base$ git init<br \/>\nInitialized empty Git repository in \/home\/rmohan\/docker-ansible\/todobackend-base\/.git\/<\/p>\n<p>rmohan@root:~\/docker-ansible\/todobackend-base$ vim Dockerfile<br \/>\nFROM ubuntu:trusty<br \/>\nMAINTAINER rafi494<\/p>\n<p># Prevent dpkg errors<br \/>\nENV TERM=xterm-256color<\/p>\n<p># Set mirrors to NZ<br \/>\n# RUN sed -i \u201cs\/http:\\\/\\\/archive.\/http:\\\/\\\/nz.archive.\/g\u201d \/etc\/apt\/sources.list<\/p>\n<p># Install Python runtime<br \/>\nRUN apt-get update &amp;&amp; \\<br \/>\napt-get install -qy \\<br \/>\n-o APT::Install-Recommend=false -o APT::Install-Suggests=false \\<br \/>\npython python-virtualenv libpython2.7 python-mysqldb<\/p>\n<p># Create virtual environment<br \/>\n# Upgrade PIP in virtual environment to latest version<br \/>\nRUN virtualenv \/appenv &amp;&amp; \\<br \/>\n. \/appenv\/bin\/activate &amp;&amp; \\<br \/>\npip install pip \u2013upgrade<\/p>\n<p># Add entrypoint script<br \/>\nADD scripts\/entrypoint.sh \/usr\/local\/bin\/entrypoint.sh<br \/>\nRUN chmod +x \/usr\/local\/bin\/entrypoint.sh<br \/>\nENTRYPOINT [\u201centrypoint.sh\u201d]<\/p>\n<p>LABEL application=todobackend<\/p>\n<p>rmohan@root:~\/docker-ansible\/todobackend-base$ mkdir scripts<br \/>\nrmohan@root:~\/docker-ansible\/todobackend-base$ vim scripts\/entrypoint.sh<br \/>\n#!\/bin\/bash<br \/>\n. \/appenv\/bin\/activate<br \/>\nexec $@<\/p>\n<p>rmohan@root:~\/docker-ansible\/todobackend-base$ docker build -t rafi494\/todobackend-base .<br \/>\nSending build context to Docker daemon 34.82 kB<br \/>\nSending build context to Docker daemon<br \/>\nStep 0 : FROM ubuntu:trusty<br \/>\ntrusty: Pulling from ubuntu<\/p>\n<p>77ec837caf85: Pull complete<br \/>\n27fb25a22e6b: Pull complete<br \/>\n668a3fc0cef3: Pull complete<br \/>\nad221bf67cf4: Pull complete<br \/>\n93f6219c4eb0: Pull complete<br \/>\nb44ce450cb60: Pull complete<br \/>\nDigest: sha256:404e4e6352099db4d3fb2781a13c3b3b090d3bcf61fc2b30b009c3987199a3aa<br \/>\nStatus: Downloaded newer image for ubuntu:trusty<br \/>\n\u2014&gt; b44ce450cb60<br \/>\nStep 1 : MAINTAINER rafi494<br \/>\n\u2014&gt; Running in e2e87972a04c<br \/>\n\u2014&gt; 6e2f149ea112<br \/>\nRemoving intermediate container e2e87972a04c<br \/>\nStep 2 : ENV TERM xterm-256color<br \/>\n\u2014&gt; Running in e22a9e2499db<br \/>\n\u2014&gt; c413f9b3a937<br \/>\nRemoving intermediate container e22a9e2499db<br \/>\nStep 3 : RUN apt-get update &amp;&amp; apt-get install -qy -o APT::Install-Recommend=false -o APT::Install-Suggests=false python python-virtualenv libpython2.7 python-mysqldb<br \/>\n\u2014&gt; Running in 81df16349ae6<br \/>\nGet:1 http:\/\/security.ubuntu.com trusty-security InRelease [65.9 kB]<br \/>\n.<br \/>\n.<br \/>\nRunning hooks in \/etc\/ca-certificates\/update.d\u2026.done.<br \/>\n\u2014&gt; 38d9bf507eb3<br \/>\nRemoving intermediate container 81df16349ae6<br \/>\nStep 4 : RUN virtualenv \/appenv &amp;&amp; . \/appenv\/bin\/activate &amp;&amp; pip install pip \u2013upgrade<br \/>\n\u2014&gt; Running in e454212014dd<br \/>\nNew python executable in \/appenv\/bin\/python<br \/>\nInstalling setuptools, pip\u2026done.<br \/>\nDownloading\/unpacking pip from https:\/\/pypi.python.org\/packages\/b6\/ac\/7015eb97dc749283ffdec1c3a88ddb8ae03b8fad0f0e611408f196358da3\/pip-9.0.1-py2.py3-none-any.whl#md5=297dbd16ef53bcef0447d245815f5144<br \/>\nInstalling collected packages: pip<br \/>\nFound existing installation: pip 1.5.4<br \/>\nUninstalling pip:<br \/>\nSuccessfully uninstalled pip<br \/>\nSuccessfully installed pip<br \/>\nCleaning up\u2026<br \/>\n\u2014&gt; 8bd2596212ea<br \/>\nRemoving intermediate container e454212014dd<br \/>\nStep 5 : ADD scripts\/entrypoint.sh \/usr\/local\/bin\/entrypoint.sh<br \/>\n\u2014&gt; 5090f2d23cbc<br \/>\nRemoving intermediate container 79bc20d7085a<br \/>\nStep 6 : RUN chmod +x \/usr\/local\/bin\/entrypoint.sh<br \/>\n\u2014&gt; Running in 77a421e12cf2<br \/>\n\u2014&gt; 4a33b5f19bcf<br \/>\nRemoving intermediate container 77a421e12cf2<br \/>\nStep 7 : ENTRYPOINT entrypoint.sh<br \/>\n\u2014&gt; Running in f99f99500432<br \/>\n\u2014&gt; c860003f9b59<br \/>\nRemoving intermediate container f99f99500432<br \/>\nStep 8 : LABEL application todobackend<br \/>\n\u2014&gt; Running in 5ad48a0bdd6d<br \/>\n\u2014&gt; 00a95d4fd18f<br \/>\nRemoving intermediate container 5ad48a0bdd6d<br \/>\nSuccessfully built 00a95d4fd18f<\/p>\n<p>rmohan@root:~\/docker-ansible\/todobackend-base$ docker images<br \/>\nREPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE<br \/>\nrafi494\/todobackend-base latest 00a95d4fd18f 2 minutes ago 378.8 MB<\/p>\n<p>rmohan@root:~\/docker-ansible\/todobackend-base$ docker run -rm rafi494\/todobackend-base ps<br \/>\nPID TTY TIME CMD<br \/>\n1 ? 00:00:00 ps<\/p>\n<p>rmohan@root:~\/docker-ansible\/todobackend-base$ vim scripts\/entrypoint.sh<br \/>\n#!\/bin\/bash<br \/>\n. \/appenv\/bin\/activate<br \/>\n$@<\/p>\n<p>rmohan@root:~\/docker-ansible\/todobackend-base$ docker build -t rafi494\/todobackend-base .<br \/>\nSending build context to Docker daemon 34.82 kB<br \/>\nSending build context to Docker daemon<br \/>\nStep 0 : FROM ubuntu:trusty<br \/>\n\u2014&gt; b44ce450cb60<br \/>\nStep 1 : MAINTAINER rafi494<br \/>\n\u2014&gt; Using cache<br \/>\n\u2014&gt; 6e2f149ea112<br \/>\nStep 2 : ENV TERM xterm-256color<br \/>\n\u2014&gt; Using cache<br \/>\n\u2014&gt; c413f9b3a937<br \/>\nStep 3 : RUN apt-get update &amp;&amp; apt-get install -qy -o APT::Install-Recommend=false -o APT::Install-Suggests=false python python-virtualenv libpython2.7 python-mysqldb<br \/>\n\u2014&gt; Using cache<br \/>\n\u2014&gt; 38d9bf507eb3<br \/>\nStep 4 : RUN virtualenv \/appenv &amp;&amp; . \/appenv\/bin\/activate &amp;&amp; pip install pip \u2013upgrade<br \/>\n\u2014&gt; Using cache<br \/>\n\u2014&gt; 8bd2596212ea<br \/>\nStep 5 : ADD scripts\/entrypoint.sh \/usr\/local\/bin\/entrypoint.sh<br \/>\n\u2014&gt; f0b62f95219f<br \/>\nRemoving intermediate container a70509f7c735<br \/>\nStep 6 : RUN chmod +x \/usr\/local\/bin\/entrypoint.sh<br \/>\n\u2014&gt; Running in de0ca94753ad<br \/>\n\u2014&gt; 43626306b958<br \/>\nRemoving intermediate container de0ca94753ad<br \/>\nStep 7 : ENTRYPOINT entrypoint.sh<br \/>\n\u2014&gt; Running in e82c88a26500<br \/>\n\u2014&gt; 7936a208c626<br \/>\nRemoving intermediate container e82c88a26500<br \/>\nStep 8 : LABEL application todobackend<br \/>\n\u2014&gt; Running in e29c5e4599a0<br \/>\n\u2014&gt; 43d184525209<br \/>\nRemoving intermediate container e29c5e4599a0<br \/>\nSuccessfully built 43d184525209<\/p>\n<p>rmohan@root:~\/docker-ansible\/todobackend-base$ docker run -rm rafi494\/todobackend-base ps<br \/>\nPID TTY TIME CMD<br \/>\n1 ? 00:00:00 entrypoint.sh<br \/>\n11 ? 00:00:00 ps<\/p>\n<p>rmohan@root:~\/docker-ansible\/todobackend-base$ vim scripts\/entrypoint.sh<br \/>\n#!\/bin\/bash<br \/>\n. \/appenv\/bin\/activate<br \/>\nexec $@<\/p>\n<p>rmohan@root:~\/docker-ansible\/todobackend-base$ docker run -rm rafi494\/todobackend-base ps<br \/>\nPID TTY TIME CMD<br \/>\n1 ? 00:00:00 ps<\/p>\n<p>Creating Devlopment Image<\/p>\n<p>rmohan@root:~\/docker-ansible\/todobackend-base$ cd ..\/todobackend<br \/>\nrmohan@root:~\/docker-ansible\/todobackend$ tree -L 1<br \/>\n.<br \/>\n|\u2013 src<br \/>\n`\u2013 venv<\/p>\n<p>2 directories, 0 files<\/p>\n<p>rmohan@root:~\/docker-ansible\/todobackend$ mkdir -p docker\/dev<br \/>\nrmohan@root:~\/docker-ansible\/todobackend$ cd docker\/dev\/<\/p>\n<p>rmohan@root:~\/docker-ansible\/todobackend\/docker\/dev$ touch Dockerfile<br \/>\nFROM rafi494\/todobackend-base:latest<br \/>\nMAINTAINER rafi<\/p>\n<p># Install dev\/build dependencies<br \/>\nRUN apt-get update &amp;&amp; \\<br \/>\napt-get install -qy python-dev libmysqlclient-dev<\/p>\n<p># Activate virtual environment and install wheel support<br \/>\nRUN . \/appenv\/bin\/activate &amp;&amp; \\<br \/>\npip install wheel \u2013upgrade<\/p>\n<p># PIP environment variables (NOTE: must be set after installing wheel)<br \/>\nENV WHEELHOUSE=\/wheelhouse PIP_WHEEL_DIR=\/wheelhouse PIP_FIND_LINKS=\/wheelhouse XDG_CACHE_HOME=\/cache<\/p>\n<p># OUTPUT: Build artefacts (Wheels) are output here<br \/>\nVOLUME \/wheelhouse<\/p>\n<p># OUTPUT: Build cache<br \/>\nVOLUME \/build<\/p>\n<p># OUTPUT: Test reports are output here<br \/>\nVOLUME \/reports<\/p>\n<p># Add test entrypoint script<br \/>\nCOPY scripts\/test.sh \/usr\/local\/bin\/test.sh<br \/>\nRUN chmod +x \/usr\/local\/bin\/test.sh<\/p>\n<p># Set defaults for entrypoint and command string<br \/>\nENTRYPOINT [\u201ctest.sh\u201d]<br \/>\nCMD [\u201cpython\u201d, \u201cmanage.py\u201d, \u201ctest\u201d, \u201c\u2013noinput\u201d]<\/p>\n<p># Add application source<br \/>\nCOPY src \/application<br \/>\nWORKDIR \/application<\/p>\n<p>rmohan@root:~\/docker-ansible\/todobackend\/docker\/dev$ vim ..\/..\/scripts\/test.sh<br \/>\n#!\/bin\/bash<br \/>\n# Activate virtual environment<br \/>\n. \/appenv\/bin\/activate<\/p>\n<p># Download requirements to build cache<br \/>\npip download -d \/build -r requirements_test.txt \u2013no-input<\/p>\n<p># Install application test requirements<br \/>\npip install \u2013no-index -f \/build -r requirements_test.txt<\/p>\n<p># Run test.sh arguments<br \/>\nexec $@<\/p>\n<p>Creating application Requirement files<\/p>\n<p>rmohan@root:~\/docker-ansible\/todobackend\/docker\/dev$ cd ..\/..rmohan@root:~\/docker-ansible\/todobackend$ source venv\/bin\/activate<br \/>\n(venv) rmohan@root:~\/docker-ansible\/todobackend$ cd src\/<br \/>\n(venv) rmohan@root:~\/docker-ansible\/todobackend\/src$ pip freeze &gt; requirements.txt<\/p>\n<p>(venv) rmohan@root:~\/docker-ansible\/todobackend\/src$ cat requirements.txt<br \/>\ncolorama==0.3.9<br \/>\ncoverage==4.4.1<br \/>\nDjango==1.11.5<br \/>\ndjango-cors-headers==2.1.0<br \/>\ndjango-nose==1.4.5<br \/>\ndjangorestframework==3.6.4<br \/>\nMySQL-python==1.2.5<br \/>\nnose==1.3.7<br \/>\npinocchio==0.4.2<br \/>\npytz==2017.2<\/p>\n<p>(venv) rmohan@root:~\/docker-ansible\/todobackend\/src$ vim requirements.txt<br \/>\nDjango==1.11.5<br \/>\ndjango-cors-headers==2.1.0<br \/>\ndjangorestframework==3.6.4<br \/>\nMySQL-python==1.2.5<\/p>\n<p>(venv) rmohan@root:~\/docker-ansible\/todobackend\/src$ vim requirements_test.txt<br \/>\n-r requirements.txt<br \/>\ncolorama==0.3.9<br \/>\ncoverage==4.4.1<br \/>\ndjango-nose==1.4.5<br \/>\nnose==1.3.7<br \/>\npinocchio==0.4.2<\/p>\n<p>Devlopment Image review<br \/>\nTesting Devlopment Image<br \/>\n(venv) rmohan@root:~\/docker-ansible\/todobackend\/src$ cd ..<br \/>\n(venv) rmohan@root:~\/docker-ansible\/todobackend$ docker build -t todobackend-dev -f docker\/dev\/Dockerfile .<br \/>\nSending build context to Docker daemon 50.65 MB<br \/>\nSending build context to Docker daemon<br \/>\nStep 0 : FROM rafi494\/todobackend-base:latest<br \/>\n\u2014&gt; a2ca1f3870d7<br \/>\nStep 1 : MAINTAINER rafi<br \/>\n\u2014&gt; Running in c684859b3076<br \/>\n\u2014&gt; 8d359fc022e8<br \/>\nRemoving intermediate container c684859b3076<br \/>\nStep 2 : RUN apt-get update &amp;&amp; apt-get install -qy python-dev libmysqlclient-dev<br \/>\n\u2014&gt; Running in de5056a6328e<br \/>\n.<\/p>\n<p>Step 3 : RUN . \/appenv\/bin\/activate &amp;&amp; pip install wheel \u2013upgrade<br \/>\n\u2014&gt; Running in 37e84294c1e6<br \/>\nCollecting wheel<\/p>\n<p>\u2014&gt; b9e7992d4e62<br \/>\nRemoving intermediate container 37e84294c1e6<br \/>\nStep 4 : ENV WHEELHOUSE \/wheelhouse PIP_WHEEL_DIR \/wheelhouse PIP_FIND_LINKS \/wheelhouse XDG_CACHE_HOME \/cache<br \/>\n\u2014&gt; Running in 5d94907105e3<br \/>\n\u2014&gt; 101e00962323<br \/>\nRemoving intermediate container 5d94907105e3<br \/>\nStep 5 : VOLUME \/wheelhouse<br \/>\n\u2014&gt; Running in 64488d8f2d97<br \/>\n\u2014&gt; 4607e17f46e1<br \/>\nRemoving intermediate container 64488d8f2d97<br \/>\nStep 6 : VOLUME \/build<br \/>\n\u2014&gt; Running in b6607d721ded<br \/>\n\u2014&gt; 004347875e10<br \/>\nRemoving intermediate container b6607d721ded<br \/>\nStep 7 : VOLUME \/reports<br \/>\n\u2014&gt; Running in 5999cc6683b4<br \/>\n\u2014&gt; 9b238fd38525<br \/>\nRemoving intermediate container 5999cc6683b4<br \/>\nStep 8 : COPY scripts\/test.sh \/usr\/local\/bin\/test.sh<br \/>\n\u2014&gt; 07f3369050ee<br \/>\nRemoving intermediate container 18bac283237a<br \/>\nStep 9 : RUN chmod +x \/usr\/local\/bin\/test.sh<br \/>\n\u2014&gt; Running in ca52d4b7e065<br \/>\n\u2014&gt; ce20f7376ca9<br \/>\nRemoving intermediate container ca52d4b7e065<br \/>\nStep 10 : ENTRYPOINT test.sh<br \/>\n\u2014&gt; Running in ae410324d55f<br \/>\n\u2014&gt; 78e8c1392b51<br \/>\nRemoving intermediate container ae410324d55f<br \/>\nStep 11 : CMD python manage.py test \u2013noinput<br \/>\n\u2014&gt; Running in a1a4eb631e76<br \/>\n\u2014&gt; 20f2cf563d00<br \/>\nRemoving intermediate container a1a4eb631e76<br \/>\nStep 12 : COPY src \/application<br \/>\n\u2014&gt; ae7f0b9dad4f<br \/>\nRemoving intermediate container 59727c5df809<br \/>\nStep 13 : WORKDIR \/application<br \/>\n\u2014&gt; Running in c629a3601c4e<br \/>\n\u2014&gt; d7a363a684d8<br \/>\nRemoving intermediate container c629a3601c4e<\/p>\n<p>(venv) rmohan@root:~\/docker-ansible\/todobackend$ vim .dockerignore<br \/>\nvenv<\/p>\n<p>(venv) rmohan@root:~\/docker-ansible\/todobackend$ docker build -t todobackend-dev -f docker\/dev\/Dockerfile .<br \/>\nSending build context to Docker daemon 165.9 kB<\/p>\n<p>(venv) rmohan@root:~\/docker-ansible\/todobackend$ docker run \u2013rm todobackend-devCollecting Django==1.11.5 (from -r requirements.txt (line 1))<br \/>\n\/appenv\/local\/lib\/python2.7\/site-packages\/pip\/_vendor\/requests\/packages\/urllib3\/util\/ssl_.py:318: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https:\/\/urllib3.readthedocs.io\/en\/latest\/security.html#snimissingwarning.<br \/>\nSNIMissingWarning<br \/>\n\/appenv\/local\/lib\/python2.7\/site-packages\/pip\/_vendor\/requests\/packages\/urllib3\/util\/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https:\/\/urllib3.readthedocs.io\/en\/latest\/security.html#insecureplatformwarning.<br \/>\nInsecurePlatformWarning<br \/>\nDownloading Django-1.11.5-py2.py3-none-any.whl (6.9MB)<br \/>\nSaved \/build\/Django-1.11.5-py2.py3-none-any.whl<br \/>\nCollecting django-cors-headers==2.1.0 (from -r requirements.txt (line 2))<br \/>\nDownloading django_cors_headers-2.1.0-py2.py3-none-any.whl<br \/>\nSaved \/build\/django_cors_headers-2.1.0-py2.py3-none-any.whl<br \/>\nCollecting djangorestframework==3.6.4 (from -r requirements.txt (line 3))<br \/>\nDownloading djangorestframework-3.6.4-py2.py3-none-any.whl (1.5MB)<br \/>\nSaved \/build\/djangorestframework-3.6.4-py2.py3-none-any.whl<br \/>\nCollecting MySQL-python==1.2.5 (from -r requirements.txt (line 4))<br \/>\nDownloading MySQL-python-1.2.5.zip (108kB)<br \/>\nSaved \/build\/MySQL-python-1.2.5.zip<br \/>\nCollecting colorama==0.3.9 (from -r requirements_test.txt (line 2))<br \/>\nDownloading colorama-0.3.9-py2.py3-none-any.whl<br \/>\nSaved \/build\/colorama-0.3.9-py2.py3-none-any.whl<br \/>\nCollecting coverage==4.4.1 (from -r requirements_test.txt (line 3))<br \/>\nDownloading coverage-4.4.1-cp27-cp27mu-manylinux1_x86_64.whl (193kB)<br \/>\nSaved \/build\/coverage-4.4.1-cp27-cp27mu-manylinux1_x86_64.whl<br \/>\nCollecting django-nose==1.4.5 (from -r requirements_test.txt (line 4))<br \/>\nDownloading django_nose-1.4.5-py2.py3-none-any.whl<br \/>\nSaved \/build\/django_nose-1.4.5-py2.py3-none-any.whl<br \/>\nCollecting nose==1.3.7 (from -r requirements_test.txt (line 5))<br \/>\nDownloading nose-1.3.7-py2-none-any.whl (154kB)<br \/>\nSaved \/build\/nose-1.3.7-py2-none-any.whl<br \/>\nCollecting pinocchio==0.4.2 (from -r requirements_test.txt (line 6))<br \/>\nDownloading pinocchio-0.4.2.tar.gz<br \/>\nSaved \/build\/pinocchio-0.4.2.tar.gz<br \/>\nCollecting pytz (from Django==1.11.5-&gt;-r requirements.txt (line 1))<br \/>\nDownloading pytz-2017.2-py2.py3-none-any.whl (484kB)<br \/>\nSaved \/build\/pytz-2017.2-py2.py3-none-any.whl<br \/>\nSuccessfully downloaded Django django-cors-headers djangorestframework MySQL-python colorama coverage django-nose nose pinocchio pytz<br \/>\nCollecting Django==1.11.5 (from -r requirements.txt (line 1))<br \/>\nCollecting django-cors-headers==2.1.0 (from -r requirements.txt (line 2))<br \/>\nCollecting djangorestframework==3.6.4 (from -r requirements.txt (line 3))<br \/>\nCollecting MySQL-python==1.2.5 (from -r requirements.txt (line 4))<br \/>\nCollecting colorama==0.3.9 (from -r requirements_test.txt (line 2))<br \/>\nCollecting coverage==4.4.1 (from -r requirements_test.txt (line 3))<br \/>\nCollecting django-nose==1.4.5 (from -r requirements_test.txt (line 4))<br \/>\nCollecting nose==1.3.7 (from -r requirements_test.txt (line 5))<br \/>\nCollecting pinocchio==0.4.2 (from -r requirements_test.txt (line 6))<br \/>\nCollecting pytz (from Django==1.11.5-&gt;-r requirements.txt (line 1))<br \/>\nBuilding wheels for collected packages: MySQL-python, pinocchio<br \/>\nRunning setup.py bdist_wheel for MySQL-python: started<br \/>\nRunning setup.py bdist_wheel for MySQL-python: finished with status \u2018done\u2019<br \/>\nStored in directory: \/cache\/pip\/wheels\/16\/ed\/55\/f27783bb5ab1cb57c9ac00356859d19adf17d76c31230f3f1f<br \/>\nRunning setup.py bdist_wheel for pinocchio: started<br \/>\nRunning setup.py bdist_wheel for pinocchio: finished with status \u2018done\u2019<br \/>\nStored in directory: \/cache\/pip\/wheels\/ab\/43\/84\/ba075171b712e03d94d14b1e264a80678dbca7ebb8bfe4f7b3<br \/>\nSuccessfully built MySQL-python pinocchio<br \/>\nInstalling collected packages: pytz, Django, django-cors-headers, djangorestframework, MySQL-python, colorama, coverage, nose, django-nose, pinocchio<br \/>\nSuccessfully installed Django-1.11.5 MySQL-python-1.2.5 colorama-0.3.9 coverage-4.4.1 django-cors-headers-2.1.0 django-nose-1.4.5 djangorestframework-3.6.4 nose-1.3.7 pinocchio-0.4.2 pytz-2017.2<br \/>\n\u2026\u2026\u2026\u2026<br \/>\n\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014-<br \/>\nRan 12 tests in 0.098s<\/p>\n<p>OK<br \/>\nCreating test database for alias \u2018default\u2019\u2026<br \/>\nSystem check identified no issues (0 silenced).<br \/>\nDestroying test database for alias \u2018default\u2019\u2026<\/p>\n<p>How to reduce docker run time<\/p>\n<p>(venv) rmohan@root:~\/docker-ansible\/todobackend$ docker run -v \/tmp\/cache:\/cache \u2013entrypoint true \u2013name cache todobackend-dev(venv)<\/p>\n<p>(venv) rmohan@root:~\/docker-ansible\/todobackend$ docker ps -a<br \/>\nCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES<br \/>\n664e669f0a1a todobackend-dev:latest \u201ctrue\u201d 30 seconds ago Exited (0) 29 seconds ago cache<\/p>\n<p>(venv) rmohan@root:~\/docker-ansible\/todobackend$ time docker run \u2013rm \u2013volumes-from cache todobackend-devCollecting Django==1.11.5 (from -r requirements.txt (line 1))<br \/>\nOK<br \/>\nCreating test database for alias \u2018default\u2019\u2026<br \/>\nSystem check identified no issues (0 silenced).<br \/>\nDestroying test database for alias \u2018default\u2019\u2026<\/p>\n<p>real 0m27.803s<br \/>\nuser 0m0.028s<br \/>\nsys 0m0.012s<\/p>\n<p>(venv) rmohan@root:~\/docker-ansible\/todobackend$ time docker run \u2013rm \u2013volumes-from cache todobackend-dev<br \/>\nreal 0m11.441s<br \/>\nuser 0m0.028s<br \/>\nsys 0m0.008s<\/p>\n<p>Using diffrent test settings<\/p>\n<p>(venv) rmohan@root:~\/docker-ansible\/todobackend$ time docker run \u2013rm -e DJANGO_SETTINGS=todobackend.settings.test \u2013volumes-from cache todobackend-dev<br \/>\nCollecting Django==1.11.5 (from -r requirements.txt (line 1))<br \/>\nFile was already downloaded \/build\/Django-1.11.5-py2.py3-none-any.whl<br \/>\nCollecting django-cors-headers==2.1.0 (from -r requirements.txt (line 2))<br \/>\nFile was already downloaded \/build\/django_cors_headers-2.1.0-py2.py3-none-any.whl<br \/>\nCollecting djangorestframework==3.6.4 (from -r requirements.txt (line 3))<br \/>\nFile was already downloaded \/build\/djangorestframework-3.6.4-py2.py3-none-any.whl<br \/>\nCollecting MySQL-python==1.2.5 (from -r requirements.txt (line 4))<br \/>\nFile was already downloaded \/build\/MySQL-python-1.2.5.zip<br \/>\nCollecting colorama==0.3.9 (from -r requirements_test.txt (line 2))<br \/>\nFile was already downloaded \/build\/colorama-0.3.9-py2.py3-none-any.whl<br \/>\nCollecting coverage==4.4.1 (from -r requirements_test.txt (line 3))<br \/>\nFile was already downloaded \/build\/coverage-4.4.1-cp27-cp27mu-manylinux1_x86_64.whl<br \/>\nCollecting django-nose==1.4.5 (from -r requirements_test.txt (line 4))<br \/>\nFile was already downloaded \/build\/django_nose-1.4.5-py2.py3-none-any.whl<br \/>\nCollecting nose==1.3.7 (from -r requirements_test.txt (line 5))<br \/>\nFile was already downloaded \/build\/nose-1.3.7-py2-none-any.whl<br \/>\nCollecting pinocchio==0.4.2 (from -r requirements_test.txt (line 6))<br \/>\nFile was already downloaded \/build\/pinocchio-0.4.2.tar.gz<br \/>\nCollecting pytz (from Django==1.11.5-&gt;-r requirements.txt (line 1))<br \/>\nFile was already downloaded \/build\/pytz-2017.2-py2.py3-none-any.whl<br \/>\nSuccessfully downloaded Django django-cors-headers djangorestframework MySQL-python colorama coverage django-nose nose pinocchio pytz<br \/>\nCollecting Django==1.11.5 (from -r requirements.txt (line 1))<br \/>\nCollecting django-cors-headers==2.1.0 (from -r requirements.txt (line 2))<br \/>\nCollecting djangorestframework==3.6.4 (from -r requirements.txt (line 3))<br \/>\nCollecting MySQL-python==1.2.5 (from -r requirements.txt (line 4))<br \/>\nCollecting colorama==0.3.9 (from -r requirements_test.txt (line 2))<br \/>\nCollecting coverage==4.4.1 (from -r requirements_test.txt (line 3))<br \/>\nCollecting django-nose==1.4.5 (from -r requirements_test.txt (line 4))<br \/>\nCollecting nose==1.3.7 (from -r requirements_test.txt (line 5))<br \/>\nCollecting pinocchio==0.4.2 (from -r requirements_test.txt (line 6))<br \/>\nCollecting pytz (from Django==1.11.5-&gt;-r requirements.txt (line 1))<br \/>\nInstalling collected packages: pytz, Django, django-cors-headers, djangorestframework, MySQL-python, colorama, coverage, nose, django-nose, pinocchio<br \/>\nSuccessfully installed Django-1.11.5 MySQL-python-1.2.5 colorama-0.3.9 coverage-4.4.1 django-cors-headers-2.1.0 django-nose-1.4.5 djangorestframework-3.6.4 nose-1.3.7 pinocchio-0.4.2 pytz-2017.2<br \/>\n\u2026\u2026\u2026\u2026<br \/>\n\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014-<br \/>\nRan 12 tests in 0.100s<\/p>\n<p>OK<br \/>\nCreating test database for alias \u2018default\u2019\u2026<br \/>\nSystem check identified no issues (0 silenced).<br \/>\nDestroying test database for alias \u2018default\u2019\u2026<\/p>\n<p>real 0m20.798s<br \/>\nuser 0m0.032s<br \/>\nsys 0m0.032s<\/p>\n<p>Creating multicontainer environment using docker compose<\/p>\n<p>(venv) rmohan@root:~\/docker-ansible\/todobackend$ vim docker\/dev\/docker-compose.yml<br \/>\ntest:<br \/>\nbuild: ..\/..\/<br \/>\ndockerfile: docker\/dev\/Dockerfile<br \/>\nvolumes_from:<br \/>\n\u2013 cache<br \/>\nlinks:<br \/>\n\u2013 db<br \/>\nenvironment:<br \/>\nDJANGO_SETTINGS_MODULE: todobackend.settings.test<br \/>\nMYSQL_HOST: db<br \/>\nMYSQL_USER: root<br \/>\nMYSQL_PASSWORD: password<br \/>\nTEST_OUTPUT_DIR: \/reports<\/p>\n<p>builder:<br \/>\nbuild: ..\/..\/<br \/>\ndockerfile: docker\/dev\/Dockerfile<br \/>\nvolumes_from:<br \/>\n\u2013 cache<br \/>\nentrypoint: \u201centrypoint.sh\u201d<br \/>\ncommand: [\u201cpip\u201d, \u201cwheel\u201d, \u201c\u2013no-index\u201d, \u201c-f \/build\u201d, \u201c.\u201d]<\/p>\n<p>agent:<br \/>\nimage: jmenga\/ansible<br \/>\nlinks:<br \/>\n\u2013 db<br \/>\nenvironment:<br \/>\nPROBE_HOST: \u201cdb\u201d<br \/>\nPROBE_PORT: \u201c3306\u201d<br \/>\ncommand: [\u201cprobe.yml\u201d]<\/p>\n<p>db:<br \/>\nimage: mysql:5.6<br \/>\nhostname: db<br \/>\nexpose:<br \/>\n\u2013 \u201c3306\u201d<br \/>\nenvironment:<br \/>\nMYSQL_ROOT_PASSWORD: password<\/p>\n<p>cache:<br \/>\nbuild: ..\/..\/<br \/>\ndockerfile: docker\/dev\/Dockerfile<br \/>\nvolumes:<br \/>\n\u2013 \/tmp\/cache:\/cache<br \/>\n\u2013 \/build<br \/>\nentrypoint: \u201ctrue\u201d<\/p>\n<p>(venv) rmohan@root:~\/docker-ansible\/todobackend$ cd docker\/dev\/<\/p>\n<p>(venv) rmohan@root:~\/docker-ansible\/todobackend\/docker\/dev$ docker-compose up test<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Continuous Delivery Using Docker And Ansible<\/p>\n<p>Continuous Delivery Release Often Release Faster Great Reliable<\/p>\n<p>Continuous Delivery workflow\/pipeline<\/p>\n<p>With which we can Test,Build,Release,&amp; Deploy a simple application.<\/p>\n<p>Application will be of any technology ex:python based.<\/p>\n<p>The work flow will be Based upon using docker &amp; docker-compose which is a emerging technology. With a goal to release [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[91],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/7321"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7321"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/7321\/revisions"}],"predecessor-version":[{"id":7322,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/7321\/revisions\/7322"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7321"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7321"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7321"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}