>> HELLO, WELCOME EVERYONE. I’M DAN TAILOR, I’M A PRINCIPAL PIPELINE DEVELOPER AT MICROSOFT. THIS IS ONE OF MY FAVORITE THINGS TO DO I SPENT HOURS AND HOURS PLAYING WITH TECHNOLOGY AND PUTTING IT TOGETHER USING THE LATEST FEATURES IN OUR TOOLS. AND I GET TO COME HERE AND SHOW YOU ALL THE HIGHLIGHTS. SOME OF THE TECHNOLOGY WE’LL BE USING TODAY IN THIS TALK, OF COURSE, IS PYTHON, WHICH IS INCREDIBLY POPULAR, 41. 7 OF DEVELOPERS USE IT. WE’LL BE DOING WEB DEVELOPMENT. 52 OF PYTHON DEVELOPERS USE PYTHON FOR WEB DEVELOPMENT. WE’LL DO A LITTLE MACHINE LEARNING BECAUSE THAT IS DRIVING USE OF PYTHON AS WELL. A LOT OF PEOPLE USE THESE TWO TECHNOLOGIES TOGETHER APPEAR LOT OF PEOPLE START BY BUILDING MACHINE LEARNING GRIMPLE AND THEN THEY WANT TO HOST IT IN AN API AND USE PYTHON FOR THAT OR MAYBE BUILDING A WEB APPLICATION AND YOU WANT TO ADD MACHINE LEARNING TO IT. WE’LL BE MIXING A LITTLE OF THIS. IN TERMS OF WEB FRAME WORKS WE’LL BE USING BOTH DJANGO AND THEY ARE PROMINENT TDLEFO BACK ENDS WE’LL DO A LITTLE REACT. SURPRISINGLY IF YOU NEED A FRONT END YOU NEED JAVA SCRIPT AND THOSE TECHNOLOGIES ARE INCREASINGLY POPULAR. AND THEN WE’LL CLUL A LITTLE BIT OF POST GRES. AND DO A BIT OF VIRTUAL ENVIRONMENTS, THEY ARE A WAY TO ISOLATE YOUR PACKAGES AND DEPENDENCIES. VERY POPULAR TOOL USED BY PYTHON DEVELOPERS. ALSO DOCKER. VERY COMMON TECHNOLOGY USED BY PYTHON DEPOSITORS. DOCKER WAS FIRST ANNOUNCED IN A LIGHTNING TYKE AT PYCON. IT GREW OUT OF THE PYTHON COMMUNITIES. WE’LL BE TEAMING TECHNOLOGY USING VISUAL STUDIO CODE. IF YOU ARE NOT FAMILIAR WITH VISUAL STUDIO CODE, IT’S A FREE PLATFORM AN OPEN SOURCE EDITOR, IT’S FAST AND LIGHT WEIGHT, GREAT EXTENSIONS AND SUPPORT FOR MULTIPLE LANGUAGES. ACTUALLY IT HAS BUILT-IN SUPPORT FOR JAVA SCRIPT WITH THINGS LIKE INTELLISENSE DEBUGGING AND COURSE CONTROL. MY TEAM BUILT A PYTHON EXTENSION THAT GIVES YOU GREAT ABILITIESZ. THE PYTHON EXTENSIONS ADDS SUPPORT FOR MANY THINGS YOU NEED LIKE IntelliSense DEBUGGING. IT HAS SUPPORT FOR VIRTUAL ENVIRONMENT AND OTHER ENVIRONMENTS LIKE POETRY, NICE TO SEE POETRY ADDED TO THAT LIST. FORMAT TERMS LIKE WINTER LINTERS AND THIS IS THE MOST POPULAR EXTENSION ON THE VISUAL STUDIO CODE MARKETPLACE ACTUALLY I’M VERY HAPPY TO SEE RECENTLY A VISUAL STUDIO CODE IS NOW THE TOP THREE TOOL USED BY PYTHON DEPOSITORS IN THE 2018 DEVELOPERS SURVEY. WE ARE EXCITED ABOUT WHAT WE ARE DOING WITH PYTHON. EVEN MORE EXCITED ABOUT THE NEW VISUAL STUDIO CODE REMOTE DEVELOPMENT FEATURES THAT WE JUST ANNOUNCED THIS PAST WEEK. THAT IS REALLY WHY I’M INCLUDING CONTAINERS IN THIS TALK. WE ANNOUNCED NEW FEATURES THAT ALLOW TO YOU WORK AS A DEVELOPER AND WORKSPACES AND ENVIRONMENTS YOU COULDN’T WORK TOMORROW BY SEPARATING VISUAL STUDIO CODE UI FROM ALL THE EXTENSIONS IN THE BACK END OF THE VISUAL STUDIO CODE DEVELOPMENT EXPERIENCE IT ALLOWS YOU TO DEVELOP INSIDE OF CONTAINERS OR OVER REMOTE CONNECTIONS AND GET A DEVELOPMENT EXPERIENCE JUST LIKE YOUR LOCAL DEVELOPMENT EXPERIENCE. SO WE’LL BE SPEND ISING TIME WITH THAT TODAY. PUTTING ALL OF THIS TOGETHER, WHAT WE’LL BE BUILDING IS A APPLICATION. THE FIRST TALK WE’LL BE SETTLEMENT ANALYSIS API FROM SCRATCH USING PYTHON LIBRARIES WE’LL DEPLOY THAT TO AZURE WEB APPS THEN WE’LL ADD FULL STACK DJANGO WITH REACT APPLICATION AND DEPLOY THAT TO AZURE WEB APPS FOR CONTAINERS THE LAST FEW MINUTES WE’LL GO BRIEFLY THROUGH HOW TO SET UP AN AZURE PIPELINE TO TAKE THIS FROM GitHub AND PUSH IT UP TO IT AZURE. THE FIRST PART, LIKE I SAID, WE’LL DO A LITTLE HELLO WORLD GETTING STARTED WITH VS CODE AND BUILD THAT API AND DEPLOY IT THEN GO THROUGH THE NEW REMOTE USING DEV CONTAINERS. WE’LL OPEN AN EXISTING DEV CONTAINER FROM GitHub AND DEPLOY THAT. THEN LIKE I SAID SETTING UP THAT CI/CD AND DEPLOYING THE DOCKER LET’S GET STARTED WITH THE FIRST

