The browser won't finish loading http://localhost.
Showing the login screen I suppose.
config.ymlport: 80 to port: 3000 in config.yml./data/mongo folderdocker-compose upAdding property entrypoint: [ "node", "server" ] to wikijs in the docker-compose.yml and changing the db property of the config.yml from db: mongodb://localhost:27017/wiki to db: mongodb://wikidb:27017/wiki seemed to resolve my problem.
Ran into the same issue. Maybe the changed mentionned by @oleic need to be imtegrated? cc @NGPixel
I already changed the db in config.yml. Thanks to this I also added entrypoint: ["node", "server"] but still no luck and infinite loading.
I managed. I didn't need to change the entrypoint for wikijs.
I changed the wikidb container by doing the following:
image: mongo by image:mongo:3 (mongo will resolve to latest which is mongo 4)command: '--smallfiles --bind_ip wikidb by command: '--smallfiles' (I removed --bind_ip because the container logs showed it couldn't resolve) Having the same issue, is there an official way to solve this? Thanks!
I created 2 PR to solve that: #618 and #620. Hopefully @NGPixel can review them soon.
@tadeaspetak Could you try again with the Dockerfile from the master branch? PR was merged, hopefully it's working now :)
Running in to the same issue, using the updated version. I've tried changing a few settings trying to get past the infinite loading, with no success.
config.yml
port: 3000db: mongodb://wikidb:27017/wikidocker-compose.yml
image: mongo:3command: '--smallfiles --bind_ip ::,0.0.0.0' and command: '--smallfiles'ports: - 80:3000From the log for wikijs, using either command setting noted above, and using the entrypoint: [ "node", "server" ] option noted above:
wikijs_1 | 2018-10-19T21:11:10.700Z - info: [SERVER] Wiki.js is initializing...
wikijs_1 | 2018-10-19T21:11:10.928Z - info: [SERVER] Checking data directories...
wikijs_1 | 2018-10-19T21:11:10.929Z - info: [SERVER] Data and Repository directories are OK.
wikijs_1 | 2018-10-19T21:11:11.378Z - info: [SERVER] Checking Git repository...
wikijs_1 | 2018-10-19T21:11:13.611Z - info: [SERVER] Starting HTTP/WS server on port 3000...
wikijs_1 | 2018-10-19T21:11:13.673Z - info: [SERVER] HTTP/WS server started successfully! [RUNNING]
wikijs_1 | 2018-10-19T21:11:13.735Z - error: [SERVER] Failed to connect to MongoDB instance.
wikijs_1 | Unhandled rejection MongoError: failed to connect to server [wikidb:27017] on first connect [MongoError: connect ECONNREFUSED 192.168.192.2:27017]
wikijs_1 | at Pool.<anonymous> (/var/wiki/node_modules/mongodb-core/lib/topologies/server.js:336:35)
wikijs_1 | at emitOne (events.js:116:13)
wikijs_1 | at Pool.emit (events.js:211:7)
wikijs_1 | at Connection.<anonymous> (/var/wiki/node_modules/mongodb-core/lib/connection/pool.js:280:12)
wikijs_1 | at Object.onceWrapper (events.js:317:30)
wikijs_1 | at emitTwo (events.js:126:13)
wikijs_1 | at Connection.emit (events.js:214:7)
wikijs_1 | at Socket.<anonymous> (/var/wiki/node_modules/mongodb-core/lib/connection/connection.js:187:49)
wikijs_1 | at Object.onceWrapper (events.js:315:30)
wikijs_1 | at emitOne (events.js:116:13)
wikijs_1 | at Socket.emit (events.js:211:7)
wikijs_1 | at emitErrorNT (internal/streams/destroy.js:64:8)
wikijs_1 | at _combinedTickCallback (internal/process/next_tick.js:138:11)
wikijs_1 | at process._tickCallback (internal/process/next_tick.js:180:9)
wikijs_1 | 2018-10-19T21:11:13.778Z - info: [SERVER] Search index flushed and ready.
wikijs_1 | 2018-10-19T21:11:13.891Z - info: [SERVER] Git repository is OK.
wikijs_1 | 2018-10-19T21:11:14.122Z - info: [AGENT] Background Agent is initializing...
wikijs_1 | 2018-10-19T21:11:15.273Z - info: [AGENT] Checking Git repository...
wikijs_1 | 2018-10-19T21:11:16.512Z - error: [AGENT] Failed to connect to MongoDB instance.
wikijs_1 | Unhandled rejection MongoError: failed to connect to server [wikidb:27017] on first connect [MongoError: connect ECONNREFUSED 192.168.192.2:27017]
wikijs_1 | at Pool.<anonymous> (/var/wiki/node_modules/mongodb-core/lib/topologies/server.js:336:35)
wikijs_1 | at emitOne (events.js:116:13)
wikijs_1 | at Pool.emit (events.js:211:7)
wikijs_1 | at Connection.<anonymous> (/var/wiki/node_modules/mongodb-core/lib/connection/pool.js:280:12)
wikijs_1 | at Object.onceWrapper (events.js:317:30)
wikijs_1 | at emitTwo (events.js:126:13)
wikijs_1 | at Connection.emit (events.js:214:7)
wikijs_1 | at Socket.<anonymous> (/var/wiki/node_modules/mongodb-core/lib/connection/connection.js:187:49)
wikijs_1 | at Object.onceWrapper (events.js:315:30)
wikijs_1 | at emitOne (events.js:116:13)
wikijs_1 | at Socket.emit (events.js:211:7)
wikijs_1 | at emitErrorNT (internal/streams/destroy.js:64:8)
wikijs_1 | at _combinedTickCallback (internal/process/next_tick.js:138:11)
wikijs_1 | at process._tickCallback (internal/process/next_tick.js:180:9)
wikijs_1 | 2018-10-19T21:11:16.657Z - info: [AGENT] Git repository is OK.
without entrypoint: [ "node", "server" ], i do not see any connection notices, only:
wikijs_1 | 2018-10-19 21:10:34,213 CRIT Supervisor running as root (no user in config file)
wikijs_1 | 2018-10-19 21:10:34,224 INFO RPC interface 'supervisor' initialized
wikijs_1 | 2018-10-19 21:10:34,225 CRIT Server 'unix_http_server' running without any HTTP authentication checking
wikijs_1 | 2018-10-19 21:10:34,225 INFO supervisord started with pid 1
wikijs_1 | 2018-10-19 21:10:35,228 INFO spawned: 'wikijs' with pid 8
wikijs_1 | 2018-10-19 21:10:36,549 INFO success: wikijs entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
Having the same problem and none of the above fixes solve the issue.
This is actually an issue with the wikijs service starting too quickly. It tries to connect with the wikidb service before it is online and listening on port 27017.
If you call "docker-compose start wikidb" wait 30 seconds, then call "docker-compose start wikijs" the service starts up correctly.
the mongo express docker package has an interesting take on this issue:
https://github.com/mongo-express/mongo-express-docker/blob/b089fe7708d9dd619d648a6ec226fe0175b27740/docker-entrypoint.sh
Perhaps creating a similar entrypoint.sh file like this could work:
#!/bin/bash
set -eo pipefail
# if command does not start with wikijs, run the command instead of the entrypoint
# if [ "${1}" != "wikijs" ]; then
# exec "$@"
# fi
function wait_tcp_port {
local host="$1" port="$2"
local max_tries=5 tries=1
# see http://tldp.org/LDP/abs/html/devref1.html for description of this syntax.
while ! exec 6<>/dev/tcp/$host/$port && [[ $tries -lt $max_tries ]]; do
sleep 1s
tries=$(( tries + 1 ))
echo "$(date) retrying to connect to $host:$port ($tries/$max_tries)"
done
exec 6>&-
}
# wait for the mongo server to be available
echo Waiting for wikidb:27017...
wait_tcp_port "wikidb" "27017"
# run wikijs
supervisord --nodaemon -c /etc/supervisord.conf
Solved by adding command: bash -c "sleep 10 && node server" for wikijs container. (10 seconds was enough for me)
Most helpful comment
This is actually an issue with the wikijs service starting too quickly. It tries to connect with the wikidb service before it is online and listening on port 27017.
If you call "docker-compose start wikidb" wait 30 seconds, then call "docker-compose start wikijs" the service starts up correctly.