Long Deploy Time (Docker)

I checked and it did say I needed a reboot. I rebooted and it said it was successful but then gave me an ECON error when I tried to deploy.

Restarted Wappler and checked and it didn’t say it needed a reboot so I tried to deploy but deploy is currently at 7 min already.

Now if I try to reboot the server I get

Rebooting server SkinsClickCom ...
Error: read ECONNRESET at __node_internal_captureLargerStackTrace (node:internal/errors:464:5) at __node_internal_errnoException (node:internal/errors:594:12) at TCP.onStreamRead (node:internal/stream_base_commons:220:20)
Error: Connection lost before handshake at makeError (C:\Users\Eric\AppData\Local\Wappler\resources\app\node_modules\ssh2\lib\protocol\utils.js:142:15) at C:\Users\Eric\AppData\Local\Wappler\resources\app\node_modules\ssh2\lib\client.js:693:13 at Socket.<anonymous> (C:\Users\Eric\AppData\Local\Wappler\resources\app\node_modules\ssh2\lib\client.js:755:7) at Socket.emit (node:events:390:28) at TCP.<anonymous> (node:net:687:12)
Reboot of server SkinsClickCom completed
Rebooting server SkinsClickCom ...
Reboot of server SkinsClickCom completed
Error: connect ECONNREFUSED 142.93.119.120:22 at __node_internal_captureLargerStackTrace (node:internal/errors:464:5) at __node_internal_exceptionWithHostPort (node:internal/errors:642:12) at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1161:16)

Would this be related to long deploy time?

Unlikely, seems the errors are due to connection failures due to the server rebooting (if you reboot the server, then it doesn’t answer any connections for a few seconds)

Can you try to find a Dockerfile file inside the .wappler directory? It should be in your targets, in a folder “Live”, if you paste it here I can modify it

This file?

Close, should be near! The file is really named “Dockerfile”, check the app or web folders

Here it is

FROM node:16-bullseye-slim

ARG NODE_ENV=production

ENV NODE_ENV $NODE_ENV

ARG PORT=3000

ENV PORT $PORT

EXPOSE $PORT

RUN mkdir /opt/node_app

COPY ./ /opt/node_app/

ENV PATH /opt/node_app/node_modules/.bin:$PATH

WORKDIR /opt/node_app

RUN npm install --no-optional --production --no-package-lock

CMD [ "nodemon", "./index.js" ]

is this something I would have to do on all my projects?

A post was split to a new topic: Optimize docker NodeJS deployments

Getting


[+] Building 1.7s (6/10)
[+] Building 1.8s (7/10)
[+] Building 1.8s (8/10)
 => [internal] load build definition from Dockerfile                                                                                             0.7s 
 => => transferring dockerfile: 394B                                                                                                             0.2s 
 => [internal] load .dockerignore                                                                                                                0.7s 
 => => transferring context: 34B                                                                                                                 0.1s 
 => [internal] load metadata for docker.io/library/node:16-bullseye-slim                                                                         0.7s 
 => [1/6] FROM docker.io/library/node:16-bullseye-slim@sha256:97de7e6381540b593c55cd628a44ddffacdbadf9d3ba2f56b56f4913d8f95541                   0.0s 
 => [internal] load build context                                                                                                                0.2s 
 => => transferring context: 8.40kB                                                                                                              0.2s 
 => CACHED [2/6] RUN mkdir /opt/node_app                                                                                                         0.0s 
 => [3/6] WORKDIR /opt/node_app                                                                                                                  0.1s 
 => ERROR [4/6] COPY package.json package-lock.json ./                                                                                           0.0s 
------
 > [4/6] COPY package.json package-lock.json ./:
------
failed to solve: failed to compute cache key: "/package-lock.json" not found: not found
Error Launching Services!

Hm… Sorry about that, try this:

FROM node:16-bullseye-slim

ARG NODE_ENV=production
ENV NODE_ENV $NODE_ENV

ARG PORT=3000
ENV PORT $PORT
EXPOSE $PORT

RUN mkdir /opt/node_app
ENV PATH /opt/node_app/node_modules/.bin:$PATH

WORKDIR /opt/node_app

COPY package.json ./
RUN npm install --no-optional --production --no-package-lock

COPY . .
CMD [ "nodemon", "./index.js" ]

Also, repeat the step of switching to local environment, and switching back to Live

Looks to be working. Thanks for your help! Will report back when deploy is done.

1 Like

Got this

[+] Building 956.8s (8/10)
 => [internal] load .dockerignore                                                                                                                0.8s 
 => => transferring context: 34B                                                                                                                 0.1s 
 => [internal] load build definition from Dockerfile                                                                                             0.8s 
 => => transferring dockerfile: 376B                                                                                                             0.2s 
 => [internal] load metadata for docker.io/library/node:16-bullseye-slim                                                                         0.2s 
 => [1/6] FROM docker.io/library/node:16-bullseye-slim@sha256:97de7e6381540b593c55cd628a44ddffacdbadf9d3ba2f56b56f4913d8f95541                   0.0s 
 => [internal] load build context                                                                                                                0.1s 
 => => transferring context: 8.40kB                                                                                                              0.1s 