PART. THAT’S ENOUGH TALKING FOR ME. I LIKE TO JUMP INTO THE DEMO BUILDING API IN FLARVEG. I THRIBEG GET STARRED FROM THE COMMAND PROMINENT ASSUMING I’VE GOT VS CODE INSTALLED, THIS IS HOW I LIKE TO DEVELOP. USING THE CODE TO THE COMMAND LINE HERE WE’LL MAKE A NEW FOLDER FOR OUR API. I HOPE I CAN REMEMBER ALL THE CODE. THE TOOLS WILL HELP ME. THERE IS NOTHING HERE. TO GET STARTED, I CAN TYPE CODE SPACE DOT, THAT WILL OPEN VISUAL STUDIO CODE FROM THE COMMAND LINE AND OPEN UP THIS FOLDER IN VISUAL STUDIO CODE. IF YOU DIDN’T OPEN IT FROM THE COMMAND LINE, YOU CAN OPEN IT BY CLICKING OPEN FOLDER OR FILE OPEN FOLDER IT’S GENERALLY GOOD TO WORK INSIDE OF A FOLDER BECAUSE YOU CAN STORE VARIOUS SETTINGS, UNDERSTANDING WHERE YOUR IMPORTS ARE RATHER THAN WORKING ONE AT A TIME. THE FIRST TIME YOU GET RT STARTED YOU CAN CLICK THE PYTHON LINC THERE TO GET A LINK TO THE PYTHON EXTENSION SO YOU CAN INSTALL THAT FROM THE MARKETPLACE. I HAVE IT INSTALLED ONE THING I WANT TO CALL OUT HERE, THERE IS A GOOD QUICK START IN THE EXTENSION, JUST TO SHOW YOU HOW TO GET GOING AND SET UP YOUR VIRTUAL ENVIRONMENT, PRO TIP. CLICK ON THE PYTHON VERSION AND THE STATUS BAR IT’S VERY USEFUL. IT LINKS OFF TO OUR TUTORIAL IF YOU WANT TO GO MORE IN DEPTH IN EXPLORING THE FEATURES YOU ARE WATCHING MY TALK, SO THIS IS THE TUTORIAL FOR YOU. ALL RIGHT, TO GET STARTED WITH PYTHON I WILL OPEN A NEW FILE. WE’LL CALL THIS HELLO DOT PY. AS SOON AS I OPEN THE FILE IT ACTIVATES THE PYTHON EXTENSION. IF YOU ARE NOT SEEING PYTHON FEATURES IN VS CODE, YOU HAVE TO OPEN A PYTHON FILE. OTHERWISE WE DON’T KNOW YOU WANT TO WORK WITH PYTHON. ONCE I ACTIVATE THE PYTHON EXTENSION, I WILL TRY TO ZOOM IN HERE. I CAN TYPE, HELLO WORLD, I CAN SAVE THAT. RIGHT CLICK AND SAY, RUN PYTHON FILE IN TERMINAL. THAT WILL RUN HELLO WORLD. OKAY. THAT’S HOW YOU BUILD CODE WITH PYTHON VS CODE PYTHON EXTENSION. I WILL USE — I WILL START BUILDING UP MY SENTIMENTS ANALYSIS API HERE. TO DO THAT I NEED THE TEXT BLOG PACKAGE. I CAN DO THAT BY GOING TO THE COMMAND LINE SAYING PIP INSTALL TEXT BLOB THAT MAY INSTALL DEPENDENCIES THAT MY MACHINE MAY HAVE CONFLICTING VERSION. I WANT TO CREATE A VIRTUAL ENVIRONMENT FOR THIS APPLICATION WHICH WILL CONTAIN ALL OF MY PACKAGES NOW, TO DO THAT, I CAN RUN PYTHON TO CREATE A VIRTUAL ENVIRONMENT I WILL DO THAT USING PY-3 ON WINDOWS THIS WILL GUARANTEES I’M RUNNING PYTHON 3. IF YOU DON’T HAVE PYTHON ON THE TOP TYPE PY, THAT WILL GIVE YOU PYTHON. I WILL RUN PY-3-M WHICH MEANS RUN A MODULE. THEN I’LL PASS AN ARGUMENT TO SAY I WANT TO CREATE THAT ENVIRONMENTS. SO YOU CAN SEE VS CODE HAS HOPEFULLY SAID DO YOU WANT TO USE THIS VIRTUAL ENVIRONMENT FOR YOUR WORKSPACE? WE CAN SELECT YES. THAT WILL CHANGE THE STATUS BAR, THE VIRTUAL ENVIRONMENT. THAT IS THE ACTIVE INTERPRETER USED BY VS CODE. YOU CAN CLICK ON THAT TO CHANGE IT. I HAVE DIFFERENT VERSIONS INSTALLED ON MY MACHINE. TO ACTIVATE THE VIRTUAL ENVIRONMENT IN THE TERMINAL, I CAN TYPE SCRIPTS ACTIVATE. THEN IF I SAY WHICH PYTHON, CAN YOU SEE IT’S RUNNING PIELTSDS OUT OF THIS VIRTUAL ENVIRONMENT. ALSO, ONCE I HAVE THIS ACTIVATED, IF I CREATE A NEW TERMINAL IT WILL ACTIVATE SCRIPT FOR THE COMMAND LINE. YOU CAN SAY WHICH PYTHON WE HAVE. THE KEY THERE IS TO GET THIS VIRTUAL ENVIRONMENT SELECTED IN VS CODE AND THEN YOU CAN DO THINGS LIKE INSTALLING TEXT BLOB PACKAGE I WANT TO USE. ONCE I INSTALL THAT PACKAGE IT WILL PULL DOWN SOME OF THE PACKAGES THIS DEPENDS ON. THIS IS A WRAPPER OVER A NATIONAL LANGUAGE TOOLKIT THAT LETS US START PLAYING WITH SOME NATURAL LANGUAGE THINGS. NOW I CAN IMPORT A TEXT BLOB. AIL SAY FROM TEXT BLOB IMPORT TEXT. I GET AUTO COMPLETIONS HERE AS I’M WRITING MY CODE. LET’S WRITE “THIS IS AMAZING

AND SEE WHAT THAT LOOKS LIKE. I CAN SEE THE RESULT. I CAN SELECT THIS PIECE OF TEXT AND PRESS SHIFT-ENTER NOW IT WILL OPEN A NEW PYTHON IN MY TERMINAL AND RUN THAT PIECE OF CODE. YOU CAN SEE THIS SAYS “THIS IS AMAZING. ” THAT’S COOL. YOU CAN ADD SOME THAT SENTIMENT THERE. IT GIVES US A POE POLARITY. THAT IS A NEGATIVE SENTIMENT THERE. I THINK I FIGURED OUT HOW TO USE THIS SENTIMENT ANALYSIS LIBRARY. LET’S BUILD A FLASK API SO I CAN CALL THIS FROM AN EXTERNAL WEB SERVER AND SUBMIT MESSAGES TO IT AND GET THE MESSAGES BACK HERE. LET’S CREATE A NEW FLASK APP CALLED APP DOT PY. THIS IS THE DEFAULT FOR FLASK APPS, OTHERWISE YOU HAVE TO SET UP A CONFIGURE I WANT TO SHOW YOU HOW TO USE SNIPPET I HAVE A SNIPPET TO ADD CALLED FLASK APP. PRESS TAB AND THAT CREATES A NEW FLASK APP FOR ME. IT’S ONLY A FEW LINES OF CODE. YOU CAN DEFINE YOUR SNIPPETS BY GOING FILE PREFERENCES, USE EGG SNIPPETS. THERE. YOU CAN PARAMETERIZE THEM. I HAVE THE BASIC FLARVEG APP THERE. IF I WANT TO RUN THIS — LET’S GIVE THAT A GO I CAN DO FLASK RUN, NOW IF I GO TO — RUNNING THE SERVER ON LOCAL HOST. I CAN CONTROL-CLICK THIS HELLO, UNIVERSE. WE ARE NOT SATISFIED WITH HELLO WORLD. WE HAVE TO GO BIGGER. THIS IS WORKING. GO BACK TO OUR TEXT BLOB PACKAGE. LET’S PULL THIS CODE INTO THE FLASK APP NOW INSTEAD OF TAKING NOTHING, WE CAN TAKE A MESSAGE. THAT’S HOW YOU DEFINE A PARAMETER. LET’S PUT IT INTO THE API AND MOVE THE IMPORT TO THE TOP. SHIFT-TAB. SO NOW WE WANT THIS API TO IT ANALYZE THIS MESSAGE. I COPY/PASTE A LOT OF MY OWN CODE. THAT’S JUST HOW I DO IT LET’S START BY ASSUMING THAT SENTIMENTS IS POS. POSITIVE. ALWAYS ASSUME POSITIVITY UNLESS WE HAVE DATA TO INDICATE OTHERWISE. LET’S PASS MESSAGE TO THAT SENTIMENTS. IF THE POLARITY IS LESS THAN ZERO, THEN SENTIMENT IS NEGATIVE. LET’S RETURN THE SENTIMENT FROM THE API. CONTROL-C. WE RUN THAT AGAIN. NOW WE CAN SAY, THIS IS AMAZING. AND WE HAVE OUR SENTIMENT ANALYSIS API WRITTEN IN FLASK. WONDERFUL SO, LET’S GO AHEAD AND DEPLOY THIS API TO AZURE SO IT’S AVAILABLE TO THE WORLD. SO WE CAN DO THAT USING A NEW FEATURE AT THE AZURE C. O I., IT WILL INSTALL WHATEVER YOU FIND THERE AS LONG AS IT COMES FROM AN MICROSOFT WEBSITE. RUN AZ-N AND THIS BUILD SENTIMENT. I RUN THAT COMMAND. IT WILL TAKE THIS — I FORGOT ONE THING. SO I CAN FIRST I NEED TO FREEZE MY REQUIREMENTS INTO A REQUIREMENT DOT TXT FILE I RUN PIP FREEZE AND THAT GETS ALL OF THE PACKAGES THAT I USE WITH THE EXACT VERSION NUMBERS, SO THAT WHEN I DEPLOY IT, IT’S GUARANTEED TO WORK. I RUN EASY WEB APP. THIS DEPLOY TO SEE AZURE WEB APPS. IT WILL USE THE REQUIREMENT SET TXT FILE. IT WILL ZIP UP THE CODE. THEN ON THE SERVICE SIDE, IT WILL INSTALL THE PACKAGES FOUND IN THE REQUIREMENTS DOT TXT FILE. THIS WILL TAKE A MINUTE WHILE IT’S DOING THAT, I AM GOING TO DO A QUICK RECAP OF WHAT WE TALKED ABOUT. JUST A QUICK RECAP. WE CREATED

