Update README to include event management scripts and LXC deployment details

This commit is contained in:
Arunavo Ray
2025-05-22 09:06:47 +05:30
parent 1ab642c9e7
commit 8b5c5d8ed2

View File

@@ -1,12 +1,14 @@
# Scripts Directory
This folder contains utility scripts for database management.
This folder contains utility scripts for database management, event management, Docker builds, and LXC container deployment.
## Database Management Tool (manage-db.ts)
## Database Management
### Database Management Tool (manage-db.ts)
This is a consolidated database management tool that handles all database-related operations. It combines the functionality of the previous separate scripts into a single, more intelligent script that can check, fix, and initialize the database as needed.
### Features
#### Features
- **Check Mode**: Validates the existence and integrity of the database
- **Init Mode**: Creates the database only if it doesn't already exist
@@ -14,12 +16,12 @@ This is a consolidated database management tool that handles all database-relate
- **Reset Users Mode**: Removes all users and their data
- **Auto Mode**: Automatically checks, fixes, and initializes the database if needed
## Running the Database Management Tool
#### Running the Database Management Tool
You can execute the database management tool using your package manager with various commands:
```bash
# Checks database status (default action if no command is specified, equivalent to 'bun run check-db')
# Checks database status (default action if no command is specified)
bun run manage-db
# Check database status
@@ -37,9 +39,6 @@ bun run db-auto
# Reset all users (for testing signup flow)
bun run reset-users
# Update the database schema to the latest version
bun run update-schema
# Remove database files completely
bun run cleanup-db
@@ -53,6 +52,70 @@ bun run dev:clean
bun run start:fresh
```
## Database File Location
#### Database File Location
The database file should be located in the `./data/gitea-mirror.db` directory. If the file is found in the root directory, the fix mode will move it to the correct location.
## Event Management
The following scripts help manage events in the SQLite database:
### Event Inspection (check-events.ts)
Displays all events currently stored in the database.
```bash
bun scripts/check-events.ts
```
### Event Cleanup (cleanup-events.ts)
Removes old events from the database to prevent it from growing too large.
```bash
# Remove events older than 7 days (default)
bun scripts/cleanup-events.ts
# Remove events older than X days
bun scripts/cleanup-events.ts 14
```
This script can be scheduled to run periodically (e.g., daily) using cron or another scheduler.
### Mark Events as Read (mark-events-read.ts)
Marks all unread events as read.
```bash
bun scripts/mark-events-read.ts
```
### Make Events Appear Older (make-events-old.ts)
For testing purposes, this script modifies event timestamps to make them appear older.
```bash
bun scripts/make-events-old.ts
```
## Deployment Scripts
### Docker Deployment
- **build-docker.sh**: Builds the Docker image for the application
- **docker-diagnostics.sh**: Provides diagnostic information for Docker deployments
### LXC Container Deployment
Two scripts are provided for deploying Gitea Mirror in LXC containers:
1. **gitea-mirror-lxc-proxmox.sh**: For online deployment on a Proxmox VE host
- Pulls everything from GitHub
- Creates a privileged container with the application
- Sets up systemd service
2. **gitea-mirror-lxc-local.sh**: For offline/LAN-only deployment on a developer laptop
- Pushes your local checkout + Bun ZIP to the container
- Useful for testing without internet access
For detailed instructions on LXC deployment, see [README-lxc.md](./README-lxc.md).