Skip to content
This repository has been archived by the owner on Jul 23, 2024. It is now read-only.

Commit

Permalink
Containerize apollo router for compound soaking
Browse files Browse the repository at this point in the history
  • Loading branch information
iamvigneshwars committed Feb 29, 2024
1 parent 78deea6 commit 326181d
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 20 deletions.
5 changes: 2 additions & 3 deletions .devcontainer/Dockerfile.backend
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@ RUN apt-get update \
libopencv-dev clang libclang-dev \
&& rm -rf /var/lib/apt/lists/*

# Install Rover CLI for composing and precompiles rust router (gateway) for subgraphs
RUN curl -sSL https://rover.apollo.dev/nix/latest | sh\
&& curl -sSL https://router.apollo.dev/download/nix/latest | sh
# Install Rover CLI for composing subgraphs
RUN curl -sSL https://rover.apollo.dev/nix/latest | sh
14 changes: 14 additions & 0 deletions .devcontainer/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
version: "3.8"

services:
apollo-router:
image: ghcr.io/apollographql/router:v1.41.0-rc.2
volumes:
- ./supergraph.graphql:/dist/schema/supergraph.graphql
- ./router.yaml:/dist/config/router.yaml
ports:
- 4001:4000
command:
- --dev
- -c
- config/router.yaml
- -s
- schema/supergraph.graphql

backend:
build:
context: .
Expand Down
6 changes: 5 additions & 1 deletion backend/router.yaml → .devcontainer/router.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@ headers:
all: # Header rules for all subgraphs
request:
- propagate:
matching: .*
matching: .*

supergraph:
listen: 0.0.0.0:4000

5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,5 @@
# Developer Tooling
.vscode

# Apollo router
router
backend/router
# Generated supergraph schema
backend/supergraph.graphql
.devcontainer/supergraph.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ impl CompoundInstanceQuery {

/// Reference resolver for compound instance in compound library subgraph
#[graphql(entity)]
async fn get_compound_instance_by_id(
async fn route_compound_instance(
&self,
ctx: &Context<'_>,
plate_id: Uuid,
Expand Down
6 changes: 3 additions & 3 deletions backend/compound_soaking/src/graphql/soak_compound_res.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ impl SoakCompoundQuery {

/// Reference resolver for crystal wells
#[graphql(entity)]
async fn get_crystal_well_by_plate_id(&self, plate_id: Uuid, well_number: i16) -> CrystalWells {
async fn route_crystal_well(&self, plate_id: Uuid, well_number: i16) -> CrystalWells {
CrystalWells {
plate_id,
well_number,
Expand All @@ -116,7 +116,7 @@ impl SoakCompoundQuery {

/// Reference resolver for compound wells
#[graphql(entity)]
async fn get_compound_instances_by_plate_id(
async fn route_compound_instances(
&self,
plate_id: Uuid,
well_number: i16,
Expand All @@ -131,7 +131,7 @@ impl SoakCompoundQuery {
#[Object]
impl SoakCompoundMutation {
/// Adds a soaked compound to the database
async fn add_soaked_compound(
async fn soak_compound(
&self,
ctx: &Context<'_>,
compound_plate_id: Uuid,
Expand Down
2 changes: 1 addition & 1 deletion backend/compound_soaking/src/tables/soak_compound.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub struct Model {
/// The well on the plate which the crystal is located.
#[sea_orm(primary_key, auto_increment = false)]
pub crystal_well_number: i16,
/// The volume of compounds soaked.
/// The volume of compounds transferred into the crystal well.
pub volume: f32,
/// The identifier of the operator which added this entry.
pub operator_id: String,
Expand Down
2 changes: 1 addition & 1 deletion backend/crystal_library/src/graphql/crystal_wells_res.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ impl CrystalWellsQuery {

/// Reference resolver for crystal wells in crystal library graphql subgraph
#[graphql(entity)]
async fn find_crystal_wells_by_id(
async fn route_crystal_wells(
&self,
ctx: &Context<'_>,
plate_id: Uuid,
Expand Down
13 changes: 7 additions & 6 deletions backend/supergraph-config.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
federation_version: 2
subgraphs:
crystal_library:
routing_url: http://localhost:80
routing_url: http://backend:80
schema:
subgraph_url: http://localhost:80
subgraph_url: http://backend:80
compound_library:
routing_url: http://localhost:81
routing_url: http://backend:81
schema:
subgraph_url: http://localhost:81
subgraph_url: http://backend:81
compound_soaking:
routing_url: http://localhost:82
routing_url: http://backend:82
schema:
subgraph_url: http://localhost:82
subgraph_url: http://backend:82

0 comments on commit 326181d

Please sign in to comment.