A NEW FILE. WE RAN THE FILE IN TERMINAL THEN WE USED SHIFT-ENTER TO RUN THE SELECTION AND CREATED A VIRTUAL ENVIRONMENT. JUST TIPS ON USING VIRTUAL ENVIRONMENT. THE INSTRUCTIONS ARE DIFFERENT ON MAC AND WINDOWS SO ON WINDOWS YOU USE PY-6 AND ON MAC AND LINUX YOU USE — I’LL BE LOOKING TOWARD TO THAT IF YOU WANT TO INSTALL PACKAGES USE PIP INSTALL — R DOT TXT. IF UPDATE TO GET OUT RUN DEACTIVATE. I USED VIRTUAL ENVIRONMENT WITH VISUAL STUDIO CODE. WE SUPPORT PIP AND ETC. AND THEN WE RAN AZ WEB APP UP. AZURE WEB APPS, THIS DEPLOYS FOR LINUX. IF YOU WANT A FREE TIER OF WEB APPS YOU CAN — AS OF BUILD, THIS IS NOW A G. A SERVICE FOR PYTHON. YOU GET ONE FREE TIER, ONE FREE B 1 INSTANCE FROM YOUR SUBSCRIPTION. LET ME POP BACK HERE. IT’S TAKING A MOMENT FOR MY API. IT JUST FINISHED. I TALKED A BIT TOO FAST THIS TIME OUR SAY FINISHED. IT’S DEPENDED TO AZURE WEBSITE . NET. YOU CAN SEE THAT COMES UP HERE. THIS IS AMAZING. TRY NOT TO BE TOO HARSH AWESOME. ONE THING WE WANT TO DO BEFORE WE MOVE ON, IF WE WANT TO APPLICATION TO BE AVAILABLE TO OTHER APPLICATIONS. WE WANT TO ENABLE A CROSS-ORIGIN SITE CALLS. LET’S HOP OVER TO THE PORTAL AND TAKE A LOOK. BY DEFAULT THIS APP WAS DEPENDED TO THIS APP SERVICE LINUX RESOURCE GROUP. IF YOU ARE NOT FAMILIAR WITH A RESOURCE GROUP. IT’S A FOLDER THAT CONTAINS YOUR RESOURCES IN AZURE, SO YOU CAN GROUP RELATED RESOURCES TOGETHER. THE AZ UP COMMAND HAS PICKED A DEFAULT ONE. SO THERE IS THE APP THAT OUR APP IS DEPENDED TO. AND THEN ENABLE CROSS CALLS WE PRESS START. ANY WEBSITE CAN CALL THIS API WITHOUT GETTING AN ERROR ON THE BROWSER. HIT SAVE THAT WILL SAVE US SOME TIME A LITTLE BIT LATER. NOW LET’S TALK ABOUT DEVELOPING USING CONTAINERS. AS I MENTIONED, WE HAVE THE NEW REMOTE CONTAINERS EXTENSION THAT ALLOWS US TO GET A GREAT CONTAINIZED DEVELOPMENT WHY WOULD WE WANT TO DO THAT? THERE IS A COUPLE OF DIFFERENT REASONS IF YOU THINK ABOUT GETTING STARTED STEPS AT YOUR COMPANY, IF YOU WANT TO START A NEW DEVELOPER ON THE TEAM. THEY WALK THROUGH ALL THE STEPS ON THE GETTING STARTED GUIDE USUALLY ONE OF THE FIRST ACTIONS IS UPDATE TO FIX THE BROKEN INSTRUCTIONS IF YOU HAVE A CONTAINERIZED DEVELOPMENT ENVIRONMENT YOU COULD DEFINE ALL THE THINGS YOU NEED TO USE IN ALL THE PACKAGES, ALL THE TOOLS AND THINGS LIKES THAT. IT MINIMIZES THE TIME YOU SPEND GETTING GOING THE OTHER THING IS THAT A LOT OF PEOPLE DON’T LIKE INSTALLING A LOT OF DEPENDENCIES ON THEIR MACHINE BECAUSE IT MIGHT CAUSE ISSUES OR THINGS LIKE THAT. CONTAINERS CAN MINIMIZE DEPENDENCIES ON YOUR DEV MACHINE. FOR EMPLOYING, IT WILL WORK IN PRODUCTION. SO, THE ONLY DOWN SIDE — THE MAIN DOWN SIDE IS TOOLING WITH THE ENVIRONMENTS CAN BE A CHALLENGE. YOUR CODE IS IN A CONTAINER. HOW DO I GET INTELLISENSE WHAT IT DOES, AS I MENTIONED, YOUR UI RUNS ON YOUR LOCAL MACHINE THERE ON THE LEFT. THERE IS A SERVER INSIDE OF THE CONTAINER THAT RUNS YOUR EXTENSIONS. IT RUNS PARTS OF THE FILE SYSTEM. IT IT CAN TALK TO OTHER CONTAINERS THAT GET SPUN UP ALONGSIDE YOUR DEV CONTAINER. SO THIS ALLOWS YOU TO GET A USER INTERFACE THAT FEELS JUST LIKE THE DEVELOPMENT ON YOUR LOCAL LAPTOP. LET’S TAKE THE APP THAT WE BUILT. LET’S JUST QUICKLY REBUILD IT INSIDE OF AFTER

