I would like to introduce what I have done with a NodeBB and a docker.
Contribute to qgp9/nodebb-docker-dev development by creating an account on GitHub.
This docker chain of Nginx, NodeBB, Redis, MongoDB(!!) is based on Alpine Linux and
This design is mainly for developments and small standalone service rather than large distributable/scalable service.
A Major Difference from other many(?) docker implementations is that I don't embed source and config files into images but just mount most of files on a host directory to containers even include NodeBB source and node_modules. There are pros and cons. I'll explain them briefly and we could discuss them.
MongoDB is added as a default DB !!!
And redis is intened to be used for websock blabla, but I'm not sure it's properly working.
What I know actually, no errors, no warnings and I can see both of mongo and redis at admin web UI.
If anybody would try this docker chain, please let me know results.
!!! WARNING !!!
I haven't checked yet how
SIGTERM which docker send.
This means that in worst case one can loose data !
Does any body know about this?
redis-serverhas been checked. Safe with
docker stop but not with
- This chain consists of 4 docker containers each of NodeBB, Redis, MongoDB, Nginx.
- I don't provide compiled images but 10 mins will be more than enough to build them by yourself with this instructions.
- You will get error from a nginx docker if you already have any web server with port 80. I'll explain solutions after lines.
git clone https://github.com/qgp9/nodebb-docker-dev.git nodebb-docker-dev
git clone -b v1.x.x https://github.com/NodeBB/NodeBB.git nodebb
./bin/com-nodebb npm install
./bin/com-nodebb npm install socket.io-redis connect
./bin/com-nodebb npm setup
./bin/utils jq -M -s add nodebb/config.json conf/example/redis.josn > tmp.json && mv tmp.json nodebb/config.json
mongo , DB address:
mongodb , DB user:
admin , no DB password
- If you have a web server already, you have two options
- Remove a nginx from
docker-compose.xml , connect a port 4567 of NodeBB to host, and you may know how you can connect from your webserver to
http://127.0.0.1:4567 . Here is a example docker-compose.xml
- change a external port of a nginx docker ( example is 8080 ) and connect from your web server to
http://127.0.0.1:8080. Here is a example docker-compose.xml
Command line Settings, Upgrade, npm and so on
When you want to do
./nodebb setup or
./nodebb upgrade or
npm install on your nodebb, don't do it on Host directory. You have a helper script, do next.
./bin/com-nodebb ./nodebb setup
./bin/com-nodebb ./nodebb upgrade
./bin/com-nodebb npm install <package>
Also you can open bash and do whatever you want
- But to edit/add/delete files,
git pull, you can do it on the host directory ( or with docker, doesn't matter )
│ ├── com-nodebb # Helper to control NodeBB docker
│ └── docker-compose # Docker version of docker-compose for portability
├── conf # All Dockerfile and configuration.
│ ├── nginx
│ │ ├── Dockerfile
│ │ └── nginx.conf
│ ├── nodebb-dev
│ │ └── Dockerfile
│ └── redis
│ ├── Dockerfile
│ └── redis.conf
│ ├── nginx
│ │ └── logs # nginx, site logs
│ ├── nodebb # Empty. reserved for future plans.
│ └── redis # dump.rgb ( db data ) , redis.log ( log file )
└── nodebb # NodeBB source will be here
- All configuration, data( log file ), NodeBB codes are mounted to dockers ( not copied ). So you can just edit them on a host directory.
- All configurations are in a
conf directory. All data files genereated by nginx, redis are in a
config.json and a logfile of NodeBB are in nodebb directory for easy management.
- This desigin is aimed to archive easy and best development/management system for small standalone service.
- Every improtant files are just under a main directory on a host and dockers act just like applications,
- so you can remove/rebuild docker containers/images freely without any effect to data.
- Also you can easily migrate this chain to new server. What you need is just copy the main directory to new server and rebuild dockers.
- But large distributing/scaling can meet some side effects.
When you build a system by
./bin/docker-compose up, you will see a wired long name of images/container like
docker images or
docker ps -a. This is because
docker-compose use a directory name as a project nam.
To get a short/readable name , you have recommontable 2 options.
- Change the directory name
- Shell variables ( RECOMMENDED but easilly one can make mistakes. smartcd can help )
- or you can embed this variable to
Then you will see
More details will be .. updated at the github repo soon.
Any questions/comments/ideas/criticizing/WOW/BOO~ ?