SlideShare a Scribd company logo
1 of 26
Download to read offline
let swift(16)
Docker + Swift Server-Side
OSXDEV.orgByungwook Ahn
OSXDEV.orgWonseok Yang
1
2
Experienced
Device driver(windows, linux)
Media streaming
CDN
Docker
Letswift Conf. 2016 Speaker
Tensorflow-KR 2016 Speaker
PyCon Hongkong 2015 Speaker
PyCon Korea 2015 Speaker
3
Agenda
WWDC 2016 - swift session
Server-Side?
Swift backend framework
VirtualBox, Kitura, Docker
myFirstProject
Demo
Summary
4
WWDC 2016 - swift session
Swift
What’s New in Swift : https://developer.apple.com/videos/play/wwdc2016/402/
Client-Side
What’s New in Foundation for Swift : https://developer.apple.com/videos/play/wwdc2016/207/
Getting Started with Swift : https://developer.apple.com/videos/play/wwdc2016/404/
Introducing Swift Playgrounds : https://developer.apple.com/videos/play/wwdc2016/408/
Swift API Design Guidelines : https://developer.apple.com/videos/play/wwdc2016/403/
Understanding Swift Performance : https://developer.apple.com/videos/play/wwdc2016/416/
Concurrent Programming With GCD in Swift 3 : https://developer.apple.com/videos/play/
wwdc2016/720/
Using Store Kit for In-App Purchase wit Swift 3 : https://developer.apple.com/videos/play/
wwdc2016/702/
Server-Side
Going Server-side with Swift Open Source : https://developer.apple.com/videos/play/
wwdc2016/415/
Software Engineer
@red
5
Server-Side?
Backend Web Framework
Web Framework?
Ajax asynchronous Javascript and XML
MVC framework Model/View/Controller
i18n Internationalization ( ex:date … )
ORM Object Relational Mapping(RDB)
Testing framework Framework JUnit, Cedar…
Security Framework Spring Security(OAuth)
Template Framework Mustache
Caching Framework redis, Ehcache
6
Kitura Perfect
Hosted IBM perfect.org
latest version v0.20.0 v1.0.0
started date Feb 9, 2016 Oct 3, 2015
License Apache 2.0 Apache 2.0
MySQL O O
SQLite O O
Redis O O
HTTP URL routing O O
Parmeter Parsing O O
JSON O O
OAuth Kitura-Credentials -
Package/3rdParty Library Many ?
Swift backend framework
Most popular Swift backend framework : Zewo,Vapor…
let swift(16)
VirtualBox, Kitura, Docker
https://github.com/bwahn/letswift2016-conference
8
VirtualBox(vagrantfile)
# -*- mode: ruby -*-
# vi: set ft=ruby :
BOX_URL = 'https://cloud-images.ubuntu.com/vagrant/wily/current/wily-server-cloudimg-amd64-vagrant-
disk1.box'.freeze
SWIFT_PATH = 'https://swift.org/builds/development/ubuntu1510/swift-DEVELOPMENT-
SNAPSHOT-2016-06-06-a'.freeze
SWIFT_DIRECTORY = 'swift-DEVELOPMENT-SNAPSHOT-2016-06-06-a-ubuntu15.10'.freeze
SWIFT_FILE = "#{SWIFT_DIRECTORY}.tar.gz".freeze
SWIFT_HOME = "/home/vagrant/#{SWIFT_DIRECTORY}".freeze
LIBDISPATCH_URL = '-b experimental/foundation https://github.com/apple/swift-corelibs-libdispatch'.freeze
KITURA_URL = 'https://github.com/IBM-Swift/Kitura.git'.freeze
KITURA_BRANCH = 'master'.freeze
Vagrant.configure(2) do |config|
config.vm.box = BOX_URL
config.vm.network 'forwarded_port', guest: 8090, host: 8090
Swift 3.0
For Restful-APIs
9
KITURA master
###
# 1. Install compiler, autotools
sudo apt-get --assume-yes install clang
sudo apt-get --assume-yes install autoconf libtool pkg-config
# 2. Install dtrace (to generate provider.h)
sudo apt-get --assume-yes install systemtap-sdt-dev
# 3. Install libdispatch pre-reqs
sudo apt-get --assume-yes install libblocksruntime-dev libkqueue-dev libpthread-
workqueue-dev libbsd-dev
# 4. Kitura packages
sudo apt-get --assume-yes install libhttp-parser-dev libcurl4-openssl-dev libhiredis-dev
Install packages
10
11
### Download and install Kitura
git clone #{KITURA_URL} -b #{KITURA_BRANCH}
cd Kitura
swift build -Xcc -fblocks
cd ..
$ vagrant up
let swift(16)
myFirstProject
13
$ vagrant ssh
vagrant@vagrant-ubuntu-wily-64: $ mkdir myFirstProject
vagrant@vagrant-ubuntu-wily-64: $ cd myFirstProject
vagrant@vagrant-ubuntu-wily-64: $ swift package init
14
$ vi package.swift
import PackageDescription
let package = Package(
name: "myFirstProject",
dependencies: [
.Package(url: "https://github.com/IBM-Swift/Kitura.git",
majorVersion: 0, minor: 20)
])
15
$ vi Sources/main.swift
import Kitura
let router = Router()
router.get("/") {
request, response, next in
response.send("Hello, World!")
next()
}
Kitura.addHTTPServer(onPort: 8090, with: router)
Kitura.run()
$ swift build -Xcc -fblocks
$ ./build/debug/myFirstProject
let swift(16)
For Docker
For Docker build
Run a letswift-api server
17
18
Docker build
$ git clone https://github.com/bwahn/
letswift2016-conference.git
$ docker build -t swift-api .
Docker run
$ docker run -d -p 8090:8090 --name api
swift-api:latest
image(swift-api:latest)
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
swift-api latest 829e110bd520 3 hours ago 1.524 GB
ibmcom/kitura-ubuntu latest 20cb1052cd2e 2 weeks ago 1.524 GB
ibmcom/swift-ubuntu latest b4daffd2bbaf 2 weeks ago 1.233 GB
Virtual Box VM - Ubuntu
$ docker run -d -p 8090 --name api1 swift-api:latest
$ docker run -d -p 8090 --name api2 swift-api:latest
$ docker run -d -p 8090 --name api3 swift-api:latest
…
…
..
macOS
port
8090:8090
? => scale up
$ docker-compose
19
let swift(16)
Demo : Introduction
“I Hate Objective-C” Application
Client : Swift 2.2 ( Cocoa-
touch)
Server : Swift 3 ( Kitura)
21
Architecture
MySQL
Cloud End-Point
swift backend
swift backend
swift backend
Google Container cluster
Swift App
22
Dev/Prod Environment
Virtual Box VM - Ubuntu
(Swift - backend)
google container registry
Swift - Client
Google Cloud Platform
swift backend
swift backend
swift backend
MySQL
24
==================================
Description : get a number of vote
Request: Verb: GET URL: http://letswift-api:8090/vote
Response: HTTP code: 200
Body:
{
"objective-c": 100,
"swift": 100
}
==================================
Description : Increase a vote
Request: Verb: PUT URL: http://letswift-api:8090/votes/objectivec_voted
Request: Verb: PUT URL: http://letswift-api:8090/votes/swift_voted
Response: HTTP code: 200
let swift(16)
Let’s vote!
25
26
let swift(16)

