Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use Local Storage for backup #1288

Closed
Schnuecks opened this issue Dec 5, 2019 · 11 comments
Closed

How to use Local Storage for backup #1288

Schnuecks opened this issue Dec 5, 2019 · 11 comments
Assignees

Comments

@Schnuecks
Copy link

Hello,

how could i use the local storage for backup?
i ran the docker-compose.yml from docs.

how do i need to modify the docker-compose.yml to set a volume or path so wikijs could backup in it and copy to the host.

OS: CentOS 7, docker-compose
Wiki.js version: 2.0.12
Database engine: postgres 9

@NGPixel
Copy link
Member

NGPixel commented Dec 5, 2019

You would need to mount a folder, e.g.:

version: "3"
services:

  db:
    image: postgres:11-alpine
    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
    restart: unless-stopped
    ports:
      - "80:3000"
    volumes:
      - /host/backup/path:/backups

volumes:
  db-data:

Then specify /backups as the path in Wiki.js admin

@Schnuecks
Copy link
Author

Hello,

i tried that and save it in the compose file. the folder on host and container is created.

i specified the path in wikijs but nothing is happen if i click on create backup.

both folder are empty.

@ChristopherRotter
Copy link

ChristopherRotter commented Dec 17, 2019

I ran into the same problem.

This

wiki:
    volumes:
      - ./backup:/backups

did the trick for me.

@Schnuecks
Copy link
Author

That still doesn't work for me.The backups folder defined in docker-compose.yml is created as root.
So the user node who runs doesn't have the permission to write to that folder.
If i backup to the node home directory it works.

@ssimontis
Copy link
Contributor

@Schnuecks Assign the user node to the Docker group and that should fix your issue.

@Schnuecks
Copy link
Author

@ssimontis How? I have no node user on the host who could i assigne for docker group

@ssimontis
Copy link
Contributor

@Schnuecks I'll get you an answer tonight, one of my goals for this evening is to dig into the Dockerfiles

@krema
Copy link

krema commented Jan 9, 2020

The problem is that the backup folder is created with root ownership on the container and therefore the node user does not have write permissions on this folder. To fix this the folder ownership in the container must be changed to node:node. We could change the Dockerfile to have a default backup folder with the correct permissions in the container. What do you think?

Temporary you can connect on the container (docker exec) and change the ownership to node:node of your backup folder.

@ssimontis
Copy link
Contributor

I think that sounds like a winner to me...in my opinion the more directories we can pry away from root ownership related to our applications, the better

@Schnuecks
Copy link
Author

Sounds good. A default backup location with correct permission seems the way to go.

@NGPixel
Copy link
Member

NGPixel commented Jan 10, 2020

/wiki/data/content has been added as a predefined volume with node:node permissions in the Dockerfile. It will be available in the 2.1 release.

@NGPixel NGPixel closed this as completed Jan 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants