Back

Stopping a function runtime container manually using CLI and triggering again is not possible

  • 0
  • Functions
THE-E
11 May, 2023, 18:38

Hi there,

so I am using several appwrite functions and because there is a delay on the first run, I was thinking, I would like to test a certain use case when the function did not have the initial first trigger. So the use case when the docker container of the function is not running. So I thought I could simply stop the container:

TypeScript
docker container stop <function-container-name>

and then retrigger the function. But in this case I get an error and only a complete restart (docker compose down and docker compose up -d) of the appwrite docker compose fixes this issue. I thought: Yeah maybe this is something I shouldn't do because the appwrite-executor is managing the container and I shouldn't tamper with the function container directly. But what happens if a container fails? Is a restart of the appwrite function impossible and a complete restart either of the appwrite docker compose (or maybe the appwrite-executor) is necessary? This would lead to a downtime.

So my actual question is: Is this behaviour by design?

TL;DR
The user wants to know if it is possible to manually stop a function runtime container using CLI and then trigger it again. They have tried stopping the container, but it causes an error and requires a complete restart of the appwrite docker compose. The user wonders if this behavior is intentional. There is no solution mentioned in the thread.
Drake
11 May, 2023, 18:51

The runtime container shouldn't just fail ..

You'll need to restart the executor yes

THE-E
11 May, 2023, 19:05

I agree it shouldn't fail but isn't it a possible case? I was wondering which behavior is set for the restart property of the docker container of the functions. In case it is set to on-failure I guess it might be sufficient.

But in general, is it possible to stop a function container in a clean way? I have set my function threshold to never stop for performance reasons.

THE-E
11 May, 2023, 19:12
TypeScript
"RestartPolicy": {
  "Name": "no",
  "MaximumRetryCount": 0
}

So it is set to no. Is there a reason which I am missing? Shouldn't on-failure and unless-stopped be the better configuration, especially if the restart of appwrite-executor is necessary for a on-failure case?

Drake
11 May, 2023, 19:36

Maybe but it doesn't happen in my experience

Best thing to do to stop a container would be to wait for it to be killed to die inactivity.

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more