More Related Content

What's hot

What's hot (20)

當專案漸趕,當遷移也不再那麼難 (Ship Your Projects with Docker EcoSystem)
當專案漸趕,當遷移也不再那麼難 (Ship Your Projects with Docker EcoSystem)當專案漸趕,當遷移也不再那麼難 (Ship Your Projects with Docker EcoSystem)
當專案漸趕,當遷移也不再那麼難 (Ship Your Projects with Docker EcoSystem)
 
OpenDaylight Developer Experience 2.0
 OpenDaylight Developer Experience 2.0 OpenDaylight Developer Experience 2.0
OpenDaylight Developer Experience 2.0
 
Container sig#1 ansible-container
Container sig#1 ansible-containerContainer sig#1 ansible-container
Container sig#1 ansible-container
 
Docker
DockerDocker
Docker
 
Managing dependencies with gradle
Managing dependencies with gradleManaging dependencies with gradle
Managing dependencies with gradle
 
Photon Server Deep Dive - View from Implmentation of PhotonWire, Multiplayer ...
Photon Server Deep Dive - View from Implmentation of PhotonWire, Multiplayer ...Photon Server Deep Dive - View from Implmentation of PhotonWire, Multiplayer ...
Photon Server Deep Dive - View from Implmentation of PhotonWire, Multiplayer ...
 
