requarks / wiki

Wiki.js | A modern and powerful wiki app built on Node.js
https://js.wiki
GNU Affero General Public License v3.0
24.24k stars 2.68k forks source link

Wikijs with Docker MacVLAN network drivers fails to launch #449

Closed CMobley7 closed 6 years ago

CMobley7 commented 6 years ago

To Whom It May Concern,

Firstly, I just want to thank you for the project/product you are making. I scoured the internet for days looking for the best open source wiki project and I must say I was really impressed with wiki.js. However, I've been unable to get it up and running using docker-compose. If you could help me get it up and running, I would greatly appreciate it.

Actual behavior

Mongo DB sever appears to come up correctly; however, the Wikijs sever exits as shown from the logs below.

wikijs-server_1  | 2018-03-14 03:45:28,298 CRIT Supervisor running as root (no user in config file)
wikijs-server_1  | 2018-03-14 03:45:28,308 INFO RPC interface 'supervisor' initialized
wikijs-server_1  | 2018-03-14 03:45:28,308 CRIT Server 'unix_http_server' running without any HTTP authentication checking
wikijs-server_1  | 2018-03-14 03:45:28,308 INFO supervisord started with pid 1
wikijs-server_1  | 2018-03-14 03:45:29,311 INFO spawned: 'wikijs' with pid 9
wikijs-server_1  | 2018-03-14 03:45:29,511 INFO exited: wikijs (exit status 1; not expected)
wikijs-server_1  | 2018-03-14 03:45:30,513 INFO spawned: 'wikijs' with pid 15
wikijs-server_1  | 2018-03-14 03:45:30,711 INFO exited: wikijs (exit status 1; not expected)
wikijs-server_1  | 2018-03-14 03:45:32,715 INFO spawned: 'wikijs' with pid 21
wikijs-server_1  | 2018-03-14 03:45:32,910 INFO exited: wikijs (exit status 1; not expected)
wikijs-server_1  | 2018-03-14 03:45:35,915 INFO spawned: 'wikijs' with pid 27
wikijs-server_1  | 2018-03-14 03:45:36,107 INFO exited: wikijs (exit status 1; not expected)
wikijs-server_1  | 2018-03-14 03:45:37,108 INFO gave up: wikijs entered FATAL state, too many start retries too quickly
wikijs-server_1  | 2018-03-14 03:48:42,986 WARN received SIGTERM indicating exit request
wikijs-server_1  | 2018-03-14 03:48:44,341 CRIT Supervisor running as root (no user in config file)
wikijs-server_1  | 2018-03-14 03:48:44,351 INFO RPC interface 'supervisor' initialized
wikijs-server_1  | 2018-03-14 03:48:44,351 CRIT Server 'unix_http_server' running without any HTTP authentication checking
wikijs-server_1  | 2018-03-14 03:48:44,351 INFO supervisord started with pid 1
wikijs-server_1  | 2018-03-14 03:48:45,353 INFO spawned: 'wikijs' with pid 9
wikijs-server_1  | 2018-03-14 03:48:45,548 INFO exited: wikijs (exit status 1; not expected)
wikijs-server_1  | 2018-03-14 03:48:46,551 INFO spawned: 'wikijs' with pid 15
wikijs-server_1  | 2018-03-14 03:48:46,741 INFO exited: wikijs (exit status 1; not expected)
wikijs-server_1  | 2018-03-14 03:48:48,745 INFO spawned: 'wikijs' with pid 21
wikijs-server_1  | 2018-03-14 03:48:48,940 INFO exited: wikijs (exit status 1; not expected)
wikijs-server_1  | 2018-03-14 03:48:51,945 INFO spawned: 'wikijs' with pid 27
wikijs-server_1  | 2018-03-14 03:48:52,137 INFO exited: wikijs (exit status 1; not expected)
wikijs-server_1  | 2018-03-14 03:48:53,138 INFO gave up: wikijs entered FATAL state, too many start retries too quickly

Expected behavior

Wikijs and Mongo communicate via the backend network while Wikijs is hosted on the frontend network through the two macvlan network drivers.

Steps to reproduce the behavior

execute docker-compose up -d with the following docker-compose.yml and config.yml. The files will likely need to be edited slightly depending on the user's setup.

version: '3'

