(HACKS!!!)lots of bullshit hacks to remove later (#14)
This commit is contained in:
parent
e8de6475c7
commit
8950751c82
11 changed files with 114 additions and 35 deletions
2
src/client/.gitignore
vendored
2
src/client/.gitignore
vendored
|
@ -45,3 +45,5 @@ app.*.map.json
|
|||
/android/app/debug
|
||||
/android/app/profile
|
||||
/android/app/release
|
||||
|
||||
shared-dir
|
||||
|
|
|
@ -20,11 +20,15 @@ RUN flutter upgrade
|
|||
|
||||
RUN flutter doctor
|
||||
|
||||
COPY ./ /client/
|
||||
COPY root-pubspec.yaml /client/pubspec.yaml
|
||||
COPY ./shared-dir /client/shared
|
||||
COPY ./ /client/client
|
||||
|
||||
WORKDIR /client/client
|
||||
|
||||
RUN flutter build web --dart-define-from-file=.env
|
||||
|
||||
WORKDIR /client/build/web
|
||||
WORKDIR /client/client/build/web
|
||||
|
||||
EXPOSE 80/tcp
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ class ApiService extends Service {
|
|||
required Coordinates start,
|
||||
required Coordinates end,
|
||||
}) async {
|
||||
final uri = _base.resolve("/path").replace(
|
||||
final uri = Uri.parse("/tmp-api/path").replace(
|
||||
queryParameters: {
|
||||
"start_lat": start.lat.toString(),
|
||||
"start_lon": start.long.toString(),
|
||||
|
|
10
src/client/root-pubspec.yaml
Normal file
10
src/client/root-pubspec.yaml
Normal file
|
@ -0,0 +1,10 @@
|
|||
name: cs445
|
||||
|
||||
environment:
|
||||
sdk: ^3.7.0
|
||||
|
||||
workspace:
|
||||
- shared
|
||||
- client
|
||||
dev_dependencies:
|
||||
very_good_analysis: ^7.0.0
|
|
@ -6,12 +6,17 @@ services:
|
|||
depends_on:
|
||||
- server
|
||||
- client
|
||||
- hack
|
||||
restart: unless-stopped
|
||||
|
||||
client:
|
||||
build: ./client
|
||||
restart: unless-stopped
|
||||
|
||||
hack:
|
||||
build: ./shared
|
||||
restart: unless-stopped
|
||||
|
||||
server:
|
||||
build: ./server
|
||||
environment:
|
||||
|
@ -19,29 +24,30 @@ services:
|
|||
#ports:
|
||||
# - "127.0.0.1:8080:80"
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
neo4j:
|
||||
condition: service_healthy
|
||||
neo4j:
|
||||
image: neo4j:latest
|
||||
volumes:
|
||||
- neo4jconfig:/config
|
||||
- neo4jdata:/data
|
||||
- neo4jplugins:/plugins
|
||||
environment:
|
||||
# neo4j isn't exposed to the internet so having the password checked into version control doesn't matter
|
||||
- NEO4J_AUTH=neo4j/your_password
|
||||
ports:
|
||||
# useful for dev
|
||||
- "127.0.0.1:7474:7474"
|
||||
- "127.0.0.1:7687:7687"
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: wget http://localhost:7474 || exit 1
|
||||
interval: 1s
|
||||
timeout: 10s
|
||||
retries: 20
|
||||
start_period: 3s
|
||||
# depends_on:
|
||||
# neo4j:
|
||||
# condition: service_healthy
|
||||
#neo4j:
|
||||
# image: neo4j:latest
|
||||
# volumes:
|
||||
# - neo4jconfig:/config
|
||||
# - neo4jdata:/data
|
||||
# - neo4jplugins:/plugins
|
||||
# environment:
|
||||
# # neo4j isn't exposed to the internet so having the password checked into version control doesn't matter
|
||||
# - NEO4J_AUTH=neo4j/your_password
|
||||
# ports:
|
||||
# # useful for dev
|
||||
# - "127.0.0.1:7474:7474"
|
||||
# - "127.0.0.1:7687:7687"
|
||||
# restart: unless-stopped
|
||||
# healthcheck:
|
||||
# test: wget http://localhost:7474 || exit 1
|
||||
# interval: 1s
|
||||
# timeout: 10s
|
||||
# retries: 20
|
||||
# start_period: 3s
|
||||
|
||||
|
||||
volumes:
|
||||
neo4jconfig:
|
||||
|
|
|
@ -3,4 +3,7 @@
|
|||
handle_path /api/* {
|
||||
reverse_proxy server:80
|
||||
}
|
||||
handle_path /tmp-api/* {
|
||||
reverse_proxy hack:8001
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,13 +24,13 @@ const substitute_base_name = substitute_base_name_.bind(
|
|||
const { hostname, port } = { hostname: "0.0.0.0", port: 80 };
|
||||
|
||||
const neo4jHost = usingDocker ? "neo4j" : "127.0.0.1"; // localhost does NOT work
|
||||
const graph_driver = neo4j.driver(
|
||||
`neo4j://${neo4jHost}:7687`,
|
||||
neo4j.auth.basic("neo4j", "your_password"),
|
||||
);
|
||||
console.log("initializing graph with static data");
|
||||
await graph_setup(graph_driver);
|
||||
console.log("graph initialization complete");
|
||||
//const graph_driver = neo4j.driver(
|
||||
// `neo4j://${neo4jHost}:7687`,
|
||||
// neo4j.auth.basic("neo4j", "your_password"),
|
||||
//);
|
||||
//console.log("initializing graph with static data");
|
||||
//await graph_setup(graph_driver);
|
||||
//console.log("graph initialization complete");
|
||||
|
||||
const db = new DatabaseSync(":memory:");
|
||||
db_setup(db);
|
||||
|
|
2
src/shared/.gitignore
vendored
2
src/shared/.gitignore
vendored
|
@ -2,5 +2,7 @@
|
|||
# Created by `dart pub`
|
||||
.dart_tool/
|
||||
pubspec.lock
|
||||
client-dir
|
||||
server-data
|
||||
path.log
|
||||
notes.md
|
||||
|
|
42
src/shared/Dockerfile
Normal file
42
src/shared/Dockerfile
Normal file
|
@ -0,0 +1,42 @@
|
|||
FROM alpine:3.21
|
||||
|
||||
RUN mkdir /client
|
||||
|
||||
RUN apk add bash curl file git unzip which zip gcompat wget tar xz
|
||||
|
||||
#ENTRYPOINT bash
|
||||
|
||||
WORKDIR /client
|
||||
|
||||
RUN wget -O flutter.tar.xz https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.29.0-stable.tar.xz
|
||||
|
||||
RUN tar xf flutter.tar.xz
|
||||
|
||||
ENV PATH="/client/flutter/bin/:${PATH}"
|
||||
|
||||
RUN git config --global --add safe.directory /client/flutter
|
||||
|
||||
RUN flutter upgrade
|
||||
|
||||
RUN flutter doctor
|
||||
|
||||
|
||||
COPY root-pubspec.yaml /client/pubspec.yaml
|
||||
|
||||
COPY ./ /client/shared
|
||||
|
||||
RUN mkdir /client/client
|
||||
|
||||
COPY ./client-dir/* /client/client
|
||||
|
||||
RUN mkdir /client/server
|
||||
|
||||
COPY server-data /client/server/data
|
||||
|
||||
RUN dart pub get
|
||||
|
||||
WORKDIR /client/shared
|
||||
|
||||
EXPOSE 80/tcp
|
||||
|
||||
CMD ["dart", "bin/server.dart"]
|
|
@ -20,6 +20,6 @@ void main() async {
|
|||
router.get("/path", handlers.getPath);
|
||||
router.get("/stops", handlers.getStops);
|
||||
router.get("/routes", handlers.getRoutes);
|
||||
await io.serve(router.call, "localhost", 8001);
|
||||
print("Listening on localhost:8001");
|
||||
await io.serve(router.call, "0.0.0.0", 8001);
|
||||
print("Listening on 0.0.0.0:8001");
|
||||
}
|
||||
|
|
10
src/shared/root-pubspec.yaml
Normal file
10
src/shared/root-pubspec.yaml
Normal file
|
@ -0,0 +1,10 @@
|
|||
name: cs445
|
||||
|
||||
environment:
|
||||
sdk: ^3.7.0
|
||||
|
||||
workspace:
|
||||
- shared
|
||||
- client
|
||||
dev_dependencies:
|
||||
very_good_analysis: ^7.0.0
|
Loading…
Reference in a new issue