Giter Site home page Giter Site logo

website-demo's Introduction

Simple website deployed to Cloud Foundry via Concourse

This is an example of a simple website that you can host on your cloud foundry environment, using Concourse for automated deployments. Just check in your code and let Concourse take care of the rest.

Prerequisites:

  1. A Cloud Foundry environment you can use
  2. A Concourse environment you can use
  3. The Concourse Fly CLI installed. You can install from your concourse home page, see the icons in the lower right corner.

Try it!

  1. Fork the repo to your own github account

  2. Clone the repo to your workstation

cd
git clone https://github.com/YOUR-GITHUB-ACCOUNT/website-demo
cd website-demo
  1. Edit the pipeline.yml file, and replace mjeffries-pivotal with YOUR-GITHUB-ACCOUNT under the resource-web-app resource. Also note that the pipeline has 2 resources, one for github, and one for Cloud Foundry. There is one job (job-deploy-app) which uses the resources to get your latest website content and deploy it to Cloud Foundry.
---
resources:
- name: resource-web-app
  type: git
  source:
    uri: https://github.com/mjeffries-pivotal/website-demo.git

- name: resource-deploy-web-app
  type: cf
  source:
    api: {{cf-api}}
    username: {{cf-username}}
    password: {{cf-password}}
    organization: {{cf-organization}}
    space: {{cf-space}}
    skip_cert_check: true

jobs:
- name: job-deploy-app
  serial: true
  plan:
  - {get: resource-web-app, trigger: true}
  - put: resource-deploy-web-app
    params:
      manifest: resource-web-app/website/manifest.yml
      path: resource-web-app/website
  1. Create a credentials.yml file with the following contents in the website-demo directory. Replace the placeholders with your cloud foundry environment information (run cf target). Be sure to include credentials.yml in your .gitignore file in the website-demo directory so you don't upload it when you commit your changes.
cf-api: https://YOUR-CF-API-ENDPOINT
cf-username: YOUR-CF-USERID
cf-password: YOUR-CF-PASSWORD
cf-organization: YOUR-CF-ORG
cf-space: YOUR-CF-SPACE
  1. Login to concourse using the Fly CLI. You'll be prompted for your concourse userid and password. If you have been assigned to a team, include -n TEAM_NAME when you login. You can use any value for YOUR_CONCOURSE-TARGET, such as demo or lab, you'll just need to include the same value in subsequent fly commands.
fly -t YOUR-CONCOURSE-TARGET login -c CONCOURSE_URL -n TEAM_NAME
  1. Create the pipeline
fly set-pipeline --target YOUR-CONCOURSE-TARGET --config pipeline.yml --pipeline deploy-website-demo --non-interactive --load-vars-from ./credentials.yml
fly unpause-pipeline --target YOUR-CONCOURSE-TARGET --pipeline deploy-website-demo
  1. To see your pipeline in concourse, copy the URL from the output of the command above to your browser. Login using same userid/password you did for the fly CLI.

  2. Click on the job job-deploy-app, then kick off a manual build by clicking on the plus sign at the upper right corner of the page. The build should start after a few seconds. Look at the build output to see your website pushed to cloud foundry.

  1. Now you're ready to start automating. Edit the index.html file to change the text or color, then commit and sync your changes. Refresh your Concourse page and within a minute or so you should see a new build kick off. Get the URL for your app from the output of the build, and bring it up in a browser. The website should have the changes you just made.

  2. Now you just need to check in your code, and Concourse will handle your deployment to Cloud Foundry.

  3. When you're done, you can destroy the pipeline:

fly -t YOUR-CONCOURSE-TARGET destroy-pipeline -p deploy-website-demo
  1. Explore the fly CLI.

website-demo's People

Contributors

mjeffries-pivotal avatar

Watchers

James Cloos avatar

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.