[+] Building 956.8s (9/10)
 => [internal] load .dockerignore                                                                                                                0.8s 
 => => transferring context: 34B                                                                                                                 0.1s 
 => [internal] load build definition from Dockerfile                                                                                             0.8s 
 => => transferring dockerfile: 376B                                                                                                             0.2s 
 => [internal] load metadata for docker.io/library/node:16-bullseye-slim                                                                         0.2s 
 => [1/6] FROM docker.io/library/node:16-bullseye-slim@sha256:97de7e6381540b593c55cd628a44ddffacdbadf9d3ba2f56b56f4913d8f95541                   0.0s 
 => [internal] load build context                                                                                                                0.1s 
 => => transferring context: 8.40kB                                                                                                              0.1s 
 => CACHED [2/6] RUN mkdir /opt/node_app                                                                                                         0.0s 
 => CACHED [3/6] WORKDIR /opt/node_app                                                                                                           0.0s 
 => [4/6] COPY package.json ./                                                                                                                   0.0s 
 => ERROR [5/6] RUN npm install --no-optional --production --no-package-lock                                                                   955.4s 
------
 > [5/6] RUN npm install --no-optional --production --no-package-lock:
#0 2.419 npm WARN config optional Use `--omit=optional` to exclude optional dependencies, or
#0 2.419 npm WARN config `--include=optional` to include them.
#0 2.419 npm WARN config
#0 2.419 npm WARN config     Default value does install optional deps unless otherwise omitted.
#0 2.419 npm WARN config production Use `--omit=dev` instead.
#0 952.9 npm notice 
#0 952.9 npm notice New major version of npm available! 8.19.3 -> 9.5.1
#0 952.9 npm notice Changelog: <https://github.com/npm/cli/releases/tag/v9.5.1>
#0 952.9 npm notice Run `npm install -g npm@9.5.1` to update!
#0 952.9 npm notice 
#0 953.2 npm ERR! code ECONNRESET
#0 953.5 npm ERR! network aborted
#0 953.5 npm ERR! network This is a problem related to network connectivity.
#0 953.5 npm ERR! network In most cases you are behind a proxy or have bad network settings.
#0 953.9 npm ERR! network 
#0 953.9 npm ERR! network If you are behind a proxy, please make sure that the
#0 953.9 npm ERR! network 'proxy' config is set properly.  See: 'npm help config'
#0 954.8 
#0 955.0 npm ERR! A complete log of this run can be found in:
#0 955.0 npm ERR!     /root/.npm/_logs/2023-02-26T04_06_12_668Z-debug-0.log
------
failed to solve: executor failed running [/bin/sh -c npm install --no-optional --production --no-package-lock]: exit code: 1
Error Launching Services!

Sounds like it’s not slow anymore, now it’s completely broken :frowning:

It’s not a fault of the Dockerfile I supplied, you can keep using it

Would you maybe be able to deploy the VPS in another location? The location you’re currently using might be having a network problem. You could always open a ticket but then you’d probably need to spend time with the diagnosis of the problem with them

I think the problem may have to do with portainer/traefik.

I made a brand new project and made a new digital ocean server through the resource manager with Frankfurt as the location(old one has NYC). I was able to deploy fine and it only took 30 secs.

I changed the text and deployed again and it worked and took a little over 30 secs.

One last test took around 30 sec again

I used an old domain I had on DigitalOcean and added portainer and traefik. They both installed correctly

After they were installed I deployed to my URL rather than IP and it worked

Site was visible online with SSL.

I changed text again and redeployed and it is currently almost at 10 min

This is the same that happened to my original site. Before portainer and traefik it deployed fine and so did first deploy after installing them, but any further deploys take forever.

Not sure if I am doing something wrong or if there’s a problem with DigitalOcean and/or Wappler.

Update, it just finished deploying and took 17ish minutes

I will try another deploy to test but I assume it will take over 30min like with my original site.

Another update, the redeploy took around 6 mins

and I tried again and it broke after 9ish min

So I am assuming the problem is with portainer/traefik since the 3 deploys before adding them took 30sec and other than the first deploy after installing them, they all took 5+ and/or gave an error.

Any ideas or am I better off @ing someone on the team or filling a bug report?

It’s likely the Wappler team will need the log file npm spat out. However, it might be a bit tricky to get it, as it’s inside the Docker container rather than the VPS itself. Here’s the command you need to run on the remote server (Terminal/SSH [can use the one built-in in Wappler]):

find / -path "*/root/.npm/_logs/2023-02-26T06"

The output of that command might take a minute or two, whatever is the output run:

tail -50 log_location

Of course, replace the last argument (log_location). That command (tail) will give the output of the last 50 lines of the log file

You can then reply to this topic. @ patrick is probably the best person to check this, but I’m not sure if he actually receives notifications, so it’s better to tag @ Teodor

I ran at and waited around 5 min it hasn’t sent anything back. I tried again for a few min and nothing.

