Upload
ethan-ram
View
162
Download
11
Embed Size (px)
Citation preview
kiss.tsThe Keep It Simple Software Stack
Ethan Ram | 18-Nov-17
kiss.ts | sbtech.com | ista-20171
kiss.ts - The Keep It Simple Software Stack
kiss.ts | sbtech.com | ista-20172
20172012
ASP (VB)
ASP.NET (C#)
JSP (Java)
LAMP Stack (PHP)
Django (Python)
Ruby on Rails (Ruby)
Node.js (JavaScript)
What is the most popular SW Stacks?
kiss.ts | sbtech.com | ista-20173
kiss.ts | sbtech.com | ista-20174
KISS SW Stack 2017Wishlist
Ops Flow
QA
Dev
KISS SW Stack 2017 - Wishlist
kiss.ts | sbtech.com | ista-20175
Dev Infra.•Few simple technologies
•Mature & corporate ready
•Easy componentization
•Open standards
•Open-source (free)
•Package manager
•Cloud and on-prem.
•Scalable and performant
One Language!•Scripted and typed
•Backend, frontend and build
•Excellent dev tools
•Opinionated and low-level
•Dev, Unit test
•Integration Test, Stress Test
•DevOPs
kiss.ts | sbtech.com | ista-20176
kiss.ts
•NodeJS
•TypeScript
•ReactJS
•Koa Server
•PostgreSQL
•Docker
NodeJS
kiss.ts | sbtech.com | ista-20177
Why NodeJS?“… enabling both the browser and server applications to be written in JavaScript. It
unifies our engineering specialties into one team…”
(Jeff Harrel @ PayPal)
“… servers were cut from 30 to 3. The development itself was unusually fast…”
(Kiran Prasad @ LinkedIn)
“… You can make it scale, and it’s very performant…”
(Eric Ferraiuolo @ Yahoo)
“… lightweight, modular and fast application… startup time of the new app
has been reduced by 70%” (Kristofer Baxter @ Netflix)
“… we are moving every product & every site within PayPal to Node... We are seeing
big scale gains, performance boosts and big developer productivity…”
(Justin Lowery @ PayPal)
“… each major feature became a thin, independent web app.
Now teams are able to launch new features quickly and independently…”
(Adam Geitgey @ Groupon)
• Open-source, cross-platform
• Google's V8 JavaScript engine
• Event loop
• Low-level async I/O API
• Node Package Manager
• Large and active community
• Supported by all major cloud providers
• Followers: Vert.x (Java/Groovy), EventMachine (RoR), libuv (C, PHP), Twisted (Python), TPL (.NET Core) etc.
Node.JS - JavaScript Run-time Environment
kiss.ts | sbtech.com | ista-20178
code is messy runtime errors on
invalid types callbacks everywhere functional programming seems inconsistent
IntelliSense is #@%!@ hard to master
kiss.ts | sbtech.com | ista-20179
But I hate JavaScript
kiss.ts | sbtech.com | ista-201710
kiss.ts
•NodeJS
•TypeScript
•ReactJS
•Koa Server
•PostgreSQL
•Docker
• Code is nice and tidy!• Types, interfaces, classes, inheritance• Object oriented programming• Generics, promises await/async
• Real-time developer support• Type checking in coding time• Excellent IntelliSense in IDE• Linter forces devs write to standards
• Easy to learn from C# or Java
• Transpile to any JS version.
• Built by Microsoft
TypeScript – JavaScript Supercharged!
kiss.ts | sbtech.com | ista-201711[Transpile it]
TypeScript – JavaScript Supercharged!
kiss.ts | sbtech.com | ista-201712
Transpile to ES6
TypeScript on VSCodekiss.ts | sbtech.com | ista-201713
Stack Overflow Developer Survey 2017
kiss.ts | sbtech.com | ista-201714
kiss.ts | sbtech.com | ista-201715
kiss.ts
•NodeJS
•TypeScript
•ReactJS
•Koa Server
•PostgreSQL
•Docker
kiss.ts | sbtech.com | ista-201716
ReactJS JSX Example
• Stateful Components• Declarative code• SASS styling• Webpack bundle delivery• Tool-set using NodeJS• Debugging tools
• React Native• Open Source & Free• React Bootstrap, Ant Design, React
Router, React SPA, Redux…• Built by Facebook
ReactJS Ecosystem
kiss.ts | sbtech.com | ista-201717
kiss.ts | sbtech.com | ista-201718
kiss.ts
•NodeJS
•TypeScript
•ReactJS
•Koa Server
•PostgreSQL
•Docker
• Designed by the team behind Express
• Web applications and APIs
• No callbacks and simple error-handling
• Official Middleware libs• Basic-auth, JWT
• Router, URL rewriting
• REST, params validation
• Socket.io
• Parsers, range, etag, fav-icon,
• gzip, minify, static-cache
• Static/S3 file-server, CDN
• Logger (Bunyan), statsD
• Sessions in memory / Redis / cookies
• Templating engines
• Locales, i18n
• Mocks and server-rendering
• …
KOA Web Server
kiss.ts | sbtech.com | ista-201719
kiss.ts | sbtech.com | ista-201720
kiss.ts
•NodeJS
•TypeScript
•ReactJS
•Koa Server
•PostgreSQL
•Docker
Not Only SQLRDBMS
PostgreSQL: RDBMS, Web Ready and Open/Free
kiss.ts | sbtech.com | ista-201721
• JSON/JSONB/XML types (indexed)
• HStore type (indexed key-value)• Listen-Notify • Queues• Text stemming, searching and
Regex• Columnar store, Tables in RAM• Object Store / Large binaries• Graphs, RTF, Geospatial• Time series, ranges• Unlogged tables
• ACID compliant
• Structured, Normalized data
• Triggers, Materialized views
• Transactions, Nested transactions
• SQL:2011, Stored procedures
• Query planners, Advisory locks
• Row level security
• HA: Clustering, Log-shipping etc.
• Sharding
• Performance analysis tools
Oracle
MSSQL
MySQL
PostgreSQL
DB2
SQLite
Redis
MemchacheD
Resque
Lucene
InfluxDB
S3 Object Store
Celery
Cassandra
Hadoop
MongoDB
Neo4J
RethinkDB
RabbitMQ
hBase
Hive
KDB
LogStash
Kafka
Aerospike
kiss.ts | sbtech.com | ista-201722
PostgreSQL ORM: Sequelize-Typescript Example
Annotations describe model:
Schema Types relation
Model creates the DB schema
CROD built-in
Expressive search returns typed
objects
Add validations, translations, hooks,
indexes, foreign keys etc.
kiss.ts | sbtech.com | ista-201723
kiss.ts
•NodeJS
•TypeScript
•ReactJS
•Koa Server
•PostgreSQL
•Docker
kiss.ts | sbtech.com | ista-201724
Docker is a Shipping Container System for Code
• Build once - run anywhere• Run locally, in QA, in PROD or in the cloud• All dependencies are in• OS independent
• Cheap• Fast to boot• Revert back to image• Low runtime overhead• Open source & free
• Quality• Clean environment to run on• Every dev can run full system on her machine.• Less hardware and VMs across DEV/QA/STG.
kiss.ts | sbtech.com | ista-201725
Containerize It!
kiss.ts | sbtech.com | ista-201726
SDLC With Docker: Dev, QA and DevOPs
Ops Flow
QA
Dev
Create a Feature Branch
Dev: Test-first code it
Pull Request to Master
Build; Run unit-tests;
Coverage %
Pull Request Ready
Code Review
Merge to Master
Build a Dockerpackage
Save Dockerin ‘Snapshot Repository’
Deploy Docker to CI
env.
CI: Run Test
automation
Green Master
Deploy Docker to QA env.
Manual QAPromote
Docker to ‘Release’
Deploy Docker to
STG
STG: Run test
automationStress Test
Deploy Docker to
PROD
PROD: Run test
automationMonitor App
kiss.ts | sbtech.com | ista-201727
kiss.ts - demo
•NodeJS
•TypeScript
•ReactJS
•Koa Server
•PostgreSQL
•Docker
Corporate KISS.TSkiss.ts | sbtech.com | ista-201728
SDLC Process
Ops Flow
• PostgreSQL
• Docker
• PM2 / PMX
• VS Code
• Jenkins
• Ngnix
• Ansible
• Kafka Q
• ELK
• Core OS
DevQA
• Agile scrum framework
• Multi-functional team
• Full stack devs
• Test automation devs
• DevOps
• Each dev has the full stack locally
• Test first coding
• Master branch coverage >80%
• Component APIs are contracts
• Test integration first
• DB is the main infrastructure
• Minimize MVP release scope
• Team delivers feature to PROD
• NodeJS
• TypeScript
• ReactJS
• Koa Server
• Jest
• Cucumber
• Selenium WDIO
• Artillery
kiss.ts - Q&A
kiss.ts | sbtech.com | ista-201729
Ethan Ram
e-mail|GitHub|Linkedin
• Tutorial: Building a RESTful API with Koa, PostgreSQL in TDD
• Turning PostgreSQL into a queue serving 10,000 jobs per second
• Non-relational PostgreSQL
• TypeScript at Slack
• http://docs.sequelizejs.com/manual/installation/getting-started
• https://github.com/RobinBuschmann/sequelize-typescript/blob/master/README.md
Links
kiss.ts | sbtech.com | ista-201730