You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 6, 2025. It is now read-only.
Copy file name to clipboardExpand all lines: docs/deployment-process.md
+8-3Lines changed: 8 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -51,9 +51,9 @@ and production dependencies.
51
51
52
52
#### Cloud Foundry environment variables
53
53
54
-
In production, Tock requires a few different environment variables. These are
55
-
updated using the [User Provided Service](#user-provided-service-ups) and
56
-
configured in the `manifest-*.yaml`.
54
+
In production, Tock requires a few different environment variables. These values are
55
+
updated using the [User Provided Service](#user-provided-service-ups),
56
+
configured in the `manifest-*.yaml`, or set manually during [egress proxy setup](egress.md).
57
57
58
58
| type | name | description |
59
59
| ---- | -----| ----------- |
@@ -67,9 +67,14 @@ configured in the `manifest-*.yaml`.
67
67
|**public**|`NEW_RELIC_ENV`| The application environment that appears in the New Relic interface. |
68
68
|**public**|`NEW_RELIC_HOST`| The New Relic endpoint used to collect APM data from the Python agent. Per [New Relic documentation](https://docs.newrelic.com/docs/security/security-privacy/compliance/fedramp-compliant-endpoints/#apm-endpoints), the default endpoint will not ensure FedRAMP compliance. |
69
69
|**public**|`NEW_RELIC_LOG`| Logging that New Relic should listen to: e.g. `stdout`. |
70
+
|**egress**|`egress_proxy`| The URL of the egress proxy used to filter external network traffic. Set manually during egress proxy setup. |
71
+
|**egress**|`http_proxy`| Set to the value of `egress_proxy`. Used to filter HTTP traffic. |
72
+
|**egress**|`https_proxy`| Set to the value of `egress_proxy`. Used to filter HTTPS traffic. |
73
+
|**egress**|`NEW_RELIC_PROXY_HOST`| Set to the value of `egress_proxy`. Specifies the proxy URL for the New Relic Python agent and admin tool. |
70
74
71
75
Variables with the designation **secret** are stored in the `tock-credentials` User-Provided Service (UPS).
72
76
**Public** variables are stored in the environment's `manifest-*.yml` file.
77
+
Variables marked **egress** are set based on manual configuration during [egress proxy setup](egress.md).
@@ -10,39 +10,94 @@ Accordingly, we have configured [a Caddy proxy](https://github.com/GSA-TTS/cg-eg
10
10
11
11
-`uaa.fr.cloud.gov`: The [cloud.gov UAA server](https://cloud.gov/docs/management/leveraging-authentication/) which in turn uses GSA SecureAuth for authentication.
12
12
-`google-analytics.com`: [DAP](https://digital.gov/guides/dap/), for web app analytics
13
-
-`api.newrelic.com`: [New Relic endpoints](https://docs.newrelic.com/docs/apis/rest-api-v2/get-started/introduction-new-relic-rest-api-v2/) which is used for the `newrelic-admin` tool
13
+
-`api.newrelic.com`: The [New Relic REST API endpoint](https://docs.newrelic.com/docs/apis/rest-api-v2/get-started/introduction-new-relic-rest-api-v2/) which is used by the `newrelic-admin` tool to record deployments
14
+
-`gov-collector.newrelic.com`: The FedRAMP-compliant [New Relic APM collector endpoint](https://docs.newrelic.com/docs/security/security-privacy/compliance/fedramp-compliant-endpoints/#agents), used by the New Relic Python agent
14
15
15
16
## A note about cloud.gov egress and spaces
16
17
17
18
cloud.gov allows configuration of [egress traffic controls](https://cloud.gov/docs/management/space-egress/) on a per-space basis _only_. Also, different network security groups are required for the proxy and application. This is why a separate space is required for the proxy.
18
19
19
20
## Tock staging setup
20
21
21
-
### Create the egress proxy
22
+
Updating Tock's egress proxy settings is a rarely performed, highly manual process that requires rebuilding the proxy configuration in a local development environment. If possible, seek an administrator of this repo to pair with you as you make changes.
22
23
23
-
To create a new proxy, we largely follow the [cf-egress-proxy README](https://github.com/GSA-TTS/cg-egress-proxy).
24
+
The following instructions use the staging egress proxy as an example.
24
25
25
-
As an example, to set up egress for Tock staging:
26
+
### Clone the proxy application repo
27
+
28
+
Pull the current version of the Caddy proxy application from [GSA-TTS/cf-egress-proxy](https://github.com/GSA-TTS/cg-egress-proxy). Refer to its documentation for more information about local development.
29
+
30
+
#### First-time setup
31
+
32
+
If you have not previously cloned the repo, do so:
If you have previously cloned the repo, ensure you are working from the current version with git:
40
+
41
+
1. Stash or delete any local changes
42
+
2. Check out the `main` branch
43
+
3. Pull the `main` branch from upstream
44
+
45
+
### Log in with the Cloud Foundry CLI tool
26
46
27
-
Create a new cloud.gov space
28
47
```bash
29
48
cf login -a api.fr.cloud.gov --sso
49
+
```
50
+
51
+
### Create a new egress proxy (if needed)
52
+
53
+
If you are setting up a new egress proxy from scratch, create a new cloud.gov space:
54
+
```bash
30
55
cf create-space staging-egress -o gsa-18f-tock
31
56
```
32
57
33
-
Clone the egress proxy from [GSA-TTS/cf-egress-proxy](https://github.com/GSA-TTS/cg-egress-proxy). Refer to its documentation for more information about local development.
### Configure the `tock.vars.yml` file for the proxy
65
+
66
+
Copy these files from from your local `tock` repo into your `cf-egress-proxy` repo:
67
+
68
+
1.[tock.vars.yml](../egress_proxy/tock.vars.yml)
69
+
2.[manifest.yml](../egress_proxy/manifest.yml)
70
+
71
+
#### Set username and password
72
+
73
+
In your `cf-egress-proxy` repo, manually set the `username` and `password` values in `tock.vars.yml`.
74
+
75
+
##### When creating a new proxy
76
+
77
+
Use the `uuidgen` command to create a new, random username and password. Paste each into the vars file for the appropriate key.
78
+
79
+
##### When updating an existing proxy
80
+
81
+
Retrieve the existing proxy username and password from the deployed egress proxy application:
82
+
83
+
```bash
84
+
cf env staging-egress | grep PROXY_USERNAME
36
85
```
37
86
38
-
Copy over [vars.tock.yml](../egress_proxy/tock.vars.yml) and configure it for your application. Use `uuidgen` for the username and password. Also copy over the [manifest.yml](../egress_proxy/manifest.yml). Finally, push the egress application to your space.
87
+
Paste each value into the vars file for the appropriate key.
88
+
89
+
#### Deploy the egress proxy application
90
+
91
+
Push the egress proxy application to your space.
39
92
40
93
```bash
41
94
cf target -s staging-egress
42
95
cf push --vars-file tock.vars.yml
43
96
```
44
97
45
-
SSH into the proxy to make sure that it is running and restricting URLs as advertised.
98
+
### Validate the proxy
99
+
100
+
SSH into the proxy application's container to make sure that it is running and restricting URLs as advertised.
# restage the application so it can use the variable
73
131
cf restage tock-staging
74
132
```
75
133
134
+
### Validate Tock configuration
135
+
76
136
SSH into the Tock staging space and confirm with `curl` that traffic out is being vetted by staging-egress.
77
137
78
-
__Note:__ The [../.profile](.profile file) (see the [relevant documentation](https://docs.cloudfoundry.org/devguide/deploy-apps/deploy-app.html#profile)) is configured to export the environmental variables `http_proxy` and `https_proxy` to whatever `egress_proxy` is set to. This allows us to update cloud.gov buildpacks and build the application itself without the proxy active. In other words, the proxy is only active once the application has booted up.
> curl: (56) Received HTTP code 403 from proxy after CONNECT
146
+
147
+
# test that it is allowing egress appropriately
148
+
$ curl https://google-analytics.com
149
+
> (html response)
150
+
```
151
+
152
+
### Troubleshooting
79
153
80
-
If you need to troubleshoot, you may want to start with the logs:
154
+
To troubleshoot end-to-end traffic, you may want to start with the egress proxy logs:
81
155
82
156
```bash
83
157
cf logs staging-egress --recent
84
158
```
85
159
160
+
If network calls from the Tock application are reaching the egress proxy, you should see log lines from the proxy indicating whether the calls were allowed or denied.
161
+
162
+
If a call from the Tock application is behaving unexpectedly (i.e. failing when it should be allowed, or succeeding when it should be denied):
163
+
164
+
* If the proxy logs show that the proxy is processing the call, double-check the `proxyallow` and `proxydeny` settings in [tock.vars.yml](../egress_proxy/tock.vars.yml).
165
+
* If the proxy log doesn't contain any record of the call, double-check the URL in the `egress_proxy` environment variable and the network policy for the Tock application.
166
+
167
+
## A note on proxy URL environment variables
168
+
169
+
The [.profile file](../.profile) (see the [relevant documentation](https://docs.cloudfoundry.org/devguide/deploy-apps/deploy-app.html#profile)) is configured to export the environmental variables `http_proxy` and `https_proxy` to whatever `egress_proxy` is set to. This allows us to update cloud.gov buildpacks and build the application itself without the proxy active. In other words, the proxy is only active once the application has booted up.
170
+
171
+
It additionally exports a `NEW_RELIC_PROXY_HOST` variable set to the value of `egress_proxy`. This variable is required by the New Relic Python agent and `newrelic-admin` tool.
172
+
86
173
## A note on SSL certificates
87
174
88
175
The Python [certifi](https://pypi.org/project/certifi/) library does _not_ pick up on system-wide certificate authority files automatically. Instead, we have configured manifest files to explicitly set the environment variable `REQUESTS_CA_BUNDLE` so that Python libraries, including `certifi`, will use these certificates. If we do not, then all connections to the proxy are considered untrusted (cloud.gov specific certificates are in `/etc/cf-system-certificates` and replicated to `/etc/ssl/certs/ca-certificates.crt`).
0 commit comments