1
0
Fork 0
mirror of https://github.com/requarks/wiki.git synced 2026-03-02 22:06:55 -05:00

Import Data from Local Disc says success but does nothing #2558

Closed
opened 2026-02-20 19:07:09 -05:00 by deekerman · 8 comments
Owner

Originally created by @rico161 on GitHub (Feb 4, 2022).

EDIT: SOLVED == The problem is that if you set your local path in the admin panel "storage" section to "/home/user/wiki" for example (which is what the settings recommend even though it's not correct), it actually starts that file path from /var/lib/docker/ sub folders so when my files were in /home/user/wiki they weren't found because it was looking in /var/lib/docker/i/home/user/wiki or some such. This took me forever to figure out because the recommended local path is misleadingly recommended to be "/home/user/wiki" inside the admin panel. Everyone who uses docker - be aware that most of your local files and directories are going to stem from the /var/lib/docker directory and not from the regular root directory.

====

Our old wikijs 2.x version was running SQlite and we upgraded the server and re-installed the latest wiki version, this time with Postgres DB instead. We have the old / repo folder from the previous version with all our pages as .md files, and all our media in /repo/uploads backed up. However, when we try to use the admin panel to import the old data from the local directory nothing is imported. A green "success" notification immediately appears but no pages or data seem to actually be added. There's over 160 pages that we need to import into Postgres, too many to recreate manually.

Is the "storage > local storage > import" prompt supposed to work with .md files or is it impossible to import old .md page files into Postgres?

Running wikijs through docker on Xubuntu.

Originally created by @rico161 on GitHub (Feb 4, 2022). EDIT: SOLVED == The problem is that if you set your local path in the admin panel "storage" section to "/home/user/wiki" for example (which is what the settings recommend even though it's not correct), it actually starts that file path from /var/lib/docker/ sub folders so when my files were in /home/user/wiki they weren't found because it was looking in /var/lib/docker/i/home/user/wiki or some such. This took me forever to figure out because the recommended local path is misleadingly recommended to be "/home/user/wiki" inside the admin panel. Everyone who uses docker - be aware that most of your local files and directories are going to stem from the /var/lib/docker directory and not from the regular root directory. ==== Our old wikijs 2.x version was running SQlite and we upgraded the server and re-installed the latest wiki version, this time with Postgres DB instead. We have the old / repo folder from the previous version with all our pages as .md files, and all our media in /repo/uploads backed up. However, when we try to use the admin panel to import the old data from the local directory nothing is imported. A green "success" notification immediately appears but no pages or data seem to actually be added. There's over 160 pages that we need to import into Postgres, too many to recreate manually. Is the "storage > local storage > import" prompt supposed to work with .md files or is it impossible to import old .md page files into Postgres? Running wikijs through docker on Xubuntu.
Author
Owner

@rico161 commented on GitHub (Feb 4, 2022):

SOLVED == The problem is that if you set your local path in the admin panel "storage" section to "/home/user/wiki" for example (which is what the settings recommend even though it's not correct), it actually starts that file path from /var/lib/docker/ sub folders so when my files were in /home/user/wiki they weren't found because it was looking in /var/lib/docker/i/home/user/wiki or some such. This took me forever to figure out because the recommended local path is misleadingly recommended to be "/home/user/wiki" inside the admin panel. Everyone who uses docker - be aware that most of your local files and directories are going to stem from the /var/lib/docker directory and not from the regular root directory.

@rico161 commented on GitHub (Feb 4, 2022): SOLVED == The problem is that if you set your local path in the admin panel "storage" section to "/home/user/wiki" for example (which is what the settings recommend even though it's not correct), it actually starts that file path from /var/lib/docker/ sub folders so when my files were in /home/user/wiki they weren't found because it was looking in /var/lib/docker/i/home/user/wiki or some such. This took me forever to figure out because the recommended local path is misleadingly recommended to be "/home/user/wiki" inside the admin panel. Everyone who uses docker - be aware that most of your local files and directories are going to stem from the /var/lib/docker directory and not from the regular root directory.
Author
Owner

@rico161 commented on GitHub (Feb 4, 2022):

Installation documentation needs serious repair to avoid everyone being confused:

Docker install instructions need to clarify that the actual wiki files installed by docker on the drive are in /var/lib/docker/

Further, it should be clarified in the admin panel and/or documentation that the "local path" in "storage" settings branches from /var/lib/docker/ and not /home/ root.

Docker install instructions need to clarify that wiki pages and media are all stored inside the database now (ive seen a lot of forums with people scouring their hard drives for where the hell their pages are stored, i was doing the same during troubleshooting)

Docker install instructions ran into multiple errors for me (with permissions and finding the postgres db) and i had to fix it with docker-compose, but there's no clear docker-compose instructions aside from a random example config file, and this example file doesn't show you how to use the .db-secret file for the password either like the other docker instructions do.

Hoping this saves others the same headaches I've gone through for the past week trying to get this running!

@rico161 commented on GitHub (Feb 4, 2022): Installation documentation needs serious repair to avoid everyone being confused: Docker install instructions need to clarify that the actual wiki files installed by docker on the drive are in /var/lib/docker/ Further, it should be clarified in the admin panel and/or documentation that the "local path" in "storage" settings branches from /var/lib/docker/ and not /home/ root. Docker install instructions need to clarify that wiki pages and media are all stored inside the database now (ive seen a lot of forums with people scouring their hard drives for where the hell their pages are stored, i was doing the same during troubleshooting) Docker install instructions ran into multiple errors for me (with permissions and finding the postgres db) and i had to fix it with docker-compose, but there's no clear docker-compose instructions aside from a random example config file, and this example file doesn't show you how to use the .db-secret file for the password either like the other docker instructions do. Hoping this saves others the same headaches I've gone through for the past week trying to get this running!
Author
Owner

@akiross commented on GitHub (Feb 8, 2022):

Hi, can you write here the command you used to start the docker container? In /var/lib/docker there are docker local storage files, which usually aren't accessed directly.

@akiross commented on GitHub (Feb 8, 2022): Hi, can you write here the command you used to start the docker container? In `/var/lib/docker` there are docker local storage files, which usually aren't accessed directly.
Author
Owner

@rico161 commented on GitHub (Feb 9, 2022):

@akiross I used this command to start the container with docker-compose:

docker-compose -f /home/user/wiki/wiki-docker-compose.yml up

And this is the contents of my docker-compose file:

version: "3"
services:

  db:
    image: postgres:11
    environment:
      POSTGRES_DB: wiki
      POSTGRES_PASSWORD: wikijsrocks
      POSTGRES_USER: wikijs
    logging:
      driver: "none"
    restart: unless-stopped
    volumes:
      - db-data:/var/lib/postgresql/data

  wiki:
    image: requarks/wiki:2
    depends_on:
      - db
    environment:
      DB_TYPE: postgres
      DB_HOST: db
      DB_PORT: 5432
      DB_USER: wikijs
      DB_PASS: wikijsrocks
      DB_NAME: wiki
      UPGRADE_COMPANION: 1
    restart: unless-stopped
    ports:
      - "8080:3000"

volumes:
  db-data:
@rico161 commented on GitHub (Feb 9, 2022): @akiross I used this command to start the container with docker-compose: `docker-compose -f /home/user/wiki/wiki-docker-compose.yml up` And this is the contents of my docker-compose file: ``` version: "3" services: db: image: postgres:11 environment: POSTGRES_DB: wiki POSTGRES_PASSWORD: wikijsrocks POSTGRES_USER: wikijs logging: driver: "none" restart: unless-stopped volumes: - db-data:/var/lib/postgresql/data wiki: image: requarks/wiki:2 depends_on: - db environment: DB_TYPE: postgres DB_HOST: db DB_PORT: 5432 DB_USER: wikijs DB_PASS: wikijsrocks DB_NAME: wiki UPGRADE_COMPANION: 1 restart: unless-stopped ports: - "8080:3000" volumes: db-data: ```
Author
Owner

@akiross commented on GitHub (Feb 9, 2022):

I think /home/user/wiki is suggested when installing on the system without using containers. In the docker installation page I don't see any suggestion regarding /home/user/wiki.

I'm using containers as well (sqlite instead of postgres) and I had no issues. Also, note that in the docker image the path of the wiki is in /wiki (that can be seen in the documentation in the Alternative: Mount the config file section):

docker run -d \
    -e"DB_TYPE=sqlite" \
    -e"DB_FILEPATH=/wjs/db.sqlite" \
    -v"/home/my-user/wikijs-mount:/wjs:Z" \
    -p"3000:3000" \
    requarks/wiki:2

In this case, I specify that /wjs is mounted and contains the database file. If I specify e.g. /wjs/local_storage as the local storage path, it works as I expect and I find the data in /home/my-user/wikijs-mount/local_storage.

I hope this helps

@akiross commented on GitHub (Feb 9, 2022): I think `/home/user/wiki` is suggested when installing on the system without using containers. In the [docker installation page](https://docs.requarks.io/install/docker) I don't see any suggestion regarding `/home/user/wiki`. I'm using containers as well (sqlite instead of postgres) and I had no issues. Also, note that in the docker image the path of the wiki is in `/wiki` (that can be seen in the documentation in the `Alternative: Mount the config file` section): ``` docker run -d \ -e"DB_TYPE=sqlite" \ -e"DB_FILEPATH=/wjs/db.sqlite" \ -v"/home/my-user/wikijs-mount:/wjs:Z" \ -p"3000:3000" \ requarks/wiki:2 ``` In this case, I specify that `/wjs` is mounted and contains the database file. If I specify e.g. `/wjs/local_storage` as the local storage path, it works as I expect and I find the data in `/home/my-user/wikijs-mount/local_storage`. I hope this helps
Author
Owner

@rico161 commented on GitHub (Feb 9, 2022):

/home/user/wiki is not suggested by the documentation for the local storage path, i meant that it is suggested in the admin panel inside of wiki.js Local Storage settings (it is displayed as the example path under the field where you enter the path for local storage). The problem is that /home/ should be starting from root when i enter it as my local storage path, but in my installation home/ is stemming from the root of /var/lib/docker/... instead of the true system root.

One difference i notice in my docker-compose file (compared to the command you are running) is that i didn't specify "DB_FILEPATH" (but i used the example docker-compose file in documentation). So i'm not sure if that's why the path isn't starting from root or not, but if that's the reason why then the example docker file in documentation should be corrected to include that. Documentation specifically says that it's for SQLite only though and not for Postgres, so it shouldn't be a problem for my setup.

I'm not sure how to add the other line -v"/home/my-user/wikijs-mount:/wjs:Z" \ into my docker compose file properly but if something like that is required then it should definitely be in the example file.

Originally i had tried running the regular docker commands from documentation, which were similar to what you posted above, but that didn't work because of errors connecting to Postgres, which is why i had to switch to docker-compose which fixed that issue.

@rico161 commented on GitHub (Feb 9, 2022): `/home/user/wiki` is not suggested by the documentation for the local storage path, i meant that it is suggested in the admin panel inside of wiki.js Local Storage settings (it is displayed as the example path under the field where you enter the path for local storage). The problem is that `/home/` should be starting from root when i enter it as my local storage path, but in my installation `home/` is stemming from the root of `/var/lib/docker/...` instead of the true system root. One difference i notice in my docker-compose file (compared to the command you are running) is that i didn't specify "DB_FILEPATH" (but i used the [example docker-compose file in documentation](https://docs.requarks.io/install/docker#using-docker-compose)). So i'm not sure if that's why the path isn't starting from root or not, but if that's the reason why then the [example docker file in documentation](https://docs.requarks.io/install/docker#using-docker-compose) should be corrected to include that. Documentation specifically says that it's for SQLite only though and not for Postgres, so it shouldn't be a problem for my setup. I'm not sure how to add the other line ` -v"/home/my-user/wikijs-mount:/wjs:Z" \` into my docker compose file properly but if something like that is required then it should definitely be in the example file. Originally i had tried running the regular docker commands from documentation, which were similar to what you posted above, but that didn't work because of errors connecting to Postgres, which is why i had to switch to docker-compose which fixed that issue.
Author
Owner

@akiross commented on GitHub (Feb 10, 2022):

The problem is that /home/ should be starting from root when i enter it as my local storage path,

Well, not really, it shouldn't: you're running in a container, so there is no mapping with the filesystem unless you specify it (that's what the -v"/home/my-user/wikijs-mount:/wjs:Z" flag does). The fact that you're seeing the files in /var/lib/docker/... is just because your docker storage driver places the container there - but this is not mandatory, it might change between different computers and installations.

I think the docker documentation currently on-line is decent, while it doesn't explain how to set-up wikijs with postgres containers. One option is to create a network and attach two containers to it. Here's an untested example to give you a rough idea:

docker network create wikijs-network
docker run -d --network=wikijs-network ... requarks/wikijs:2
docker run -d --network=wikijs-network ... postgres

This is similar to what docker-compose is doing: it creates a network and places two containers in it. But I see no particular reason to do this manually when you're using compose already.

To mount the /wjs directory from the container on your filesystem, similar to what I did, you can edit your compose like so:

  wiki:
    image: requarks/wiki:2
    depends_on:
      - db
    environment:
      DB_TYPE: postgres
      DB_HOST: db
      DB_PORT: 5432
      DB_USER: wikijs
      DB_PASS: wikijsrocks
      DB_NAME: wiki
      UPGRADE_COMPANION: 1
    restart: unless-stopped
    volumes:                                   # this is new
      - /home/my-user/wikijs-mount:/wjs        # this is new
    ports:
      - "8080:3000"

If you use /wjs/foobar/ in your local storage configuration, you should be able to see the foobar directory in /home/my-user/wikijs-mount/foobar.

Hope it helps

@akiross commented on GitHub (Feb 10, 2022): > The problem is that /home/ should be starting from root when i enter it as my local storage path, Well, not really, it shouldn't: you're running in a container, so there is no mapping with the filesystem unless you specify it (that's what the `-v"/home/my-user/wikijs-mount:/wjs:Z"` flag does). The fact that you're seeing the files in `/var/lib/docker/...` is just because your docker storage driver places the container there - but this is not mandatory, it might change between different computers and installations. I think the docker documentation currently on-line is decent, while it doesn't explain how to set-up wikijs with postgres containers. One option is to create a network and attach two containers to it. Here's an untested example to give you a rough idea: ``` docker network create wikijs-network docker run -d --network=wikijs-network ... requarks/wikijs:2 docker run -d --network=wikijs-network ... postgres ``` This is similar to what docker-compose is doing: it creates a network and places two containers in it. But I see no particular reason to do this manually when you're using compose already. To mount the `/wjs` directory from the container on your filesystem, similar to what I did, you can edit your compose like so: ``` wiki: image: requarks/wiki:2 depends_on: - db environment: DB_TYPE: postgres DB_HOST: db DB_PORT: 5432 DB_USER: wikijs DB_PASS: wikijsrocks DB_NAME: wiki UPGRADE_COMPANION: 1 restart: unless-stopped volumes: # this is new - /home/my-user/wikijs-mount:/wjs # this is new ports: - "8080:3000" ``` If you use `/wjs/foobar/` in your local storage configuration, you should be able to see the `foobar` directory in `/home/my-user/wikijs-mount/foobar`. Hope it helps
Author
Owner

@rico161 commented on GitHub (Feb 11, 2022):

Thanks! That's super helpful, I don't know much about docker or docker-compose so your docker-compose example is perfect, it seems like that's what's missing from the documentation example.

I'll try modifying my docker-compose file with these new settings, i was going to edit it to change the port anyways. Do you know by chance if when i run docker-compose down and change my file, then run docker-compose up again with my new .yml file if it will wipe any of my data/settings inside the wiki or keep my wiki intact as it was? Worried about losing Postgres data by re-making the containers, i'm not sure if that would happen or not.

@rico161 commented on GitHub (Feb 11, 2022): Thanks! That's super helpful, I don't know much about docker or docker-compose so your docker-compose example is perfect, it seems like that's what's missing from the documentation example. I'll try modifying my docker-compose file with these new settings, i was going to edit it to change the port anyways. Do you know by chance if when i run `docker-compose down` and change my file, then run `docker-compose up` again with my new .yml file if it will wipe any of my data/settings inside the wiki or keep my wiki intact as it was? Worried about losing Postgres data by re-making the containers, i'm not sure if that would happen or not.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/wiki-requarks#2558
No description provided.