Skip to content

Commit d86ebf5

Browse files
committed
Add more checking, change params.
1 parent 0358537 commit d86ebf5

File tree

7 files changed

+235
-153
lines changed

7 files changed

+235
-153
lines changed

β€Ždev-local/README.mdβ€Ž

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,13 @@ favorites:
3535
access_type: cli
3636
```
3737

38-
If you already have some aliases, you can just add this one to the list. The account number and cloud access role can be obtained from the Cloudtamer dashboard. The alias **must** be named `BB2-NON-PROD` for these tools to work.
38+
If you already have some aliases, you can just add this one to the list. The account number and cloud access role can be obtained from the Cloudtamer dashboard. This is not strictly necessary, as the tooling cannot automate a `kion` call *and* then continue, as `kion` opens a new shell. However, it is much easier (and, for this documentation, the preferred method) to invoke
39+
40+
```
41+
kion f BB2-NON-PROD
42+
```
43+
44+
than to navigate a menu structure. You may ultimately choose a shorter alias, e.g. `kion f bnp`.
3945

4046
## to start
4147

@@ -61,23 +67,43 @@ The first step is to build the local containers. From the root of the tree, or f
6167
make build-local
6268
```
6369

64-
This should build the image `bb-local:latest`.
70+
This should build the container image for `bb-local:latest`, the Selenium image, and the MSLS image.
6571

66-
Building the image is only necessary when the `requirements/requirements.txt` or `requirements/requirements.dev.txt` files change. Those requirements get baked into the image; changes to application code should be picked up via dynamic reload during normal development.
72+
Building the images is only necessary when the `requirements/requirements.txt` or `requirements/requirements.dev.txt` files change. Those requirements get baked into the image; changes to application code should be picked up via dynamic reload during normal development.
6773

6874
## running the local image
6975

7076
Next, run the stack.
7177

72-
### running locally / mocking MSLS
78+
### running the stack
7379

74-
To run the stack locally,
80+
There are four possible ways to run the stack.
7581

7682
```
77-
make run-local ENV=local
83+
make run-local bfd=<bfd-option> auth=<auth-option>
7884
```
7985

