Save data and create new project with Docker setup

Enonic version: 6.8.0
OS: Linux/Docker

Hi !

I have a question about storing content in my app on local machine. I had setup enonic via https://github.com/enonic-cloud/docker-compose-enonic-xp. Almost everything works fine with default setup. But every time when I do “docker-composer down” all my data disappears ( and this is correct ). How can save it on my PC before stopping docker container ?

And second question is how to use toolbox with docker setup ?

Thank you !

Hi!

You can replace the storage volume with mapping to local filesystem on your docker host like this:

apache2:
  build: apache2
  hostname: awsome-xp-site.enonic.com
  restart: always
  ports:
    - "80:80"
  links:
    - exp
exp:
  build: exp
  restart: always
  ports:
    - "8080:8080"
  volumes:
    - "/<storage_dir>/work:/enonic-xp/home/work"
    - "/<storage_dir>/repo:/enonic-xp/home/repo"
  labels:
    io.enonic.backup.prescripts: "/usr/local/bin/backup.sh $ec_backup_user $ec_backup_password"
    io.enonic.backup.data: "/enonic-xp/home/snapshots,/enonic-xp/home/repo"
mail:
  image: enoniccloud/postfix
  hostname: awsome-xp-site.enonic.com
  restart: always

This will put the repo and work folder in the /<storage_dir>/ on yout docker host.

The toolbox util is located in “/enonic-xp/toolbox” folder in the exp container. You can execute it by the “docker exec” command directly as docker exec <exp_container> /enonic-xp/toolbox/toolbox.sh or by entering the container with the command docker exec -it <exp_container> bash

Hi Erik !

Thanks for your reply. I was able to make docker work together with gredlew deploy. However now I have another strange issue. Looks like that Enonic can’t handle my changes in “com.enonic.xp.web.vhost.cfg” file. It works only if I change volume.

BTW: I’m using docker compose version 2.

And this is my docker-compose.yml file:

version: ‘2’

volumes:
projectData:

services:
apache2:
build: apache2
hostname: site.name
ports:
- “81:80”
links:
- exp
restart: always
exp:
build: exp
ports:
- “8080:8080”
#labels:
# io.enonic.backup.prescripts: “/usr/local/bin/backup.sh $ec_backup_user $ec_backup_password”
# io.enonic.backup.data: “/enonic-xp/home/snapshots,/enonic-xp/home/repo”
volumes:
- “projectData:/enonic-xp/home”
- “./app:/home/app”
restart: always
exp_builder:
build: exp
volumes:
- “projectData:/enonic-xp/home”
- “./app:/home/app”
user: enonic-xp:1000
environment:
XP_HOME: /enonic-xp/home
command: “sh -c ‘cd /home/app/ && ./gradlew -t deploy’”
mail:
image: enoniccloud/postfix
hostname: site.name

P.S.: not a big deal - I can remove existing volume manually :slight_smile:

Not shure what you mean about change volume… do you have to delete the volume before the changes is read in enonic xp? or do you mean redeploying the exp container?

Yes. I need to remove volume and build a new one. This is not a big problem :slight_smile: