Closed Rudis1261 closed 1 year ago
When I bash into the container:
docker run -it contribsys/faktory sh
/ # ls -alhtr /var/lib/faktory/db/
total 8K
drwxr-xr-x 3 root root 4.0K Oct 3 19:20 ..
drwxr-xr-x 2 root root 4.0K Oct 3 19:20 .
/ # ./faktory &
/ # Faktory 1.6.2
Copyright © 2022 Contributed Systems LLC
Licensed under the GNU Affero Public License 3.0
I 2022-12-01T10:11:33.593Z Initializing redis storage at /root/.faktory/db, socket /root/.faktory/db/redis.sock
I 2022-12-01T10:11:33.606Z Web server now listening at localhost:7420
I 2022-12-01T10:11:33.606Z PID 15 listening at localhost:7419, press Ctrl-C to stop
/ # ls -alhtr /var/lib/faktory/db/
total 8K
drwxr-xr-x 3 root root 4.0K Oct 3 19:20 ..
drwxr-xr-x 2 root root 4.0K Oct 3 19:20 .
It puts the file in /var when running in production mode. Sounds like it’s in development mode.
So a valid service definition would be?
faktory:
image: contribsys/faktory
environment:
FAKTORY_PROVIDER: tcp://localhost:7419
Environment: production
volumes:
- ./data:/var/lib/faktory
ports:
- 7419:7419
- 7420:7420
I have tried production / development, but nothing happens
FAKTORY_ENV=production
Awesome thanks, lemme try that
These don't indicate that specific ENV: https://github.com/contribsys/faktory/wiki/Installation#docker https://hub.docker.com/r/contribsys/faktory/
Hmm still no joy:
faktory:
image: contribsys/faktory
environment:
FAKTORY_PROVIDER: tcp://:secret@localhost:7419
FAKTORY_ENV: production
FAKTORY_PASSWORD: secret
volumes:
- ./data:/var/lib/faktory/db
ports:
- 7419:7419
- 7420:7420
Whether or not I touch the file ./data/redis.rdb
, it crashes when I start the container:
distributor-faktory-1 | W 2022-12-01T13:16:35.001Z Redis at /var/lib/faktory/db crashed: exit status 1
certificate_distributor-faktory-1 | panic: exit status 1
certificate_distributor-faktory-1 |
certificate_distributor-faktory-1 | goroutine 7 [running]:
certificate_distributor-faktory-1 | github.com/contribsys/faktory/storage.bootRedis.func2()
certificate_distributor-faktory-1 | /Users/mperham/src/github.com/contribsys/faktory/storage/redis.go:160 +0xb4
certificate_distributor-faktory-1 | created by github.com/contribsys/faktory/storage.bootRedis
certificate_distributor-faktory-1 | /Users/mperham/src/github.com/contribsys/faktory/storage/redis.go:156 +0x83c
Running into all sorts of segmentation faults etc. I am thinking it's got something to do with Mac volume mounts specifically.
This "works" as in the app fires up, but then seg-faults when I try and enqueue a job
version: '3.4'
services:
faktory:
image: contribsys/faktory
environment:
FAKTORY_PROVIDER: tcp://:secret@localhost:7419
FAKTORY_ENV: production
FAKTORY_PASSWORD: secret
volumes:
- faktory-data:/var/lib/faktory/db
ports:
- 7419:7419
- 7420:7420
volumes:
faktory-data:
You shouldn't need FAKTORY_PROVIDER: tcp://:secret@localhost:7419
at all. I'm not sure what that's doing there.
I don't recall the Docker volume config but seems like you aren't mapping the host-side. Try:
volumes:
- .:/var/lib/faktory/db
You should see a faktory.rdb
appear in your current directory.
Looks like people have been editing the Docker wiki page and not explaining things fully.
I've updated this page with more explicit detail and better formatting, thanks for the feedback. https://github.com/contribsys/faktory/wiki/Installation#docker
I think I am also battling the Apple M2 (ARM64) differences between inside and outside of the container. So I will just need to ensure that our kubernetes implementation's persistence will work out, and leave it at that for now 👍 Our development can be ephemeral.
Thanks for the assistance 🥇
I have tried using a couple of different configurations, but I can't seem to test the persistence locally in docker, I also looked at the Kubernetes examples.
Using this service definition in
docker-compose.yaml
:Using this as a volume mount, when I
docker-compose down -v
, thendocker-compose up
I seem to be losing all my data. Is/var/lib/faktory/db/redis.rdb
still the correct file in the container?