80-
This will launch the stack with no connection to live environments, and it will use the mocked MSLS tooling.
86+
For example, to run against `test` with a live SLSX exchange:
87+
88+
```
89+
make run-local bfd=test auth=live
90+
```
91+
92+
Each combination has different implications. Only some make sense at this time (Nov '25):
93+
94+
| bfd / auth | mock | live |
95+
| --- | --- | --- |
96+
| local | local unit tests | testing SLSX sequences |
97+
| test | β›” | Full-up against `test` |
98+
| sbx | β›” | Full-up against `sbx` |
99+
100+
* `local/mock`: This makes sense for running unit tests; only local tests will run in this configuration.
101+
* `local/live`: Manual testing of SLSX sequences should be able to be performed with this combination (TBD)
102+
* `test/mock`: Not a valid condition; a mock authentication will not work with a live server.
103+
* `test/live`: Live SLSX exchanges with medicare.gov and calls against the `test` BFD environment.
104+
* `sbx/mock`: Not a valid condition.
105+
* `sbx/live`: Live SLSX exchanges and calls against the `sbx` BFD environment.
106+
81107

82108
### running against `test`
83109

β€Ždev-local/check-pre-post.bashβ€Ž

Lines changed: 0 additions & 66 deletions
This file was deleted.

β€Ždev-local/docker-compose-local.yamlβ€Ž

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,34 +14,29 @@ services:
1414
# A small Flask app for testing.
1515
msls:
1616
image: msls-local:latest
17-
command: python app.py
17+
platform: linux/amd64
18+
command: /code/start-local.sh
1819
ports:
1920
- "8080:8080"
2021
volumes:
2122
- ../msls-local:/code
22-
profiles:
23-
- mocksls
24-
- slsx
2523
####################
2624
# Blue Button
2725
web:
2826
image: bb-local:latest
29-
command: /start-local.sh
27+
platform: linux/amd64
28+
command: /code/dev-local/start-local.sh
3029
env_file:
3130
- .env.container
3231
volumes:
3332
- ..:/code
3433
- ~/.bb2/certstore:/certstore
35-
- ./start-local.sh:/start-local.sh
3634
ports:
3735
- "8000:8000"
3836
- "5678:5678"
3937
depends_on:
4038
- db
4139
- msls
42-
profiles:
43-
- slsx
44-
platform: linux/amd64
4540

4641
# web_msls:
4742
# build: .
Lines changed: 15 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,34 @@
11
#!/usr/bin/env bash
2-
source ./check-pre-post.bash
3-
source ./retrieve-certs-and-salt.bash
2+
source ./utility-functions.bash
43

54
# this says to "export all variables."
65
set -a
76
# exit on error.
87
set -e
98

9+
# bfd = local | test | sbx
10+
# auth = mock | live
1011

11-
######################################################################
1212
# let's make sure we have a valid ENV var before proceeding
1313
check_valid_env
1414

15-
######################################################################
1615
# source the baseline environment variables
1716
# these set the stage for all further environment manipulation for
1817
# launching the app.
18+
clear_canary_variables
1919
source ./.env.local
2020

2121
# add another check or two after we source the env file.
2222
check_env_after_source
2323

24-
######################################################################
2524
# let's make sure the .env.local sourced in correctly.
2625
check_env_preconditions
2726

2827
# set the FHIR_URL and FHIR_URL_V3
29-
set_fhir_urls
28+
set_bfd_urls
3029

3130
# set the profile for docker compose
32-
set_profile
31+
set_auth_profile
3332

3433
# retrieve the certs and store them in $HOME/.bb2/certstore
3534
retrieve_certs
@@ -38,33 +37,20 @@ set_salt
3837

3938
echo "πŸš€ Launching the stack for '${ENV}'."
4039

41-
echo "FHIR_URLs are:"
42-
echo " * ${FHIR_URL}"
43-
echo " * ${FHIR_URL_V3}"
44-
45-
DOCKER_PS=$(docker ps -q)
46-
echo $DOCKER_PS
47-
48-
TAKE_IT_DOWN="NO"
49-
for id in $DOCKER_PS; do
50-
NAME=$(docker inspect --format '{{.Config.Image}}' $id)
51-
if [[ "${NAME}" =~ "postgres" ]]; then
52-
echo "πŸ€” I think things are still running. Bringing the stack down."
53-
TAKE_IT_DOWN="YES"
54-
fi
55-
done
56-
57-
if [ "${TAKE_IT_DOWN}" = "YES" ]; then
58-
for id in $DOCKER_PS; do
59-
echo "πŸ›‘ Stopping container $id"
60-
docker stop $id
61-
done
40+
if [[ "${bfd}" == "local" ]]; then
41+
echo "πŸ₯Ά FHIR_URLs are not set when running locally."
42+
echo " BFD calls will fail."
43+
else
44+
echo "FHIR_URLs are:"
45+
echo " * ${FHIR_URL}"
46+
echo " * ${FHIR_URL_V3}"
6247
fi
6348

49+
cleanup_docker_stack
50+
6451
echo "πŸ“Š Vernier start."
6552
echo
6653

6754
docker compose \
68-
--profile "${PROFILE}" \
6955
-f docker-compose-local.yaml \
7056
up

β€Ždev-local/start-local.shβ€Ž

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ set -a
44

55
if [ "${DB_MIGRATIONS}" = "true" ]
66
then
7-
echo "πŸ†— running migrations"
7+
echo "πŸ”΅ running migrations"
88
python manage.py migrate
99

1010
# We will recrate this with every launch.
@@ -13,21 +13,29 @@ then
1313
# Only create the root user if it doesn't exist.
1414
result=$(echo "from django.contrib.auth.models import User; print(1) if User.objects.filter(username='${SUPER_USER_NAME}').exists() else print(0)" | python manage.py shell)
1515
if [[ "$result" == "0" ]]; then
16-
echo "πŸ†— creating ${} user."
1716
echo "from django.contrib.auth.models import User; User.objects.create_superuser('${SUPER_USER_NAME}', '${SUPER_USER_EMAIL}', '${SUPER_USER_PASSWORD}')" | python manage.py shell
17+
echo "πŸ†— created ${SUPER_USER_NAME} user."
1818
else
1919
echo "πŸ†— ${SUPER_USER_NAME} already exists."
2020
fi
2121

2222
python manage.py create_admin_groups
23-
echo "πŸ†— loading scopes.json"
23+
echo "πŸ†— create_admin_groups"
24+
2425
python manage.py loaddata scopes.json
26+
echo "πŸ†— loaddata scopes.json"
2527

2628
python manage.py create_blue_button_scopes
29+
echo "πŸ†— create_blue_button_scopes"
30+
2731
python manage.py create_test_user_and_application
32+
echo "πŸ†— create_test_user_and_application"
33+
2834
python manage.py create_user_identification_label_selection
29-
echo "creating feature switches......"
35+
echo "πŸ†— create_user_identification_label_selection"
36+
3037
python manage.py create_test_feature_switches
38+
echo "πŸ†— create_test_feature_switches"
3139
else
3240
echo "restarting blue button server, no db image migration and models initialization will run here, you might need to manually run DB image migrations."
3341
fi

0 commit comments

Comments
Β (0)