kamal icon indicating copy to clipboard operation
kamal copied to clipboard

kamal setup crashing on redis accessory

Open lizdeika opened this issue 1 year ago • 5 comments

Hi, I have an issue with kamal setup crashing on redis accessory.

  INFO [4243044c] Running docker run --name app-redis --detach --restart unless-stopped --log-opt max-size="10m" --publish 36379:6379 --env-file .kamal/env/accessories/app-redis.env --volume /var/lib/redis:/data --label service="app-redis" redis:latest redis-server --save 60 1 on 10.0.0.6
Releasing the deploy lock...
  Finished all in 9.0 seconds
  ERROR (SSHKit::Command::Failed): Exception while executing on host 10.0.0.6: docker exit status: 125
docker stdout: Nothing written
docker stderr: docker: Error response from daemon: Conflict. The container name "/app-redis" is already in use by container "069c97eb7287142e2fbaaad7de82c656a488fdb7bc115dcebbaadbfe799f5f8f". You have to remove (or rename) that container to be able to reuse that name.
See 'docker run --help'.

redis deploy config:

accessories:
  redis:
    image: redis:latest
    cmd: redis-server --save 60 1
    hosts:
      - 10.0.0.6
    port: "36379:6379"
    volumes:
      - /var/lib/redis:/data

I have tried kamal remove and rebuilding/reinstalling the hosting instance from ground up to no avail. The only thing that helps is sshing to the instance and doing docker rm -f /app-redis. Then I am able to run kamal setup for one time, second run crashes again.

lizdeika avatar Sep 21 '23 15:09 lizdeika

Some time ago I've stuck with the same issue, but with mongodb database.

As I understand the problem - kamal setup is a command only for first-time deployment. For next deployments you should use kamal deploy command instead.

picolino avatar Sep 22 '23 21:09 picolino

@picolino I agree, but it's possible you could have an issue deploying, I some guard rails would be nice here, "oh the container exists, don't start another one" etc.

shaneshort avatar Sep 26 '23 05:09 shaneshort

@lizdeika Any luck solving the issue?

hapiben avatar Nov 17 '23 04:11 hapiben

@hapiben no, sadly no luck the only workaround is executing docker rm -f /app-redis on the redis server machine

lizdeika avatar Dec 01 '23 11:12 lizdeika

I also had similar issue, and I commented the accessory part after the first setup, just so I could run kamal setup again after the first setup.

BranLiang avatar Dec 17 '23 07:12 BranLiang