PuppetConf 2016: Building Nano Server Images with Puppet and DSC – Michael Sm...
PuppetConf 2016: Building Nano Server Images with Puppet and DSC – Michael Sm...PuppetConf 2016: Building Nano Server Images with Puppet and DSC – Michael Sm...
PuppetConf 2016: Building Nano Server Images with Puppet and DSC – Michael Sm...
 
Golang workshop
Golang workshopGolang workshop
Golang workshop
 
PuppetConf 2016: Docker, Mesos, Kubernetes and...Puppet? Don't Panic! – Deep...
PuppetConf 2016:  Docker, Mesos, Kubernetes and...Puppet? Don't Panic! – Deep...PuppetConf 2016:  Docker, Mesos, Kubernetes and...Puppet? Don't Panic! – Deep...
PuppetConf 2016: Docker, Mesos, Kubernetes and...Puppet? Don't Panic! – Deep...
 
Супер быстрая автоматизация тестирования на iOS
Супер быстрая автоматизация тестирования на iOSСупер быстрая автоматизация тестирования на iOS
Супер быстрая автоматизация тестирования на iOS
 
手把手帶你學Docker 03042017
手把手帶你學Docker 03042017手把手帶你學Docker 03042017
手把手帶你學Docker 03042017
 
PuppetConf 2016: Deploying Multi-Tier Windows Applications with Application O...
PuppetConf 2016: Deploying Multi-Tier Windows Applications with Application O...PuppetConf 2016: Deploying Multi-Tier Windows Applications with Application O...
PuppetConf 2016: Deploying Multi-Tier Windows Applications with Application O...
 
Docker & PHP - Practical use case
Docker & PHP - Practical use caseDocker & PHP - Practical use case
Docker & PHP - Practical use case
 
時代在變 Docker 要會:台北 Docker 一日入門篇
時代在變 Docker 要會:台北 Docker 一日入門篇時代在變 Docker 要會:台北 Docker 一日入門篇
時代在變 Docker 要會:台北 Docker 一日入門篇
 
Going native with less coupling: Dependency Injection in C++
Going native with less coupling: Dependency Injection in C++Going native with less coupling: Dependency Injection in C++
Going native with less coupling: Dependency Injection in C++
 
Dessi docker kubernetes paas cloud
Dessi docker kubernetes paas cloudDessi docker kubernetes paas cloud
Dessi docker kubernetes paas cloud
 
Build service with_docker_in_90mins
Build service with_docker_in_90minsBuild service with_docker_in_90mins
Build service with_docker_in_90mins
 
Start tracking your ruby infrastructure
Start tracking your ruby infrastructureStart tracking your ruby infrastructure
Start tracking your ruby infrastructure
 
Gradle in 45min
Gradle in 45minGradle in 45min
Gradle in 45min
 
Vagrant
VagrantVagrant
Vagrant
 

Viewers also liked (9)

안드로이드 개발자를 위한 스위프트
안드로이드 개발자를 위한 스위프트안드로이드 개발자를 위한 스위프트
안드로이드 개발자를 위한 스위프트
 
Swift and Xcode8
Swift and Xcode8Swift and Xcode8
Swift and Xcode8
 
Letswift Swift 3.0
Letswift Swift 3.0Letswift Swift 3.0
Letswift Swift 3.0
 
Swift package manager
Swift package managerSwift package manager
Swift package manager
 
Do swift: Swift 무작정 해보기
Do swift: Swift 무작정 해보기Do swift: Swift 무작정 해보기
Do swift: Swift 무작정 해보기
 