DEV CONTAINER. THIS IS WHERE WE LEFT OFF. WE HAD OUR APP WITH OUR SENTIMENT ANALYSIS API. IF I WANT TO ADD A DEV CONTAINER HERE — I NEED TO SWITCH TO VS CODE INSIDERS BECAUSE THIS IS ONLY AVAILABLE IN THE INSIDERS EDITION OF CODE. CODE INSIDERS IS A SEPARATE SIDEBY SIDE INSTALL VS CODE, THE DAILY DEVELOPMENT BUILD. THIS WILL BE AVAILABLE IN A COUPLE OF WEEKS. IN HERE I HAVE THE REMOTE CONTAINERS EXTENSION INSTALLED. THAT GIVES ME THIS LITTLE BUTTON ON THE BOTTOM LEFT-HAND CORNER THAT SAYS “OPEN REMOTE WINDOW. ” I GET THIS MENU. I WANT TO SELECT CONTAINER CONFIGURATION FILE. THIS ALLOWS US TO PICK FROM A BUNCH OF TEMPLATES. I WANT TO SELECT PYTHON 3. AND THEN IF YOU LOOK OVER HERE THAT CREATES A BUNCH OF FILES. I HAVE A JSON, A DOCKER FILE, AND IF I OPEN — THIS DOES STANDARD THINGS LIKE INSTALLS REQUIREMENTS OF TXT IN THE CONTAINER. ONE THING BEFORE WE OPEN IT, I WANT TO SPECIFY MY OUTPUT TO BE 5, 000 BECAUSE THAT’S THE PORT MY FLASK APPLICATION LISTENS ON. I CAN SAY REOPEN THIS FOLDER IN THIS CONTAINER THAT WILL CREATE A NEW INSTANCE OF VISUAL STUDIO CODE. IT WILL BUILD THAT DOCKER CONTAINER. IT WILL INSTALL THE VS CODE SERVER, IT WILL INSTALL THE EXTENSIONS SPECIFIED IN THE DEV CONTAINER DOT JSON, THEN IT WILL GIVE ME A DEVELOPMENT ENVIRONMENT WE CAN SEE IT HAS DOCKER BUILD COMMANDS THIS ONE BUILDS ON TOP OF A PYTHON 3 IMAGE. IF I MAKE SMALL TWEAKS IT DOESN’T HAVE TO REBUILD ALL FROM SCRATCH. IT CAN USE THE CACHE LAYERS THERE. I’M GUESSING — I DON’T KNOW WHAT THAT MEANS. HOPEFULLY I DON’T HAVE A DOCKER ERROR. LET’S TAKE A LOOK AT WHAT CONTAINERS ARE RUNNING ON MY MACHINE HERE. OKAY. THAT’S ODD. OKAY, THAT WAS A FLUKE. SO NOW THIS IS OPENED INSIDE OF THIS DEVELOPMENT CONTAINER. NOW I CAN SEE MY FILES. WHEN I OPEN THE FILES, I’M NOT EDITING THEM LOCALLY, I’M EDITING INSIDE THE CONTAINER. IF I SELECT MY PYTHON INTERPRETER, I GET PYTHON ENTERTAINERS, LOCAL USE, BIN, ETC. , ETC. IF I OPEN A TERMINAL, I GET A TERMINAL INSIDE OF THE CONTAINER. SO IF I DO LS, I HAVE A DEVELOPMENT ENVIRONMENT I CAN USE. AND IF I GET MY IntelliSense DEBUGGING AND ALL SORTS OF THINGS COMES FROM WITHIN THAT CONTAINER THAT WAS A HELLO WORLD OF CONTAINERS LET’S MOVE ON TO SOMETHING A LITTLE MORE COMPLICATED. JUST A QUICK RECAP TO DO THIS, WE RAN CODE INSIDERS DOT BECAUSE IT’S INSIDERS. WE OPEN THE COMMAND PALETTE USING CONTROL-SHIFT P. WE ADDED PORT 5, 000 AND THEN REOPENED THE FOLDNER THE CONTAINER LET’S SWITCH OVER TO SOMETHING A LITTLE BIT MORE COMPLICATED. THAT IS ARJIANGER AND — OUR DJANGO AND REACT CONTAINER. THIS IS A FRESH CLONE, I GOT IT OFF GITHUB. LY OPEN IT USING CODE INSIDERS. THIS DEFINES IS MORE COMPLICATED DEVELOPMENT ENVIRONMENTS. TO WORK IN THIS ENVIRONMENT I DON’T NEED ANYTHING INSTALLED OTHER THAN DOCKER. THIS DEFINES MULTIPLE CONTAINERS THAT WE WANT TO START. IF WE USE INSIDE THE DOCKER COMPOSE FILE, I’LL USE A SIDE BY SIDE TAB. THIS CONTAINS AND APP

CONTAINER AS WELL AS A DATABASE CONTAINER, WHICH CONTAINS POST GRES IT IT CONTAINS PYTHON, AND THEN THE POSTGRES DATABASE. THE FILES WILL APPEAR MOMENTARILY. THAT WAS NICE AND FAST. AGAIN I’M WORKING WITH ALL OF THESE FILES ON INSIDE OF THE APP CONTAINER. IF I CREATE A NEW TERMINAL, I CAN USE MPN. I DON’T NEED A NODE INSTALLED ON MY MACHINE. I CAN SAY MPN INSTALL I CAN BUILD MY FRONT END. THIS IS REALLY COOL. I CAN START MY DJANGO WEB SERVER HERE BY SAYING PYTHON MANAGE PY — I NEED — IF I START MY DJANGO WEB SERVER IT WILL TELL ME IT’S AN ERROR BECAUSE I HAVEN’T SET UP MY DATABASE YET. I CAN SAY PYTHON MANAGE PY, IT WILL PLY THE MIGRATIONS. DJANGO HAS AN ORM WHERE YOU SPECIFY ALL OF YOUR DATA AS MODELS, THEN IT CREATES A DATABASE FROM THAT. RUNNING THE DJANGO MIGRATE COMMAND WILL THEN APPLY THOSE MODELS AND CREATE DATABASE TABLES FROM THEM. THEN WE CAN LOAD INITIAL DATA HERE. AS I’M TYPING, IT’S COMMUNICATING TO A SERVER INSIDE OF A CONTAINER GETTING BACK TO U. I. ALL OF THE MESSAGES. EVERYTHING THAT WORKS IN THE PYTHON EXTENSION AUTOMATICALLY WORKS HERE. NOW I CAN MANAGE THE PY SERVER. INTERESTING POINT HERE THIS IS BEHINDING TO THE I. P. ADDRESS, WHICH IS BECAUSE MY CODE IS RUNNING INSIDE OF A CONTAINER. I SEE I P. ADDRESS, YOU WANT TO BIND TO, IF YOU ARE BINDING TO LOCAL HOST BUT UPDATE CONNECTION AVAILABLE FROM EXTERNAL INCOMING CLIENTS NOW IF WE COME BACK HERE AND SAY LOCAL HOST 8000. WE GET THIS BEAUTIFUL APPLICATION THAT JUST WORKS. I HAVE GIVEN THIS TO OTHER PEOPLE ON MY TEAM AND THEY FOLLOW THE SAME STEPS AND GET THE SAME APPLICATION EVERY SINGLE TIME. LET’S ADD A TWEET I KEEP SAYING THIS IS AMAZING. IF WE DIDN’T WORK, WHY DIDN’T IT WORK? IT SAYS I MUST BE LOGGED IN. I DON’T WANT TO LOG INEN LET’S SEE IF WE CAN DEBUG THIS AND SEE IF WE CAN HAVE A DEFAULT USER SO WE CAN PLAY WITH THE APPLICATION HERE FOR DEMO PURPOSES AT LEAST. SO TO START DEBUGGING, I WILL MOVE TO THE DEBUG TAB. I WANT TO ADD A DEBUG. THIS IS ACTUALLY VERY STRAIGHTFORWARD. I SELECT ADD CONFIGURATION, I SELECT DJANGO, THEN THIS GENERATES YOUR STANDARD DJANGO DEBUG. I DON’T NEED TO MODIFY ANYTHING HERE. WE CAN CLICK PLAY THAT WILL START THE DEBUGGER. SO NOW I’M DEBUGGING MY APPLICATION PRETTY EASILY. LET’S SET A BREAK POINT. I NEED TO FIGURE OUT WHERE TO SET A BREAK POINTS. IF I HIT CONTROL-P, I CAN BROWSE THROUGH MY WORK FILES, I CAN GO TO THE USE FILE. I CAN PRESS POUND TO SEE ALL OF THE INTLZ IN MY WORK — SYMBOLS IN MY WORKSPACE, FOR EXAMPLE. IF I WANTED TO FIND — LET’S FIND SOMETHING WITH USER. LET’S GO THERE. IF YOU SCROLL DOWN HERE, THIS IS WHERE WE CREATE THE TWEET. IF I WANT TO LOOK AT OTHER SYMBOLS IN THIS FILE, I CAN PRESS AT WHICH WILL LET ME NAVIGATE SYMBOL BY SYMBOL THROUGH THE FILE. THERE ARE COOL NAVIGATION THINGS WE CAN DO. IF I WANT TO SET A BREAK POINT, LY CLICK THE LITTLE RED DOT ON THE LEFT-HAND SIDE. TRY THIS AGAIN. CLICK TWEET. WE HIT THE BREAK POINT. LET’S SEE WHAT WE CAN DO HERE ON THE USER OBJECT LET ME POP OPEN THE DEBUG CONSOLE

