requarks / wiki-v1

Legacy version (1.x) of Wiki.js
https://wiki.js.org
GNU Affero General Public License v3.0
101 stars 75 forks source link

Confusion about wikijs configuration and setup in docker container #119

Open pdavis68 opened 5 years ago

pdavis68 commented 5 years ago

I'm using Docker for Windows... Using the example provide here:

https://github.com/Requarks/wiki/blob/master/tools/docker-compose.yml

I seem to have issues with my volumes. For example, ./config.yml:/var/wiki/config.yml would presumably map the config.yml in the directory from where I'm executing docker-compose up to the /var/wiki directory in my docker container. But there is no wiki directory under my /var directory.

So, this is my docker-compose.yml that I actually use. I've tried replacing ./ with //./ but that doesn't address my issues...

version: '3'
services:

  wikidb:
    image: mongo:3
    environment:
      MONGO_INITDB_ROOT_USERNAME: root
      MONGO_INITDB_ROOT_PASSWORD: expassword 

    volumes:
        - /mongo/data/db:/data/db
        - ./data/mongod.conf:/etc/mongod.conf

  wikijs:
    image: 'requarks/wiki:latest'
    links:
      - wikidb
    depends_on:
      - wikidb
    ports:
      - '1081:3000'
    environment:
      WIKI_ADMIN_EMAIL: myemail@gmail.com
    volumes:
      - ./config.yml:/var/wiki/config.yml        
      - ./logs:/logs

From the directory where I run docker-compose up...

If I run with ./, I get no mongod.conf in my etc folder. I get no /logs folder in my root.

I do have the mongo volume that I've created separately, outside of all this and that's used properly....

Now, if I replace './' with '//./', in the container, I get a /data directory in the root with a mongod.conf directory, but not the actual mongod.conf file which is my host data directory. And obviously, it's backwards. It should be mongod.conf in the etc folder, not in the data folder.

What's going on? How do I straighten this all out? Thanks

NGPixel commented 5 years ago

Try: https://github.com/docker/compose/issues/4303#issuecomment-379563170

However, on Windows, you should instead use absolute paths instead.

pdavis68 commented 5 years ago

I tried that. Replacing the ./ above with //F/docker/wikijs (the above yml is in F:\docker\wikijs, I end up getting a folder in the root called F which then has docker and then wikijs under it. It then shows config.yml as a directory, my "data" directory (which is empty in the container, but has a directory and file in the host), and the logs folder which, in the container, contains supervisord.log, wiki-stderr.log and wiki-stdout.log, but these files are not on the host.

This is the config file with the replacements:

version: '3'
services:

  wikidb:
    image: mongo:3
    environment:
      MONGO_INITDB_ROOT_USERNAME: root
      MONGO_INITDB_ROOT_PASSWORD: expassword 

    volumes:
        - /mongo/data/db:/data/db
        - //F/docker/wikijs/data/mongod.conf:/data/mongod.conf

  wikijs:
    image: 'requarks/wiki:latest'
    links:
      - wikidb
    depends_on:
      - wikidb
    ports:
      - '1081:3000'
    environment:
      WIKI_ADMIN_EMAIL: pdavis68@gmail.com
    volumes:
      - //F/docker/wikijs/config.yml:/var/wiki/config.yml        
      - //F/docker/wikijs/logs:/logs

Using F:/ instead of //F/ yields the same result except that the "F" directory becomes a lowercase "f".