Skip to content

Commit

Permalink
Merge pull request #7 from TheJacksonLaboratory/feature/docker
Browse files Browse the repository at this point in the history
Docker, HPO-WEB integration support
  • Loading branch information
iimpulse authored Feb 7, 2024
2 parents 3321b53 + 5c6a3e4 commit 41ffc91
Show file tree
Hide file tree
Showing 60 changed files with 1,327 additions and 1,319,855 deletions.
78 changes: 78 additions & 0 deletions .github/workflows/network-etl-build-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Deploy Graph Container
on:
workflow_dispatch:
env:
GCLOUD_PROJECT_ID: ${{ secrets.GCLOUD_PROJECT_ID }}
GCLOUD_REGION: us-east1
GCLOUD_GCR: us-docker.pkg.dev
GCLOUD_REGISTRY_PROJECT_ID: ${{ secrets.GCLOUD_REGISTRY_PROJECT_ID }}
GCLOUD_REGISTRY_IMAGE_ENV: docker
GCLOUD_REGISTRY_IMAGE_PROJECT: ontology
SERVICE_NAME: ontology-annotation-network

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: temurin

- name: Authenticate to Google Cloud
uses: 'google-github-actions/auth@v1'
with:
credentials_json: '${{ secrets.GCLOUD_SA_KEY }}'

- name: Setup Google Cloud CLI
uses: 'google-github-actions/setup-gcloud@v1'
- name: Get project version
run: |
echo "PROJECT_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
- name: Maven Verify
run: mvn clean package -pl oan-etl -am

- name: Docker Login
run: |
gcloud auth configure-docker "${GCLOUD_GCR}"
- name: Start our builder database container
run: |
docker pull neo4j:community-bullseye
docker run -d --name=builder-neo4j -p7474:7474 -p7687:7687 -v ./neo4j/data:/data --env NEO4J_AUTH=neo4j/password neo4j:community-bullseye
- name: Fetch our data
run: sh oan-etl/update.sh oan-etl/data/

- name: Load our neo4j data
run: |
java -jar oan-etl/target/oan-etl-${PROJECT_VERSION}.jar -d=oan-etl/data
docker stop builder-neo4j
- name: Build And Push Docker Image
env:
TESTCONTAINERS_RYUK_DISABLED: true
run: |
echo "DOCKER_IMAGE=${GCLOUD_GCR}/${GCLOUD_REGISTRY_PROJECT_ID}/${GCLOUD_REGISTRY_IMAGE_ENV}/${GCLOUD_REGISTRY_IMAGE_PROJECT}/$SERVICE_NAME:PROJECT_VERSION" >> $GITHUB_ENV
docker build . --tag=${DOCKER_IMAGE}
docker push "${DOCKER_IMAGE}"
- name: Tag Artifact Registry
run: |
gcloud artifacts docker tags add "${DOCKER_IMAGE}" "${GCLOUD_GCR}/${GCLOUD_REGISTRY_PROJECT_ID}/${GCLOUD_REGISTRY_IMAGE_ENV}/${GCLOUD_REGISTRY_IMAGE_PROJECT}/$SERVICE_NAME:latest"
- name: Deploy Cloud Run
run: |
DOCKER_IMAGE_REPOSITORY=$(docker images --format "{{.Repository}}" | grep ontology-annotation-network-etl)
DOCKER_IMAGE=$(docker images --format "{{.Repository}}:{{.Tag}}" "${DOCKER_IMAGE_REPOSITORY}" )
gcloud run deploy $SERVICE_NAME --quiet \
--image "${DOCKER_IMAGE}" --project "${GCLOUD_PROJECT_ID}" \
--region "${GCLOUD_REGION}" --platform managed --allow-unauthenticated --format json \
--memory 2Gi --cpu 2 --min-instances 1 --max-instances 5 --no-cpu-throttling --ingress internal-and-cloud-load-balancing --service-account "${GCLOUD_SERVICE_ACCOUNT}"
echo "Invoke endpoint:"
gcloud run services list --platform managed --format json | jq -r \
'.[] | select(.metadata.name == "google-cloud-run-maven-test") | .status.address.url'
66 changes: 66 additions & 0 deletions .github/workflows/network-rest-build-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Build Ontology Annotation Network Rest
on:
workflow_dispatch:
env:
GCLOUD_PROJECT_ID: ${{ secrets.GCLOUD_PROJECT_ID }}
GCLOUD_REGION: us-east1
GCLOUD_GCR: us-docker.pkg.dev
GCLOUD_REGISTRY_PROJECT_ID: ${{ secrets.GCLOUD_REGISTRY_PROJECT_ID }}
GCLOUD_REGISTRY_IMAGE_ENV: docker
GCLOUD_REGISTRY_IMAGE_PROJECT: ontology
SERVICE_NAME: ontology-annotation-rest

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: temurin

