These steps will help as a guide to restore dotCMS dataset (database and assets) using docker-compose, on local machine for testing purposes.
Install docker:
Follow the steps here: https://docs.docker.com/engine/install/
Install docker-compose:
Follow the steps here: https://docs.docker.com/compose/install/
docker-compose File
a. Once that docker and docker compose is installed, copy this docker-compose file to use it as example and change as needed:
version: '3.5' networks: http_net: db_net: es_net: services: ################################################################################ elasticsearch: image: dotcms/es-open-distro:1.3.0 environment: - cluster.name=elastic-cluster - discovery.type=single-node - data - bootstrap.memory_lock=true - "ES_JAVA_OPTS=-Xmx3G " ulimits: memlock: soft: -1 hard: -1 nofile: soft: 65536 hard: 65536 networks: - es_net ################################################################################ dotcms: image: dotcms/dotcms:5.3.8.2 environment: "CMS_HEAP_SIZE": '7g' "CMS_JAVA_OPTS": '-XX:+PrintFlagsFinal' "PROVIDER_DB_DNSNAME": 'db' "PROVIDER_DB_PASSWORD": 'db_pass' "PROVIDER_ELASTICSEARCH_ENDPOINTS": 'https://elasticsearch:9200' "DOT_DOTGENERATED_DEFAULT_PATH": 'shared' depends_on: - db - elasticsearch volumes: - ./shared:/data/shared - ./logs:/srv/dotserver/tomcat-8.5.32/logs networks: - db_net - es_net - http_net ports: - "8080:8080" ################################################################################ db: image: dotcms/postgres:12 command: postgres -c 'max_connections=400' -c 'shared_buffers=512MB' -c 'effective_cache_size=1536MB' -c 'maintenance_work_mem=128MB' environment: "POSTGRES_USER": 'dotcmsdbuser' "POSTGRES_PASSWORD": 'db_pass' "POSTGRES_DB": 'dotcms' networks: - db_net restart: "unless-stopped" ports: - "5432:5432"
b. Create the directory paths
shared
andlogs
on the same path that thedocker-compose.ym
file will read from:mkdir shared logs
c. You will want to create an assets directory under the
shared
path like this:./shared/assets/
and place the assets from your dataset on that folder.d. If there are any Dynamic Plugins (OSGi) put them in the
./shared/felix/load/
directory and for any undeployed (OSGI) put them in./shared/felix/undeployed/
e. Change the permissions on the
shared
andlogs
paths to userid and groupid1000000000
, which is the userid that dotCMS runs inside the container:sudo chown -R 1000000000.1000000000 shared sudo chown -R 1000000000.1000000000 logs
You should have something like this:
dotcms-standalone $ ls -lha total 20K drwxrwxr-x 4 dotcmsuser dotcmsuser 4.0K Jan 8 14:31 . drwxrwxr-x 4 dotcmsuser dotcmsuser 4.0K Jan 7 08:46 .. -rw-rw-r-- 1 dotcmsuser dotcmsuser 1.7K Jan 7 14:43 docker-compose.yml drwxrwxr-x 2 1000000000 1000000000 4.0K Jan 8 14:31 logs drwxrwxr-x 2 1000000000 1000000000 4.0K Jan 8 14:31 shared
f. For now, just start the DB container to restore the database (use
-d
to run it as daemon):docker-compose up db
g. Restore the database by connecting with the credentials on the
docker-compose.yml
file just like you would restore any other DB dump in Postgresql:Password for user dotcmsdbuser: psql (12.5 (Ubuntu 12.5-0ubuntu0.20.10.1), server 12.4 (Debian 12.4-1.pgdg100+1)) Type "help" for help. dotcms=# \i dotcms-prod-restore.sql
h. Stop the
docker-compose
withstop
or control + c, if it was not running as daemondocker-compose stop
i. Start the
docker-compose
with all the services (use -d to run it as daemon):docker-compose up -d
j. At this point you should be able to access your dotCMS instance running with the restore dataset by accessing http://localhost:8080 in the browser.
NOTE: This is an example for running dotCMS as testing purposes this should not be used as a production environment.