Run nodebb inside of docker container
-
Hi,
I tried to run nodebb/docker with a redis db as swarm / stack.compose:
version: '3.7' services: nodebb: image: nodebb/docker networks: webproxy: redis: labels: # caddy swarm reverse proxy with lets encrypt caddy.address: "nodebb.example.com" caddy.targetport: '4567' caddy.log: '/ stdout "[{host}] {remote} - {user} [{when}] \"{method} {uri} {proto}\" {status} {size}"' caddy.errors: "stdout" stdin_open: true tty: true volumes: - build:/usr/src/app/build - uploads:/usr/src/app/public/uploads deploy: restart_policy: condition: any delay: 10s max_attempts: 5 window: 60s redis: image: redis:5.0.7 networks: redis: volumes: - data:/data command: 'redis-server --appendonly yes' networks: webproxy: external: name: proxy_webproxy redis: volumes: data: build: uploads:
After setup is finished I click the "Launch" button and that kills the container:
2019-12-28T11:54:49.017Z [19] - info: [build] Asset compilation successful. Completed in 140.239sec. NodeBB Setup Completed. Run "./nodebb start" to manually start your NodeBB server. Starting NodeBB "./nodebb stop" to stop the NodeBB server "./nodebb log" to view server output "./nodebb restart" to restart NodeBB
Would be no problem because of swarm restart_policy a new container should start...
But after that I get the installer again instead of the installed nodebb forum.So something seems to be wrong. Redis DB is empty and nodebb volumes contains data.
See below:rancher:/var/lib/docker/volumes# ls -lh nodebb_*/_data/ nodebb_build/_data/: total 12 -rw-r--r-- 1 root root 11 Dec 28 11:54 cache-buster drwxr-xr-x 2 root root 4.0K Dec 28 11:33 export drwxr-xr-x 7 root root 4.0K Dec 28 11:53 public nodebb_data/_data/: total 132 -rw-r--r-- 1 999 ping 129.8K Dec 28 11:52 appendonly.aof nodebb_uploads/_data/: total 20 drwxr-xr-x 2 root root 4.0K Dec 28 11:25 category drwxr-xr-x 2 root root 4.0K Dec 28 11:25 files drwxr-xr-x 2 root root 4.0K Dec 28 11:25 profile drwxr-xr-x 2 root root 4.0K Dec 28 11:25 sounds
So how to install with persistent data?
Why no redis data is written to the volume?
I'm new with redis, but it should work without password because I haven't set an password?
Redis connect works fine from nodebb to redis container:root@a8dd26787f8f:/usr/src/app# telnet redis 6379 Trying 10.0.19.2... Connected to redis. Escape character is '^]'. quit +OK Connection closed by foreign host.
-
If I restart the running nodebb container it would work, but docker swarm respawn a new container to the first one after I manually restart it...
Also tested to add the install directory as volume if there would be changes after web install is finished, but same problem.
Each time a new container is spawned I get the web installer again...It would help to now WHY I get the installer each time and how to solve that with the nodebb/docker image (with additional persistent volumes)?
-
@Staff
After some more debugging I found the config.json file inside of the "/usr/src/app" directory, which prevents the image to update the nodebb app by pulling a new image...Any change to get the config.json moved to a sub directory "config"? Or wouldn't work nodebb inside of a docker container that way?