AngularJS Deployment Essentials - Zachariah Moreno - E-Book

AngularJS Deployment Essentials E-Book

Zachariah Moreno

0,0
20,39 €

-100%
Sammeln Sie Punkte in unserem Gutscheinprogramm und kaufen Sie E-Books und Hörbücher mit bis zu 100% Rabatt.

Mehr erfahren.
Beschreibung

If you are a web developer, this handy guide will empower you to quickly learn the fundamentals of AngularJS development and deployment.



Das E-Book AngularJS Deployment Essentials wird angeboten von Packt Publishing und wurde mit folgenden Begriffen kategorisiert:

Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:

EPUB
MOBI

Seitenzahl: 171

Veröffentlichungsjahr: 2015

Bewertungen
0,0
0
0
0
0
0
Mehr Informationen
Mehr Informationen
Legimi prüft nicht, ob Rezensionen von Nutzern stammen, die den betreffenden Titel tatsächlich gekauft oder gelesen/gehört haben. Wir entfernen aber gefälschte Rezensionen.



Table of Contents

AngularJS Deployment Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Errata
Piracy
Questions
1. Our App and Tool Stack
The right tools for the job
Version control with Git and GitHub
Node.js
NPM
Yeoman's workflow
Yo
Installing Yo
Grunt
Bower
The Ionic framework
Batarang
Sublime Text and Editor integration
Krakn
Setting up Git and GitHub
Scaffolding the app with Yo
Development
Views, controllers, and routes
The login view
The chat view
The account view
The menu view
The about view
Global controller constants
Models and services
Predeployment
Summary
2. Deploying to Apache
From local to remote
Deployment destination
A comparison between the local and remote setup
Manual deployment
FTPing from your command line
FTP clients
Automating deployment with GitHub and SSH
Troubleshooting deployment issues
A visual diff tool
Using diff with Git
Configuring Apache for Angular
Google's PageSpeed Service for Apache
Summary
3. Deploying to Heroku
Setting up your Heroku environment
Creating an account
Heroku's dashboard
Defining a new application
The Heroku Toolbelt
Installation
SSH access
New app in Toolbelt
New app in dashboard
Heroku branch
Predeployment configuration
Express
Gzippo
Package.json
The Procfile
Web.js
Scaling and deploying to Heroku
Dynos
Scalability
Add-ons
Troubleshooting deployment issues
Summary
4. Deploying to Firebase Hosting
The Firebase setup
Creating your Firebase account
Using the Firebase Forge dashboard
Using the Data view
Using the Security Rules view
Using the Simulator view
Using the Analytics view
Using the Simple Login view
Hosting your application
Using the firebase-tools CLI
Configuring your Firebase environment
Troubleshooting deployment issues
HTTP resources served over HTTPS
Summary
5. Deploying a Mobile App
Context is the king
What is Apache Cordova and how does it address issues?
Configuring your development environment for Apache Cordova
A word on Cordova's dependencies
Installing Apache Cordova
Installing the Android SDK
Configuring the Android SDK and tools
OS X configuration
Windows configuration
Installing an Android target and creating an emulator
From Angular web applications to hybrid mobile apps with Cordova
Deploying your app to an emulator
Moving your code into /www
Deploying your app to your physical device with Cordova
From Angular web applications to mobile apps with the Cordova Chrome App toolchain
Configuring your development environment for the Cordova Chrome App toolchain
Packaging your Angular web application for mobile with CCA
From Angular web applications to mobile apps with PhoneGap Build
Publishing your application
Signing your .apk file
Publishing to the Google Play Store
Troubleshooting deployment issues
Summary
6. Deploying as Chrome Apps
Why Chrome Apps?
Choosing the best app type
The Chrome App setup
Augmenting your Angular App for Chrome
The manifest.json file
Icons
Content security policy
Other ways to customize your manifest.json file
The background.js file
Deploying to your Chrome instance
Troubleshooting deployment issues
Deploying to the Chrome Web Store
Summary
7. Postdeployment
Features and fixes
Adding support to Google Analytics
Setting up the angular-google-analytics module
Deploying updates to Apache
The FTP command-line interface
An FTP client
Git and SSH
Deploying updates to Heroku
Deploying updates to Firebase Hosting
Deploying updates to mobile apps
Deploying updates to the local emulator with Cordova
Deploying updates to the physical device with Cordova
Deploying updates to the local emulator with CCA
Deploying updates to the physical device with CCA
Building updates with PhoneGap Build
Deploying updates to Google Play Store
Deploying updates to Chrome App
Packing updates with your local Chrome instance
Deploying updates to the Chrome Web Store
Summary
8. Conclusion – AngularJS Deployment Essentials
Developing a dynamic tool stack
Deploying early and deploying
Index

