enonic / cli-enonic

GNU General Public License v3.0
41 stars 1 forks source link

dump load command fails on non-sandbox instance of XP #178

Closed alansemenov closed 4 years ago

alansemenov commented 4 years ago

This was initiated from a thread on Slack and then support case in Zendesk: https://enonic.zendesk.com/agent/tickets/3173.

Basically, customer tried to use CLI purely to load 6.15 dump into XP instance on a production server. CLI response was that it failed to find dump files.

Enonic version: 7.1.0, cli v.1.0.12
OS: Ubuntu bionic 18.04.3 lts

XP = /opt/enonic-xp-linux-server-7.1.0
XP_HOME = /var/enonic-xp/kmd

init-script: https://gist.github.com/oc/b0e77b6575903b2303648e37e9599a40

Config:

root@test:/var/enonic-xp/kmd/config# grep -vE '^$|\s+*#' *cfg
com.enonic.xp.app.main.cfg:tourDisabled = false
com.enonic.xp.app.standardidprovider.cfg:loginWithoutUser=false
com.enonic.xp.blobstore.cfg:provider = file
com.enonic.xp.blobstore.cfg:cache = true
com.enonic.xp.blobstore.cfg:cache.sizeThreshold = 1mb
com.enonic.xp.blobstore.cfg:cache.memoryCapacity = 100mb
com.enonic.xp.blobstore.file.cfg:baseDir = ${xp.home}/repo/blob
com.enonic.xp.mail.cfg:smtpHost= localhost
com.enonic.xp.mail.cfg:smtpPort= 25
com.enonic.xp.mail.cfg:smtpAuth= false
com.enonic.xp.mail.cfg:smtpUser=
com.enonic.xp.mail.cfg:smtpPassword=
com.enonic.xp.mail.cfg:smtpTLS= false
com.enonic.xp.market.cfg:marketUrl = https://market.enonic.com/applications
com.enonic.xp.repo.cfg:snapshots.dir = ${xp.home}/snapshots
com.enonic.xp.server.shell.cfg:enabled = false
com.enonic.xp.server.shell.cfg:telnet.ip = 127.0.0.1
com.enonic.xp.server.shell.cfg:telnet.port = 5555
com.enonic.xp.server.shell.cfg:telnet.maxConnect = 2
com.enonic.xp.server.shell.cfg:telnet.socketTimeout = 0
com.enonic.xp.server.trace.cfg:enabled = false
com.enonic.xp.server.udc.cfg:enabled = true
com.enonic.xp.web.dos.cfg:enabled = false
com.enonic.xp.web.dos.cfg:maxRequestsPerSec = 25
com.enonic.xp.web.dos.cfg:delayMs = 100
com.enonic.xp.web.dos.cfg:maxWaitMs = 50
com.enonic.xp.web.dos.cfg:throttledRequests = 5
com.enonic.xp.web.dos.cfg:throttleMs = 30000
com.enonic.xp.web.dos.cfg:maxRequestMs = 30000
com.enonic.xp.web.dos.cfg:maxIdleTrackerMs = 30000
com.enonic.xp.web.dos.cfg:insertHeaders = true
com.enonic.xp.web.dos.cfg:trackSessions = true
com.enonic.xp.web.dos.cfg:remotePort = false
com.enonic.xp.web.dos.cfg:ipWhitelist =
com.enonic.xp.web.jetty.cfg:host = localhost
com.enonic.xp.web.jetty.cfg:timeout = 60000
com.enonic.xp.web.jetty.cfg:sendServerHeader = false
com.enonic.xp.web.jetty.cfg:http.enabled = true
com.enonic.xp.web.jetty.cfg:http.xp.port = 8080
com.enonic.xp.web.jetty.cfg:http.management.port = 4848
com.enonic.xp.web.jetty.cfg:http.monitor.port = 2609
com.enonic.xp.web.jetty.cfg:http.requestHeaderSize = 32000
com.enonic.xp.web.jetty.cfg:http.responseHeaderSize = 32000
com.enonic.xp.web.jetty.cfg:session.timeout = 120
com.enonic.xp.web.jetty.cfg:session.cookieName = JSESSIONID
com.enonic.xp.web.jetty.cfg:gzip.enabled = true
com.enonic.xp.web.jetty.cfg:gzip.minSize = 16
com.enonic.xp.web.jetty.cfg:log.enabled = false
com.enonic.xp.web.jetty.cfg:log.file = ${xp.home}/logs/jetty-yyyy_mm_dd.request.log
com.enonic.xp.web.jetty.cfg:log.append = true
com.enonic.xp.web.jetty.cfg:log.extended = true
com.enonic.xp.web.jetty.cfg:log.timeZone = Europe/Copenhagen
com.enonic.xp.web.jetty.cfg:log.retainDays = 60
com.enonic.xp.web.vhost.cfg:enabled = true
com.enonic.xp.web.vhost.cfg:mapping.kmd.host = test.kmd.uib.no
com.enonic.xp.web.vhost.cfg:mapping.kmd.source = /
com.enonic.xp.web.vhost.cfg:mapping.kmd.target = /site/default/master/kmd
com.enonic.xp.web.vhost.cfg:mapping.admin.host = test.kmd.uib.no
com.enonic.xp.web.vhost.cfg:mapping.admin.source = /admin
com.enonic.xp.web.vhost.cfg:mapping.admin.target = /admin
com.enonic.xp.web.vhost.cfg:mapping.admin.idProvider.system = default
com.enonic.xp.web.vhost.cfg:mapping.sar2020.host = sar2020.test.kmd.uib.no
com.enonic.xp.web.vhost.cfg:mapping.sar2020.source = /
com.enonic.xp.web.vhost.cfg:mapping.sar2020.target = /site/default/master/sites/sar2020
com.enonic.xp.web.vhost.cfg:mapping.event-test.host = event.test.kmd.uib.no
com.enonic.xp.web.vhost.cfg:mapping.event-test.source = /
com.enonic.xp.web.vhost.cfg:mapping.event-test.target = /site/default/master/sites/event
# grep -vE '^$|\s+*#' *properties
xp.name = kmd
xp.suPassword = {sha1}db970edf4efffffb9ff01ff30ff40ff0ff5f2fd1f
xp.init.adminUserCreation = true