NOW LET’S START POKING AT THIS OBJECT SELF DOT REQUEST. I GET AUTO COMPLETIONS IN MY CONSOLE AS I’M TYPING, I CAN TYPE EXPRESSIONS INTO THE CONSOLE AND EXPAND VARIABLES AND I CAN SEE IN THIS CASE THAT THIS IS TRUE LET’S SEE IF WE CAN PICK A DEFAULT USER. LET’S SEE IF WELL CAN GET BOB AS OUR DEFAULT USER SO I CAN WRITE AN EXPRESSION TO QUERY THE DATABASE SO I CAN SAY USER DOT OBJECTS DOT FILTER. FIRST NAME EQUALS BOB WE’LL PUT THAT FIRST. IF I PRESS ENTER THERE, WE CAN SEE THAT RETURNED OUR USER BOB. OKAY. LET’S SEE IF WE CAN RETURN THISUSIONER INSTEAD LET’S PRESS STOP. HIGH RESOLUTION IS AN ART TO ITSELF. IF USER THAT IS ANONYMOUS, THEN YOU COULD SAY USER DOT OBJECTS. LET’S GO BACK TO THE TERMINAL AND RUN THAT. LET’S SEE IF WE CAN — NOW WE CAN TWEET FROM MY APPLICATION. THAT’S FUN AS I MENTIONED EARLIER, I STARTED AN MPN SCRIPT THAT BUILT OUR FRONT END. THIS IS RUNNING IN WATCH MODE I CAN START EDITING THE JAVA SCRIPT INSIDE THE CONTAINER AND GET MY REACT DEVELOPMENT TOOLS. IF I BROWSE THROUGH FILES, I CAN GO — LET’S GO TO THE TWEETS CONTROL-P AND LET’S SEE IF WE CAN ADD THAT SENTIMENT API INTO THE APPLICATION. I’VE GOT A REACT COMPONENT HERE CALLED SENTIMENT WHAT IT DOES, YOU PASS IT THE TEXT WHEN THE COMPONENT LOADS T WILL MAKE AN API CALL TO TO THE API WE JUST BUILT. WHEN IT GETS — WE’LL GET BACK THE POSITIVE AND NEGATIVE SENTIMENT. THEN WHEN IT GETS A RESPONSE IT WILL RENDER WITH THE SENTIMENT IF WE GO DOWN TO THE HTML CODE HERE, WE CAN ADD THIS SENTIMENT COMPONENT I’M GETTING MY REACT AUTO COMPLETION HERE. ONE OF THE GREAT THINGS ABOUT VS CODE T HAS GREAT SUPPORT FOR MULTIPLE LANGUAGES. I CAN SAY TWEET THAT TEXT. PRESS SAVE. I CAN COME IN HERE AND HIT REFRESH. THEN THE SENTIMENT API CALLS ARE THERE. AND THEN LET’S GO BACK TO OUR GO-TO DASH. THAT’S ALL WORKING. THAT’S COOL. NOW LET’S RUN SOME TESTS SO I’VE GOT TESTS THAT ARE DEFINED IN THIS APPLICATION IN MY TEST DOT PY FILE. IF I WANT TO CONFIGURE VS CODE, I CAN USE CONTROL-SHIFT P TO RUN A COMMAND AND SAY PYTHON CONFIGURE TESTS. THESE TESTS ARE BUILT USING THE PIE TEST FRAMEWORK THEY ARE IN THE TWEETER FOLDER THAT WILL INITIALLYIZE TESTED HEREN I GET THE COOL CODE LENSES. I CAN RUN AN ENTIRE TEST CLASS OR DEBUG TESTS. I GET A NEW TEST EXPLORER THAT WE ADDED TO VS CODE WHERE I CAN SEE ALL OF MY TESTS IN A PREVIEW OR I CAN RUN THEM ONE AT A TIME I’M RUNNING ALL OF THIS IN THIS CONTAINERIZED DEVELOPMENT ENVIRONMENT SO I CAN BE PERFECTLY PRODUCTIVE HERE. I THINK THAT IS THE MAIN THING THAT WAS A QUICK TOUR OF OPENING AN EXISTING APPLICATION INSIDE OF A DEV CONTAINER WORKING WITH IT AND USING A BUNCH OF FEATURES. TO DO WE RAN THE OPEN FOLDER IN THE CONTAINER COMMAND. IF THERE IS A DEV CONTAINER FOLDER AND THEN WE OPENED A NEW TERMINAL. WE INSTALLED — NODE MODULES ON THE FRONT END AND OPENED A SECOND TERMINAL AND INITIALLYIZED THAT DATABASE AND RAN OUR SERVER. WE ADDED THE DJANGO DEBUG. IF YOU TRY THIS AT HOME AND YOU DON’T SEE PYTHON SHOW UP. OPEN A PYTHON FILE FIRST AND GIVE YOU YOUR DEBUG CONFIGURATION OPTIONS WE USED THE CONSOLE TO INSPECT VARIABLES WE DID A LITTLE CODE NAVIGATION CAN CONTROL-P TO OPEN FILES, SYMBOLS, AND BUZZ AROUND. THEN WE CONFIGURED OUR TESTS. ONCE WE CONFIGURED THE TESTS, WE COULD USE THE TEST EXPLORER

