Anda di halaman 1dari 69

1 / 42

Playback isn't supported on this device.

#EverythingIsAwesome
1 / 42
Building in Blocks
Adrian Png

Insum Solutions

Photo by Kelly Sikkema on Unsplash 2 / 42


About Me
APEX Developer at Insum Solutions
Community Activities:
Founder and co-organizer, ORCLAPEX-YVR
Director, British Columbia Oracle Users Group (BCOUG)
https://fuzziebrain.com
https://twitter.com/fuzziebrain
https://github.com/fuzziebrain

3 / 42
About Insum Solutions
Oracle APEX expert practice since 2004
Oracle APEX Centre of Excellence Our Core Values
Offices in Canada, USA and Peru Respect
Comprehensive consulting services Teamwork
Training and coaching Integrity
Architecture and analysis Innovation
Project management Quality
On-site/off-site development Fun
APEX best practices, methodology and
Toolkit

4 / 42
Agenda
Microservice Architecture
What is it?
Do I need it?

5 / 42
Agenda
Microservice Architecture
What is it?
Do I need it?
Case Studies
Mailchimp
Slack
Eventbrite

5 / 42
Agenda
Microservice Architecture
What is it?
Do I need it?
Case Studies
Mailchimp
Slack
Eventbrite
Challenges
Choosing the right API Authentication
Dealing with SSL Certificates

5 / 42
Agenda
Microservice Architecture
What is it?
Do I need it?
Case Studies
Mailchimp
Slack
Eventbrite
Challenges
Choosing the right API Authentication
Dealing with SSL Certificates
Designing, Managing and Documenting APIs

5 / 42
Microservices Architecture
What is it?
Small, and Focused on Doing One Thing Well

Sam Newman
Building Microservices

6 / 42
Microservices Architecture
What is it?
Small, and Focused on Doing One Thing Well

Sam Newman
Building Microservices

Some say...

SOA done right

6 / 42
Microservices Architecture
Should I use it?
The Good Benefits The Bad Considerations

Technology agnostic - best of breed selection Consistency think transactions

Application role decomposition Distributed multiple points of failure?

Smaller, more focused teams Complexity

Lightweight communications usually over HTTP

7 / 42
How's this dierent from SOA?
The power of microservices comes from their non-prescriptive nature. There is no
formal, slow-moving, industry-driven specification; rather, the microservices
approach has emerged as a pattern of development that has been practiced and
refined by pioneers. Born in the modern Web, microservices are interconnected
using a thin layer of simple APIs and the lingua franca of HTTP

Mark Richards
Microservices vs. Service-Oriented Architecture

8 / 42
Share everything (SOA) vs. Isolation
Photo by Brandon Kawamura on Unsplash 9 / 42
Gartner Hype Cycle

Source: https://en.wikipedia.org/wiki/Hype_cycle#/media/File:Hype-Cycle-General.png

10 / 42
Gartner Hype Cycle
Check out:
The Long Sad History of Microservices presented by Greg Young

https://vimeo.com/191521079

Source: https://en.wikipedia.org/wiki/Hype_cycle#/media/File:Hype-Cycle-General.png

10 / 42
API Gateway
Roles and responsibilities:
Security / Authentication
Transformations / protocol translations
Load balancing
Logging
Benefits:
A faade, shields implementation details
from client
Reduce network roundtrips for clients

11 / 42
API Gateway - Implementations

Kong Zuul

Google Cloud Endpoints Amazon API Gateway

12 / 42
APEX as an API Gateway?
Photo by frank mckenna on Unsplash 13 / 42
On hindsight, apex.world was developed with a Microservices-like architecture.

14 / 42
Development Team
Small team*
Juergen Schuster
Daniel Hochleitner
Michael Drbeck
Anonymous I
Anonymous II
Me
Geographically dispersed
Extremely low budget
Tight schedules and limited development hours

*Nothing is static. Please check out the most up-to-date list on apex.world.

15 / 42
APEX.WORLD Feature Requirements in a Nutshell
First stop for APEX-related content

16 / 42
APEX.WORLD Feature Requirements in a Nutshell
First stop for APEX-related content

Phase 1
Member sign up and profile management
Bookmarks/News
Twitter feed
Job Market
List of Meetup Groups worldwide
List of community APEX plugins
Live chat

16 / 42
APEX.WORLD Feature Requirements in a Nutshell
First stop for APEX-related content

