Skip to content

Commit 7c27d4e

Browse files
committed
updates
1 parent 76c88dd commit 7c27d4e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+11406
-8051
lines changed

README.md

100755100644
File mode changed.

buildspec.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ version: 0.2
33
env:
44
variables:
55
AWS_REGION: "us-west-1"
6-
REACT_APP_USERS_SERVICE_URL: "flask-react-alb-288140227.us-west-1.elb.amazonaws.com"
6+
REACT_APP_API_SERVICE_URL: "http://flask-react-alb-828458753.us-west-1.elb.amazonaws.com"
77

88
phases:
99
install:
@@ -27,19 +27,19 @@ phases:
2727
commands:
2828
- echo building and testing dev images...
2929
- docker-compose up -d --build
30-
- docker-compose exec -T users python -m pytest "project/tests" -p no:warnings --cov="project"
31-
- docker-compose exec -T users flake8 project
32-
- docker-compose exec -T users black project --check
33-
- docker-compose exec -T users /bin/sh -c "isort project/*/*.py --check-only"
30+
- docker-compose exec -T api python -m pytest "src/tests" -p no:warnings --cov="src"
31+
- docker-compose exec -T api flake8 src
32+
- docker-compose exec -T api black src --check
33+
- docker-compose exec -T api isort src --check-only
3434
- docker-compose exec -T client npm run lint
3535
- docker-compose exec -T client npm run prettier:check
3636
- docker-compose exec -T client npm run prettier:write
3737
- echo building prod images...
3838
- >
3939
docker build \
40-
--cache-from $AWS_ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com/test-driven-users:$DOCKER_TAG \
40+
--cache-from $AWS_ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com/test-driven-users:$DOCKER_TAG \
4141
-f services/users/Dockerfile.prod \
42-
-t $AWS_ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com/test-driven-users:$DOCKER_TAG \
42+
-t $AWS_ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com/test-driven-users:$DOCKER_TAG \
4343
./services/users
4444
- >
4545
docker build \
@@ -48,13 +48,13 @@ phases:
4848
-f services/client/Dockerfile.prod \
4949
-t $AWS_ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com/test-driven-client:builder \
5050
--build-arg NODE_ENV=production \
51-
--build-arg REACT_APP_USERS_SERVICE_URL=$REACT_APP_USERS_SERVICE_URL \
51+
--build-arg REACT_APP_API_SERVICE_URL=$REACT_APP_API_SERVICE_URL \
5252
./services/client
5353
- >
5454
docker build \
55-
--cache-from $AWS_ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com/test-driven-client:$DOCKER_TAG \
55+
--cache-from $AWS_ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com/test-driven-client:$DOCKER_TAG \
5656
-f services/client/Dockerfile.prod \
57-
-t $AWS_ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com/test-driven-client:$DOCKER_TAG \
57+
-t $AWS_ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com/test-driven-client:$DOCKER_TAG \
5858
./services/client
5959
post_build:
6060
commands:

docker-compose.prod.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
version: '3.7'
1+
version: '3.8'
22

33
services:
44

5-
users:
5+
api:
66
build:
77
context: ./services/users
88
dockerfile: Dockerfile.prod
99
ports:
10-
- 5001:5000
10+
- 5004:5000
1111
environment:
1212
- FLASK_ENV=production
13-
- APP_SETTINGS=project.config.ProductionConfig
14-
- DATABASE_URL=postgres://postgres:postgres@users-db:5432/users_prod
15-
- DATABASE_TEST_URL=postgres://postgres:postgres@users-db:5432/users_test
13+
- APP_SETTINGS=src.config.ProductionConfig
14+
- DATABASE_URL=postgres://postgres:postgres@api-db:5432/api_prod
15+
- DATABASE_TEST_URL=postgres://postgres:postgres@api-db:5432/api_test
1616
- SECRET_KEY=my_precious
1717
depends_on:
18-
- users-db
18+
- api-db
1919

20-
users-db:
20+
api-db:
2121
build:
22-
context: ./services/users/project/db
22+
context: ./services/users/src/db
2323
dockerfile: Dockerfile
2424
expose:
2525
- 5432
@@ -33,8 +33,8 @@ services:
3333
dockerfile: Dockerfile.prod
3434
args:
3535
- NODE_ENV=production
36-
- REACT_APP_USERS_SERVICE_URL=${REACT_APP_USERS_SERVICE_URL}
36+
- REACT_APP_API_SERVICE_URL=${REACT_APP_API_SERVICE_URL}
3737
ports:
3838
- 3007:80
3939
depends_on:
40-
- users
40+
- api

