Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Deploying First Application to Cloud Foundry

Deploying First Application to Cloud Foundry

Dr Nic Williams

September 11, 2019
Tweet

More Decks by Dr Nic Williams

Other Decks in Technology

Transcript

  1. Title Text
    Body Level One
    Body Level Two
    Body Level Three
    Body Level Four
    Body Level Five
    Deploying first application
    to Cloud Foundry
    Cloud Foundry Summit Hague 2019
    Dr Nic Williams @drnic

    View Slide

  2. View Slide

  3. @drnic
    Install
    cf CLI
    $ Mac, Windows, Linux
    https://docs.cloudfoundry.org/cf-cli/install-go-cli.html
    v6
    cf7
    https://docs.cloudfoundry.org/cf-cli/v7.html
    UX changes in progress
    v7

    View Slide

  4. @drnic
    cf login --help
    USAGE:
    cf login [-a API_URL] [-u USERNAME] [-p PASSWORD] [-o ORG]
    [-s SPACE] [--sso | --sso-passcode PASSCODE]
    EXAMPLES:
    cf login (login interactively)
    cf login -u [email protected] -p pa55woRD
    cf login -u [email protected] -p "my password"
    cf login -u [email protected] -p "\"password\""
    cf login --sso (obtain a one-time passcode to login)

    View Slide

  5. @drnic https://www.cloudfoundry.org/certified-platforms/
    cf login --api

    View Slide

  6. https://github.com/cloudfoundry-incubator/cfdev/
    cf dev start

    View Slide

  7. @drnic
    # deploy to cf
    cf push tiny-ruby
    # local
    git clone https://tinyurl.com/tiny-ruby
    cd tiny-ruby
    bundle install
    rackup --port 8080

    View Slide

  8. cf push -b ruby_buildpack
    cf push -m 256M
    cf push -i 2
    # config is reused for future deployments
    cf push tiny-ruby

    View Slide

  9. @drnic
    cf create-app-manifest tiny-ruby \
    -p manifest.yml
    # automatic discovery of name & config
    cf push
    # edit manifest.yml
    cf push

    View Slide

  10. cf logs tiny-ruby --recent
    # watch for future logs
    cf logs
    # application logs
    [APP/PROC/WEB/4] OUT Happy print statement
    [APP/PROC/WEB/4] ERR Sad panda

    View Slide

  11. @drnic
    cf help -a
    # => 300 lines of commands
    cf repo-plugins
    # => 80+ community plugins
    cf install-plugin open
    cf open tiny-ruby

    View Slide

  12. cf marketplace
    # => different for every Cloud Foundry
    cf marketplace -s elephantsql
    service plan description
    turtle 4 conn, 20MB Storage
    panda 20 conn, 2GB Storage
    hippo 300 conns, 100 GB Storage
    elephant 300 conns, 1000 GB Storage

    View Slide

  13. cf create-service elephantsql turtle db
    Creating service instance
    cf bind-service tiny-ruby db
    Binding service db to app tiny-ruby…
    cf restart tiny-ruby
    cf service-open db
    Open service dashboard to browser

    View Slide

  14. @drnic
    cf ssh tiny-ruby
    [email protected]:~$
    /tmp/lifecycle/shell
    # => loads app environment into shell
    ps ax
    15 … /home/vcap/deps/0/vendor_bundle/
    ruby/2.4.0/bin/rackup config.ru -p 8080

    View Slide

  15. @drnic
    env
    # => all env vars provided to app
    echo "$VCAP_SERVICES"
    # => app discovery of available services
    Convert $VCAP_SERVICES into application config files before app start
    https://github.com/starkandwayne/ghost-for-cloudfoundry/blob/master/.profile

    View Slide

  16. @drnic https://www.cloudfoundry.org/certified-platforms/
    cf login --api

    View Slide

  17. View Slide