Giter Site home page Giter Site logo

swift-buildpack's Introduction

Apple Swift buildpack for Cloud Foundry

This is a Cloud Foundry/Heroku buildpack for Swift app, powered by SwiftPM (Swift Package Manager). It can be used on any Cloud Foundry, and administrators can upload an online (fetch assets from Internet) or offline (is bundled with buildpack assets) variation.

Check out a helloworld for a fully working example that can be deployed to any Cloud Foundry.

Usage

Example usage:

$ ls
Procfile Project.swift Sources

$ cf push -b https://github.com/cloudfoundry-community/swift-buildpack.git
-----> Downloaded app package (4.0K)
-----> Downloaded app buildpack cache (171M)
-----> Buildpack version 1.0.0
-----> Installing Swift 2.2-SNAPSHOT-2016-01-11-a
       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' (7 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'

The buildpack will detect your app as Swift if it has a Package.swift file in the root.

Procfile

Using the Procfile, you can set the process to run for your web server. Any binaries built from your Swift source using SwiftPM will be placed in your $PATH.

web: HelloWorld --workers 3 --bind 0.0.0.0:$PORT

Specify a Swift version

You can also customise the version of Swift used with a .swift-version file in your repository:

$ cat .swift-version
2.2-SNAPSHOT-2016-01-11-a

See manifest.yml for supported versions.

NOTE: Since there are frequent Swift language changes, it's advised that you pin to your Swift version.

Debugging

If the buildpack preparation or compilation steps are failing then you can enable some debugging:

cf set-env <appname> BP_DEBUG 1

To deactivate:

cf unset-env <appname> BP_DEBUG

Admin installation

wget https://github.com/cloudfoundry-community/swift-buildpack/releases/download/v1.0.0/swift_buildpack-cached-v1.0.0.zip
cf create-buildpack swift_buildpack swift_buildpack*.zip 10

Or to update:

wget https://github.com/cloudfoundry-community/swift-buildpack/releases/download/v1.0.0/swift_buildpack-cached-v1.0.0.zip
cf update-buildpack swift_buildpack -p swift_buildpack*.zip

Packaging

The two buildpack zip files are built from two different manifest.yml files:

BUNDLE_GEMFILE=cf.Gemfile bundle install
BUNDLE_GEMFILE=cf.Gemfile bundle exec buildpack-packager --uncached --use-custom-manifest manifest.yml
BUNDLE_GEMFILE=cf.Gemfile bundle exec buildpack-packager --cached --use-custom-manifest manifest-cached.yml

swift-buildpack's People

Contributors

briancroom avatar drnic avatar ikenwoo avatar jhunt avatar kylef avatar rolivieri avatar rsmoz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

swift-buildpack's Issues

swift-build: error: no Package.swift file found

I'm deploying https://github.com/kylef/Curassow-example-helloworld to Bluemix and am seeing this in my logs:
2016-01-20T17:20:49.034-0600[API/1]OUTCreated app with guid d40ed4c7-0380-45d9-a3ff-a6dd5bf97040
2016-01-20T17:20:53.654-0600[DEA/113]OUTGot staging request for app with id d40ed4c7-0380-45d9-a3ff-a6dd5bf97040
2016-01-20T17:21:02.854-0600[API/4]OUTUpdated app with guid d40ed4c7-0380-45d9-a3ff-a6dd5bf97040 ({"state"=>"STARTED", "buildpack"=>"https://github.com/cloudfoundry-community/swift-buildpack.git"})
2016-01-20T17:21:03.061-0600[STG/113]OUT-----> Downloaded app package (40K)
2016-01-20T17:21:03.217-0600[STG/0]ERRCloning into '/tmp/buildpacks/swift-buildpack'...
2016-01-20T17:21:04.390-0600[STG/0]OUT-----> Buildpack version 1.0.2
2016-01-20T17:21:04.394-0600[STG/0]OUT-----> Installing Swift 2.2-SNAPSHOT-2016-01-11-a
2016-01-20T17:21:13.283-0600[STG/0]OUT Downloaded Swift
2016-01-20T17:21:16.091-0600[STG/0]OUT-----> Installing Clang 3.7.0
2016-01-20T17:22:27.627-0600[STG/0]OUT Downloaded Clang
2016-01-20T17:22:40.920-0600[STG/0]OUT-----> Building Package
2016-01-20T17:22:41.119-0600[STG/0]ERRswift-build: error: no Package.swift file found
2016-01-20T17:22:41.130-0600[STG/0]OUTStaging failed: Buildpack compilation step failed
2016-01-20T17:22:41.380-0600[API/4]ERRencountered error: App staging failed in the buildpack compile phase

Is there an issue with the buildpack that it can't be staged in bluemix? i'm sending an exact copy of this repo to Bluemix. I'm deploying via CF Rest API and not the CF CLI.

releases?

@drnic @briancroom the README suggests that there will be releases published in a /releases folder. Yet, that doesn't exists (yet?). Are there plans to publish formal stable releases? Or, at a minimum, publish shas of the stable releases?

No support for released 2.2 branches

Hello,

It appears the manifest doesn't support the released & dev branches of 2.2

https://swift.org/builds/swift-2.2-release/ubuntu1404/swift-2.2-RELEASE/swift-2.2-RELEASE-ubuntu14.04.tar.gz

and

https://swift.org/builds/swift-2.2-branch/ubuntu1404/swift-2.2.1-SNAPSHOT-2016-03-28-a/swift-2.2.1-SNAPSHOT-2016-03-28-a-ubuntu14.04.tar.gz

I believe translated_uri doesn't handle the directory layout for these resources to simply "plug" them into the manifest.

It appears that the build pack supports either old "SNAPSHOT" but not the "RELEASE" itself.

Unable to push the swift app.

I am trying to push the swift helloworld app in Cloudfoundary .But its throwing error .
Attaching the screen shot for error.
Can you please look into the error.
screen shot 02-13-17 at 04 25 pm

Thanks in advance

Doesn't seem to work for Swift 4.0

Hi,

This doesn't seem to work with Swift 4.0 or 4.1. When running with both these versions this error is outputted:

DEPENDENCY_MISSING_IN_MANIFEST: 'swift-4.1.tar.gz'

Leigh

Need formal release of the buildpack with latest code

Hello, @drnic - Could you guys do a new release of the Swift buildpack with the latest buildpack code? Our team is currently attempting to use the latest release build (https://github.com/cloudfoundry-community/swift-buildpack/releases/tag/v1.0.2) but that version is somewhat outdated (Dec 10, 2015). For instance, using that old version, we cannot specify the latest version of Swift (DEVELOPMENT-SNAPSHOT-2016-02-03-a) in the .swift-version file. Any possibility of making a new release available early this week? Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.