Docker pull new image 2.7 => 2.8 : stay in 2.7
-
Hello,
Finally i dockerized all things with this docker-compose below i share with you
But i can't get the forum upgrade when i pulled the very newer version yesterday (2.8)
It seems that it keeps the files of 2.7 in the docker volume and in the entrypoint there is no notion of "upgrade" (only test setup & start).What is the proper way to upgrade nodebb when you are running on Docker ?
Thanks in advance.
Here is my docker-compose.yml file :
version: "3.3" services: redis: image: redis:alpine container_name: redis restart: unless-stopped volumes: - /etc/localtime:/etc/localtime:ro - redis:/data networks: - web nodebb: image: nodebb/docker:latest container_name: nodebb restart: unless-stopped user: 1000:1000 volumes: - /etc/localtime:/etc/localtime:ro - /var/run/docker.sock:/var/run/docker.sock:ro - static:/usr/src/app networks: - web depends_on: redis: condition: service_started networks: web: name: web volumes: redis: static:
-
Hi @arnaudw — I don't actually maintain the Docker builds, I just happen to have authorized the script that runs it. It is run automatically and pushed to Docker Hub based on the configs in the repo.
Unfortunately I can't help you with that, but I directly replacing the files (that is, spinning up a new docker image) should be fine as long as the database connection details are unchanged, no?
On startup, NodeBB will automatically run any upgrade scripts as needed.
-
Finally i found a workaround : i overload the CMD but i need to reinstall plugins i use before run.
It was indeed the named volume which is persistent, so it kept the old files.
So the new docker-compose is like below (where user 1000 is the user on the Docker host who run NodeBB ). It does not use persistent volume for NodeBB but a simple bind of config.json, so everytime a new version is published, all files and directory will be recreated when pulled.
For better performance i share static content with a named volume static with an nginx container.
Note : it does not run setup, so usable for an existing installation.
version: "3.3" services: redis: image: redis:alpine container_name: redis restart: unless-stopped volumes: - /etc/localtime:/etc/localtime:ro - redis:/data networks: - web nodebb2: image: nodebb/docker:latest container_name: nodebb restart: unless-stopped user: 1000:1000 volumes: - /etc/localtime:/etc/localtime:ro - /var/run/docker.sock:/var/run/docker.sock:ro - ./config.json:/usr/src/app/config.json:ro - static:/usr/src/app/public networks: - web depends_on: redis: condition: service_started command : > sh -c "npm i nodebb-plugin-calendar nodebb-plugin-category-notifications nodebb-plugin-custom-pages nodebb-plugin-desktop-notifications nodebb-plugin-gravatar nodebb-plugin-imgur nodebb-plugin-newsletter nodebb-plugin-night-mode nodebb-plugin-ns-embed nodebb-plugin-poll nodebb-plugin-question-and-answer nodebb-plugin-anti-spam-question nodebb-plugin-google-analytics nodebb-plugin-soundpack-default && node ./nodebb upgrade; node ./nodebb start" networks: web: name: web volumes: redis:
Nginx container config
version: '3' services: reverse-proxy: container_name: reverse-proxy hostname: reverse-proxy image: nginx:latest restart: unless-stopped ports: - 80:80 volumes: - conf:/etc/nginx - html:/usr/share/nginx/html - nodebb-static:/usr/share/nginx/html/nodebb_static - /etc/localtime:/etc/localtime:ro environment: - NGINX_PORT=80 networks: - web networks: web: name: web volumes: conf: html: nodebb-static: external: name: nodebb_static
-