AngularJS Deployment Essentials

AngularJS Deployment Essentials

Copyright © 2015 Packt Publishing

All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.

Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.

Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.

First published: February 2015

Production reference: 1250215

Published by Packt Publishing Ltd.

Livery Place

35 Livery Street

Birmingham B3 2PB, UK.

ISBN 978-1-78398-358-2

www.packtpub.com

Credits

Author

Zachariah Moreno

Reviewers

Kent C. Dodds

Ladislav Gažo

K. Aava Rani

Commissioning Editor

Andrew Duckworth

Acquisition Editors

Richard Harvey

James Jones

Content Development Editor

Adrian Raposo

Technical Editors

Ruchi Desai

Rosmy George

Copy Editors

Rashmi Sawant

Ashwati Thampi

Project Coordinator

Kinjal Bari

Proofreaders

Maria Gould

Paul Hindle

Chris Smith

Indexer

Rekha Nair

Graphics

Disha Haria

Abhinash Sahu

Production Coordinator

Nilesh R. Mohite

Cover Work

Nilesh R. Mohite

About the Author

Zachariah Moreno is a 23-year-old web developer from Sacramento, California, who works for the state government and enjoys contributing to open source projects of the web variety. Zach completed an internship with Google in 2012 and graduated with his BS in web development from the Art Institute of California—Sacramento, in the following year. He has published an article entitled AngularJS Tool Stack in Software Developer's Journal. Zach can typically be found on Google+ discussing design, developer tools, workflow, camping, golf, and his English bulldog, Gladstone.

About the Reviewers

Kent C. Dodds is a frontend software engineer at Alianza, Inc. He's actively involved in the frontend community on Twitter (@kentcdodds) and through his various projects on GitHub (kentcdodds). He is a cohost to Angular Air, a live video podcast all about AngularJS. He is also an instructor at Egghead.io (https://egghead.io/), a site dedicated to bite-sized videos teaching web development skills. He spends most of his free time with his wife and two kids or coding.

I would like to thank Domo Technologies for getting me started on frontend web development as well as Angular. I would like to thank my wife, Brooke, for her patience while I worked on this book, and all the other projects that have occupied my time.

Ladislav Gažo is a long-time computer enthusiast and has been digging into the software world since his youth. He has more than 12 years of professional experience in development and software engineering. While starting experiments with computer graphics and network administration, he realized the true path is toward the combination of software engineering and business. He has been developing, analyzing, and architecting Java-based, desktop-based, and finally, modern web-based solutions for several years. The application of the Agile approach and advanced technology is both his hobby and daily job.

Rich experience with various technologies led him to cofound Seges, a software development company in Slovakia. He actively participates in start-up events and helps build development communities, namely Google Developer Group and Java Group, in Slovakia. With his colleagues, he designed and spun off an interactive content management solution called Synapso, utilizing contemporary technologies combined with user experience in mind.

He has also worked on the books Learning Apache Karaf, Apache Karaf Cookbook, and Learning Karaf Cellar, all by Packt Publishing.

I would not have been able to realize my knowledge as part of the review process of this book without the support of all my colleagues, friends, and family. Creating a good long-term environment helped me gain the experience that I can pass further on.

K. Aava Rani is a cofounder of CulpzLab Pvt Ltd, a software company with 10 years of experience in game technologies. A successful blogger and technologist, she switched her focus to game development in 2004. Since then, she has produced a number of game titles and has provided art and programming solutions to Unity developers across the globe. She is based in New Delhi, India. She has been the recipient of several prestigious awards, including Adobe for Game Technology Expert 2012 and SmartFoxServer, for her articles. She has experience in various different technologies.