스위프트 성능 이해하기
스위프트 성능 이해하기스위프트 성능 이해하기
스위프트 성능 이해하기
 
Protocol Oriented Programming in Swift
Protocol Oriented Programming in SwiftProtocol Oriented Programming in Swift
Protocol Oriented Programming in Swift
 
Swift internals
Swift internalsSwift internals
Swift internals
 
LetSwift RxSwift 시작하기
LetSwift RxSwift 시작하기LetSwift RxSwift 시작하기
LetSwift RxSwift 시작하기
 

Similar to Swift server-side-let swift2016

Developing and Deploying PHP with Docker
Developing and Deploying PHP with DockerDeveloping and Deploying PHP with Docker
Developing and Deploying PHP with Docker
Patrick Mizer
 

Similar to Swift server-side-let swift2016 (20)

GDGSCL - Docker a jeho provoz v Heroku a AWS
GDGSCL - Docker a jeho provoz v Heroku a AWSGDGSCL - Docker a jeho provoz v Heroku a AWS
GDGSCL - Docker a jeho provoz v Heroku a AWS
 
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
 
Preparation study of_docker - (MOSG)
Preparation study of_docker  - (MOSG)Preparation study of_docker  - (MOSG)
Preparation study of_docker - (MOSG)
 
Docker engine - Indroduc
Docker engine - IndroducDocker engine - Indroduc
Docker engine - Indroduc
 
PHP on Heroku: Deploying and Scaling Apps in the Cloud
PHP on Heroku: Deploying and Scaling Apps in the CloudPHP on Heroku: Deploying and Scaling Apps in the Cloud
PHP on Heroku: Deploying and Scaling Apps in the Cloud
 
Blockchain Software for Hardware: The Canaan AvalonMiner Open Source Embedded...
Blockchain Software for Hardware: The Canaan AvalonMiner Open Source Embedded...Blockchain Software for Hardware: The Canaan AvalonMiner Open Source Embedded...
Blockchain Software for Hardware: The Canaan AvalonMiner Open Source Embedded...
 
Docker module 1
Docker module 1Docker module 1
Docker module 1
 
Developing and Deploying PHP with Docker
Developing and Deploying PHP with DockerDeveloping and Deploying PHP with Docker
Developing and Deploying PHP with Docker
 
Docker to the Rescue of an Ops Team
Docker to the Rescue of an Ops TeamDocker to the Rescue of an Ops Team
Docker to the Rescue of an Ops Team
 
Docker to the Rescue of an Ops Team
Docker to the Rescue of an Ops TeamDocker to the Rescue of an Ops Team
Docker to the Rescue of an Ops Team
 
AWS EC2 Ubuntu Instance - Step-by-Step Deployment Guide
AWS EC2 Ubuntu Instance - Step-by-Step Deployment GuideAWS EC2 Ubuntu Instance - Step-by-Step Deployment Guide
AWS EC2 Ubuntu Instance - Step-by-Step Deployment Guide
 
Package a PyApp as a Flatpak Package: An HTTP Server for Example @ PyCon APAC...
Package a PyApp as a Flatpak Package: An HTTP Server for Example @ PyCon APAC...Package a PyApp as a Flatpak Package: An HTTP Server for Example @ PyCon APAC...
Package a PyApp as a Flatpak Package: An HTTP Server for Example @ PyCon APAC...
 
Rasperry Pi and TI CC2650 IPv6 border router
Rasperry Pi and TI CC2650 IPv6 border routerRasperry Pi and TI CC2650 IPv6 border router
Rasperry Pi and TI CC2650 IPv6 border router
 
Build and run embedded apps faster from qt creator with docker
Build and run embedded apps faster from qt creator with dockerBuild and run embedded apps faster from qt creator with docker
Build and run embedded apps faster from qt creator with docker
 
Webinar: Building Embedded Applications from QtCreator with Docker
Webinar: Building Embedded Applications from QtCreator with DockerWebinar: Building Embedded Applications from QtCreator with Docker
Webinar: Building Embedded Applications from QtCreator with Docker
 
