How do I persist data within a Codenvy/Che Workspace?

582 views Asked by At

I have a workspace with the following config

{
  "environments": {
    "default": {
      "machines": {
        "db": {
          "attributes": {
            "memoryLimitBytes": "536870912"
          },
          "servers": {},
          "agents": [
            "org.eclipse.che.terminal",
            "org.eclipse.che.exec"
          ]
        },
        "dev-machine": {
          "attributes": {
            "memoryLimitBytes": "2684354560"
          },
          "servers": {},
          "agents": [
            "org.eclipse.che.ssh",
            "org.eclipse.che.ws-agent",
            "org.eclipse.che.terminal",
            "org.eclipse.che.exec"
          ]
        }
      },
      "recipe": {
        "type": "compose",
        "content": "services:\n db:\n  image: 'terrywbrady/dspacedb:latest'\n  mem_limit: 1073741824\n dev-machine:\n  image: 'terrywbrady/dspace:latest'\n  mem_limit: 2147483648\n  depends_on:\n   - db\n",
        "contentType": "application/x-yaml"
      }
    }
  },
  ...
}

I can start my workspace, build code, and deploy to tomcat. Data is written to postgres.

When I halt my workspace and then restart it, all of my built content is gone.

How can I declare volumes that will persist from workspace session to workspace session?

1

There are 1 answers

2
gaal On

It really depends on a Che flavor and version you are using. Is it local Che? Which version of Che? Is it hosted at codenvy.com? Is it on Docker or openshift or kubernetes? Depending on this I can help you figuring out what to do.

So looks like there are couple of ppl that run different flavours of Che. And there are other flavors which could be interesting for other ppl.

For codenvy there are 2 solution (it runs enterprise grade modification of Che 5): - snapshot workspaces - configure software to persist data in /projects folder which is automatically synced

For local Che 6 (which has all the enterprise stuff and more out of the box) it is better to follow thread on GitHub. There is no snapshotting functionality but it allows to configure volumes for custom paths. Depending on a platform that runs Che 6 (Docker, Kubernetes, Openshift) you might need to additionally configure Che to achieve persistence in a way that fit your needs best. To get more info it is better to ask on GitHub since all the maintainers track it.