Error Invalid VM group:

While setting up loki as a log store at fly, I ran into an issue with a vm that I’m unable to shut down:

Deployment Status
  ID          = 77c6eec9-fee9-2c3f-ee79-80368634696e
  Version     = v2
  Status      = failed
  Description = Failed due to unhealthy allocations - no stable job version to auto revert to
  Instances   = 1 desired, 1 placed, 0 healthy, 1 unhealthy

Instances
ID       TASK            VERSION REGION DESIRED STATUS HEALTH CHECKS RESTARTS CREATED
8ea17a1f release_command 2 ⇡     scl    run     failed 1 total       2        11m5s ago
aa721c89 app             1       scl    stop    failed 1 total       2        18m15s ago
6ca794d5 app             0       scl    stop    failed 1 total       2        27m23s ago
$ flyctl suspend

Error Invalid VM group:

fly.toml:

app = "my-app"
kill_signal = "SIGINT"
kill_timeout = 5

[build]
image = "grafana/loki:2.3.0"

[env]

[processes]
# make sure volume has correct uid before starting up
release_command = "chown -R loki:loki /loki"
app = "/usr/bin/loki -config.file=/etc/loki/local-config.yaml"

[experimental]
allowed_public_ports = []
auto_rollback = true
private_network = "true"

[mount]
destination = "/loki/"
source = "loki_storage"

status: failed means it is shut down. Am I misunderstanding what you’re seeing here?

The release_command process wont do what you want, I don’t think. There’s currently no way to run a command before release on an app with volumes mounted. For what I think you’re trying to do, you’ll be better off creating a run.sh script, adding it to your Docker image, then setting that as the command:

FROM grafana/loki:2.3.0
ADD run.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/run.sh

CMD /usr/local/bin/run.sh

The run script could look like this:

#!/bin/bash
chown -R loki:loki /loki
exec /usr/bin/loki -config.file=/etc/loki/local-config.yaml

Perhaps I’m just not fully understanding it. I was able to redeploy a few times while testing the setup and am now reached by:

$ flyctl deploy
Deploying my-app
==> Validating app configuration
--> Validating app configuration done
Searching for image 'grafana/loki:2.3.0' remotely...
image found: img_jy7nxpkw51rp8w25
Image: registry-1.docker.io/grafana/loki:2.3.0
Image size: 21 MB
==> Creating release

Error not enough volumes named loki_storage (1) to run 2 processes

Edit: no more deployment-related issues after removing the release_command stuff.

The release_command process wont do what you want, I don’t think. There’s currently no way to run a command before release on an app with volumes mounted.

Ok, I was being a bit “smart” with these experimental commands - I will go the shell evaluation route instead then.

Oh that error makes more sense to me.

It’s trying to run both release_command and app scripts at the same time. Unlike Heroku, the release_command process type isn’t magical. It would be the same as naming that worker or something.