diff --git a/.gitignore b/.gitignore index 2ca305ab2..617f94887 100644 --- a/.gitignore +++ b/.gitignore @@ -20,6 +20,7 @@ coverage/ .env.development.local .env.test.local .env.production.local +.vscode npm-debug.log* yarn-debug.log* @@ -32,4 +33,6 @@ config.js .env settings.cfg +Orchestration/docker-compose.yml + __pycache__/ diff --git a/Dockerfile b/Dockerfile index d6f9f524f..01d61949b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,16 +1,20 @@ # base image FROM node:12.2.0-alpine +RUN npm install webpack webpack-cli -g + +WORKDIR /tmp +COPY package.json /tmp/ +RUN npm config set registry http://registry.npmjs.org/ && npm install -# set working directory WORKDIR /app +COPY . /app/ +RUN cp -a /tmp/node_modules /app/ -# add `/app/node_modules/.bin` to $PATH -ENV PATH /app/node_modules/.bin:$PATH +RUN webpack -# install and cache app dependencies -COPY package.json /app/package.json -RUN npm install --silent -RUN npm install react-scripts@3.0.1 -g --silent +ENV NODE_ENV=production +ENV PORT=8080 +RUN ls +CMD [ "npm", "run-script", "dev" ] -# start app -CMD ["npm", "start"] +EXPOSE 8080 diff --git a/Orchestration/docker-compose-default.yml b/Orchestration/docker-compose-default.yml index 6ae7b4186..67db31152 100644 --- a/Orchestration/docker-compose-default.yml +++ b/Orchestration/docker-compose-default.yml @@ -1,28 +1,28 @@ version: '3.1' services: - backend: - build: - context: ../python - image: 311-data-back:0.0.1 - restart: always - container_name: "311-backend" - environment: - SODAPY_APPTOKEN: - ports: - - 5000:5000 - - frontend: - build: - context: ../javascript/react/311-data - image: 311-data-front:0.0.1 - volumes: - - '../javascript/react/311-data:/app' - - '/app/node_modules' - restart: always - container_name: "311-frontend" - ports: - - 3000:3000 +# backend: +# build: +# context: ../python +# image: 311-data-back:0.0.1 +# restart: always +# container_name: "311-backend" +# environment: +# SODAPY_APPTOKEN: +# ports: +# - 5000:5000 +# +# frontend: +# build: +# context: ../javascript/react/311-data +# image: 311-data-front:0.0.1 +# volumes: +# - '../javascript/react/311-data:/app' +# - '/app/node_modules' +# restart: always +# container_name: "311-frontend" +# ports: +# - 3000:3000 db: image: postgres diff --git a/server/src/app.py b/server/src/app.py index 87595cf7e..0167e55f2 100644 --- a/server/src/app.py +++ b/server/src/app.py @@ -3,6 +3,7 @@ from sanic.response import json from services.time_to_close import time_to_close from services.frequency import frequency +from services.ingress_service import ingress_service app = Sanic(__name__) app.config.from_pyfile(os.path.join(os.getcwd(),'settings.cfg')) @@ -32,5 +33,23 @@ async def sample_route(request): sample_dataset = {'cool_key':['value1', 'value2'], app.config['REDACTED']:app.config['REDACTED']} return json(sample_dataset) +@app.route('/injest') +async def injest(request): + ingress_worker = ingress_service() + return_data = ingress_worker.injest() + return json(return_data) + +@app.route('/update') +async def update(request): + ingress_worker = ingress_service() + return_data = ingress_worker.update() + return json(return_data) + +@app.route('/delete') +async def delete(request): + ingress_worker = ingress_service() + return_data = ingress_worker.delete() + return json(return_data) + if __name__ == '__main__': app.run(host=app.config['HOST'], port=app.config['PORT'], debug=app.config['DEBUG']) diff --git a/server/src/services/ingress_service.py b/server/src/services/ingress_service.py new file mode 100644 index 000000000..b7c9970d8 --- /dev/null +++ b/server/src/services/ingress_service.py @@ -0,0 +1,15 @@ +class ingress_service(object): + def __init__(self): + pass + + def injest(self): + return {'response':'injest ok'} + + def update(self): + return {'response':'update ok'} + + def delete(self): + return {'response':'delete ok'} + + def hello_world(self): + return {'response':'hello from frequency service'}