services:
  wikidb-server:
    image: 'mongo:latest'
    expose:
      - '27017'
    networks:
      backend:
        ipv4_address: 192.168.10.13
    command: '--smallfiles --bind_ip wikidb'
    environment:
      - 'MONGO_LOG_DIR=/dev/null'
    volumes:
      - /data/wikijs/data:/data/db
    restart: always

  wikijs-server:
    image: 'requarks/wiki:latest'
    depends_on:
      - wikidb-server
    links:
      - wikidb-server
    ports:
      - '80:80'
    networks:
      frontend:
        ipv4_address: 192.168.1.42
      backend:
        ipv4_address: 192.168.10.14
    environment:
      WIKI_ADMIN_EMAIL: admin@example.com
    volumes:
      - /data/wikijs/config/config.yml:/var/wiki/config.yml
    restart: always

networks:
  frontend:
    driver: macvlan
    driver_opts:
      parent: eno1
    ipam:
      config:
        - subnet: 192.168.1.0/24
  backend:
    driver: macvlan
    driver_opts:
      parent: eno1.10
    ipam:
      config:
        - subnet: 192.168.10.0/24
#######################################################################
# Wiki.js - CONFIGURATION                                             #
#######################################################################
# Full explanation + examples in the documentation:
# https://docs.requarks.io/wiki/install
# You can use an ENV variable by using $(ENV_VAR_NAME) as the value

# ---------------------------------------------------------------------
# Title of this site
# ---------------------------------------------------------------------

title: Site_Title

# ---------------------------------------------------------------------
# Full public path to the site, without the trailing slash
# ---------------------------------------------------------------------
# INCLUDE CLIENT PORT IF NOT 80/443!

host: http://192.168.1.42

# ---------------------------------------------------------------------
# Port the main server should listen to (80 by default)
# ---------------------------------------------------------------------
# To use process.env.PORT, comment the line below:

port: 80

# ---------------------------------------------------------------------
# Data Directories
# ---------------------------------------------------------------------

paths:
  repo: ./repo
  data: ./data

# ---------------------------------------------------------------------
# Upload Limits
# ---------------------------------------------------------------------
# In megabytes (MB)

uploads:
  maxImageFileSize: 3
  maxOtherFileSize: 100

# ---------------------------------------------------------------------
# Site Language
# ---------------------------------------------------------------------
# Possible values: en, de, es, fa, fr, ja, ko, nl, pt, ru, sr, sv, tr or zh

lang: en

# Enable for right to left languages (e.g. arabic):
langRtl: false

# ---------------------------------------------------------------------
# Site Authentication
# ---------------------------------------------------------------------

public: false

auth:
  defaultReadAccess: false
  local:
    enabled: true

# ---------------------------------------------------------------------
# Secret key to use when encrypting sessions
# ---------------------------------------------------------------------
# Use a long and unique random string (256-bit keys are perfect!)

sessionSecret: 1234567890abcdefghijklmnopqrstuvxyz

# ---------------------------------------------------------------------
# Database Connection String
# ---------------------------------------------------------------------

db: mongodb://192.168.10.13:27017/wiki
#db: mongodb://wikidb-server:27017/wiki

# ---------------------------------------------------------------------
# Git Connection Info
# ---------------------------------------------------------------------

# ---------------------------------------------------------------------
# Features
# ---------------------------------------------------------------------
# You can enable / disable specific features below

features:
  linebreaks: true
  mathjax: true

# ---------------------------------------------------------------------
# External Logging
# ---------------------------------------------------------------------

externalLogging:
  bugsnag: false
  loggly: false
  papertrail: false
  rollbar: false
  sentry: false

# ---------------------------------------------------------------------
# Color Theme
# ---------------------------------------------------------------------

theme:
  primary: indigo
  alt: blue-grey
  viewSource: all # all | write | false
  footer: blue-grey
  code:
    dark: true
    colorize: true

Thank you for your time and attention to this matter. Have a great rest of the week. God bless.

NGPixel commented 6 years ago

Have you checked in the logs to make sure the issue is really Wiki.js being unable to connect to Mongo?

CMobley7 commented 6 years ago

@NGPixel,

Thanks for your help. I was able to get it up and running. Due to changing the name from wikidb to wikidb-server. command: '--smallfiles --bind_ip wikidb' needed to be changed to command: '--smallfiles --bind_ip wikidb-server'. Also, I missed typed the port. It needed to be changed from '192.168.1.42:80:80' to '192.168.1.42:80:3000' like your example.

Thanks again. Have a great rest of the week and a wonderful weekend. God bless.