-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(1136): Accept AMS OpenID #1369
Changes from all commits
5109614
4b8e8f7
6840d47
e1c21cb
1b62fa2
fd249c3
05fcf33
e07b4bd
3dae31d
612e706
ba2128c
d90ebdd
223d382
a061431
3ac7288
5a9c1d3
49a428e
aa87411
6d36344
9cec3e3
0f24cde
019990a
31e5c8a
66bd8ce
abc456d
528c603
2a0a1a5
f5e4bde
2fd8c2d
dff0627
73302ee
57bb813
4dc5ff3
13d5ced
4f663c2
97a4fac
ad09091
b7fb6b3
aed8323
5edd14d
bd7d9ea
455864b
8711fed
6265e0f
2419cbe
4df6545
e0c80cc
712d1c0
48ff513
93796f8
bca61fb
f1aa418
711bb1e
c5b0ce9
e9ebd98
1bbd391
39086dc
ca01dac
1d0c5e7
ad04b82
ddf2ac0
87a0afb
b3e8833
4beb63a
3021019
9e7e68a
7bb9234
113a019
d1a7ac7
b70076c
1ce9ae9
fbf915f
143794c
e51a518
0ea550e
c38f229
3fc5298
64c5240
2e0476a
813b054
901d628
922a95e
e985590
24cf7c1
855ccea
95e4db9
52081d6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ coverage: | |
target: 90% | ||
flags: | ||
- backend | ||
patch: off | ||
|
||
parsers: | ||
gcov: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# Remote Development | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added remote-development documentation covering development on remotely hosted machines and containers. |
||
|
||
There will be times when a developer needs access to a container or a remote machine to debug a running application, or to change source code without needing to trigger a formal deployment. This document specifically describes how to use the Cloud.gov environments where TDRS is deployed as development environments. | ||
|
||
## Tools | ||
|
||
### Visual Studio Code | ||
This guide presumes the use of [VS Code](https://code.visualstudio.com/) with the [Remote Development](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.vscode-remote-extensionpack) extension pack. You can achieve a similar setup on other IDEs or in the terminal (as this all uses OpenSSH underneath); please save yourself the time and just go download VS Code. | ||
|
||
### **`cf-cli`** | ||
Additionally, install the latest version of the [Cloudfoundry CLI](https://docs.cloudfoundry.org/cf-cli/install-go-cli.html) if you haven't. | ||
|
||
- **Important**: There are issues with `cf-cli` versions below `7.0` so I suggest grabbing the latest version. | ||
|
||
To get the latest version as of this writing (on macOS): | ||
|
||
```shell | ||
brew install cloudfoundry/tap/cf-cli@7 | ||
``` | ||
|
||
## Access Cloudfoundry | ||
|
||
Login to CloudFoundry with the CLI: | ||
|
||
```shell | ||
cf login -a api.fr.cloud.gov --sso | ||
``` | ||
|
||
### Get App GUID | ||
|
||
Use `curl` to get the process GUID of the application on deployed application you want to connect to; replace `<app-name>` with a string like `tdp-backend-raft`. You can see a list of currently running app names with `cf apps`. | ||
|
||
```shell | ||
cf curl /v3/apps/$(cf app <app-name> --guid)/processes | jq --raw-output '.resources | .[] | select(.type == "web").guid' | ||
``` | ||
|
||
**This GUID will be used to construct the `User` name of the SSH connection.** | ||
|
||
## Create an SSH Config | ||
|
||
Create a file `~/username/.ssh/config` if one doesn't exist, and append the Host setting below: | ||
|
||
``` | ||
# Read more about SSH config files: https://linux.die.net/man/5/ssh_config | ||
Host <app-name> | ||
HostName ssh.fr.cloud.gov | ||
User cf:<guid>/0 | ||
Port 2222 | ||
``` | ||
|
||
Where `<guid>` is the string received in the last step. The User setting should look like this: `User cf:38f6a064-4ba7-4693-8732-960dea9f32f8/0`. Note the `/0` at the end of the string is the ID of the *instance*. | ||
|
||
To connect with `ssh` from the terminal: | ||
|
||
```shell | ||
ssh -p 2222 cf:<guid>/0@ssh.fr.cloud.gov | ||
``` | ||
|
||
## Get a One Time Password | ||
|
||
In VS Code, open the command menu (ctrl/cmd+shift+p), type "Remote-SSH", and select "Connect Current Window to Host". This should automatically look at the previously created config, and now prompt you for a one time password. | ||
|
||
```shell | ||
cf ssh-code | ||
``` | ||
|
||
## Navigate to Application Code | ||
|
||
You should now be connected to the remote host, and need only navigate to the directory containing the application code you want to change (likely `/home/vcap/app/`). | ||
|
||
Note that redeploying or restaging will wipe all changes made remotely. | ||
|
||
## Useful Links | ||
|
||
[VS Code Remote Overview](https://code.visualstudio.com/docs/remote/remote-overview) | ||
[Jetbrains Remote development](https://www.jetbrains.com/help/idea/remote-development-starting-page.html) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,13 @@ JWT_CERT_TEST=a_public_cert | |
# Initial superuser username should be the developer's login.gov email address | ||
DJANGO_SU_NAME=dev.email@example.com | ||
|
||
|
||
### AMS OpenID vars ### | ||
|
||
AMS_CONFIGURATION_ENDPOINT= | ||
AMS_CLIENT_ID= | ||
AMS_CLIENT_SECRET= | ||
Comment on lines
+23
to
+25
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These are required to be set with at least dummy values when running locally. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. per discussion with Jorge--clarified that these need to be set to the correct values locally. |
||
|
||
### | ||
# Optional environment variables | ||
# These need not be defined, but can be overwritten as needed | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,6 +46,7 @@ psycopg2-binary = "==2.9.1" | |
pyjwt = "==2.1.0" | ||
requests = "==2.26.0" | ||
wait-for-it = "==2.2.0" | ||
requests-mock = "==1.9.3" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added for simpler request mocking in tests. |
||
|
||
[requires] | ||
python_version = "3.8" |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -191,3 +191,8 @@ $ cf bind-service tdp-backend tdp-db | |
```bash | ||
$ cf restage tdp-backend | ||
``` | ||
|
||
|
||
### Useful Links | ||
|
||
[Remote Development Guide](../docs/Technical-Documentation/remote-development.md) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Link to the document above |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,6 +63,9 @@ services: | |
- JWT_KEY | ||
- USE_LOCALSTACK | ||
- LOGGING_LEVEL | ||
- AMS_CLIENT_ID | ||
- AMS_CLIENT_SECRET | ||
- AMS_CONFIGURATION_ENDPOINT | ||
Comment on lines
+66
to
+68
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pass on new env vars into Docker context |
||
volumes: | ||
- .:/tdpapp | ||
image: tdp | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,15 +26,17 @@ docstring-convention=numpy | |
exclude = | ||
.git, | ||
__pycache__, | ||
# We ideally want migrations to be readbale, but they often get quite nested | ||
# We ideally want migrations to be readable, but they often get quite nested | ||
# and often have long strings. | ||
*/migrations/*, | ||
# No need to check blank files | ||
__init__.py, | ||
# These settings files often have very long strings | ||
*/settings/common.py/, | ||
# D203 conflicts with D211, which is the more conventional of the two | ||
extend-ignore = E226,E302,E41,D203 | ||
# Reducing line length so flake8 linter forces easier to read code | ||
max-line-length = 88 | ||
max-line-length = 120 | ||
Comment on lines
+34
to
+39
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tweaked flake line-length per @abottoms-coder for convenience. and ignoring common.py to reduce noise |
||
max-complexity = 10 | ||
|
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Patch diff status runs turned off as they are not useful compared to the main project build.