Are my Deno/Dockerfile based services meant to indicate "sleep" in the GUI when they finish executing their ENTRYPOINT?
christoshrousis
HOBBYOP

10 months ago

I've created a Deno project, with associated Dockerfile, and deployments via CLI, the docker file effectively calls the main script, and the script executes once, and isn't continuously running (it's not a meant to be a web server, just a task). I have set them to "server less" mode.

I noticed that the "redis" service actually flips to "deployment slept", but I never see this for my services.

I have two questions, one is:

despite the UI are my services actually going to sleep or are they not? Have I configured my scripts/dockerfile in such a way that they're stuck running?

what I'm actually trying to do, is run a collection of scripts once a day, but they need to be in isolated services as they are prone to crashing.

I have maybe 4 scripts in total I run from my machine daily that I'm trying to migrate into the cloud. Is there a better way to do this?

I also don't know how to trigger these services once they're deployed. I'm comfortable with running them as a web server, but I'm curious as to whether I'm overlooking something and going about this the wrong way.

Here is the Dockerfile example:

```

# Use Deno base image

FROM denoland/deno:2.5.4

# Install git and ssh (required for cloning repos)

RUN apt-get update && apt-get install -y \

git \

openssh-client \

&& rm -rf /var/lib/apt/lists/*

# Set working directory

WORKDIR /app

# Copy source files

COPY . .

# Cache dependencies

RUN deno cache main.ts

# Set environment

ENV DENO_DIR=/deno-dir

# Entry point

CMD ["deno", "run", "--allow-net", "--allow-env", "--env", "main.ts"]

```

Attachments

Solved

2 Replies

Railway
BOT

10 months ago

Hey there! We've found the following might help you get unblocked faster:

If you find the answer from one of these, please let us know by solving the thread!


sarahkb125
EMPLOYEE

10 months ago

Hi there,

You do correctly have serverless enabled. However, the way serverless works is that it scales up/down based on traffic. Looking at your metrics, you have constant traffic - so, it's not scaling down because the traffic is constant.

If you want to run something on a schedule, you could also try using functions and scheduling them via the cron feature.

Best,

The Railway Team


Status changed to Awaiting User Response Railway 10 months ago


Status changed to Solved sarahkb125 10 months ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...