Not sure if this is right since I don’t understand most of the backend stuff, but I tried the tail -50 with the location from error and it says no file or directory.

@Teodor @patrick Could one of you take a look at this thread and see if you have any solutions?

Can you try this command:

find / -path "*/root/.npm/_logs/2023-02-26T06*"

I added a wildcard in the end

Got this

root@test:~# find / -path "*/root/.npm/_logs/2023-02-26T06*"
/var/lib/docker/overlay2/rbojk5oc35cqi15zqzac5c9nd/diff/root/.npm/_logs/2023-02-26T06_06_57_638Z-debug-0.log
/var/lib/docker/overlay2/v4qdd6vkjqqphq7sle9hxkmet/diff/root/.npm/_logs/2023-02-26T06_08_14_114Z-debug-0.log
/var/lib/docker/overlay2/sfwc5pen6zrnzpuz1k68z6kb8/diff/root/.npm/_logs/2023-02-26T06_05_50_611Z-debug-0.log
/var/lib/docker/overlay2/7nyjt01ncdvw3k0g94q01t8l0/diff/root/.npm/_logs/2023-02-26T06_13_55_011Z-debug-0.log
/var/lib/docker/overlay2/axlspjk2c7evigc94skc2862t/diff/root/.npm/_logs/2023-02-26T06_32_12_566Z-debug-0.log
/var/lib/docker/overlay2/a285dd572d59805aa8ccf85d705122c0eb544fc11506e981adddcff85d6ae788/merged/root/.npm/_logs/2023-02-26T06_32_12_566Z-debug-0.log

Ok, run this command:

tail -50 /var/lib/docker/overlay2/a285dd572d59805aa8ccf85d705122c0eb544fc11506e981adddcff85d6ae788/merged/root/.npm/_logs/2023-02-26T06_32_12_566Z-debug-0.log
root@test:~# tail -50 /var/lib/docker/overlay2/a285dd572d59805aa8ccf85d705122c0eb544fc11506e981adddcff85d6ae788/merged/root/.npm/_logs/2023-02-26T06_3
2_12_566Z-debug-0.log
2028 silly ADD node_modules/unzipper/node_modules/readable-stream
2029 silly ADD node_modules/unzipper/node_modules/bluebird
2030 silly ADD node_modules/socket.io
2031 silly ADD node_modules/session-file-store
2032 silly ADD node_modules/session-file-store/node_modules/universalify
2033 silly ADD node_modules/session-file-store/node_modules/jsonfile
2034 silly ADD node_modules/session-file-store/node_modules/fs-extra
2035 silly ADD node_modules/qs
2036 silly ADD node_modules/nodemon
2037 silly ADD node_modules/nodemon/node_modules/has-flag
2038 silly ADD node_modules/nodemon/node_modules/supports-color
2039 silly ADD node_modules/nodemon/node_modules/debug
2040 silly ADD node_modules/node-schedule
2041 silly ADD node_modules/mime-types
2042 silly ADD node_modules/knex
2043 silly ADD node_modules/fs-extra
2044 silly ADD node_modules/follow-redirects
2045 silly ADD node_modules/express-session
2046 silly ADD node_modules/express-session/node_modules/ms
2047 silly ADD node_modules/express-session/node_modules/safe-buffer
2048 silly ADD node_modules/express-session/node_modules/debug
2049 silly ADD node_modules/express-session/node_modules/cookie
2050 silly ADD node_modules/express-fileupload
2051 silly ADD node_modules/express-end
2052 silly ADD node_modules/express-end/node_modules/ms
2053 silly ADD node_modules/express-end/node_modules/debug
2054 silly ADD node_modules/express
2055 silly ADD node_modules/express/node_modules/ms
2056 silly ADD node_modules/express/node_modules/safe-buffer
2057 silly ADD node_modules/express/node_modules/debug
2058 silly ADD node_modules/express/node_modules/cookie
2059 silly ADD node_modules/ejs
2060 silly ADD node_modules/dotenv
2061 silly ADD node_modules/debug
2062 silly ADD node_modules/cors
2063 silly ADD node_modules/cookie-parser
2064 silly ADD node_modules/connect-session-knex
2065 silly ADD node_modules/compression
2066 silly ADD node_modules/compression/node_modules/ms
2067 silly ADD node_modules/compression/node_modules/debug
2068 silly ADD node_modules/archiver
2069 timing command:install Completed in 350335ms
2070 notice
2070 notice New major version of npm available! 8.19.3 -> 9.5.1
2070 notice Changelog: <https://github.com/npm/cli/releases/tag/v9.5.1>
2070 notice Run `npm install -g npm@9.5.1` to update!
2070 notice
2071 verbose exit 0
2072 timing npm Completed in 350660ms
2073 info ok

So, it looks like that log file isn’t the errored one we’re looking for, the filename differs from your last screenshot showing the error :frowning:

But then, the find command didn’t find the one exactly we’re looking for. Not sure if you’re doing it on another VPS, or if Docker automatically erased the contents because it failed to run with success