Software Quality Assurance Tooling - Wintersession 2024
Software Quality Assurance Tooling - Wintersession 2024Software Quality Assurance Tooling - Wintersession 2024
Software Quality Assurance Tooling - Wintersession 2024
 
Chicago Docker Meetup Presentation - Mediafly
Chicago Docker Meetup Presentation - MediaflyChicago Docker Meetup Presentation - Mediafly
Chicago Docker Meetup Presentation - Mediafly
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to Docker
 
BBL Premiers pas avec Docker
BBL Premiers pas avec DockerBBL Premiers pas avec Docker
BBL Premiers pas avec Docker
 
Docker con osdk_ver1.0
Docker con osdk_ver1.0Docker con osdk_ver1.0
Docker con osdk_ver1.0
 

More from Eric Ahn (15)

Tensorflow and python : fault detection system - PyCon Taiwan 2017
Tensorflow and python : fault detection system - PyCon Taiwan 2017Tensorflow and python : fault detection system - PyCon Taiwan 2017
Tensorflow and python : fault detection system - PyCon Taiwan 2017
 
Docker remote-api
Docker remote-apiDocker remote-api
Docker remote-api
 
Docker deploy
Docker deployDocker deploy
Docker deploy
 
Tensorflow in Docker
Tensorflow in DockerTensorflow in Docker
Tensorflow in Docker
 
Docker command
Docker commandDocker command
Docker command
 
High perforance-browse-networking-2015-bwahn
High perforance-browse-networking-2015-bwahnHigh perforance-browse-networking-2015-bwahn
High perforance-browse-networking-2015-bwahn
 
Cdn gslb-20151209
Cdn gslb-20151209Cdn gslb-20151209
Cdn gslb-20151209
 
Keep it simple web development stack
Keep it simple web development stackKeep it simple web development stack
Keep it simple web development stack
 
Py conkr 20150829_docker-python
Py conkr 20150829_docker-pythonPy conkr 20150829_docker-python
Py conkr 20150829_docker-python
 
Http capturing
Http capturingHttp capturing
Http capturing
 
Apache module-201511
Apache module-201511Apache module-201511
Apache module-201511
 
Spring rest-doc-2015-11
Spring rest-doc-2015-11Spring rest-doc-2015-11
Spring rest-doc-2015-11
 
Py conkr 20150829_docker-python
Py conkr 20150829_docker-pythonPy conkr 20150829_docker-python
Py conkr 20150829_docker-python
 
CORS review
CORS reviewCORS review
CORS review
 
Docker build #1
Docker build #1Docker build #1
Docker build #1
 

Recently uploaded

一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
pxcywzqs
 
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girlsRussian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
Monica Sydney
 
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
ydyuyu
 
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
ayvbos
 
Russian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi EscortsRussian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Monica Sydney
 
PowerDirector Explination Process...pptx
PowerDirector Explination Process...pptxPowerDirector Explination Process...pptx
PowerDirector Explination Process...pptx
galaxypingy
 
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdfpdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
JOHNBEBONYAP1
 
Indian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi EscortsIndian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Monica Sydney
 

Recently uploaded (20)

一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
 
Trump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts SweatshirtTrump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts Sweatshirt
 
"Boost Your Digital Presence: Partner with a Leading SEO Agency"
"Boost Your Digital Presence: Partner with a Leading SEO Agency""Boost Your Digital Presence: Partner with a Leading SEO Agency"
"Boost Your Digital Presence: Partner with a Leading SEO Agency"
 
Vip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac Room
Vip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac RoomVip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac Room
Vip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac Room
 
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...
 
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girlsRussian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
 
Best SEO Services Company in Dallas | Best SEO Agency Dallas
Best SEO Services Company in Dallas | Best SEO Agency DallasBest SEO Services Company in Dallas | Best SEO Agency Dallas
Best SEO Services Company in Dallas | Best SEO Agency Dallas
 
Microsoft Azure Arc Customer Deck Microsoft
Microsoft Azure Arc Customer Deck MicrosoftMicrosoft Azure Arc Customer Deck Microsoft
Microsoft Azure Arc Customer Deck Microsoft
 
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
 
Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoil
Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime NagercoilNagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoil
Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoil
 
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
 
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
 
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrStory Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
 
