Skip to content

Commit

Permalink
Merge pull request #3 from hackforla/dev
Browse files Browse the repository at this point in the history
Bring up to date with Dev
  • Loading branch information
ryanmswan authored Dec 10, 2019
2 parents f74218a + c744426 commit 0fe15d2
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 31 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ coverage/
.env.development.local
.env.test.local
.env.production.local
.vscode

npm-debug.log*
yarn-debug.log*
Expand All @@ -32,4 +33,6 @@ config.js
.env
settings.cfg

Orchestration/docker-compose.yml

__pycache__/
22 changes: 13 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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 [email protected] -g --silent
ENV NODE_ENV=production
ENV PORT=8080
RUN ls
CMD [ "npm", "run-script", "dev" ]

# start app
CMD ["npm", "start"]
EXPOSE 8080
44 changes: 22 additions & 22 deletions Orchestration/docker-compose-default.yml
Original file line number Diff line number Diff line change
@@ -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: <Your Token Here>
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: <Your Token Here>
# 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
Expand Down
19 changes: 19 additions & 0 deletions server/src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
Expand Down Expand Up @@ -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'])
15 changes: 15 additions & 0 deletions server/src/services/ingress_service.py
Original file line number Diff line number Diff line change
@@ -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'}

0 comments on commit 0fe15d2

Please sign in to comment.