You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have a Deno app that, because it's using MongoDB Atlas, can sometimes experience timeouts or database disconnections. While the Deno app doesn't crash, the site won't load during these periods.
I’m looking for a way to ensure that if the Deno main.ts disconnects or encounters a MongoDB disconnection or connection error, it will automatically restart.
For redundancy, we should ideally have 2 or 3 instances running at a time, but I'm not sure if Pup can handle that.
I tried using PM2, but it doesn't work on a Docker image built for Deno.
here is the deno Dockerfile
FROM denoland/deno:1.45.3
# The port that your application listens to.
EXPOSE 7000
WORKDIR /app
# Install curl using apt-get
USER root
RUN apt-get update && apt-get install -y curl
ADD . .
# Prefer not to run as root.
#USER deno
# Install Pup globally using Deno
RUN deno run -Ar jsr:@pup/pup@1.0.0-rc.44 setup --channel prerelease
# Cache the dependencies as a layer (the following two steps are re-run only when deps.ts is modified).
# Ideally cache deps.ts will download and compile _all_ external files used in main.ts.
#COPY deps.ts .
#RUN deno cache deps.ts
# These steps will be re-run upon each file change in your working directory:
#RUN deno install -qAf --unstable https://deno.land/x/pm2@latest
# Compile the main app so that it doesn't need to be compiled each startup/entry.
RUN deno cache main.ts
HEALTHCHECK --interval=30s --timeout=10s --retries=3 \
CMD curl -f https://example.com || exit 1
CMD ["pup", "run", "--cmd", "deno run --allow-all main.ts", "--instances", "3"]
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
We have a Deno app that, because it's using MongoDB Atlas, can sometimes experience timeouts or database disconnections. While the Deno app doesn't crash, the site won't load during these periods.
I’m looking for a way to ensure that if the Deno main.ts disconnects or encounters a MongoDB disconnection or connection error, it will automatically restart.
For redundancy, we should ideally have 2 or 3 instances running at a time, but I'm not sure if Pup can handle that.
I tried using PM2, but it doesn't work on a Docker image built for Deno.
here is the deno Dockerfile
Beta Was this translation helpful? Give feedback.
All reactions