docker-compose.yml

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
1-
version: '3.7'
1+
version: '3.8'
22

33
services:
44

5-
users:
5+
api:
66
build:
77
context: ./services/users
88
dockerfile: Dockerfile
99
entrypoint: ['/usr/src/app/entrypoint.sh']
1010
volumes:
1111
- './services/users:/usr/src/app'
1212
ports:
13-
- 5001:5000
13+
- 5004:5000
1414
environment:
1515
- FLASK_ENV=development
16-
- APP_SETTINGS=project.config.DevelopmentConfig
17-
- DATABASE_URL=postgresql://postgres:postgres@users-db:5432/users_dev
18-
- DATABASE_TEST_URL=postgresql://postgres:postgres@users-db:5432/users_test
16+
- APP_SETTINGS=src.config.DevelopmentConfig
17+
- DATABASE_URL=postgresql://postgres:postgres@api-db:5432/api_dev
18+
- DATABASE_TEST_URL=postgresql://postgres:postgres@api-db:5432/api_test
1919
depends_on:
20-
- users-db
20+
- api-db
2121

22-
users-db:
22+
api-db:
2323
build:
24-
context: ./services/users/project/db
24+
context: ./services/users/src/db
2525
dockerfile: Dockerfile
2626
expose:
2727
- 5432
@@ -30,6 +30,7 @@ services:
3030
- POSTGRES_PASSWORD=postgres
3131

3232
client:
33+
stdin_open: true
3334
build:
3435
context: ./services/client
3536
dockerfile: Dockerfile
@@ -40,6 +41,6 @@ services:
4041
- 3007:3000
4142
environment:
4243
- NODE_ENV=development
43-
- REACT_APP_USERS_SERVICE_URL=${REACT_APP_USERS_SERVICE_URL}
44+
- REACT_APP_API_SERVICE_URL=${REACT_APP_API_SERVICE_URL}
4445
depends_on:
45-
- users
46+
- api