Bug: enonic cli doesn't seem to communicate properly with enonic XP (:4848?)

root@test:/var/enonic-xp/kmd# env | grep -E 'ENON|XP'
ENONIC_CLI_REMOTE_USER=su
ENONIC_CLI_REMOTE_PASS=**********
XP=/opt/enonic-xp-linux-server-7.1.0
XP_HOME=/var/enonic-xp/kmd

root@test:/var/enonic-xp/kmd# enonic dump load
? WARNING: This will delete all existing repositories that also present in the system-dump. Continue ? Yes
Error reading dumps folder: open /var/enonic-xp/kmd/data/dump: no such file or directory
No existing dumps found

root@test:/var/enonic-xp/kmd# enonic system info
Loading...{
"Version": "7.1.0",
"Installation": "kmd",
"RunMode": "PROD",
"Build": {
"Hash": "a82ef81aa84156b792d97ad173e3038f906f9fba",
"ShortHash": "a82ef81",
"Branch": "master",
"Timestamp": "2019-09-17T14:57:43+0200"
}
}
pmi commented 4 years ago

Judging by the following he used snapcraft to install CLI

# which enonic
/snap/bin/enonic

Snapcraft restricts us to accessing home folder only, thus his enonic home folder /var/enonic-xp/kmd is not accessible by CLI

I see 2 possible fixes:

  1. Install CLI manually (not through snapcraft)
  2. Move home folder somewhere under /home/ folder
alansemenov commented 4 years ago

The reason was in folder access limitation from snapcraft