Skip to content

Commit 66709c3

Browse files
authored
BB2-823: Attempt to fix docker issues (#3)
* Attempt to fix docker issues * Moved pipenv files and utilize it for docker * Fixing docker issue with proxy and pipenv install * Fixed all the Docker Issues * Updated Readme and fixed base config urls * More Readme updates * README Formatting changes * Fixed issue with no data - updated ignore file * added more xhecks and print statements * Encoded Params for Auth URL * Added additinoal encoding or authurl/callback * resolve issue with redirect urls not matching * fixed issue with redirect uri and encoding * General code clean-up and comments * update git ignore * remove .py files and folders * restore utils folder and files
1 parent ce9d283 commit 66709c3

37 files changed

Lines changed: 198 additions & 119 deletions

.gitignore

Lines changed: 41 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,12 @@
11
# dependencies
22
node_modules
33

4-
# build trash
5-
#server/dist
6-
74
# testing
85
coverage
96

107
# production
118
build
129

13-
# misc
14-
#.DS_Store
15-
1610
npm-debug.log*
1711
yarn-debug.log*
1812
yarn-error.log*
@@ -27,8 +21,44 @@ production.env
2721
sandbox.env
2822

2923
config.py
30-
server/src/app/__pycache__/views.cpython-39.pyc
31-
server/src/entities/__pycache__/Settings.cpython-39.pyc
32-
server/src/prestart/__pycache__/setenv.cpython-39.pyc
33-
server/src/shared/__pycache__/LoggerFactory.cpython-39.pyc
34-
server/src/utils/__pycache__/generatePKCE.cpython-39.pyc
24+
25+
# Generic
26+
*.pyc
27+
*.komodoproject
28+
*~
29+
.cache/
30+
media/
31+
.swp
32+
33+
# Byte-compiled / optimized / DLL files
34+
__pycache__/
35+
*.py[cod]
36+
*$py.class
37+
38+
# Distribution / packaging
39+
.Python
40+
build/
41+
develop-eggs/
42+
dist/
43+
downloads/
44+
eggs/
45+
.eggs/
46+
lib/
47+
lib64/
48+
parts/
49+
sdist/
50+
var/
51+
wheels/
52+
*.egg-info/
53+
.installed.cfg
54+
*.egg
55+
56+
# PyInstaller
57+
# Usually these files are written by a python script from a template
58+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
59+
*.manifest
60+
*.spec
61+
62+
# Installer logs
63+
pip-log.txt
64+
pip-delete-this-directory.txt

README.md

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,52 @@
1-
Running backend & frontend
1+
Create a Blue Button Sandbox Account
2+
---------------
3+
Create an account at the link below, and register your test application, to get your Blue Button Sandbox Credentials which will allow you to
4+
access the Blue Button synthetic data. These credentials will be necessary to run this sample application as well as
5+
utilize the Blue Button data within your own applcation. See the section below 'Running the Back-end & Front-end'.
6+
7+
https://sandbox.bluebutton.cms.gov/v1/accounts/create
8+
9+
To ensure this sample application will work properly, make sure that when you register your application you add
10+
the following url (see below) under the 'Callback URLS/Redirect Uris' section:
11+
12+
http://localhost:3001/api/bluebutton/callback/
13+
14+
When you are ready to run your own application, you can change this value to the url that you need.
15+
Just log into your Blue Button Sandbox account and select 'View/Edit App->'.
16+
17+
Setup Docker & Python
18+
---------------
19+
Install and setup Docker. Go to https://docs.docker.com/get-started/ and follow the directions.
20+
21+
Install Python: https://www.python.org/downloads/
22+
23+
Running the Back-end & Front-end
224
---------------
325

26+
Once Docker and Python are Installed then do the following:
27+
428
copy server/src/configs/sample_config.py -> server/src/configs/config.py
5-
replace the secret variables with the ones for your application
29+
30+
Make sure to replace the clientId and clientSecret variables within the config file with
31+
the ones you were provided, for your application, when you created your Blue Button Sandbox account.
632

733
copy server/src/prestart/env/sandbox.sample.env -> server/src/prestart/env/development.env
834

935
docker-compose up -d
10-
36+
37+
This single command will create the docker container with all the necessary packages, configuration, and code to
38+
run both the front and back ends of this sample application.
39+
40+
To see the application in action open your browser and enter the following URL:
41+
42+
http://localhost:3000
43+
44+
To see the process of authenticating with Blue Button via Medicare.gov and retrieve EoB data just click on the 'Authorize' button.
45+
1146
BB2 Sandbox User
1247
-----------
1348
To ensure data displays properly in the sample application please use a
14-
Blue Button 2 Sandbox user that has PDE EoBs. An example of a user with this
49+
Blue Button Sandbox user that has PDE (Part-D Events) EoBs (Explanation of Benefits). An example of a user with this
1550
data would be: BBUser29999 (PWD: PW29999!) or BBUser29998 (PWD: PW29998!)
1651

1752
Development

client/package.json

Lines changed: 51 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,52 @@
11
{
2-
"name": "my-app",
3-
"version": "0.1.0",
4-
"private": true,
5-
"proxy": "http://localhost:3001",
6-
"dependencies": {
7-
"@cmsgov/design-system": "^2.7.3",
8-
"@testing-library/jest-dom": "^5.11.4",
9-
"@testing-library/react": "^11.1.0",
10-
"@testing-library/user-event": "^12.1.10",
11-
"@types/jest": "^26.0.15",
12-
"@types/node": "^12.0.0",
13-
"@types/react": "^17.0.0",
14-
"@types/react-dom": "^17.0.0",
15-
"axios": "^0.21.1",
16-
"http-proxy-middleware": "^1.3.1",
17-
"node-sass": "^4.14.1",
18-
"react": "^17.0.2",
19-
"react-dom": "^17.0.2",
20-
"react-router-dom": "^5.2.0",
21-
"react-scripts": "4.0.3",
22-
"typescript": "^4.1.2",
23-
"web-vitals": "^1.0.1"
24-
},
25-
"scripts": {
26-
"start": "react-scripts start",
27-
"build": "react-scripts build",
28-
"test": "react-scripts test",
29-
"eject": "react-scripts eject"
30-
},
31-
"eslintConfig": {
32-
"extends": [
33-
"react-app",
34-
"react-app/jest"
35-
]
36-
},
37-
"browserslist": {
38-
"production": [
39-
">0.2%",
40-
"not dead",
41-
"not op_mini all"
42-
],
43-
"development": [
44-
"last 1 chrome version",
45-
"last 1 firefox version",
46-
"last 1 safari version"
47-
]
48-
},
49-
"devDependencies": {
50-
"@types/react-router-dom": "^5.1.7"
51-
}
52-
}
2+
"name": "my-app",
3+
"version": "0.1.0",
4+
"private": true,
5+
"proxy": "http://server:3001",
6+
"dependencies": {
7+
"@cmsgov/design-system": "^2.7.3",
8+
"@testing-library/jest-dom": "^5.11.4",
9+
"@testing-library/react": "^11.1.0",
10+
"@testing-library/user-event": "^12.1.10",
11+
"@types/jest": "^26.0.15",
12+
"@types/node": "^12.0.0",
13+
"@types/react": "^17.0.0",
14+
"@types/react-dom": "^17.0.0",
15+
"axios": "^0.21.1",
16+
"http-proxy-middleware": "^1.3.1",
17+
"node-sass": "^4.14.1",
18+
"react": "^17.0.2",
19+
"react-dom": "^17.0.2",
20+
"react-router-dom": "^5.2.0",
21+
"react-scripts": "4.0.3",
22+
"typescript": "^4.1.2",
23+
"web-vitals": "^1.0.1"
24+
},
25+
"scripts": {
26+
"start": "react-scripts start",
27+
"build": "react-scripts build",
28+
"test": "react-scripts test",
29+
"eject": "react-scripts eject"
30+
},
31+
"eslintConfig": {
32+
"extends": [
33+
"react-app",
34+
"react-app/jest"
35+
]
36+
},
37+
"browserslist": {
38+
"production": [
39+
">0.2%",
40+
"not dead",
41+
"not op_mini all"
42+
],
43+
"development": [
44+
"last 1 chrome version",
45+
"last 1 firefox version",
46+
"last 1 safari version"
47+
]
48+
},
49+
"devDependencies": {
50+
"@types/react-router-dom": "^5.1.7"
51+
}
52+
}