Russian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi EscortsRussian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
 
PowerDirector Explination Process...pptx
PowerDirector Explination Process...pptxPowerDirector Explination Process...pptx
PowerDirector Explination Process...pptx
 
20240507 QFM013 Machine Intelligence Reading List April 2024.pdf
20240507 QFM013 Machine Intelligence Reading List April 2024.pdf20240507 QFM013 Machine Intelligence Reading List April 2024.pdf
20240507 QFM013 Machine Intelligence Reading List April 2024.pdf
 
Real Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtReal Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirt
 
Power point inglese - educazione civica di Nuria Iuzzolino
Power point inglese - educazione civica di Nuria IuzzolinoPower point inglese - educazione civica di Nuria Iuzzolino
Power point inglese - educazione civica di Nuria Iuzzolino
 
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdfpdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
 
Indian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi EscortsIndian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
 

Swift server-side-let swift2016

  • 1. let swift(16) Docker + Swift Server-Side OSXDEV.orgByungwook Ahn OSXDEV.orgWonseok Yang 1
  • 2. 2 Experienced Device driver(windows, linux) Media streaming CDN Docker Letswift Conf. 2016 Speaker Tensorflow-KR 2016 Speaker PyCon Hongkong 2015 Speaker PyCon Korea 2015 Speaker
  • 3. 3
  • 4. Agenda WWDC 2016 - swift session Server-Side? Swift backend framework VirtualBox, Kitura, Docker myFirstProject Demo Summary 4
  • 5. WWDC 2016 - swift session Swift What’s New in Swift : https://developer.apple.com/videos/play/wwdc2016/402/ Client-Side What’s New in Foundation for Swift : https://developer.apple.com/videos/play/wwdc2016/207/ Getting Started with Swift : https://developer.apple.com/videos/play/wwdc2016/404/ Introducing Swift Playgrounds : https://developer.apple.com/videos/play/wwdc2016/408/ Swift API Design Guidelines : https://developer.apple.com/videos/play/wwdc2016/403/ Understanding Swift Performance : https://developer.apple.com/videos/play/wwdc2016/416/ Concurrent Programming With GCD in Swift 3 : https://developer.apple.com/videos/play/ wwdc2016/720/ Using Store Kit for In-App Purchase wit Swift 3 : https://developer.apple.com/videos/play/ wwdc2016/702/ Server-Side Going Server-side with Swift Open Source : https://developer.apple.com/videos/play/ wwdc2016/415/ Software Engineer @red 5
  • 6. Server-Side? Backend Web Framework Web Framework? Ajax asynchronous Javascript and XML MVC framework Model/View/Controller i18n Internationalization ( ex:date … ) ORM Object Relational Mapping(RDB) Testing framework Framework JUnit, Cedar… Security Framework Spring Security(OAuth) Template Framework Mustache Caching Framework redis, Ehcache 6
  • 7. Kitura Perfect Hosted IBM perfect.org latest version v0.20.0 v1.0.0 started date Feb 9, 2016 Oct 3, 2015 License Apache 2.0 Apache 2.0 MySQL O O SQLite O O Redis O O HTTP URL routing O O Parmeter Parsing O O JSON O O OAuth Kitura-Credentials - Package/3rdParty Library Many ? Swift backend framework Most popular Swift backend framework : Zewo,Vapor…
  • 8. let swift(16) VirtualBox, Kitura, Docker https://github.com/bwahn/letswift2016-conference 8
  • 9. VirtualBox(vagrantfile) # -*- mode: ruby -*- # vi: set ft=ruby : BOX_URL = 'https://cloud-images.ubuntu.com/vagrant/wily/current/wily-server-cloudimg-amd64-vagrant- disk1.box'.freeze SWIFT_PATH = 'https://swift.org/builds/development/ubuntu1510/swift-DEVELOPMENT- SNAPSHOT-2016-06-06-a'.freeze SWIFT_DIRECTORY = 'swift-DEVELOPMENT-SNAPSHOT-2016-06-06-a-ubuntu15.10'.freeze SWIFT_FILE = "#{SWIFT_DIRECTORY}.tar.gz".freeze SWIFT_HOME = "/home/vagrant/#{SWIFT_DIRECTORY}".freeze LIBDISPATCH_URL = '-b experimental/foundation https://github.com/apple/swift-corelibs-libdispatch'.freeze KITURA_URL = 'https://github.com/IBM-Swift/Kitura.git'.freeze KITURA_BRANCH = 'master'.freeze Vagrant.configure(2) do |config| config.vm.box = BOX_URL config.vm.network 'forwarded_port', guest: 8090, host: 8090 Swift 3.0 For Restful-APIs 9 KITURA master
  • 10. ### # 1. Install compiler, autotools sudo apt-get --assume-yes install clang sudo apt-get --assume-yes install autoconf libtool pkg-config # 2. Install dtrace (to generate provider.h) sudo apt-get --assume-yes install systemtap-sdt-dev # 3. Install libdispatch pre-reqs sudo apt-get --assume-yes install libblocksruntime-dev libkqueue-dev libpthread- workqueue-dev libbsd-dev # 4. Kitura packages sudo apt-get --assume-yes install libhttp-parser-dev libcurl4-openssl-dev libhiredis-dev Install packages 10
  • 11. 11 ### Download and install Kitura git clone #{KITURA_URL} -b #{KITURA_BRANCH} cd Kitura swift build -Xcc -fblocks cd .. $ vagrant up
  • 13. 13 $ vagrant ssh vagrant@vagrant-ubuntu-wily-64: $ mkdir myFirstProject vagrant@vagrant-ubuntu-wily-64: $ cd myFirstProject vagrant@vagrant-ubuntu-wily-64: $ swift package init
  • 14. 14 $ vi package.swift import PackageDescription let package = Package( name: "myFirstProject", dependencies: [ .Package(url: "https://github.com/IBM-Swift/Kitura.git", majorVersion: 0, minor: 20) ])
  • 15. 15 $ vi Sources/main.swift import Kitura let router = Router() router.get("/") { request, response, next in response.send("Hello, World!") next() } Kitura.addHTTPServer(onPort: 8090, with: router) Kitura.run() $ swift build -Xcc -fblocks $ ./build/debug/myFirstProject
  • 17. For Docker build Run a letswift-api server 17
  • 18. 18 Docker build $ git clone https://github.com/bwahn/ letswift2016-conference.git $ docker build -t swift-api . Docker run $ docker run -d -p 8090:8090 --name api swift-api:latest image(swift-api:latest) $ docker images REPOSITORY TAG IMAGE ID CREATED SIZE swift-api latest 829e110bd520 3 hours ago 1.524 GB ibmcom/kitura-ubuntu latest 20cb1052cd2e 2 weeks ago 1.524 GB ibmcom/swift-ubuntu latest b4daffd2bbaf 2 weeks ago 1.233 GB
  • 19. Virtual Box VM - Ubuntu $ docker run -d -p 8090 --name api1 swift-api:latest $ docker run -d -p 8090 --name api2 swift-api:latest $ docker run -d -p 8090 --name api3 swift-api:latest … … .. macOS port 8090:8090 ? => scale up $ docker-compose 19
  • 20. let swift(16) Demo : Introduction
  • 21. “I Hate Objective-C” Application Client : Swift 2.2 ( Cocoa- touch) Server : Swift 3 ( Kitura) 21
  • 22. Architecture MySQL Cloud End-Point swift backend swift backend swift backend Google Container cluster Swift App 22
  • 23. Dev/Prod Environment Virtual Box VM - Ubuntu (Swift - backend) google container registry Swift - Client Google Cloud Platform swift backend swift backend swift backend MySQL
  • 24. 24 ================================== Description : get a number of vote Request: Verb: GET URL: http://letswift-api:8090/vote Response: HTTP code: 200 Body: { "objective-c": 100, "swift": 100 } ================================== Description : Increase a vote Request: Verb: PUT URL: http://letswift-api:8090/votes/objectivec_voted Request: Verb: PUT URL: http://letswift-api:8090/votes/swift_voted Response: HTTP code: 200