- name: Authenticate to Google Cloud
uses: 'google-github-actions/auth@v1'
with:
credentials_json: '${{ secrets.GCLOUD_SA_KEY }}'

- name: Setup Google Cloud CLI
uses: 'google-github-actions/setup-gcloud@v1'
- name: Get project version
run: |
echo "PROJECT_VERSION=$(./gradlew properties -q | awk '/^version:/ {print $2}')" >> $GITHUB_ENV
- name: Maven Verify
run: mvn clean package -pl oan-rest -am

- name: Docker Login
run: |
gcloud auth configure-docker "${GCLOUD_GCR}"
- name: Build And Push Docker Image
env:
TESTCONTAINERS_RYUK_DISABLED: true
run: |
echo "DOCKER_IMAGE=${GCLOUD_GCR}/${GCLOUD_REGISTRY_PROJECT_ID}/${GCLOUD_REGISTRY_IMAGE_ENV}/${GCLOUD_REGISTRY_IMAGE_PROJECT}/$SERVICE_NAME:PROJECT_VERSION" >> $GITHUB_ENV
cd oan-rest/
docker build . --build-arg="VERSION_ARG=${PROJECT_VERSION}" --build-arg="MICRONAUT_ENV_ARG=production" --tag=${DOCKER_IMAGE}
docker push "${DOCKER_IMAGE}"
- name: Tag Artifact Registry
run: |
gcloud artifacts docker tags add "${DOCKER_IMAGE}" "${GCLOUD_GCR}/${GCLOUD_REGISTRY_PROJECT_ID}/${GCLOUD_REGISTRY_IMAGE_ENV}/${GCLOUD_REGISTRY_IMAGE_PROJECT}/$SERVICE_NAME:latest"
- name: Deploy Cloud Run
run: |
DOCKER_IMAGE_REPOSITORY=$(docker images --format "{{.Repository}}" | grep ontology-annotation-network-rest)
DOCKER_IMAGE=$(docker images --format "{{.Repository}}:{{.Tag}}" "${DOCKER_IMAGE_REPOSITORY}" )
gcloud run deploy $SERVICE_NAME --quiet \
--image "${DOCKER_IMAGE}" --project "${GCLOUD_PROJECT_ID}" \
--region "${GCLOUD_REGION}" --platform managed --allow-unauthenticated --format json \
--memory 2Gi --cpu 2 --min-instances 1 --max-instances 5 --no-cpu-throttling --service-account "${GCLOUD_SERVICE_ACCOUNT}"
echo "Invoke endpoint:"
gcloud run services list --platform managed --format json | jq -r \
'.[] | select(.metadata.name == "google-cloud-run-maven-test") | .status.address.url'
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ out/
.factorypath

oan-etl/data/
oan-rest/dependency-reduced-pom.xml
10 changes: 10 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Set up running image
FROM neo4j:community-bullseye

COPY ./neo4j/data/ /data
RUN neo4j-admin dbms set-initial-password password
EXPOSE 7474 7687

CMD ["neo4j", "start", "-d neo4j"]


13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,25 @@ Micronaut 4.1.2

### Modules

Pre-package modules using
```
./mvnw clean package -pl <module> -am
```

#### OAN-ETL
A ontologyModule to load our graph data which includes phenotypes, diseases, genes, assays. There
are multiple loaders for the different ontologies that are supported

Running

```
./gradlew oan-etl:run
java -jar oan-etl/target/<jar>
```

Testing

```
./gradlew oan-etl:test
./mvnw clean test -pl oan-etl -am
```

#### OAN-REST
Expand All @@ -36,11 +41,11 @@ Testing
Running

```
./gradlew oan-rest:run
java -jar oan-rest/target/<jar>
```

Testing

```
./gradlew oan-rest:test
./mvnw clean test -pl oan-rest -am
```
Loading

0 comments on commit 41ffc91

Please sign in to comment.