Running-WikiJS

From Irregularpedia
Revision as of 05:34, 7 September 2024 by Maintenance script (talk | contribs) (Initial)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

https://docs.requarks.io/install/docker#using-docker-compose

Using docker compose is a little easier for updating making sure it is all done safely. Shooters preference of course. ## Configure WIKIJS Create this docker-compose.yml file preferably in a user home directory for wikijs See Linux Server Initial Setup

version: "3"
services:

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

  wiki:
    image: ghcr.io/requarks/wiki:2
    depends_on:
      - db
    environment:
      DB_TYPE: postgres
      DB_HOST: db
      DB_PORT: 5432
      DB_USER: wikijs
      DB_PASS: super_secret_here
      DB_NAME: wiki
    restart: unless-stopped
    ports:
      - "XZY:3000"

volumes:
  db-data:

Update the port as needed where it says xyz. "80:3000" is the typical port 80 but if you are serving this on other ports with self-host-cloudflare-tunnels then you can set this to anything you want.

Update the passwords: super_secret_here

Run WIKIJS

<syntaxhighlight lang="shell">docker compose up -d</syntaxhighlight>

Update WIKIJS

<syntaxhighlight lang="shell">docker-compose pull && docker-compose up -d</syntaxhighlight> This command will first pull any updates for the Docker images specified in your docker-compose.yml file, and then restart your Docker containers with the new images in detached mode.

Backup WIKIJS

Remember to always backup your data before updating. You can use commands like:

<syntaxhighlight lang="shell">docker exec -t your-db-container pg_dumpall -c -U wikijs > dump_date +%d-%m-%Y"_"%H_%M_%S.sql</syntaxhighlight> This command will create a dump of your database. Replace your-db-container with the name of your database container (in this case, it would be db). The output will be a .sql file with a timestamp in its filename.

After updating, make sure to verify that everything is running correctly. You can check the logs of your Wiki.js container with:

<syntaxhighlight lang="shell">docker logs wiki</syntaxhighlight> If you encounter any issues, you can revert to the previous version using the backup you created earlier. For example:

<syntaxhighlight lang="shell">cat your_backup.sql | docker exec -i your-db-container psql -U wikijs</syntaxhighlight> Replace your_backup.sql with the path to your backup file and your-db-container with the name of your database container.

Remember that updating is an important task that maintains system security and introduces new features and improvements. But also remember that it should be performed carefully, as it can potentially disrupt service. Always make sure to first test updates in an environment that does not affect live users./n