Skip to content

Commit

Permalink
Setup Docker build (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
madmikeross authored Dec 17, 2023
1 parent 7e34a38 commit 717acde
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 134 deletions.
154 changes: 27 additions & 127 deletions Cargo.lock

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

5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
reqwest = { version = "0.11", features = ["blocking", "json", "serde_json"] }
reqwest = { version = "0.11", default-features = false, features = ["blocking", "json", "serde_json", "rustls-tls"] }
serde = { version = "1", features = ["derive"] }
serde_json = "1.0"
neo4rs = "0.7.0-rc.3"
Expand All @@ -15,4 +15,5 @@ futures = "0.3.29"
uuid = "1.6.0"
thiserror = "1.0.50"
warp = "0.3.6"
chrono = "0.4.31"
chrono = "0.4.31"
openssl = { version = "0.10", features = ["vendored"] }
12 changes: 12 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM messense/rust-musl-cross:x86_64-musl as builder
WORKDIR /eve-graph
# Copy the source
COPY . .
# Build the app
RUN cargo build --release --target x86_64-unknown-linux-musl

# Create a new stage with minimal image
FROM scratch
COPY --from=builder /eve-graph/target/x86_64-unknown-linux-musl/release/eve-graph /eve-graph
ENTRYPOINT ["/eve-graph"]
EXPOSE 8008
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,13 @@ the endpoint to assign a risk to each jump:
curl -X POST 127.0.0.1:8008/systems/risk
```

Next, you need to build the `jump-risk` graph in neo4j. Refere to the `build_jump_risk_graph` function in the database
Next, you need to build the `jump-risk` graph in neo4j. Refer to the `build_jump_risk_graph` function in the database
module for the query you should run. Last, you need to run a query similar to the `find_shortest_route` function in the
database module with a couple modifications in order to find the safest path. Simply substitute `jump-risk` for
`system-map` and `risk` for `cost` (and put in your source and destination system names) and you should have a "safe" route
which is also likely shorter than the high sec route.
which is also likely shorter than the high sec route.

### Running with Docker
A fully functioning docker build for the app is not yet complete. Neo4j will come up, but we still need to install the
data science plugin. The app will start, but requests to ESI from within the container are completing too quickly, and
better logging needs to be added to debug the issue further.
21 changes: 21 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
version: '3'
services:
api:
build:
context: .
dockerfile: Dockerfile
ports:
- "8008:8008"
depends_on:
- neo4j
neo4j:
image: neo4j:5.14-community-bullseye
ports:
- "7474:7474"
- "7687:7687"
volumes:
- neo4j_data:/data/
environment:
- NEO4J_AUTH:neo4j/neo4jneo4j
volumes:
neo4j_data:
6 changes: 3 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ mod eve_scout;

#[tokio::main]
async fn main() {
println!("Starting eve-graph");
let client = Client::new();
let graph = get_graph_client().await;

Expand Down Expand Up @@ -65,9 +66,8 @@ async fn main() {
.or(stargates_routes)
.recover(handle_rejection);

warp::serve(service_routes)
.run(([127, 0, 0, 1], 8008))
.await;
println!("Serving routes on 8008");
warp::serve(service_routes).run(([0, 0, 0, 0], 8008)).await;
}

fn with_client(client: Client) -> impl Filter<Extract = (Client,), Error = Infallible> + Clone {
Expand Down

0 comments on commit 717acde

Please sign in to comment.