Phase 1 Phase 2
Member sign up and profile management Mailing list management
Bookmarks/News OTN Community Forums
Twitter feed
Job Market
List of Meetup Groups worldwide
List of community APEX plugins
Live chat

16 / 42
17 / 42
Mailing List (MailChimp)

17 / 42
Mailing List (MailChimp)


Chat (Slack)

17 / 42
APEX Meetups (Meetup.com)
Mailing List (MailChimp)


Chat (Slack)

17 / 42
APEX Meetups (Meetup.com)


Mailing List (MailChimp)
Plugins (Github)


Chat (Slack)

17 / 42
Challenges
API Authentication
Random token (API keys)
OAuth
JSON Web Tokens (JWT)

18 / 42
Challenges
Connecting to APIs Securely Communicating over HTTP
Why?
Some API service providers require it, e.g. Slack
Transmitting security or privacy-related data, e.g. API security tokens, user information

19 / 42
Challenges
Connecting to APIs Securely Communicating over HTTP
Why?
Some API service providers require it, e.g. Slack
Transmitting security or privacy-related data, e.g. API security tokens, user information
How?
Add server SSL Certificates to Oracle Wallet
Use a proxy

19 / 42
Workarounds with Oracle 11g Express Edition
Problems with Oracle XE:
No Oracle Wallet Manager
No Oracle Support no patches/updates

20 / 42
Workarounds with Oracle 11g Express Edition
Problems with Oracle XE:
No Oracle Wallet Manager
No Oracle Support no patches/updates
Use OpenSSL to manage wallet

20 / 42
Workarounds with Oracle 11g Express Edition
Problems with Oracle XE:
No Oracle Wallet Manager
No Oracle Support no patches/updates
Use OpenSSL to manage wallet
Newer certificate encryption methods not supported (no Oracle Support, sorry)

20 / 42
Workarounds with Oracle 11g Express Edition
Problems with Oracle XE:
No Oracle Wallet Manager
No Oracle Support no patches/updates
Use OpenSSL to manage wallet
Newer certificate encryption methods not supported (no Oracle Support, sorry)

Solution?

20 / 42
Workarounds with Oracle 11g Express Edition
Problems with Oracle XE:
No Oracle Wallet Manager
No Oracle Support no patches/updates
Use OpenSSL to manage wallet
Newer certificate encryption methods not supported (no Oracle Support, sorry)

Solution?
PROXY!

