Skip to content

spiegela/cf-ecs-demo

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cloud Foundry S3 Java Demo app

This is a simple example of using Amazon S3 (or another S3-compatible service) for asset storage. It uses the AWS SDK for Java. The app is an image catalog to which you can upload images and see them on the main page.

Running Locally

  • Create a file called application.yml in src/main/resources. It should have the following structure (replace the values with those appropriate for your environment):
s3:
  access-key: your-aws-access-key
  secret-key: your-aws-secret-key
  region: the-region-where-your-buckets-are
  bucket: the-bucket-name-you-want-to-use
  endpoint: s3-compatible-endpoint (optional)
  base-url: public-base-url-for-uploaded-objects (optional)
  path-style-access: true-or-false (optional, default: false)
  use-presigned-urls: true-or-false (optional, default: false, true if endpoint is an IP address)
  • Assemble the app.
$ ./gradlew assemble
  • Run it.
$ java -jar build/libs/cf-s3-demo.jar
  • Browse to http://localhost:8080

Running on Cloud Foundry

Assuming you already have the ECS Cloud Foundry Service Broker or ECS Broker PCF Tile deployed to your Cloud Foundry instance:

  • Create a ecs bucket service from the marketplatce:
$ cf create-service ecs-bucket demo-bucket 5gb
  • Compile the app.
$ ./gradlew assemble
  • Push it to Pivotal Cloud Foundry. We pass --no-start since otherwise the startup would faile, with the service not having been bound yet.
$ cf push cf-s3-123 --no-start -p build/libs/cf-s3-demo.jar
  • Bind services to the app.
$ cf bind-service cf-s3-123 demo-bucket
  • Restage the app.
$ cf restage cf-s3-123
  • Browse to the given URL (e.g. http://cf-s3-123.cfapps.io).

About

Basic demo using S3 as a user-provided service

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 63.5%
  • HTML 32.8%
  • CSS 3.7%