client/src/setupProxy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module.exports = function(app) {
44
app.use(
55
'/api',
66
createProxyMiddleware({
7-
target: 'http://localhost:3001',
7+
target: 'http://server:3001',
88
changeOrigin: true,
99
})
1010
);

docker-compose.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@ services:
55
build:
66
context: ./server
77
dockerfile: ./Dockerfile
8-
ports:
8+
ports:
99
- "3001:3001"
10+
volumes:
11+
- ./server:/server
1012
client:
1113
build:
1214
context: ./client

server/Dockerfile

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM python:3.9.6 AS builder
1+
FROM python:3.9.6
22

33
LABEL version="1.0"
44
LABEL description="Demo of a Medicare claims data sample app"
@@ -8,17 +8,13 @@ WORKDIR /server
88
COPY ["./src/configs/sample_config.py", "./src/configs/config.py"]
99
COPY ["./src/prestart/env/sandbox.sample.env","./src/prestart/env/development.env"]
1010

11-
RUN pip install pipenv
12-
RUN pip install python-dotenv
13-
RUN pip install requests_toolbelt
14-
RUN pip install flask
15-
RUN pip install argparse
16-
RUN pip install requests
17-
1811
COPY . .
1912

20-
EXPOSE 3001
13+
RUN pip install pipenv
14+
RUN pipenv install --system --deploy --ignore-pipfile
2115

2216
ENV ENV "development"
2317

18+
EXPOSE 3001
19+
2420
CMD ["sh", "-c", "python run.py --ENV ${ENV}"]

Pipfile renamed to server/Pipfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ flask = "*"
88
requests = "*"
99
argparse = "*"
1010
requests-toolbelt = "*"
11+
python-dotenv = "*"
1112

1213
[dev-packages]
1314

Pipfile.lock renamed to server/Pipfile.lock

Lines changed: 9 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

server/run.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313

1414
# here we must initiliaze our global variables that are acting like a Mocked up Database
1515
# from Database.py (using the initDB() funciton)
16-
1716
initDB()
17+
1818
# set the path base for later use
1919
main_base = os.path.dirname(__file__)
2020
# initialize the logger object
@@ -30,11 +30,9 @@
3030
# Load the configs
3131
if len(sys.argv)>2 and sys.argv[1] == "--ENV":
3232
dotenv_path = os.path.join(main_base,'src','prestart','env',sys.argv[2]+'.env')
33-
print('DOTENV1: '+dotenv_path)
3433
os.environ['FLASK_ENV'] = sys.argv[2]
3534
elif len(sys.argv) <= 2:
3635
dotenv_path = os.path.join(main_base,'src','prestart','env','development.env')
37-
print('DOTENV2: '+dotenv_path)
3836
os.environ['FLASK_ENV'] = 'development'
3937
try:
4038
setEnvVariables(dotenv_path=dotenv_path)
-162 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)