AND OUR CODE. THAT WAS OUR DEVELOPMENT CONTAINER. SOMETHING INTERESTING ABOUT THE DEVELOPMENT CONTAINER, YOUR FILES ARE IN THERE. AS I’M MISSISSAUGAING CHANGES INSIDE THE CONTAINER, THEY WERE AVAILABLE OUTSIDE EVER THE CONTAINER AS WELL. WHEN YOU BUILD A CONTAINER FOR PRODUCTION, YOU WANT TO COPY YOUR FILES ALL IN THERE. YOU WANT TO USE THE PRODUCTION WEB SERVER. WE NEED TO BUILD A PRODUCTION VERSION OF THIS APPLICATION. LET’S WALK THROUGH HOW WE WANT TO DO THAT SO THE FIRST THING I WANT TO DO IS GET OUT OF THIS DEV CONTAINER MODE. I CAN CLICK AND SAY REOPEN FOLDER LOCALLY THAT WILL EXIT DEV CONTAINER AND OPEN THIS IN A NORMAL BORING DESKTOP SORT OF VERSION EVER THE APPLICATION. IF I OPEN MY DOCKER EXTENSION HERE, I CAN SEE THE VARIOUS CONTAINERS. I WANT TO STOP THESE WE’LL BE USING THE PORTS THAT I WANT TO USE. I CAN SAY STOP AND SELECT “ALL CONTAINERS. ” THAT WILL STOP THOSE. I HAVE A DOCKER FILE HERE THAT IS MY DISEIVE DEV CONTAINER I WANT TO ADD A DOCKER FILE TO MY MAIN WORKSPACE SHOW I CAN BUILD UP THIS DOCKER CONTAINER I WANT TO DEPLOY THIS APP IN. I WILL RUN ANOTHER COMMAND AND SELECT DOCKER — ADD DOCKER FILES TO WORKSPACE I CAN NEVER REMEMBER ALL THE DOCKER STUFF OFF THE TOP OF MY HEAD. THIS GETS ME GOING WITH A PREDEFINED TEMPLATE, ALSO LIKE PYTHON. MY APP LISTENS TO PORT 8 ON R 000. >> Reporter: PORT 8000. ONE OF THE THINGS I WANT TO DO TO THIS DEFINITION FIRST OF ALL, I WANT TO BUILD THIS FROM AN IMAGE THAT SOMEBODY ELSE HAS DEFINED ON DOCKER HUB. I HAVE THIS IMAGE THERE IS A PERSON OUT THERE WHO CREATED A REALLY GOOD IMAGE THAT HOSTS A WEB SERVER. I’M GETTING AUTO COMPLETIONS HERE. THIS IS COMING FROM DOCKER HUB, SO I CAN LOOK UP THESE CONTAINERS WITHOUT HAVING TO LEAVE MY DEVELOPER TOOL. THIS IS AN ENGINE WEB SERVER WHICH IS REALLY FAST AND EFFICIENT. IT IS GOOD AT DOC FILES AND CONNECTS TO THE DJANGO APPLICATION USING THIS UWSJI INTERFACE. I DON’T NEED TO START MY APPLICATION. IT KNOWS HOW TO FIND DJANGO IN THIS CONTAINER THE FEW THINGS I NEED TO DO IS CONFIGURE A LISTEN PORT SO I CAN TELL THE WEB SERVER TO LISTEN ON PORT 8000 THEN I ALSO WANT TO DEFINE THE URL AND MY FILES WILL BE FOUND. WE’LL SAY — I NEED TO CHECK MY NOTES YEP. STATIC. AND THEN FOR DJANGO APPLICATIONS WHEN YOU DEPLOY THEM, YOU NEED TO RUN A COMMAND TO COLLECT YOUR STATIC FILES. IF YOU ARE — THAT WILL PULL ALL OF YOUR STATIC FILES FROM THE DIFFERENT APPLICATIONS INTO ONE STATIC FOLDER YOU CAN SERVE UP, WHICH WILL BE THIS FOLDER HERE SO ONE THING I NEED TO DO, I STILL NEED TO BUILD MY NODE FRONT END AND PACKAGE IT INTO THIS CONTAINER I CAN USE A MULTI-STAGE BUILD. I CAN START WITH A NODE IMAGE. I CAN RUN COMMANDS LIKE MNPM INSTALL AND RUN BUILD WHICH WILL BUILD MY CONTAINER IMAGE. THE LAST THING I WANT TO DO IS RUN — I WANT TO DELETE MY NODE MODULES SO I’M NOT PACKAGING THEM UP IN THE CONTAINER. I’M LEFT WITH MY STATIC FRONT END. I WANT TO RUN THIS INSIDE OF A NODE BUILD FOLDER. I WANT TO ADD ALL OF MY CODE INTO A NODE BUILD FOLDER. SO DOWN HERE WHAT I WANT TO DO, I WANT TO COPY THE OUTPUT OF THIS BASICALLY INTO MY SECOND CONTAINER. AS SOON AS I SAY “FROM” THIS DOCKER CONTAINER IT THROWS EVERYTHING GENERATED BEFOREHAND I WANT TO COPY — I WILL SAY COPY, AND THEN FROM, I HAVE NICE AUTO COMPLETIONS FROM ZERO INTO APP THAT WILL COPY THE RESULTS OF THIS STEP. HOPEFULLY I DIDN’T FORGET

ANYTHING THERE. THIS IS OUR PRODUCTION CONTAINER. IF WE GO TO OUR COMPOSE FILE, WE WANTED TO FIND ENVIRONMENT VARIABLES. IN THIS CASE WE’LL BE CREATING A PRODUCTION POSTGRES DATABASE AND A FEW OTHER THINGS. WE NEED SECRETS AND OTHER THINGS THAT OUR APPLICATION USES. THOSE ARE, TO SET THAT APPLICATION UP WE CAN USE THIS END SAMPLE FILE HERE. WHERE WE DEFINE OUR DATABASE USER. WE CAN SAY TWEETER. WE CAN PUT SOME THINGS IN HERE. COPY/PASTE THIS INTO THE SAMPLE. WE JUST CONFIGURE FROM THE COMMAND LINE WHAT USER NAMES WE WANT TO USE FOR OUR DATABASE THESE WILL BE USED TO CONNECT AND CREATE THE DATABASE. IF YOU WANT AN EASY TO REMEMBER PASS WORD THAT PASSES THE PASSWORD REQUIREMENTS OF AZURE, THERE IS A GOOD ONE FOR YOU. SO THIS SPHIEL A STANDARD WAY TO DEFINE VARIABLES. WHEN I RUN MY APPLICATION DJANGO WILL PICK THIS UP AND USE IT FOR PRODUCTION CONFIGURATION. IF I WANT TO CREATE A DATABASE, I HAVE A SCRIPT HERE THAT I CREATED THAT WILL LOAD THIS INFO AND CREATE A POSTGRES DATABASE IN AZURE USING THE VAIBLESZ. I CAN — VARIABLES. THIS ALLOWS ME TO CREATE THE DATABASE AND ALSO SUBSTANTIATE MY APP USING THE SAME CREDENTIALS THAT WILL GO AHEAD AND SPIN THAT UP. SO, WE STARTED THE POSTGRES DATABASE. THIS TAKES A MINUTE. SO I WILL ALSO BUILD MY CONTAINER AT THE SAME TIME. BACK TO MY COMPOSE FILE. SORRY I SWITCHED BACK AND FORTH. WHEN I START THE CONTAINER APP, THAT WILL CONFIGURE IT TO POINT AT THE RIGHT DATABASE. TO BUILD THIS CONTAINER, I CAN RIGHT CLICK AND SAY COMPOSE UP. THAT WILL BUILD THE APPLICATION. ONE THING, THIS WILL BUILD THIS WITH THIS IMAGE HERE. I WANT TO PUSH THE APPLICATION UP TO AN AZURE CONTAINER REGISTRY THIS IS THE NAME OF THE REGISTRY I CREATED. THIS IS A PRIVATE CONTAINER REGISTRY I CREATED. ONE SECOND HERE WHEN WE GO TBEEK OUR PORTAL AND OPEN OUR PYTHON DEMO ACCOUNT, THIS IS THE CONTAINER REGISTRY I CREATED IF I WANT TO BE ABLE TO PUSH TO THIS REGISTRY, I NEED TO OPEN MY ACCESS KEYS AND COPY THE SECRET FOR THAT. THEN I CAN LOG INTO THIS PROMINENT BY TYPING — THIS PROMPT BY TYPING — AND I ALREADY HAVE THIS. IT PROMPTS YOU FOR A PASSWORD, THEN YOU AUTHENTIC. I ALWAYS MISTYPE THAT FOR SOME REASON. COLLECT STACK RIGHT CLICK, COMPOSE UP. SO THAT WILL BUILD THAT CONTAINER THERE LET’S CHECK IN ON OUR DATABASE, SEE IF THAT’S STILL WORKING. THAT’S FINE. SO NOW I WANT TO PUSH THIS IMAGE THAT I CREATED UP TO OUR AZURE CONTAINER REGISTRY. I CAN USE THE DOCKER EXTENSION TO BROWSE THE IMAGES I CREATED LOCALLY. THIS IS ONE I JUST BUILT WITH COMPOSE UP. SO I CAN SELECT THIS IMAGE AND SELECT PUSH. THAT WILL PUSH IT UP TO THE