Aava is cofounder of CulpzLab, a software development company of highly skilled professionals in web game development and interactive media. Founded in 2010, CulpzLab has proven itself to be a reliable technology partner for its clients. Currently, CulpzLab employs over 50 people and has its office based out of New Delhi, India.

CulpzLab is a leading-edge custom (bespoke) process-driven software solutions provider that has helped and partnered with many reputable brands, start-up ventures, and offshore IT companies. It has helped them realize and deliver effective, efficient, and on-time digital solutions.

CulpzLab has worked globally with a plethora of clients with a diverse technology background, industry expertise, and a client footprint that extends to more than 14 countries. CulpzLab is well positioned to help organizations derive maximum value from their IT investments and fully support their business aims.

CulpzLab's core business purpose is to invent, engineer, and deliver technology solutions that drive business value, create social value, and improve the lives of customers.

She has also worked on Creating E-learning Games with Unity3D, Packt Publishing.

I would like to acknowledge the creators of the Unity3D program, an amazing tool that allows the ultimate digital experience in creative expression. I'd also like to thank my clients for being part of the fun! Many of you have become good friends through my creative successes. Finally, I'd like to thank R. K. Rajanjan who taught me how to love technologies.

www.PacktPub.com

Support files, eBooks, discount offers, and more

For support files and downloads related to your book, please visit www.PacktPub.com.

Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at <[email protected]> for more details.

At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.

https://www2.packtpub.com/books/subscription/packtlib

Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can search, access, and read Packt's entire library of books.

Why subscribe?

Fully searchable across every book published by PacktCopy and paste, print, and bookmark contentOn demand and accessible via a web browser

Free access for Packt account holders

If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view 9 entirely free books. Simply use your login credentials for immediate access.

Preface

Where is AngularJS? Since AngularJS's inception, it has been deployed into a multitude of different environments, mostly due to its flexibility and extensibility. Parallel to Angular's rise are developer tools such as Apache Cordova and Chrome packaged apps. These have given developers the opportunity to deploy web applications on platforms that were previously dominated by languages such as Java and C. With these advancements, AngularJS apps can now be found in the Chrome Web Store, Google Play Store, Apple App Store, PlayStation Store, and Firefox Marketplace, all in addition to traditional in-browser web applications. To see examples of other members of the AngularJS community that are built on AngularJS, https://builtwith.angularjs.org/ is a phenomenal place. As AngularJS and its community mature, I suspect that the aforementioned question will become "Where isn't AngularJS?"

Without a talented and thriving developer community, AngularJS would not be the framework that it is today. The most apparent metric I found to measure this phenomenon is the rate at which the new versions of AngularJS are released. At its apex, it reaches 3 minor releases in 1 day and 5 minor releases per month in March 2014. To help the community and contributors keep up with the pace of development, the AngularJS core team maintains the website https://dashboard.angularjs.org/, which provides a real-time snapshot into the current build status of AngularJS's core. Because of its extensible design, contributors have also been able to enhance AngularJS's core through the development of third-party modules, services, filters, and directives. Some examples are the popular REST Angular module for consuming RESTful APIs, the Angular-UI frontend framework, Ionic Framework for mobile UIs, Firebase real-time data storage and syncing, and Yoeman generators for Angular.

What this book covers

Chapter 1, Our App and Tool Stack, explains the tooling process, which is one of the hottest topics in today's web development community, and AngularJS has a suite of tools that enhances your developer experience. You will learn about Angular's tool stack, how they fit together, and most notably, how they can help you deploy and maintain future applications.

Chapter 2, Deploying to Apache, explains why Apache, being the most popular web server environment, is a solid platform for hosting most Angular applications. You will get an opportunity to enhance Apache's default configuration to best support your Angular application. We will also discuss best practices to determine whether Apache is suitable for your type of application or whether an alternate infrastructure should be considered.

Chapter 3, Deploying to Heroku, discusses Heroku, which is one of the best platforms as a service. Its infrastructure empowers developers to spin up, deploy to, and scale their own Node.js servers at a minimal cost. Deploying to Heroku is a positive developer experience because its tool speed and efficiency are second to none.

