Skip to content

Installation using Docker

Konstantin Yaroshovets edited this page Oct 9, 2024 · 6 revisions

How to deploy Arachne Datanode using Docker

These instructions are for Mac OS and Linux and Windows (with WSL). If you find anything to be unclear, incorrect, or missing please open an issue on this repo.

First install Docker on your machine - https://docs.docker.com/engine/install/

Next create a new folder somewhere on your computer. We will call it "Arachne" for this example but you can name it whatever you like.

Inside the folder you created you will need to create three text files.

  • docker-compose.yml - A YAML file that specifies the docker images to deploy and how they communicate, and what files are mounted from the host system into the docker images.
  • datanode.env - The environment variables used to configure datanode

You will need to modify docker-compose.yml and datanode.env. There are examples in this repo and pasted below.

docker-compose.yml example

version: '3'
services:

  # Application Postgres Database
  arachne-datanode-postgres:
    image: postgres:15.5-alpine
    pull_policy: always
    container_name: arachne-datanode-postgres
    restart: always
    logging:
      options:
        max-size: 100m
    shm_size: "4g"
    networks:
      - arachne-network
    ports:
      - "127.0.0.1:5434:5432" # Port mapping (host:container)
    volumes:
      - arachne-pg-data:/var/lib/postgresql/data # Volume mount for Arachne PG data
    environment:
      POSTGRES_USER: ohdsi-user
      POSTGRES_PASSWORD: ohdsi-password
      POSTGRES_DB: arachne_datanode

  # Execution Engine
  arachne-execution-engine:
    image: odysseusinc/execution_engine:2.5.0
    pull_policy: always
    platform: linux/amd64
    container_name: arachne-execution-engine
    restart: always
    networks:
      - arachne-network
    ports:
      - "127.0.0.1:8888:8888"  # Port mapping (host:container)
    volumes:
      - /tmp:/tmp
      - /var/run/docker.sock:/var/run/docker.sock
      - /tmp/executions:/etc/executions
    environment:
      - applyRuntimeDependenciesComparisonLogic=true
      - libraries.location.strategus=strategus
      - DOCKER_IMAGE_DEFAULT=odysseusinc/r-hades:latest
      - DOCKER_IMAGE_FILTER=odysseusinc/r-hades(.+)
      - ANALYSIS_MOUNT=/tmp/executions
      - RUNTIMESERVICE_DIST_VERBOSE_LOG=true
      - RUNTIMESERVICE_DIST_ARCHIVEFOLDER=/runtimes/
      - RUNTIMESERVICE_DIST_DEFAULTDESCRIPTORFILE=descriptor_base.json

  # Arachne Datanode Service
  arachne-datanode:
    image: odysseusinc/arachne-datanode-ce:latest
    pull_policy: always
    container_name: arachne-datanode
    platform: linux/amd64
    restart: always
    networks:
      - arachne-network
    ports:
      - "8080:8080" # Port mapping (host:container)
    volumes:
      - arachne-datanode-files:/var/arachne/files  # Volume mount for Arachne data
    env_file:
      - datanode.env  # Environment variables file
    depends_on:
      - arachne-datanode-postgres
      - arachne-execution-engine

# Volumes for the services
volumes:
  arachne-pg-data:
  arachne-datanode-files:

# Network definition
networks:
  arachne-network:

datanode.env example

datanode.baseURL=http://arachne-datanode
datanode.port=8080
datanode.jwt.expiration=3600
datanode.runMode=STANDALONE
server.ssl.enabled=false

executionEngine.protocol=https
executionEngine.host=arachne-execution-engine
executionEngine.token=
executionEngine.port=8888

spring.datasource.url=jdbc:postgresql://arachne-datanode-postgres:5432/arachne_datanode
spring.datasource.username=ohdsi-user
spring.datasource.password=ohdsi-password
spring.datasource.driver-class-name=org.postgresql.Driver
spring.datasource.platform=postgresql
spring.datasource.spring.connection-test-query=select 1

spring.servlet.multipart.max-file-size=100MB
spring.servlet.multipart.max-request-size=100MB

jasypt.encryptor.password=arachne

authenticator.user.registrationStrategy=CREATE_IF_NOT_EXISTS
authenticator.methods.db.service=org.ohdsi.authenticator.service.jdbc.JdbcAuthService
authenticator.methods.db.config.jdbcUrl=jdbc:postgresql://arachne-datanode-postgres:5432/arachne_datanode
authenticator.methods.db.config.username=ohdsi-user
authenticator.methods.db.config.password=ohdsi-password
authenticator.methods.db.config.query=select password, id, first_name as firstname, last_name as lastname, email from users where username=:username
authenticator.methods.db.config.passwordEncoder=org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder
authenticator.methods.db.config.fieldsToExtract.firstName=firstname
authenticator.methods.db.config.fieldsToExtract.lastName=lastname
authenticator.methods.db.config.fieldsToExtract.email=email

security.method=db
[email protected]
datanode.users.admin.firstName=Datanode
datanode.users.admin.lastName=Admin
datanode.users.admin.password='$2a$10$JrltmCF6zqvfdpZTYOTM0uByU1Cx9C3X0x0iRQFqlXX3bTOEsWJae' # Bcrypt format

Staring Application Stack

Run the following command inside the directory:

docker compose -d up

The images will be downloaded so internet access is required and the application will start up.

If you did not change the port mapping in the docker compose file the app should be available at this link on your local machine at http://127.0.0.1:8080

The default admin login will be username: admin password: ohdsi

Runtime Environments

Runtime environment is a Docker image with preinstalled R and OHDSI R packages (HADES). The image is used to run the Docker container and execute the submitted analysis inside it. You can configure your own or one of the community images: - DOCKER_IMAGE_DEFAULT=executionengine.azurecr.io/darwin-base:v0.1 above.

There are several runtime images that can be used maintained by different people in the community including Odysseus, Broadsea, and Darwin. You can also build your own runtime environment and plug it into Arachne which is described in a different section of the wiki.

Notes

datanode.users.admin.password needs to be encrypted using bcyrpt which can be done online. https://www.javainuse.com/onlineBcrypt.

You may encounter a port conflict if you already have something running on port 81. In that case simply change the port in the docker compose file.

For example change

    - "127.0.0.1:8080:8080" # Port mapping (host:container)

to

    - "127.0.0.1:8081:8080" # Port mapping (host:container)

and the app will be available on port 8081

Additional links

https://github.com/OHDSI/Arachne/tree/documentation/install/docker - contains example docker-compose files.