Skip to content

Commit

Permalink
[wip] support an external dataset via mounted JSON file
Browse files Browse the repository at this point in the history
  • Loading branch information
Saturn-V committed Oct 19, 2023
1 parent 6c5df37 commit 5968666
Show file tree
Hide file tree
Showing 9 changed files with 1,016 additions and 381 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/
22 changes: 22 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
version: "1.0"
services:
pewpew:
build:
context: .
dockerfile: ./docker/Dockerfile
volumes:
- ./docker/datasource/data:/opt/pewpew/data
ports:
- 8080:8080
restart: unless-stopped
# depends_on:
# - "pewpew_data"

# pewpew_data:
# build:
# context: ./docker/datasource
# dockerfile: ./docker/datasource/Dockerfile
# volumes:
# - ./docker/datasource/data:/datasource/data
# restart: unless-stopped
5 changes: 5 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
FROM node:latest

EXPOSE 8080

WORKDIR /opt/pewpew
COPY . /opt/pewpew
RUN npm install http-server -g
RUN mkdir -p /opt/pewpew

VOLUME ./data

CMD ["http-server","-a","0.0.0.0","-p","8080","/opt/pewpew"]

10 changes: 10 additions & 0 deletions docker/datasource/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM node:latest

EXPOSE 8090
WORKDIR /datasource
COPY . .
RUN npm install --include-dev

VOLUME ./data

CMD ["npm","run","trace"]
1 change: 1 addition & 0 deletions docker/datasource/data/data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"data":[{"hit":{"origin":{"latitude":37.3083,"longitude":-121.9643},"destination":{"latitude":37.3512,"longitude":-121.8846}}},{"hit":{"origin":{"latitude":37.7506,"longitude":-122.4121},"destination":{"latitude":37.3512,"longitude":-121.8846}}},{"hit":{"origin":{"latitude":37.7506,"longitude":-122.4121},"destination":{"latitude":37.3512,"longitude":-121.8846}}},{"hit":{"origin":{"latitude":30.5875,"longitude":-97.8535},"destination":{"latitude":37.3512,"longitude":-121.8846}}},{"hit":{"origin":{"latitude":30.5875,"longitude":-97.8535},"destination":{"latitude":37.3512,"longitude":-121.8846}}},{"hit":{"origin":{"latitude":30.5875,"longitude":-97.8535},"destination":{"latitude":37.3512,"longitude":-121.8846}}},{"hit":{"origin":{"latitude":30.5875,"longitude":-97.8535},"destination":{"latitude":37.3512,"longitude":-121.8846}}},{"hit":{"origin":{"latitude":30.5875,"longitude":-97.8535},"destination":{"latitude":37.3512,"longitude":-121.8846}}},{"hit":{"origin":{"latitude":30.5875,"longitude":-97.8535},"destination":{"latitude":37.3512,"longitude":-121.8846}}},{"hit":{"origin":{"latitude":30.5875,"longitude":-97.8535},"destination":{"latitude":37.3512,"longitude":-121.8846}}},{"hit":{"origin":{"latitude":30.5875,"longitude":-97.8535},"destination":{"latitude":37.3512,"longitude":-121.8846}}},{"hit":{"origin":{"latitude":30.5875,"longitude":-97.8535},"destination":{"latitude":37.3512,"longitude":-121.8846}}},{"hit":{"origin":{"latitude":37.3083,"longitude":-121.9643},"destination":{"latitude":37.3512,"longitude":-121.8846}}},{"hit":{"origin":{"latitude":30.5875,"longitude":-97.8535},"destination":{"latitude":37.3512,"longitude":-121.8846}}},{"hit":{"origin":{"latitude":30.5875,"longitude":-97.8535},"destination":{"latitude":37.3512,"longitude":-121.8846}}},{"hit":{"origin":{"latitude":30.5875,"longitude":-97.8535},"destination":{"latitude":37.3512,"longitude":-121.8846}}},{"hit":{"origin":{"latitude":30.5875,"longitude":-97.8535},"destination":{"latitude":37.3512,"longitude":-121.8846}}},{"hit":{"origin":{"latitude":30.5875,"longitude":-97.8535},"destination":{"latitude":37.3512,"longitude":-121.8846}}},{"hit":{"origin":{"latitude":30.5875,"longitude":-97.8535},"destination":{"latitude":37.3512,"longitude":-121.8846}}},{"hit":{"origin":{"latitude":30.5875,"longitude":-97.8535},"destination":{"latitude":37.3512,"longitude":-121.8846}}},{"hit":{"origin":{"latitude":30.5875,"longitude":-97.8535},"destination":{"latitude":37.3512,"longitude":-121.8846}}},{"hit":{"origin":{"latitude":30.5875,"longitude":-97.8535},"destination":{"latitude":37.3512,"longitude":-121.8846}}},{"hit":{"origin":{"latitude":30.5875,"longitude":-97.8535},"destination":{"latitude":37.3512,"longitude":-121.8846}}},{"hit":{"origin":{"latitude":30.5875,"longitude":-97.8535},"destination":{"latitude":37.3512,"longitude":-121.8846}}},{"hit":{"origin":{"latitude":30.5875,"longitude":-97.8535},"destination":{"latitude":37.3512,"longitude":-121.8846}}},{"hit":{"origin":{"latitude":37.3083,"longitude":-121.9643},"destination":{"latitude":37.3512,"longitude":-121.8846}}},{"hit":{"origin":{"latitude":30.5875,"longitude":-97.8535},"destination":{"latitude":37.3512,"longitude":-121.8846}}},{"hit":{"origin":{"latitude":30.5875,"longitude":-97.8535},"destination":{"latitude":37.3512,"longitude":-121.8846}}},{"hit":{"origin":{"latitude":37.3083,"longitude":-121.9643},"destination":{"latitude":37.3512,"longitude":-121.8846}}},{"hit":{"origin":{"latitude":30.5875,"longitude":-97.8535},"destination":{"latitude":37.3512,"longitude":-121.8846}}},{"hit":{"origin":{"latitude":37.3083,"longitude":-121.9643},"destination":{"latitude":37.3512,"longitude":-121.8846}}},{"hit":{"origin":{"latitude":30.5875,"longitude":-97.8535},"destination":{"latitude":37.3512,"longitude":-121.8846}}},{"hit":{"origin":{"latitude":37.3083,"longitude":-121.9643},"destination":{"latitude":37.3512,"longitude":-121.8846}}},{"hit":{"origin":{"latitude":30.5875,"longitude":-97.8535},"destination":{"latitude":37.3512,"longitude":-121.8846}}},{"hit":{"origin":{"latitude":37.3083,"longitude":-121.9643},"destination":{"latitude":37.3512,"longitude":-121.8846}}}]}
304 changes: 304 additions & 0 deletions docker/datasource/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions docker/datasource/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "pewpew-datasource",
"version": "1.0.0",
"description": "An adapter to pewpew to load a datasource",
"main": "./src/index.ts",
"scripts": {
"trace": "ts-node ./src/index.ts"
},
"author": "",
"license": "ISC",
"devDependencies": {
"@types/node": "^20.8.7",
"ts-node": "^10.9.1",
"typescript": "^5.2.2"
}
}
Loading

0 comments on commit 5968666

Please sign in to comment.