CONTAINER REGISTRY. YOU CAN SEE IT ALREADY HAS A VERSION OF THIS CACHE PUSHING THE 15 MEGABYTES OR SO I CREATE HERE. THIS IS STILL RUNNING. WHILE THAT’S RUNNING, WE CAN POKE INSIDE OF OUR CONTAINER FINISHED JUST IN TIME. THIS CONTAINER IS RUNNING LOCALLY. I HAVE MY DATABASE CREATED. NOW I NEED TO INITIALLYIZE THE DATABASE. I RAN MIGRATE PAWN CAN YOU DO THE SAME THING IN AZURE I NEED TO RUN IT IN AN ENVIRONMENT THAT HAS MY VARIABLES AND MY PASSWORDS AND STUFF LIKE THAT SET UP. IF I GO TO MY DOCKER TAB, I CAN RIGHT CLICK AND SAYING ATTACH SHELL. WHEN I DO THAT, I GATE COMMAND PROMPT RUNNING INSIDE THE CONTAINER. MY ENVIRONMENT VARIABLES ARE HERE NOW WHEN I RUN DJANGO MANAGE PY MIGRATE. IT WILL NOW BE POINTING AT THE PRODUCTION DATABASE. NOW, IT GIVES ME THIS REMEMBER SAYING NO COMP ENTRY FOR THIS HOST. IT MEANS MY I. P. ADDRESS NEEDS TO BE ADDED TO A FIREWALL RULE. MY SCRIPT WAS SUPPOSED TO DO THAT BUT I’M A TRICKY EMPLOYEE CONNECTED THROUGH A VPN SO IT’S 24R0EING OFF WHAT AZURE THINKS MY I. P. ADDRESS IS. I CAN BROWSE MY RESOURCES IN AZURE, GOING TO MY PYTHON RESOURCE GROUP WITH THAT DATABASE. I CAN GO INTO MY CONNECTION SECURITY THEN I CAN UPDATE THE ALLOW MY I P. ADDRESS RULE TO USE MY I. P ADDRESS. I’LL HAVE A RANGE HERE BECAUSE I HAPPEN TO KNOW MY I. P ADDRESS BOUNCES AROUND BETWEEN DIFFERENT VALUES. LY ADD A RANGE OF I. P s FOR THE MICROSOFT SUBNET HERE A PRO TIP, YOU CAN USE THE ARROW UP TO FIGURE OUT WHAT YOUR REAL I. P. ADDRESS LOOKS LIKE TO AZURE I CAN MIGRATE MY DATABASE. I CAN GENERATE IT SO IT’S APPLYING MIGRATIONS TO THAT PRODUCTION DATABASE. GIVE IT A SECOND HERE. ONCE THAT FINISHES, I CAN LOAD INITIAL DATA INTO IT LET’S TAKE A LOOK AT THIS LOCAL CONTAINER HERE. NOW THIS IS RUNNING LOCALLY, BUT IT’S TALKING TO THE PRODUCTION DATABASE THAT I GIST INITIALIZED. I’M MAKING SURE IT IT WORKS ON THE LOCAL MACHINE BEFORE I SHIP IT OFF TO PRODUCTIONEN IT’S WORKING HERE. THAT’S GREAT. I CAN DEPLOY THIS IMAGE AND CREATE A NEW WEB APPLICATION FROM IT. NOW I MENTIONED I PUSHED THIS TO AZURE CONTAINER REGISTRY. I CAN USE THE DOCKER EXTENSION TO BROWSE MY REGISTRY. I CAN SIGN IN. I CLICK INTO AZURE HERE, NICE AND SIMPLE. I SIGN IN, IT TELLS ME I AM NOW SIGNED IN. WHEN I COME BACK TO VS CODE, I CAN SEE MY DEMO REGISTRY I CREATED IN AZURE. THERE IS THAT TWEETER APP IMAGE. I CAN SELECT DEPLOY IMAGE TO AZURE APP SERVICE THAT WILL CREATE A NEW AZURE APP SERVICE CONFIGURED TO USE THIS CONTAINER IMAGE. I WANT TO PUT IT IN THE PYTHON USERS GROUP AND SELECT FROM THE EXISTING APP SERVICE PLAN WHICH BASICALLY LIVE ALLOWS KNEE SHARE MULTIPLE WEBSITES. THEN WE’LL CALL IT TWEETER APP IN THIS BUILD ON THE FRONT END. THAT WILL GO AHEAD AND DEPLOY THAT. NOW ONE THING I STILL NEED TO DO AFTER I CREATE THIS NEW WEB APP. WE NEED TO APPLY THE VAIBLES LOCALLY. THAT IS NOT CHECKED IN HERE. IT’S JUST FOR THE LOCAL ENVIRONMENT. I ADDED IT TO THE FILE SO I DON’T ACCIDENTALLY TYPE IT IN WHEN I’M DOING PASSWORDS THIS IS THE AZURE APP SERVICE EXTENSION I CAN 134R0R MY TWEETER APP HERE IF I OPEN THE APPLICATION SETTINGS THESE ARE THE ENVIRONMENTS VARIABLES ON THE APPLICATION. I CAN RIGHT CLICK. AND I WILL UPLOAD THE LOCAL SETTINGS AND USE THE SAME SET. THIS WILL TAKE ALL THE CONFIGURATION, ALL THE SETTINGS AND APPLY IT TO THE WEB APP SO IT HAS ALL THE RIGHT

PASSWORDS AND THEN I CAN BROWSE TO THIS WEBSITE HERE AND IT WILL GIVE IT A SECOND AND IT WILL LOAD UP. WHEN I BROWSE THROUGH THE WEBSITE IT IS PULLING DOWN YOU THAT CONTAINER IT TAKES A LITTLE BIT OF TIME. ACTUALLY THAT WAS QUITE QUICK. THERE IS MY APPLICATION. MY WRAPPED APP WITH THE POSTGRES DATABASE AND THE SENTIMENT ANALYSIS API. IT’S ALL HERE. I CAN THEN SAY THIS IS AMAZING. COOL IT’S COMING FROM BOB. THAT IS THE CHANGE WE JUST MADE. THAT IS A LOT STUFF. LET’S DO A QUICK RECAP. WE USE THE FILES TO STORE THE SETTINGS THIS IS LOCAL ONLY. YOU SHOULD DELETE THIS FILE WHEN YOU ARE DONE. IN OUR SETTINGS PRODUCTION PY FILE, I DIDN’T SHOW THIS, BUT WE CONFIGURED TO USE THE PRODUCTION DATABASE THE WAY WE ACTUALLY TOLD IT TO USE THE PRODUCTION DATABASE IS AN ENVIRONMENT VARIABLE THAT TELLS DJANGO WHICH CONFIGURATION TO RUN ON. WE SET UP A PRODUCTION VARIABLE. WE USED THE CREATE DB SCRIPT TO CREATE THE DATABASE. THEN WE CREATED THE PRODUCTION DOCKER FILE THAT USED MULTI-STAGE BUILDS TO BUILD THE NODE APP AND THEN BUILD THE PYTHON APP ON TOP OF THAT. ONCE WE DEFINED THE FILES WE USED COMPOSE UP TO BUILD IT WE ATTACHED INTO THE CONTAINER LOCALLY AND RAN THE DATABASE MIGRATIONS FROM THE PRODUCTION CONTAINER LOCALLY TO INITIALIZE THE PRODUCTION DATABASE AND THEN I’M MISSING A STEP. RIGHT CLICK AND DEPLOY FROM WEB APPS, THAT MAY BE OUT OF ORDER ON THE SLIDES IS. WE CREATED A CONTAINER REGISTRY. THEN WE DID A DOCKER LOG IN TO GET ACCESS TO THAT. THEN WE SET THE IMAGE NAME IN THE COMPOSE UP SO WE PREFIXED THE NAME WITH THE CONTAINER REGISTRY SO WHEN WE PUSH IT KNOWS WHERE TO DEPLOY IT TO. AND THEN FROM THERE, WE RIGHT CLICKED ON THE CONTAINER REGISTRY AND SAID DEPLOY TO AZURE SERVICE AND WE DIDN’T HAVE TO WAIT THAT LONG FOR IT TO COME UP. I WANT TO TALK ABOUT HOW WE SET UP CI/CD WITH AZURE PIPELINES. IF YOU ARE NOT FAMILIAR WITH AZURE DevOps, IT’S A SUITE OF SERVICES FOR BUILDING — FOR DEVELOPER TOOLS. SO THERE IS A FEW DIFFERENT THINGS. AZURE ARTIFACTS GIVES YOU A PRIVATE PACKAGE FEED. IF YOU ARE BUILDING PYTHON PACKAGES AND DISTRIBUTING THEM INTERNALLY, YOU CAN USE AZURE ARTIFACTS FOR BOTH PRIVATE AND PUBLIC FEED. THEN THERE IS AZURE PIPELINES WHICH GIVES YOU POSTED BUILDS. WE WILL USE THAT TO DEPLOY THE APP. ALSO SOURCE CONTROL AND THEN BOARDS FOR TRACKING. JUST A QUICK NOTE ON AZURE PIPELINES IF YOU USE AN OPEN SOURCE PROJECT, YOU GET TEN BUILDS FOR FREE WITH OPEN SOURCE PROJECTS. AND YOU GET LINUX, MAC AND WINDOWS BUILD MACHINES THIS HAS BEEN A VERY BEAUTIFUL TO THE OPEN SOURCE COMMUNITY. POPULAR PYTHON PROJECTS LIKE PYTHON ITSELF IS USING AZURE PIPELINES FOR CI, PANDAS, YOU MAY HAVE HERDS OF PANDAS AND OTHER PACKAGES USING AZURE PIPELINES BECAUSE OF THE FREE HOSTED BUILDS YOU CAN GET IT FROM GitHub AND DEFINE BUILD STEPS USINGIAMA FILES IN YOUR REPO. I HAVE A COUPLE OF THOSE HERE TAKE A LOOK. I HAVE TWO FILES THAT DEFINE MY PIPELINEN THIS DEFINES TESTS I WANT TO RUN. THIS DEFINES A SET OF STEPS THAT I WANT TO TAKE IN MY PIPELINE. IT SAYS TRIGGER MASTER. WHENEVER A CODE CHANGE IS COMMITTED TO THE MASTER BRANCH OF MY REPO IT WILL HAVE THIS CONTINUOUS INTEGRATION FILE. THIS IS A MATRIX THAT SAYS I WANT TO TEST WITH 3 6 AND 3. 7. THE FIRST IS THIS USE PYTHON VERSION STEP WHICH ALLOWS US TO PULL IN WHATEVER PYTHON VERSION WE WANT TO USE. PIPELINE 2 OR PIPELINE 3 THIS BUILD TASK WILL PULL DOWN THE RIGHT VERSION OF PYTHON. THEN IT RUNS SCRIPTS. THIS CAN INSTALL OUR REQUIREMENTS AT TXT AND THE PYTEST WAS MADE BY A MEMBER EVER

