- Add Docker Compose setup for Wiki.js and PostgreSQL. - Include setup and backup scripts for easy management. - Create command-line scripts to create and edit wiki pages via the GraphQL API. - Add comprehensive README and .gitignore.
104 lines
3.4 KiB
Markdown
104 lines
3.4 KiB
Markdown
# Personal Wiki.js Project
|
|
|
|
This repository contains everything needed to set up, manage, and programmatically interact with a personal Wiki.js instance using Docker and Python scripts.
|
|
|
|
## 🚀 Quick Start
|
|
|
|
1. **Set Up Environment**: Ensure you have `docker` and `docker-compose` installed. The `setup.sh` script will check for these.
|
|
|
|
2. **Run Setup Script**: This script generates a secure database password, creates necessary directories, and starts the wiki.
|
|
```bash
|
|
./setup.sh
|
|
```
|
|
|
|
3. **Access Your Wiki**: Open your browser and navigate to the URL specified in your `.env` file (e.g., `http://localhost:3000` or `https://wiki.liveaodh.com`). Complete the initial setup wizard and create your administrator account.
|
|
|
|
## 📁 Project Structure
|
|
|
|
```
|
|
wikiaodh/
|
|
├── docker-compose.yml # Docker services configuration
|
|
├── .env # Environment variables (passwords, API key, etc.)
|
|
├── setup.sh # Automated setup script
|
|
├── backup.sh # Backup script for database and assets
|
|
├── README.md # This file
|
|
├── requirements.txt # Python dependencies for scripts
|
|
├── venv/ # Python virtual environment
|
|
└── scripts/
|
|
├── create_page.py # CLI tool to create new wiki pages
|
|
└── edit_page.py # CLI tool to edit existing wiki pages
|
|
```
|
|
|
|
## 🔧 Wiki Management
|
|
|
|
### Docker Commands
|
|
|
|
- **Start the wiki**: `docker-compose up -d`
|
|
- **Stop the wiki**: `docker-compose down`
|
|
- **View logs**: `docker-compose logs -f`
|
|
- **Restart services**: `docker-compose restart`
|
|
- **Update to latest version**: `docker-compose pull && docker-compose up -d`
|
|
|
|
### Backup and Restore
|
|
|
|
- **Run a full backup**: The `backup.sh` script creates a timestamped backup of your database and assets in the `backups/` directory.
|
|
```bash
|
|
./backup.sh
|
|
```
|
|
|
|
## 🤖 Command-Line Scripts
|
|
|
|
These scripts use the Wiki.js GraphQL API to manage content programmatically. They require a Python virtual environment and an API key.
|
|
|
|
### Setup
|
|
|
|
1. **Activate Virtual Environment**:
|
|
```bash
|
|
source venv/bin/activate
|
|
```
|
|
|
|
2. **Set API Key**: Generate an API key in the Wiki.js **Administration -> API Access** area and add it to your `.env` file:
|
|
```
|
|
WIKI_API_KEY=your_api_key_here
|
|
```
|
|
|
|
### `scripts/create_page.py`
|
|
|
|
Creates a new page in your wiki.
|
|
|
|
**Usage**:
|
|
```bash
|
|
python3 scripts/create_page.py --path "my-folder/my-new-page" --title "My New Page" --content-file "path/to/my-content.md"
|
|
```
|
|
|
|
**Arguments**:
|
|
- `--path` (required): The URL path for the new page.
|
|
- `--title` (required): The title of the page.
|
|
- `--content-file` (required): Path to a markdown file with the page content.
|
|
- `--tags` (optional): A list of tags (e.g., `--tags project guide`).
|
|
|
|
### `scripts/edit_page.py`
|
|
|
|
Edits an existing page in your wiki.
|
|
|
|
**Usage**:
|
|
```bash
|
|
# Update content
|
|
python3 scripts/edit_page.py --path "home" --content-file "new_content.md"
|
|
|
|
# Update title
|
|
python3 scripts/edit_page.py --path "home" --title "New Home Page Title"
|
|
|
|
# Update both
|
|
python3 scripts/edit_page.py --path "home" --title "New Title" --content-file "new_content.md"
|
|
```
|
|
|
|
**Arguments**:
|
|
- `--path` (required): The path of the page to edit.
|
|
- `--content-file` (optional): Path to a markdown file with the new content.
|
|
- `--title` (optional): A new title for the page.
|
|
|
|
---
|
|
|
|
**Enjoy your powerful, scriptable personal wiki! 📖✨**
|