Skip to content

Commit

Permalink
Merge pull request #239 from alphagov/revert-236-cfapiv3
Browse files Browse the repository at this point in the history
Revert "Add in Cloud Foundry v3 API"
  • Loading branch information
Toby Lorne authored Aug 1, 2019
2 parents 444fe6f + 4a9cd9c commit af65f83
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 119 deletions.
13 changes: 1 addition & 12 deletions source/documentation/deploying_apps/index.erb
Original file line number Diff line number Diff line change
Expand Up @@ -159,18 +159,7 @@ You must create a [network policy](https://cli.cloudfoundry.org/en-US/cf/add-net
cf add-network-policy PUBLIC_APPNAME --destination-app PRIVATE_APPNAME --protocol tcp --port 8080
```

#### Recreate the network policy

You must recreate the network policy every time you push your app if you’re using both:

- [version 2 of the Cloud Foundry API](https://github.com/cloudfoundry/cloud_controller_ng/tree/master/docs/v2)
- a [blue-green deployment tool](https://docs.cloudfoundry.org/devguide/deploy-apps/blue-green.html) to reduce downtime

This is because every time you push your app, the blue-green deployment tool creates a new version of the public app. The existing network policy will then no longer work.

[Version 3 of the Cloud Foundry API](https://github.com/cloudfoundry/cloud_controller_ng/tree/master/docs/v3) deploys your app with zero downtime. You do not need to recreate the network policy every time you push your app.

Contact us at [[email protected]](mailto:[email protected]) if you have any questions.
Contact us at [[email protected]](mailto:[email protected]) if you have any further questions.

## Data security classification

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ Refer to the Cloud Foundry documentation on [using the Cloud Foundry CLI with a

You can sign in to Cloud Foundry using either your [GOV.UK PaaS account information](get_started.html#get-an-account) or the single sign-on function.

Single sign-on is only available to users within the Government Digital Service (GDS)

### Use your GOV.UK PaaS account

The default method to sign in to Cloud Foundry is to use your [GOV.UK PaaS account](get_started.html#get-an-account) information.
Expand All @@ -58,43 +56,54 @@ The default method to sign in to Cloud Foundry is to use your [GOV.UK PaaS accou
When you have signed in, run `cf` in the command line to see all available commands.
### Use the single sign-on function
### Use single sign-on
You can sign in to Cloud Foundry using the single sign-on function.
Using single sign-on makes managing your security, joining and leaving processes simpler by reducing the number of passwords or accounts you have to manage.
You must have either a [Google](https://myaccount.google.com/intro) or [Microsoft](https://account.microsoft.com/account) email address to use single sign-on. The email address must be the same as the one you use to sign into your GOV.UK PaaS account.
#### Enable single sign-on
Single sign-on is only available to users within the Government Digital Service (GDS).
1. Sign into the GOV.UK PaaS admin tool for [London](https://admin.london.cloud.service.gov.uk/) or [Ireland](https://admin.cloud.service.gov.uk/).
If you work at GDS, you can enable single sign-on for your account via the GOV.UK PaaS admin tool.
1. Select __Set up Google/Microsoft single sign-on__ and then select __Activate Google/Microsoft single sign-on__.
1. Once you have access to SSO and if your org is hosted in London, run the following in the command line:
1. Get a URL to generate a temporary authentication code. If your org is hosted in [London](orgs_spaces_users.html#regions), run the following in the command line:
```
cf login -a api.london.cloud.service.gov.uk --sso
```
If your org is hosted in Ireland, run:
If your org is hosted in [Ireland](orgs_spaces_users.html#regions), run:
```
cf login -a api.cloud.service.gov.uk --sso
```
This will give you a URL where you can generate a temporary authentication code.
1. Go to the URL and select __Continue__ under either __Google__ or __Microsoft__.
1. Go to the URL and select the __Sign in using the GOV.UK PaaS internal account login__ button.
1. On the __Sign in__ page, enter or select your email address.
1. On the __Sign in with Google__ page, select your `@digital.cabinet-office.gov.uk` email address.
1. Enter your password and, if applicable, the 2-step verification code to generate a temporary authentication code.
1. Copy the temporary authentication code into the command line.
1. Copy the generated temporary authentication code into the command line.
When you have signed in, run `cf` in the command line to see all available commands.
When you have signed in, you will see code similar to the following:
## Deploy a test static HTML page
```
API endpoint: https://api.london.cloud.service.gov.uk (API version: 2.136.0)
User: [email protected]
Org: hmrc-prod
Space: sandbox

You can practice deploying an app by deploying a test static HTML page.
```
You can use [version 2](get_started.html#use-cloud-foundry-api-version-2) or [version 3](get_started.html#use-cloud-foundry-api-version-3) of the Cloud Foundry API.
If you're not sure which version of the Cloud Foundry API to use, contact us at [[email protected]](mailto:[email protected]).
## Deploy a test static HTML page
### Use Cloud Foundry API version 2
You can practice deploying an app by deploying a test static HTML page.
1. To deploy an app, you must select a [target](deploying_apps.html#set-a-target). This is a combination of an [organisation](/orgs_spaces_users.html#organisations) and a [space](/orgs_spaces_users.html#spaces).
Expand Down Expand Up @@ -128,8 +137,7 @@ If you're not sure which version of the Cloud Foundry API to use, contact us at
applications:
- name: APPNAME
memory: 64M
buildpacks:
- staticfile_buildpack
buildpack: staticfile_buildpack
```
where `APPNAME` is the unique name for your app. You can run `cf apps` to see apps which already exist.
Expand All @@ -142,87 +150,6 @@ If you're not sure which version of the Cloud Foundry API to use, contact us at
If you do not specify the app name in `cf push`, the name specified in the manifest file is used.
The static HTML page is now available at your [app domain](/orgs_spaces_users.html#regions).

For a production app, you should follow the [production checklist](deploying_apps.html#production-checklist).

### Use Cloud Foundry API version 3

Version 3 allows you to push an app with no downtime without having to use a [blue-green deployment tool](https://docs.cloudfoundry.org/devguide/deploy-apps/blue-green.html).

<br>

<%= warning_text('Version 3 of the Cloud Foundry API is still in beta.') %>

Refer to the [Cloud Foundry documentation on the limitations of API version 3](https://docs.cloudfoundry.org/devguide/deploy-apps/rolling-deploy.html#limitations) for more information.

1. To deploy an app, you must select a [target](deploying_apps.html#set-a-target). This is a combination of an [organisation](/orgs_spaces_users.html#organisations) and a [space](/orgs_spaces_users.html#spaces).

All orgs have a sandbox space for you to use when learning about the PaaS. When deploying a test static HTML page, you should target this sandbox space by running:

```
cf target -o ORGNAME -s sandbox
```

where `ORGNAME` is your org and `sandbox` is the name of the sandbox space.

If you deploy an app using the same name and target as an existing app, the original will be replaced. If you are not sure about where to deploy your app, consult the rest of your team or speak to the PaaS team by emailing [[email protected]](mailto:[email protected]).

2. In an empty directory, create an `index.html` file containing the following markup:

```
<html>
<head>
<title>Static Site</title>
</head>
<body>
<p>Welcome to the static site!</p>
</body>
</html>
```

3. Create a `manifest.yml` file in the same directory as the `index.html` file. The manifest file tells Cloud Foundry what to do with your app.

```
---
applications:
- name: APPNAME
memory: 64M
buildpacks:
- staticfile_buildpack
```

where `APPNAME` is the unique name for your app. You can run `cf apps` to see apps which already exist.

The `memory` line tells the PaaS how much memory to allocate to the app.

A buildpack provides app framework and runtime support. For example, if your app was written in Ruby, you would use the `ruby_buildpack`. In this example, we use the `staticfile_buildpack` for the static HTML page.

4. Create an app:

```
cf v3-create-app APPNAME
```

`APPNAME` is the unique name for your app that you specified in the manifest file.

You only need to run this command if you’re creating a new app that uses version 3 of the API.

5. Apply your created manifest file to your app:

```
cf v3-apply-manifest -f PATH_TO_MANIFEST
```

6. Push a zero downtime version of your app:

```
cf v3-zdt-push APPNAME --wait-for-deploy-complete
```
The command line will display a message when your app has finished deploying.

The static HTML page is now available at your [app domain](/orgs_spaces_users.html#regions).

For a production app, you should follow the [production checklist](deploying_apps.html#production-checklist) to deploy that app.
The static HTML page is now available at your [app domain](/orgs_spaces_users.html#regions).
Refer to the [Cloud Foundry documentation on rolling app deployments](https://docs.cloudfoundry.org/devguide/deploy-apps/rolling-deploy.html) for more information on version 3 of the Cloud Foundry API.
For a production app, you should read the [production checklist](deploying_apps.html#production-checklist).
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ If you do run commands which will change the container temporarily, it's a good

SSH is enabled by default. In most cases, you will find that you can SSH directly to your app's container.

<br>

<%= warning_text('If you are using v3 of the Cloud Foundry API, you must run cf v3-ssh instead of cf ssh') %>

1. Run:

```
Expand Down Expand Up @@ -89,7 +85,7 @@ To enable local port forwarding, you can use the parameter `-L`:
cf ssh APPNAME -L LOCALPORT:REMOTEHOST:REMOTEPORT
```
This will forward the `LOCALPORT` port on the local system to the given `REMOTEHOST` host and `REMOTEPORT` port on the application container side.
This will forward the `LOCALPORT` port on the local system to the given `REMOTEHOST` host and `REMOTEPORT` port on the application container side.
Whenever a connection is made to this port, the connection is forwarded over the secure SSH channel, and a connection is made to the host and port `REMOTEHOST:REMOTEPORT` from the remote application container.
Expand Down

0 comments on commit af65f83

Please sign in to comment.