Chapter 4, Deploying to Firebase Hosting, explains why Firebase has only been offering PaaS for a few months, but the promise of hosting your application code in the same environment as your real-time database has created a lot of interest around the Firebase services. You will learn how Firebase is preconfigured to optimally serve the AngularJS applications and how to further tailor Firebase Hosting to your application's needs.

Chapter 5, Deploying a Mobile App, explains why hybrid mobile apps is not a new idea, but the quality and tooling around it has made it a strong contender when building a mobile application. We will take our application's code and build it for Android/iOS using PhoneGap, Apache Cordova, and Cordova Chrome Apps.

Chapter 6, Deploying as Chrome Apps, explains why Chrome OS's adoption is growing at an exponential rate and the need for developers to support this platform is parallel in importance. Angular thrives in this environment, and deploying our application as a Chrome App for consumption on the Chrome Web Store/Chrome OS is an exciting frontier for both developers and consumers.

Chapter 7, Postdeployment, explains why deployment is no exception to the marketing adage of "rinse, lather, repeat", because it is never finished. Optimizing your workflow with best practices is necessary to ensure the longevity of your application. We will enhance our application and grok how to safely deploy the enhancement into production.

Chapter 8, Conclusion – AngularJS Deployment Essentials, explains that harnessing the tools will allow you to deploy a single AngularJS application to new platforms and new customers. We will discuss a few tips that will help you get the best out of these tools.

What you need for this book

The materials needed for this book include the, somewhat obvious, tools typically associated with most forms of web development. This includes a computer with the operating system of your choice, a stable Internet connection, an application to create and edit text files, basic working knowledge of your computer's command line, an instance of each modern web browser, and because it is paramount to stay hydrated while growing new information, water. All other software and tools needed to accomplish the examples in this book are covered in Chapter 1, Our App and Tool Stack.

Who this book is for

This book is designed to build your existing knowledge of AngularJS development with the tools and best practices necessary to successfully deploy an application into a stable production environment. Thus, prior understanding of HTML, CSS, JavaScript, the MV* architecture, and AngularJS are needed by you to fully implement the techniques and best practices covered in this book. If you have committed to this book and aren't feeling confident about the antecedent criterion, the AngularJS community has published a surfeit of free resources (listed as follows) that will adequately prepare you to assimilate the knowledge to come:

http://egghead.iohttp://thinkster.iohttps://github.com/jmcunningham/AngularJS-Learning

Conventions

In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text are shown as follows: "This file is called manifest.json."

A block of code is set as follows:

angular.module('krakn.controllers', ['ionic', 'ngAnimate']) .controller('HomeCtrl', ['$scope', 'syncData', function($scope, syncData) { syncData('syncedValue').$bind($scope, 'syncedValue'); }]);

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

angular.module('krakn.controllers', ['ionic', 'ngAnimate']) .controller('HomeCtrl', ['$scope', 'syncData', function($scope, syncData) { syncData('syncedValue').$bind($scope, 'syncedValue'); }]);

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "From the drop-down menu, select the Settings menu item near the bottom."

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

From this point forward, I will use a few terms I consider to be relevant industry standard slang and acronyms to enhance your vocabulary when speaking with other developers, watching tutorial videos online, and reading associated literature or blog posts. These include the following terms:

Angular: This term is a shorthand name referring to all facets of AngularJS and its community.Tool Stack: This term is used for a collection of tools encompassing all phases of the development process. These include, but are not limited to, boilerplates/seed projects, code editors, IDEs, code linters, command-line utilities, language abstraction compilers, package managers, local web servers, LiveReload, source/version control and their respective web applications, web browsers / BrowserStack, browser DevTools, testing runners, build tools, server communication clients, and others. For further information, Google search for slides from Paul Irish's presentation entitled Tooling & The Webapp Development Stack.DevTools: This term is a shorthand name referring to the Google Chrome Developer Tools. Having contributed to the Chromium Open Source community, I am biased towards Google Chrome and most notably towards the Chrome Developer Tools.PaaS: This term is an acronym for Platform as a Service.CLI: This term is an acronym for command-line interface.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.

To send us general feedback, simply e-mail <[email protected]>, and mention the book's title in the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.