diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4c23bf5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +vars.yaml +*.versatiles \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..062e561 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,2 @@ +# Use the latest docker image of VersaTiles including the frontend. +FROM versatiles/versatiles-frontend:v0.15.6-alpine diff --git a/README.md b/README.md index 1f7d465..4aeb700 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,53 @@ -# cf-versatiles +# Cloud Foundry: Sample Versatiles App -Sample code to deploy Versatiles app as a Docker container on Cloud Foundry \ No newline at end of file +This repository contains the sample code to deploy a [versatiles](https://docs.versatiles.org/) app to STACKIT Cloud Foundry as a docker container. +It is based on the bundled [front-end](https://docs.versatiles.org/guides/local_server_docker.html#optionb--bundled-frontend-image-versatiles-frontend) image, please refer to versatiles documentation for further information. + +> NOTE: The project contains a dockerfile, which is merely a wrapper around the public versatiles image. It can be uploaded to a private project in STACKIT Container Registry +> to demonstrate the usage of private images in Cloud Foundry. You can also use any other registry, public or private. + +## Preparation + +Please install and [configure](https://docs.stackit.cloud/stackit/en/how-to-setup-an-object-storage-client-objectstorage-71009862.html) s3cmd in advance. + +### Object Storage + +Create a bucket: `s3cmd mb s3://`. + +Make bucket [public](https://docs.stackit.cloud/stackit/en/bucket-policies-75139510.html#BucketPolicies-SampleBucketpolicies>) applying following policy: + +```json +{ + "Statement":[ + { + "Sid": "MakePublicReadable", + "Effect":"Allow", + "Principal":"*", + "Action":"s3:GetObject", + "Resource":"urn:sgws:s3:::/*" + } + ] +} +``` + +`s3cmd setpolicy s3://` + +Download the `tiles` file: `wget -c "https://download.versatiles.org/osm.versatiles"`. + +> NOTE: the whole world map is about 65GB. + +Upload tile file to the bucket: + +```sh +s3cmd put s3:// +``` + +## Deploy the app with Cloud Foundry + +Prepare a `vars.yaml` file containing the [variables](https://docs.cloudfoundry.org/devguide/deploy-apps/manifest-attributes.html) used in the manifest. + +Push the app: `CF_DOCKER_PASSWORD= cf push --vars-file `. + +## Custom Domains + +Please refer to official STACKIT [documentation](https://docs.stackit.cloud/stackit/en/how-to-register-custom-domains-for-apps-on-stackit-cloud-foundry-67771947.html). diff --git a/manifest.yaml b/manifest.yaml new file mode 100644 index 0000000..73aa5ec --- /dev/null +++ b/manifest.yaml @@ -0,0 +1,18 @@ +--- +applications: +- name: versatiles-test + memory: 1024M + disk: 1Gi + #routes: + # - route: + # options: + # loadbalancing: round-robin + instances: 1 + random-route: true + docker: + image: ((imageUrl)) + username: ((dockerUsername)) + timeout: 10 + health-check-type: http + health-check-http-endpoint: / + command: versatiles serve -p $PORT -s frontend-dev.br.tar ((versatilesUrl)) \ No newline at end of file