--- title: SwiftアプリをCloud Foundryにデプロイ tags: ["Cloud Foundry", "Swift"] categories: ["Service", "PaaS", "CloudFoundry"] date: 2015-12-11T10:20:30Z updated: 2015-12-11T10:20:30Z --- OSSになったSwift。早速[HTTPサーバー](https://github.com/kylef/Curassow)ができていた。 Cloud FoundryのSwift用[buildpack](https://github.com/cloudfoundry-community/swift-buildpack)も出ていた。 Hello Worldアプリをデプロイしてみた https://github.com/kylef/Curassow-example-helloworld デプロイ先は[PWS](https://run.pivotal.io/)。 ``` bash $ git clone https://github.com/kylef/Curassow-example-helloworld $ cd Curassow-example-helloworld $ cf push hello-swift -b https://github.com/cloudfoundry-community/swift-buildpack -m 100m Creating app hello-swift in org maki-org / space development as ... OK Creating route hello-swift.cfapps.io... OK Binding hello-swift.cfapps.io to hello-swift... OK Uploading hello-swift... Uploading app files from: /Users/maki/git/Curassow-example-helloworld Uploading 2.3K, 6 files Done uploading OK Starting app hello-swift in org maki-org / space development as ... Creating container Successfully created container Downloading app package... Downloaded app package (1.8K) Downloading buildpacks (https://github.com/cloudfoundry-community/swift-buildpack)... Downloaded buildpacks Staging... -----> Buildpack version 1.0.0 -----> Installing Swift 2.2 Downloaded Swift -----> Installing Clang 3.7.0 Downloaded Clang -----> Building Package Cloning Packages/Curassow Cloning Packages/Nest Cloning Packages/Inquiline Cloning Packages/Commander Compiling Swift Module 'Nest' (1 sources) Linking Library: .build/release/Nest.a Compiling Swift Module 'Inquiline' (3 sources) Linking Library: .build/release/Inquiline.a Compiling Swift Module 'Commander' (8 sources) Linking Library: .build/release/Commander.a Compiling Swift Module 'Curassow' (8 sources) Linking Library: .build/release/Curassow.a Compiling Swift Module 'HelloWorld' (1 sources) Linking Executable: .build/release/HelloWorld -----> Copying dynamic libraries -----> Copying binaries to 'bin' Exit status 0 Staging complete Uploading droplet, build artifacts cache... Uploading droplet... Uploading build artifacts cache... Uploaded build artifacts cache (170.3M) Uploaded droplet (91.4M) Uploading complete 0 of 1 instances running, 1 starting 0 of 1 instances running, 1 starting 1 of 1 instances running App started OK App hello-swift was started using this command `HelloWorld --workers 5 --bind 0.0.0.0:$PORT` Showing health and status for app hello-swift in org maki-org / space development as ... OK requested state: started instances: 1/1 usage: 100M x 1 instances urls: hello-swift.cfapps.io package uploaded: Fri Dec 11 13:39:45 UTC 2015 stack: cflinuxfs2 buildpack: https://github.com/cloudfoundry-community/swift-buildpack state since cpu memory disk details #0 running 2015-12-11 10:42:01 PM 0.0% 0 of 100M 0 of 1G Toshiaki-no-MacBook:Curassow-example-helloworld maki$ cf apps Getting apps in org maki-org / space development as ... OK name requested state instances memory disk urls hello-swift started 1/1 100M 1G hello-swift.cfapps.io $ curl hello-swift.cfapps.io Hello World ``` おもちゃレベルだけど、一応動いた