THE PIPELINE COMMUNITY. FINALLY IT RUNS PYTEST THERE. THEN LET’S JUMP OVER TO BUILD PIPELINE. ANYONE CAN GO TO DEV DOT AZURE. com. IF YOU GO TO PIPELINES AND BUILDS, YOU CAN GET STARTED WITH A NEW PIPELINE BY SELECTING NEW AND GO TO NEW BUILD PIPELINE. AND THEN THAT WILL ALLOW YOU TO SELECT A GitHub REAPO. I CAN CLICK ON GITHUB. GIVE ME ONE SECOND HERE. SO IT HAS MY REPOSITORY HERE. HERE IS THE TWEETER APP REPO CAN YOU CLICK HERE TO GENERATE A YACKLE TEMPLATE — YAML TEMPLATE I CAN SELECT THE CI PIPELINE HERE I HAVE SET THAT UP. I WILL IMAGINE I CLICKED CONTINUE HERE. IF I GO BACK TO MY BUILDS. YOU CAN SEE THERE IS THE TWEETER APP TESTS. THIS RUN, WHENEVER I CHECK IN A CODE CHANGE, YOU CAN SEE THERE IS THE PYTHON 3. 6 AND 3. 7 VERSION OF THAT. I CAN VIEW MY TEST BY GOING TO TESTS IT RAN SIX TESTS. , THEY ALL PASSED I CAN SEE THE PAST TESTS WITH THE FILTER. THERE WE GO. I CAN SEE EACH TEST THAT RAN AND HOW LONG IT TOOK IF THIS PIPELINE SUCCEEDS, THEN I HAVE ANOTHER PIPELINE SET UP THAT DOES MY DEPLOYMENT. THIS IS PART OF THIS DEPLOY PIPELINE. THIS BASICALLY PULLS IN OUR DOCKER CONTAINER. IT PULLS IT DOWN AND LOGS IN, IT BUILDS IT. IT RUNS A CONTAINER. THEN IT RUNS A MIGRATE HERE. IF I HAVE ANY CHANGES TO MY DATABASE, IT WILL APPLY THOSE CHANGES A PART OF THE PIPELINE AND THEN THAT WILL UPDATE IT AND UPDATE THE IMAGE USED. SO IF I GO HERE AND TAKE A LOOK AT THE MULTI-STAGE BUILD PIPELINE YOU CAN SEE THE STEPS SUCCEEDING NOW FOR SECRET, PASS THE SECRETS INTO THE BUILD HERE. SO FOR EXAMPLE, LOOK AT THE DOCKER LOGIN STEP. IT SAYS — YOU CAN’T SEE THE SECRET HERE IN THE TERMINAL. THE WAY YOU SPECIFY THOSE IS IF WE GO TO THE EDIT PIPELINE, CLICK IN THAT STEP THERE AND LOOK AT THE VARIABLES I WENT IN AND EDITED ALL THE PASSWORDS HERE. THIS ACRT, MY DATABASE PASSWORD YOU CAN CLICK THAT ICON THAT LETS YOU LOCK THESE. IF YOU UNLOCK THEM, IT DOESN’T LET YOU GET THE SECRET OUT AGAIN. IF I TRIED TO UNHIDE THIS PASSWORD, I WOULDN’T BE ABLE TO GET AT. IT IT’S A ONE-TIME THING YOU PUT IN. IF YOU DELETE THE END FILE YOU CAN PUT YOUR SECRET IN THERE. THAT WAS A QUICK RUN THROUGH OF HOW YOU SET UP THE PIPELINES SWITCH BACK TO DO A QUICK RECAP AND WRAP IT UP. TO CREATE A NEW PIPELINE, GO TO DEV DOT AZURE DOT-COM SELECT A REPO AND ADD A YAML FILE INTO YOUR REBUILD. YOU WILL FIND STEPS THAT GET RUN INSIDE OF THOSE YAML FILES, THEN YOU CAN STORE SECRETS INSIDE THE VARIABLES IN THE PORTAL SO WE ARE NEARING THE END OF THE TALK. THAT WAS A TOUR OF BUILDING THIS TWEETER APPLICATION AND TAKING IT USING DEV CONTAINERS TO GET A NICE PRODUCTIVE LOCAL DEVELOPMENT ENVIRONMENT USING CONTAINERS. AND THEN DEPLOYING THAT TO AZURE. WE TALKED ABOUT AZ WEB COMPOSE UP AND THEN USED A BUNCH OF TOOLS TO BUILD A PRODUCTION DOCKER CONTAINER TO DEPLOY TO AND THAT’S THE FULL LIFECYCLE THANK YOU MUCH FOR COMING TODAY ALL THE CODE THAT I WENT THROUGH TODAY IS HERE AT THE MICROSOFT PYTHON SAMPLE TWEETER APP. CAN YOU LEARN MORE AT AZURE DOT PYTHON. THERE ARE GREAT SOURCES LINKED. IF YOU WANT TO KEEP UP TO DATE ON ANYTHING WE ARE DOING AT PYTHON THERE IS MY TWITTER HANDLE. I’M AVAILABLE FOR QUESTIONS AFTER THE TALK. MAKE SURE TO FILL OUT A SESSION EVALUATION I LIKE SEEING YOUR COMMENTS AND LEARNING HOW I CAN TWEAK THE TOPIC THE NEXT TIME. SO, THANK YOU, EVERYONE