ecs/ecs_users_taskdefinition.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
"environment": [
1616
{
1717
"name": "APP_SETTINGS",
18-
"value": "project.config.ProductionConfig"
18+
"value": "src.config.ProductionConfig"
1919
},
2020
{
2121
"name": "DATABASE_TEST_URL",
22-
"value": "postgres://postgres:postgres@users-db:5432/users_test"
22+
"value": "postgres://postgres:postgres@api-db:5432/api_test"
2323
},
2424
{
2525
"name": "DATABASE_URL",

services/client/.eslintrc.json

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
11
{
2-
"parser": "babel-eslint",
3-
"parserOptions": {
4-
"ecmaVersion": 2018,
5-
"ecmaFeatures": {
6-
"jsx": true
2+
"parser": "babel-eslint",
3+
"parserOptions": {
4+
"ecmaVersion": 2018,
5+
"ecmaFeatures": {
6+
"jsx": true
7+
},
8+
"sourceType": "module"
79
},
8-
"sourceType": "module"
9-
},
10-
"settings": {
11-
"react": {
12-
"version": "16.0"
13-
}
14-
},
15-
"plugins": [
16-
"react"
17-
],
10+
"settings": {
11+
"react": {
12+
"version": "16.0"
13+
}
14+
},
15+
"plugins": [
16+
"react"
17+
],
1818

19-
"extends": [
20-
"standard-jsx"
21-
],
22-
"rules": {
23-
"react/jsx-no-bind": ["error", {
24-
"allowArrowFunctions": true,
25-
"allowBind": false,
26-
"ignoreRefs": true
27-
}],
28-
"react/no-did-update-set-state": "error",
29-
"react/no-unknown-property": "error",
30-
"react/no-unused-prop-types": "error",
31-
"react/react-in-jsx-scope": "error",
32-
"jsx-quotes": "off",
33-
"react/jsx-indent": "off"
19+
"extends": [
20+
"standard-jsx"
21+
],
22+
"rules": {
23+
"react/jsx-no-bind": ["error", {
24+
"allowArrowFunctions": true,
25+
"allowBind": false,
26+
"ignoreRefs": true
27+
}],
28+
"react/no-did-update-set-state": "error",
29+
"react/no-unknown-property": "error",
30+
"react/no-unused-prop-types": "error",
31+
"react/react-in-jsx-scope": "error",
32+
"jsx-quotes": "off",
33+
"react/jsx-indent": "off"
34+
}
3435
}
35-
}

services/client/Dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# pull official base image
2-
FROM node:13.10.1-alpine
2+
FROM node:15.2.0-alpine
33

44
# set working directory
55
WORKDIR /usr/src/app
@@ -8,10 +8,10 @@ WORKDIR /usr/src/app
88
ENV PATH /usr/src/app/node_modules/.bin:$PATH
99

1010
# install and cache app dependencies
11-
COPY package.json /usr/src/app/package.json
12-
COPY package-lock.json /usr/src/app/package-lock.json
11+
COPY package.json .
12+
COPY package-lock.json .
1313
RUN npm ci
14-
RUN npm install react-scripts@3.4.0 -g --silent
14+
RUN npm install react-scripts@4.0.0 [email protected] [email protected].0 -g --silent
1515

1616
# start app
1717
CMD ["npm", "start"]

services/client/Dockerfile.prod

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
# BUILDER #
33
###########
44

5-
# base image
6-
FROM node:13.10.1-alpine as builder
5+
# pull official base image
6+
FROM node:15.2.0-alpine as builder
77

88
# set working directory
99
WORKDIR /usr/src/app
@@ -12,19 +12,20 @@ WORKDIR /usr/src/app
1212
ENV PATH /usr/src/app/node_modules/.bin:$PATH
1313

1414
# install and cache app dependencies
15-
COPY package.json /usr/src/app/package.json
16-
COPY package-lock.json /usr/src/app/package-lock.json
15+
COPY package.json .
16+
COPY package-lock.json .
1717
RUN npm ci
18-
RUN npm install [email protected] -g --silent
18+
RUN npm install [email protected] --silent
19+
1920

2021
# set environment variables
21-
ARG REACT_APP_USERS_SERVICE_URL
22-
ENV REACT_APP_USERS_SERVICE_URL $REACT_APP_USERS_SERVICE_URL
22+
ARG REACT_APP_API_SERVICE_URL
23+
ENV REACT_APP_API_SERVICE_URL $REACT_APP_API_SERVICE_URL
2324
ARG NODE_ENV
2425
ENV NODE_ENV $NODE_ENV
2526

2627
# create build
27-
COPY . /usr/src/app
28+
COPY . .
2829
RUN npm run build
2930

3031

@@ -33,7 +34,7 @@ RUN npm run build
3334
#########
3435

3536
# base image
36-
FROM nginx:1.17.9-alpine
37+
FROM nginx:1.19.4-alpine
3738

3839
# update nginx conf
3940
RUN rm -rf /etc/nginx/conf.d

services/client/README.md

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,35 @@
1+
# Getting Started with Create React App
2+
13
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
24

35
## Available Scripts
46

57
In the project directory, you can run:
68

7-
### `yarn start`
9+
### `npm start`
810

9-
Runs the app in the development mode.<br />
11+
Runs the app in the development mode.\
1012
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
1113

12-
The page will reload if you make edits.<br />
14+
The page will reload if you make edits.\
1315
You will also see any lint errors in the console.
1416

15-
### `yarn test`
17+
### `npm test`
1618

17-
Launches the test runner in the interactive watch mode.<br />
19+
Launches the test runner in the interactive watch mode.\
1820
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
1921

20-
### `yarn build`
22+
### `npm run build`
2123

22-
Builds the app for production to the `build` folder.<br />
24+
Builds the app for production to the `build` folder.\
2325
It correctly bundles React in production mode and optimizes the build for the best performance.
2426

25-
The build is minified and the filenames include the hashes.<br />
27+
The build is minified and the filenames include the hashes.\
2628
Your app is ready to be deployed!
2729

2830
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
2931

30-
### `yarn eject`
32+
### `npm run eject`
3133

3234
**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
3335

@@ -45,24 +47,24 @@ To learn React, check out the [React documentation](https://reactjs.org/).
4547

4648
### Code Splitting
4749

48-
This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting
50+
This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
4951

5052
### Analyzing the Bundle Size
5153

52-
This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size
54+
This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
5355

5456
### Making a Progressive Web App
5557

56-
This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app
58+
This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
5759

5860
### Advanced Configuration
5961

60-
This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration
62+
This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
6163

6264
### Deployment
6365

64-
This section has moved here: https://facebook.github.io/create-react-app/docs/deployment
66+
This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
6567

66-
### `yarn build` fails to minify
68+
### `npm run build` fails to minify
6769

68-
This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify
70+
This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)

0 commit comments

Comments
 (0)