Search code examples
codenvy

How can I use Codenvy to run multiple published Docker Images?


I would like to use Codenvy as a development and test environment for a project with published Docker images.

Here is a simplified version of the docker-compose configuration that I would like to replicate on Codenvy.

services:
  dspacedb:
    image: dspace/dspace-postgres-pgcrypto
    volumes:
      - pgdata:/pgdata

  dspace:
    image: "dspace/dspace:dspace-6_x"
    ports:
      - 8080:8080
    volumes:
      - "assetstore:/dspace/assetstore"
      - "solr:/dspace/solr"
    depends_on:
      - dspacedb

Based on my testing, I am unable to define volumes for my images. Fortunately, the Codenvy workspace persists the state of my containers between executions.


Solution

  • Here is the solution that I have currently implemented. I am curious to learn if there is a better approach.

    1. Create a multi-machine stack that contains the desired images plus add an additional machine (eclipse/ubuntu_jdk8) to run the IDE.

      "recipe": {
        "type": "compose",
        "content": "services:\n dev-machine:\n  image: eclipse/ubuntu_jdk8\n dspacedb:\n  image: dspace/dspace-postgres-pgcrypto\n  mem_limit: 536870912\n dspace:\n  image: 'dspace/dspace:dspace-6_x'\n  mem_limit: 2147483648\n",
        "contentType": "application/x-yaml"
      },
      
    2. Explicitly create a "server" for the container that I wish to expose with a public URL.

        "dspace": {
          "attributes": {
            "memoryLimitBytes": "2684354560"
          },
          "servers": {
            "dspace": {
              "properties": {},
              "protocol": "http",
              "port": "8080"
            }
          },
      
    3. Create a workspace that uses this multi-machine image

    4. After starting the workspace, look at the workspace configuration to determine the public URL for the service.

    enter image description here

    1. Codenvy sets up a common SSH key on each container in the workspace. Using this key, I am able to transfer files between containers.