Hi Chris,
I am trying to migrate an existing Trudesk (1.1.11) natively installed on a VM to Trudesk (1.2.2) on Docker. I’ve upgraded the native Trudesk (1.1.11 to 1.2.2) successfully - tested.
I turned off Trudesk (1.2.2 upgrade) native and archived it.
I created a new instance of Trudesk (1.2.2 fresh install) and connect it to the existing database (MongoDB also natively installed), and I was asked to choose whether to do a fresh install or use the existing database. I chose the existing database and I was able to get to the site like the one before (the one archived).
Next, I turned off the 2nd native Trudesk instand and spun up Docker Trudesk (1.2.2) and try to connect to the same database. This time, the existing database is not detected and I only was given option to do fresh install.
Question: Is there a reason why the Docker version can’t detect the pre-existing Trudesk DB while the one natively installed can?
Environment:
The native VM/Docker Host: Debian Bullseye
Node: LTS
Thank you in advance.
Yes, there is a flag set when using docker which allows a little more info stored in the DB instead of the filesystem due to how containers work.
The best way to migrate is to take a backup of your trudesk instance using the Settings -> Backup/Restore
option and then download/move the backup file to the directory you mount for the backup volume. (ex: /data/trudesk/backups
)
Once moved into the backup directory, deploy a fresh install of the docker configuration, and during the install wizard select New Database
. Once you’re logged in to the new/fresh instance, head over to Settings -> Backup/Restore
, and you should see your backup file already there and should be able to restore. (If it is not visible you can choose to upload the backup file)
This is a complete restore of your database, assets such as images and attachments, etc.
Thank you for taking time to explain the steps Chirs. Will give it a try.
I have since built my own Trudesk Docker image with the following Dockerfile (slightly different from yours) and it works just as if it was installed natively.
FROM node:16.14-alpine AS BUILD_IMAGE
WORKDIR /usr/src/trudesk
RUN apk add --no-cache ca-certificates bash curl mongodb-tools && rm -rf /tmp/*
# install node-prune (https://github.com/tj/node-prune)
RUN curl -sfL https://gobinaries.com/tj/node-prune | bash -s -- -b /usr/local/bin
COPY package.json yarn.lock ./
# install dependencies
RUN yarn --frozen-lockfile
COPY . .
# lint & test (skip this for now)
# RUN yarn lint & yarn test
# build application
RUN yarn build
# remove development dependencies
RUN npm prune --prod
# run node prune
RUN /usr/local/bin/node-prune
FROM node:16.14-alpine
WORKDIR /usr/src/trudesk
RUN apk add --no-cache ca-certificates bash mongodb-tools && rm -rf /tmp/*
# copy from build image
COPY --from=BUILD_IMAGE /usr/src/trudesk .
EXPOSE 8118
CMD [ "/bin/bash", "/usr/src/trudesk/startup.sh" ]
Thanks.
Hi Chris,
I tried to follow the steps you gave earlier. I am now using the latest version/tag: 1.2.3. Everything went well until it’s time to look for the backup. I have copied the backup to the Docker volume mapped to the uploads folder within the container. But Trudesk did not display it as currently stored backups. So, I tried to upload it but got the following notification:
I checked the log inside the container and got the followings:
05-31-2022 13:36:12 [19] info: . .o8 oooo
05-31-2022 13:36:12 [19] info: .o8 "888 `888
05-31-2022 13:36:12 [19] info: .o888oo oooo d8b oooo oooo .oooo888 .ooooo. .oooo.o 888 oooo
05-31-2022 13:36:12 [19] info: 888 `888""8P `888 `888 d88' `888 d88' `88b d88( "8 888 .8P'
05-31-2022 13:36:12 [19] info: 888 888 888 888 888 888 888ooo888 `"Y88b. 888888.
05-31-2022 13:36:12 [19] info: 888 . 888 888 888 888 888 888 .o o. )88b 888 `88b.
05-31-2022 13:36:12 [19] info: "888" d888b `V88V"V8P' `Y8bod88P" `Y8bod8P' 8""888P' o888o o888o
05-31-2022 13:36:12 [19] info: ==========================================================================
05-31-2022 13:36:12 [19] info: trudesk v1.2.3 Copyright (C) 2014-2022 Chris Brame
05-31-2022 13:36:12 [19] info:
05-31-2022 13:36:12 [19] info: Running in: production
05-31-2022 13:36:12 [19] info: Server Time: Tue May 31 2022 13:36:12 GMT+0000 (Coordinated Universal Time)
05-31-2022 13:36:13 [19] info: Connected to MongoDB
05-31-2022 13:36:16 [19] info: SocketServer Running
05-31-2022 13:36:17 [19] info: TruDesk is now listening on port: 8118
05-31-2022 13:36:17 [19] info: trudesk Ready
TypeError: Busboy is not a constructor
at backupRestore.uploadBackup (/usr/src/trudesk/src/controllers/backuprestore.js:205:18)
at Layer.handle [as handle_request] (/usr/src/trudesk/node_modules/express/lib/router/layer.js:95:5)
at next (/usr/src/trudesk/node_modules/express/lib/router/route.js:137:13)
at middleware.isAdmin (/usr/src/trudesk/src/middleware/middleware.js:229:28)
at Layer.handle [as handle_request] (/usr/src/trudesk/node_modules/express/lib/router/layer.js:95:5)
at next (/usr/src/trudesk/node_modules/express/lib/router/route.js:137:13)
at middleware.api (/usr/src/trudesk/src/middleware/middleware.js:182:12)
at Layer.handle [as handle_request] (/usr/src/trudesk/node_modules/express/lib/router/layer.js:95:5)
at next (/usr/src/trudesk/node_modules/express/lib/router/route.js:137:13)
at Route.dispatch (/usr/src/trudesk/node_modules/express/lib/router/route.js:112:3)
at Layer.handle [as handle_request] (/usr/src/trudesk/node_modules/express/lib/router/layer.js:95:5)
at /usr/src/trudesk/node_modules/express/lib/router/index.js:281:22
at Function.process_params (/usr/src/trudesk/node_modules/express/lib/router/index.js:341:12)
at next (/usr/src/trudesk/node_modules/express/lib/router/index.js:275:10)
at Function.handle (/usr/src/trudesk/node_modules/express/lib/router/index.js:174:3)
at router (/usr/src/trudesk/node_modules/express/lib/router/index.js:47:12)
at Layer.handle [as handle_request] (/usr/src/trudesk/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/usr/src/trudesk/node_modules/express/lib/router/index.js:323:13)
at /usr/src/trudesk/node_modules/express/lib/router/index.js:284:7
at Function.process_params (/usr/src/trudesk/node_modules/express/lib/router/index.js:341:12)
at next (/usr/src/trudesk/node_modules/express/lib/router/index.js:275:10)
at /usr/src/trudesk/src/middleware/index.js:119:20
TypeError: Busboy is not a constructor
at backupRestore.uploadBackup (/usr/src/trudesk/src/controllers/backuprestore.js:205:18)
at Layer.handle [as handle_request] (/usr/src/trudesk/node_modules/express/lib/router/layer.js:95:5)
at next (/usr/src/trudesk/node_modules/express/lib/router/route.js:137:13)
at middleware.isAdmin (/usr/src/trudesk/src/middleware/middleware.js:229:28)
at Layer.handle [as handle_request] (/usr/src/trudesk/node_modules/express/lib/router/layer.js:95:5)
at next (/usr/src/trudesk/node_modules/express/lib/router/route.js:137:13)
at middleware.api (/usr/src/trudesk/src/middleware/middleware.js:182:12)
at Layer.handle [as handle_request] (/usr/src/trudesk/node_modules/express/lib/router/layer.js:95:5)
at next (/usr/src/trudesk/node_modules/express/lib/router/route.js:137:13)
at Route.dispatch (/usr/src/trudesk/node_modules/express/lib/router/route.js:112:3)
at Layer.handle [as handle_request] (/usr/src/trudesk/node_modules/express/lib/router/layer.js:95:5)
at /usr/src/trudesk/node_modules/express/lib/router/index.js:281:22
at Function.process_params (/usr/src/trudesk/node_modules/express/lib/router/index.js:341:12)
at next (/usr/src/trudesk/node_modules/express/lib/router/index.js:275:10)
at Function.handle (/usr/src/trudesk/node_modules/express/lib/router/index.js:174:3)
at router (/usr/src/trudesk/node_modules/express/lib/router/index.js:47:12)
at Layer.handle [as handle_request] (/usr/src/trudesk/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/usr/src/trudesk/node_modules/express/lib/router/index.js:323:13)
at /usr/src/trudesk/node_modules/express/lib/router/index.js:284:7
at Function.process_params (/usr/src/trudesk/node_modules/express/lib/router/index.js:341:12)
at next (/usr/src/trudesk/node_modules/express/lib/router/index.js:275:10)
at /usr/src/trudesk/src/middleware/index.js:119:20
TypeError: Busboy is not a constructor
at backupRestore.uploadBackup (/usr/src/trudesk/src/controllers/backuprestore.js:205:18)
at Layer.handle [as handle_request] (/usr/src/trudesk/node_modules/express/lib/router/layer.js:95:5)
at next (/usr/src/trudesk/node_modules/express/lib/router/route.js:137:13)
at middleware.isAdmin (/usr/src/trudesk/src/middleware/middleware.js:229:28)
at Layer.handle [as handle_request] (/usr/src/trudesk/node_modules/express/lib/router/layer.js:95:5)
at next (/usr/src/trudesk/node_modules/express/lib/router/route.js:137:13)
at middleware.api (/usr/src/trudesk/src/middleware/middleware.js:182:12)
at Layer.handle [as handle_request] (/usr/src/trudesk/node_modules/express/lib/router/layer.js:95:5)
at next (/usr/src/trudesk/node_modules/express/lib/router/route.js:137:13)
at Route.dispatch (/usr/src/trudesk/node_modules/express/lib/router/route.js:112:3)
at Layer.handle [as handle_request] (/usr/src/trudesk/node_modules/express/lib/router/layer.js:95:5)
at /usr/src/trudesk/node_modules/express/lib/router/index.js:281:22
at Function.process_params (/usr/src/trudesk/node_modules/express/lib/router/index.js:341:12)
at next (/usr/src/trudesk/node_modules/express/lib/router/index.js:275:10)
at Function.handle (/usr/src/trudesk/node_modules/express/lib/router/index.js:174:3)
at router (/usr/src/trudesk/node_modules/express/lib/router/index.js:47:12)
at Layer.handle [as handle_request] (/usr/src/trudesk/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/usr/src/trudesk/node_modules/express/lib/router/index.js:323:13)
at /usr/src/trudesk/node_modules/express/lib/router/index.js:284:7
at Function.process_params (/usr/src/trudesk/node_modules/express/lib/router/index.js:341:12)
at next (/usr/src/trudesk/node_modules/express/lib/router/index.js:275:10)
at /usr/src/trudesk/src/middleware/index.js:119:20
Not sure what went wrong …
Will try to use the Docker Image I built previously (1.2.2) and see if I can reproduce the same issue.
Thanks.
Chris,
I’ve tried to carry out the same steps you gave on the Docker Image I built (with the Dockerfile I posted previously) and everything works out as you described.
Reading on the web, the cause for the TypeError: Busboy is not a constructor
could be because one (or more) of the dependencies’ (node_modules) version might have changed between the time you finished building your code and the time you created the Docker Image. For me, I “lock” my package.json to make sure I avoid this possible cause.