20 / 42
Proxy SSL Connections with Node.JS
Express.js
http-proxy-middleware
(uses Nodejitsu's http-proxy)
One proxy per service

21 / 42
Proxy SSL Connections with Node.JS
const
express = require('express'),
proxy = require('http-proxy-middleware');

var app = express();

app.use('/', proxy({
target: 'https://api.slack.com/',
changeOrigin: true // Slack is very picky about this
}));

app.listen(3000, '127.0.0.1'); // IMPORTANT: localhost and nowhere else!

22 / 42
Introducing Suez
Photo by Hisham Abo-hamad on Unsplash 23 / 42
Features
Node.js application
Multiple endpoints for APEX to gain proxy access to secure web APIs
Simple configuration

Introducing Suez
Photo by Hisham Abo-hamad on Unsplash 23 / 42
Congurable Express.js Routing
router: function(req) {
var routeName = req.hostname.split('.')[0]; // e.g. http://slackapi.localhost points to https://api.slack.com

var proxyTarget = config.apiTargets.find(


function(apiTarget) {
return apiTarget.name == this;
},
routeName
).proxyTarget;

return proxyTarget;
}

24 / 42
Example Suez Conguration
{
"service": {
"port": 3000
},
"apiTargets": [
{
"name": "slackapi",
"proxyTarget": "https://api.slack.com/"
},
{
"name": "mailchimpapi",
"proxyTarget": "https://us1.api.mailchimp.com/"
}
]
}

25 / 42
Congurable Express.js Routing

Before After (powered by Suez)

26 / 42
Chats in apex.world - Slack
Launch Demo

27 / 42
Mailing Lists in apex.world & BCOUG - MailChimp
Launch Demo

28 / 42
APEX & BCOUG - BFF
Manage
Member information
Sponsors
Events
Presentation file download
Mailing list
Integrated with Eventbrite
Track attendance
Packaged Apps in use
Survey Builder
Customer (Sponsor) Tracker

29 / 42
OUG Event Organization - Eventbrite
Launch Demo

30 / 42
OUG Event Organization - Eventbrite
Launch Demo

Registration link: http://bit.ly/bibsignup

30 / 42
Choosing the Best Platform
Image source: https%3A//commons.wikimedia.org/wiki/File:Sprungturm-seew.JPG 31 / 42
Everything is possible with PL/SQL

~ Morten Egan @kidrac

Photo by Lily Lvnatikk on Unsplash 32 / 42


Oracle, Statistics and R
Simple R script for generating a Linear Regression model
d <- input[[1]]
fit <- lm(roll~unem, d)
summary <- summary(fit)
data.frame(summary$coefficients)

33 / 42
Oracle, Statistics and R
Simple R script for generating a Linear Regression model
d <- input[[1]]
fit <- lm(roll~unem, d)
summary <- summary(fit)
data.frame(summary$coefficients)

NodeJS REST interface to the Linear Regression model


router.route('/model').post(function(req, res) {
var result = R('linear_model.R')
.data(JSON.parse(req.body.data))
.callSync();
res.json({ result: result });
});

33 / 42
Oracle, Statistics and R
Simple R script for generating a Linear Regression model
d <- input[[1]]
fit <- lm(roll~unem, d)
summary <- summary(fit)
data.frame(summary$coefficients)

NodeJS REST interface to the Linear Regression model


router.route('/model').post(function(req, res) {
var result = R('linear_model.R')
.data(JSON.parse(req.body.data))
.callSync();
res.json({ result: result });
});

Read blog post for more details.

33 / 42
Using Node.js to Implement Microservices
Why?

Simplicity. Simple to:


Develop
Test
Execute
Deploy

34 / 42
Using Node.js to Implement Microservices
Why?

Simplicity. Simple to:


Develop
Test
Execute
Deploy
Many frameworks available for creating REST services, for example:
Express - https://expressjs.com
restify - http://restify.com
LoopBack - http://loopback.io

34 / 42
Using Node.js to Implement Microservices
Why?

Simplicity. Simple to:


Develop
Test
Execute
Deploy
Many frameworks available for creating REST services, for example:
Express - https://expressjs.com
restify - http://restify.com
LoopBack - http://loopback.io
Huge selection of packages, searchable through https://www.npmjs.com
Interfaces with other programming and scripting languages, e.g. Python and R.

34 / 42
Using Node.js to Implement Microservices
Why?

Simplicity. Simple to:


Develop
Test
Execute
Deploy
Many frameworks available for creating REST services, for example:
Express - https://expressjs.com
restify - http://restify.com
LoopBack - http://loopback.io
Huge selection of packages, searchable through https://www.npmjs.com
Interfaces with other programming and scripting languages, e.g. Python and R.
Database support

34 / 42
Design, Document and Manage APIs
Specifications and Tools:
Swagger - http://swagger.io
RAML - http://raml.org
API Blueprint (Apiary) - https://apiblueprint.org

35 / 42
RAML
RESTful API Modeling Language
YAML-based, Machine-readable API document
raml2html - RAML to HTML document

> npm install -g raml2html


> raml2html demo/calculate.raml > build/calculate.html

36 / 42
Deployment
Photo by SpaceX on Unsplash 37 / 42
Deploying and Running Microservices
Microservices Application Platforms
Seneca - http://senecajs.org/
Eventuate - http://eventuate.io/

38 / 42
Deploying and Running Microservices
Microservices Application Platforms
Seneca - http://senecajs.org/
Eventuate - http://eventuate.io/

Options for Deploying Node.js Microservices


1. Docker - https://www.docker.com
2. PM2 - http://pm2.keymetrics.io/

38 / 42
PM2 Cheatsheet
# Install PM2
npm install pm2@latest -g

# Add a process, add "--watch" parameter to restart app on file change


pm2 start app.js --name "myapp"

# List all processes


pm2 list

# Restart a process
pm2 restart myapp

# Stop a process
pm2 stop myapp

# Save configuration
pm2 save

# Starting PM2 daemon on system boot


pm2 startup

39 / 42
PM2 List All Running Processes
pm2 list

40 / 42
Summary

41 / 42
Summary


agilty best-of-breed dealing with failures
self-contained synchronization issues
interface

41 / 42
APEX Lego?
Better when stuck together
Cool when you are part of a team

42 / 42
42 / 42

Anda mungkin juga menyukai