Skip to content

Installation using Docker

Adam Black edited this page Jan 11, 2024 · 6 revisions

How to deploy Arachne Datanode using Docker

These instructions are for Mac OS and Linux but should be very similar for Windows (with WSL). This page is a work in progress so 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
  • descriptor_base.json - A json file that specifies the default R environment

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
    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:latest
    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
      - /Users/adamblack/darwin/ArachneCompose:/dist # change this to your Arachne folder 
    environment:
      - RUNTIMESERVICE_DIST_VERBOSE_LOG=true
      - applyRuntimeDependenciesComparisonLogic=true
      - libraries.location.strategus=strategus
      - DOCKER_IMAGE_DEFAULT=executionengine.azurecr.io/darwin-base:v0.1 # change docker image here
      - ANALYSIS_MOUNT=/tmp/executions
      - DOCKER_ENABLE=true
      - RUNTIMESERVICE_DIST_ARCHIVEFOLDER=/dist/

  # Arachne Datanode Service
  arachne-datanode:
    image: odysseusinc/arachne-datanode-ce:latest
    platform: linux/amd64
    container_name: arachne-datanode
    restart: always
    networks:
      - arachne-network
    ports:
      - "127.0.0.1:81:8080" # Port mapping (host:container)
    volumes:
      - arachne-datanode-files:/var/arachne/files  # Volume mount for Arachne data
    env_file:
      - ~/darwin/ArachneCompose/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://host.docker.internal
datanode.port=8082
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
datanode_runMode=STANDALONE

[email protected]
datanode.users.admin.firstName=Datanode
datanode.users.admin.lastName=Admin
### example password is ohdsi, choose your own password and add it here after it has been hashed with bcrypt.
datanode.users.admin.password="$2a$10$JrltmCF6zqvfdpZTYOTM0uByU1Cx9C3X0x0iRQFqlXX3bTOEsWJae"
[email protected]
datanode.users.test.firstName=Test
datanode.users.test.lastName=Test
datanode.users.test.password=321

descriptor_base.json example

This can be downloaded from https://storage.googleapis.com/arachne-datanode/descriptor_base.json

This file contains a specification of R packages and versions. In prinicple this should match the default runtime Docker image specified with - 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.

I did encounter a bug where the admin password does not get populated in the database correctly and had to manually update it once we have the app running. We think this is fixed by surrounding the password value with quotes so you may not encounter this error.

datanode.users.admin.password="$2a$10$JrltmCF6zqvfdpZTYOTM0uByU1Cx9C3X0x0iRQFqlXX3bTOEsWJae" 

Now that you have a folder with the three required files and Docker installed we can start the app.

Open the terminal and navigate to the "Arachne" folder with the three files. The run the command docker compose up.

The images will be downloaded so internet access is required and the app 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:81

If you encountered an error when starting up the app try restarting the containers individually. Sometimes there is a conflict or issue that arises during startup that can be fixed just by restarting the individual containers. To restart the container run the following commands.

docker restart arachne-execution-engine
docker restart arachne-datanode

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:81: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

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

If this does not work then it is possible that the admin password did not get populated in the application database in which case it is possible to use docker exec and psql to jump into the arachne-datanode-postgres container and edit the users table with the correct encrypted password.

Clone this wiki locally