bMINI
This commit is contained in:
80
.gitignore
vendored
80
.gitignore
vendored
@@ -1,40 +1,40 @@
|
|||||||
# Gitea data directory
|
# Gitea data directory
|
||||||
data/
|
data/
|
||||||
|
|
||||||
# Database files
|
# Database files
|
||||||
*.db
|
*.db
|
||||||
*.sqlite
|
*.sqlite
|
||||||
|
|
||||||
# Log files
|
# Log files
|
||||||
*.log
|
*.log
|
||||||
|
|
||||||
# Environment files
|
# Environment files
|
||||||
.env
|
.env
|
||||||
|
|
||||||
# System files
|
# System files
|
||||||
.DS_Store
|
.DS_Store
|
||||||
Thumbs.db
|
Thumbs.db
|
||||||
|
|
||||||
# Docker volumes
|
# Docker volumes
|
||||||
volumes/
|
volumes/
|
||||||
|
|
||||||
# Gitea directories
|
# Gitea directories
|
||||||
gitea/*
|
gitea/*
|
||||||
!gitea/ssl/
|
!gitea/ssl/
|
||||||
!gitea/conf/
|
!gitea/conf/
|
||||||
|
|
||||||
# SSL certificates (should not be in version control)
|
# SSL certificates (should not be in version control)
|
||||||
gitea/ssl/*.pem
|
gitea/ssl/*.pem
|
||||||
gitea/ssl/*.key
|
gitea/ssl/*.key
|
||||||
gitea/ssl/*.crt
|
gitea/ssl/*.crt
|
||||||
|
|
||||||
# Gitea user data and logs
|
# Gitea user data and logs
|
||||||
gitea/gitea/*
|
gitea/gitea/*
|
||||||
gitea/git/*
|
gitea/git/*
|
||||||
gitea/ssh/*
|
gitea/ssh/*
|
||||||
gitea/data/*
|
gitea/data/*
|
||||||
|
|
||||||
# Temporary files
|
# Temporary files
|
||||||
*.tmp
|
*.tmp
|
||||||
*.temp
|
*.temp
|
||||||
*~
|
*~
|
||||||
|
|||||||
144
BACKUP-README.md
144
BACKUP-README.md
@@ -1,73 +1,73 @@
|
|||||||
# Gitea Backup Strategy
|
# Gitea Backup Strategy
|
||||||
|
|
||||||
This document outlines the backup strategy for your Gitea installation, focusing on ensuring your database is always backed up in at least one place.
|
This document outlines the backup strategy for your Gitea installation, focusing on ensuring your database is always backed up in at least one place.
|
||||||
|
|
||||||
## Backup Methods
|
## Backup Methods
|
||||||
|
|
||||||
This setup provides two complementary backup methods:
|
This setup provides two complementary backup methods:
|
||||||
|
|
||||||
### 1. PostgreSQL Database Dumps
|
### 1. PostgreSQL Database Dumps
|
||||||
|
|
||||||
Database dumps are SQL files containing all your database data. These are the most reliable way to back up a PostgreSQL database.
|
Database dumps are SQL files containing all your database data. These are the most reliable way to back up a PostgreSQL database.
|
||||||
|
|
||||||
- **Script**: `backup-gitea-db.ps1`
|
- **Script**: `backup-gitea-db.ps1`
|
||||||
- **Output**: SQL dumps in the `backups` directory, compressed as ZIP files
|
- **Output**: SQL dumps in the `backups` directory, compressed as ZIP files
|
||||||
- **Retention**: Keeps the last 10 backups by default
|
- **Retention**: Keeps the last 10 backups by default
|
||||||
|
|
||||||
### 2. Docker Volume Backups
|
### 2. Docker Volume Backups
|
||||||
|
|
||||||
This method backs up the entire PostgreSQL data volume, which includes all database files.
|
This method backs up the entire PostgreSQL data volume, which includes all database files.
|
||||||
|
|
||||||
- **Script**: `backup-volume.ps1`
|
- **Script**: `backup-volume.ps1`
|
||||||
- **Output**: TAR archives in the `backups` directory, compressed as ZIP files
|
- **Output**: TAR archives in the `backups` directory, compressed as ZIP files
|
||||||
- **Retention**: Keeps the last 5 volume backups by default
|
- **Retention**: Keeps the last 5 volume backups by default
|
||||||
|
|
||||||
## Automated Backups
|
## Automated Backups
|
||||||
|
|
||||||
You can set up automated daily backups using the included script:
|
You can set up automated daily backups using the included script:
|
||||||
|
|
||||||
```powershell
|
```powershell
|
||||||
.\schedule-backup.ps1
|
.\schedule-backup.ps1
|
||||||
```
|
```
|
||||||
|
|
||||||
This creates a Windows Scheduled Task that runs the database backup script daily at 3 AM.
|
This creates a Windows Scheduled Task that runs the database backup script daily at 3 AM.
|
||||||
|
|
||||||
## Restoring from Backups
|
## Restoring from Backups
|
||||||
|
|
||||||
### Restoring from a Database Dump
|
### Restoring from a Database Dump
|
||||||
|
|
||||||
```powershell
|
```powershell
|
||||||
.\restore-gitea-db.ps1 -BackupFile "backups\gitea-db-backup-2025-03-01_10-30-00.sql.zip"
|
.\restore-gitea-db.ps1 -BackupFile "backups\gitea-db-backup-2025-03-01_10-30-00.sql.zip"
|
||||||
```
|
```
|
||||||
|
|
||||||
### Restoring from a Volume Backup
|
### Restoring from a Volume Backup
|
||||||
|
|
||||||
```powershell
|
```powershell
|
||||||
.\restore-volume.ps1 -BackupFile "backups\postgres-volume-backup-2025-03-01_10-30-00.tar.zip"
|
.\restore-volume.ps1 -BackupFile "backups\postgres-volume-backup-2025-03-01_10-30-00.tar.zip"
|
||||||
```
|
```
|
||||||
|
|
||||||
## Best Practices
|
## Best Practices
|
||||||
|
|
||||||
1. **Regular Backups**: Run backups at least daily
|
1. **Regular Backups**: Run backups at least daily
|
||||||
2. **Multiple Backup Methods**: Use both database dumps and volume backups
|
2. **Multiple Backup Methods**: Use both database dumps and volume backups
|
||||||
3. **Off-site Storage**: Copy your backups to an external drive or cloud storage
|
3. **Off-site Storage**: Copy your backups to an external drive or cloud storage
|
||||||
4. **Test Restores**: Periodically test restoring from your backups
|
4. **Test Restores**: Periodically test restoring from your backups
|
||||||
5. **Version Control**: Keep your Gitea configuration files in version control
|
5. **Version Control**: Keep your Gitea configuration files in version control
|
||||||
|
|
||||||
## Important Notes
|
## Important Notes
|
||||||
|
|
||||||
- **Never** run `docker-compose down -v` unless you have a recent backup
|
- **Never** run `docker-compose down -v` unless you have a recent backup
|
||||||
- When upgrading Gitea, always create a backup first
|
- When upgrading Gitea, always create a backup first
|
||||||
- The database volume (`postgres-data`) persists even when containers are stopped or removed, but can be lost if explicitly deleted
|
- The database volume (`postgres-data`) persists even when containers are stopped or removed, but can be lost if explicitly deleted
|
||||||
|
|
||||||
## Manual Backup Commands
|
## Manual Backup Commands
|
||||||
|
|
||||||
If you need to create a backup manually:
|
If you need to create a backup manually:
|
||||||
|
|
||||||
```powershell
|
```powershell
|
||||||
# Database dump
|
# Database dump
|
||||||
.\backup-gitea-db.ps1
|
.\backup-gitea-db.ps1
|
||||||
|
|
||||||
# Volume backup
|
# Volume backup
|
||||||
.\backup-volume.ps1
|
.\backup-volume.ps1
|
||||||
```
|
```
|
||||||
160
HTTPS-SETUP.md
160
HTTPS-SETUP.md
@@ -1,81 +1,81 @@
|
|||||||
# Setting Up HTTPS for Gitea with Traefik
|
# Setting Up HTTPS for Gitea with Traefik
|
||||||
|
|
||||||
This guide explains how to configure Gitea with proper HTTPS using Traefik as a reverse proxy with automatic certificate management via Let's Encrypt.
|
This guide explains how to configure Gitea with proper HTTPS using Traefik as a reverse proxy with automatic certificate management via Let's Encrypt.
|
||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
|
||||||
- A domain name pointing to your server (currently using `bee8333.ddns.net`)
|
- A domain name pointing to your server (currently using `bee8333.ddns.net`)
|
||||||
- Ports 80 and 443 open and forwarded to your server
|
- Ports 80 and 443 open and forwarded to your server
|
||||||
- Docker and Docker Compose installed
|
- Docker and Docker Compose installed
|
||||||
|
|
||||||
## Configuration Steps
|
## Configuration Steps
|
||||||
|
|
||||||
1. **Update email address in docker-compose.yml**
|
1. **Update email address in docker-compose.yml**
|
||||||
|
|
||||||
Edit the `docker-compose.yml` file and replace `your-email@example.com` with your actual email address. Let's Encrypt will use this for certificate expiration notifications:
|
Edit the `docker-compose.yml` file and replace `your-email@example.com` with your actual email address. Let's Encrypt will use this for certificate expiration notifications:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
--certificatesresolvers.letsencrypt.acme.email=your-email@example.com
|
--certificatesresolvers.letsencrypt.acme.email=your-email@example.com
|
||||||
```
|
```
|
||||||
|
|
||||||
2. **Start the services**
|
2. **Start the services**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker-compose down
|
docker-compose down
|
||||||
docker-compose up -d
|
docker-compose up -d
|
||||||
```
|
```
|
||||||
|
|
||||||
3. **Check the status**
|
3. **Check the status**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker-compose ps
|
docker-compose ps
|
||||||
```
|
```
|
||||||
|
|
||||||
All services should be running without errors.
|
All services should be running without errors.
|
||||||
|
|
||||||
## How It Works
|
## How It Works
|
||||||
|
|
||||||
- **Traefik** acts as a reverse proxy, handling incoming HTTP/HTTPS traffic
|
- **Traefik** acts as a reverse proxy, handling incoming HTTP/HTTPS traffic
|
||||||
- Automatically redirects HTTP to HTTPS
|
- Automatically redirects HTTP to HTTPS
|
||||||
- Obtains and renews SSL certificates from Let's Encrypt
|
- Obtains and renews SSL certificates from Let's Encrypt
|
||||||
- Routes requests to the appropriate containers based on domain name
|
- Routes requests to the appropriate containers based on domain name
|
||||||
|
|
||||||
## Troubleshooting
|
## Troubleshooting
|
||||||
|
|
||||||
If you encounter issues:
|
If you encounter issues:
|
||||||
|
|
||||||
1. **Check Traefik logs**
|
1. **Check Traefik logs**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker-compose logs traefik
|
docker-compose logs traefik
|
||||||
```
|
```
|
||||||
|
|
||||||
2. **Check Gitea logs**
|
2. **Check Gitea logs**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker-compose logs server
|
docker-compose logs server
|
||||||
```
|
```
|
||||||
|
|
||||||
3. **Verify DNS settings**
|
3. **Verify DNS settings**
|
||||||
|
|
||||||
Make sure your domain (`bee8333.ddns.net`) correctly points to your server's IP address.
|
Make sure your domain (`bee8333.ddns.net`) correctly points to your server's IP address.
|
||||||
|
|
||||||
4. **Check firewall settings**
|
4. **Check firewall settings**
|
||||||
|
|
||||||
Ensure ports 80 and 443 are open and properly forwarded to your server.
|
Ensure ports 80 and 443 are open and properly forwarded to your server.
|
||||||
|
|
||||||
## Git Client Configuration
|
## Git Client Configuration
|
||||||
|
|
||||||
When pushing to your Gitea repository from your local machine, you'll now be using HTTPS with a valid certificate. Use the following URL format:
|
When pushing to your Gitea repository from your local machine, you'll now be using HTTPS with a valid certificate. Use the following URL format:
|
||||||
|
|
||||||
```
|
```
|
||||||
https://bee8333.ddns.net/username/repository.git
|
https://bee8333.ddns.net/username/repository.git
|
||||||
```
|
```
|
||||||
|
|
||||||
## SSH Access
|
## SSH Access
|
||||||
|
|
||||||
SSH access is still available on port 222. Use the following format in your SSH config or Git command:
|
SSH access is still available on port 222. Use the following format in your SSH config or Git command:
|
||||||
|
|
||||||
```
|
```
|
||||||
ssh://git@bee8333.ddns.net:222/username/repository.git
|
ssh://git@bee8333.ddns.net:222/username/repository.git
|
||||||
```
|
```
|
||||||
364
README.md
364
README.md
@@ -1,183 +1,183 @@
|
|||||||
# Gitea Docker Setup
|
# Gitea Docker Setup
|
||||||
|
|
||||||
This is a Docker Compose configuration for running Gitea with PostgreSQL, configured with HTTPS support.
|
This is a Docker Compose configuration for running Gitea with PostgreSQL, configured with HTTPS support.
|
||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
|
||||||
- Docker Desktop for Windows
|
- Docker Desktop for Windows
|
||||||
- Docker Compose
|
- Docker Compose
|
||||||
- A domain or DDNS service (configured to point to your server)
|
- A domain or DDNS service (configured to point to your server)
|
||||||
- Port forwarding configured on your router (if accessing from outside your network)
|
- Port forwarding configured on your router (if accessing from outside your network)
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
- Gitea with HTTPS support
|
- Gitea with HTTPS support
|
||||||
- PostgreSQL database
|
- PostgreSQL database
|
||||||
- SSH access for Git operations
|
- SSH access for Git operations
|
||||||
- Persistent data storage
|
- Persistent data storage
|
||||||
- Self-signed SSL certificates (can be replaced with Let's Encrypt)
|
- Self-signed SSL certificates (can be replaced with Let's Encrypt)
|
||||||
- Automated database backup system
|
- Automated database backup system
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
The setup includes:
|
The setup includes:
|
||||||
- Gitea web interface:
|
- Gitea web interface:
|
||||||
- External access: https://bee8333.ddns.net/
|
- External access: https://bee8333.ddns.net/
|
||||||
- Local network access: https://bee8333.ddns.net/ or https://localhost:3000
|
- Local network access: https://bee8333.ddns.net/ or https://localhost:3000
|
||||||
- Local development: https://127.0.0.1:3000
|
- Local development: https://127.0.0.1:3000
|
||||||
- SSH access on port 222 (for git clone/push/pull)
|
- SSH access on port 222 (for git clone/push/pull)
|
||||||
- PostgreSQL database (internal access only)
|
- PostgreSQL database (internal access only)
|
||||||
- SSL certificates in `./gitea/ssl/`
|
- SSL certificates in `./gitea/ssl/`
|
||||||
- Persistent data storage for both Gitea and PostgreSQL
|
- Persistent data storage for both Gitea and PostgreSQL
|
||||||
|
|
||||||
## Access Methods
|
## Access Methods
|
||||||
|
|
||||||
### Web Interface
|
### Web Interface
|
||||||
|
|
||||||
1. **External Access (Internet)**:
|
1. **External Access (Internet)**:
|
||||||
- URL: https://bee8333.ddns.net/
|
- URL: https://bee8333.ddns.net/
|
||||||
- Requires port 3000 forwarded on your router
|
- Requires port 3000 forwarded on your router
|
||||||
- Uses HTTPS with SSL certificate
|
- Uses HTTPS with SSL certificate
|
||||||
|
|
||||||
2. **Local Network Access**:
|
2. **Local Network Access**:
|
||||||
- Same URL: https://bee8333.ddns.net/
|
- Same URL: https://bee8333.ddns.net/
|
||||||
- Or use: https://localhost:3000
|
- Or use: https://localhost:3000
|
||||||
- Both use HTTPS with SSL certificate
|
- Both use HTTPS with SSL certificate
|
||||||
- No port forwarding needed
|
- No port forwarding needed
|
||||||
|
|
||||||
3. **Local Development**:
|
3. **Local Development**:
|
||||||
- URL: https://127.0.0.1:3000
|
- URL: https://127.0.0.1:3000
|
||||||
- Direct access on the hosting machine
|
- Direct access on the hosting machine
|
||||||
- Uses HTTPS with SSL certificate
|
- Uses HTTPS with SSL certificate
|
||||||
|
|
||||||
### Git Operations (SSH)
|
### Git Operations (SSH)
|
||||||
|
|
||||||
- External SSH URL: `ssh://git@bee8333.ddns.net:222/username/repository.git`
|
- External SSH URL: `ssh://git@bee8333.ddns.net:222/username/repository.git`
|
||||||
- Local SSH URL: `ssh://git@localhost:222/username/repository.git`
|
- Local SSH URL: `ssh://git@localhost:222/username/repository.git`
|
||||||
- Requires port 222 forwarded on your router for external access
|
- Requires port 222 forwarded on your router for external access
|
||||||
|
|
||||||
## Getting Started
|
## Getting Started
|
||||||
|
|
||||||
1. Make sure Docker Desktop is running
|
1. Make sure Docker Desktop is running
|
||||||
2. Clone this repository
|
2. Clone this repository
|
||||||
3. Open a terminal in this directory
|
3. Open a terminal in this directory
|
||||||
4. Generate SSL certificates (see [SSL Certificates](#ssl-certificates) section)
|
4. Generate SSL certificates (see [SSL Certificates](#ssl-certificates) section)
|
||||||
5. Run `docker-compose up -d`
|
5. Run `docker-compose up -d`
|
||||||
6. Access Gitea using one of the URLs above
|
6. Access Gitea using one of the URLs above
|
||||||
7. During first-time setup:
|
7. During first-time setup:
|
||||||
- Database settings are pre-configured (no changes needed)
|
- Database settings are pre-configured (no changes needed)
|
||||||
- Domain is set to your domain name
|
- Domain is set to your domain name
|
||||||
- SSH port is set to 222
|
- SSH port is set to 222
|
||||||
- HTTPS is enabled by default
|
- HTTPS is enabled by default
|
||||||
|
|
||||||
## SSL Certificates
|
## SSL Certificates
|
||||||
|
|
||||||
You'll need to generate SSL certificates before starting the service. The certificates should be placed in `./gitea/ssl/`:
|
You'll need to generate SSL certificates before starting the service. The certificates should be placed in `./gitea/ssl/`:
|
||||||
- `cert.pem` - The SSL certificate
|
- `cert.pem` - The SSL certificate
|
||||||
- `key.pem` - The private key
|
- `key.pem` - The private key
|
||||||
|
|
||||||
To generate self-signed certificates (for development/testing):
|
To generate self-signed certificates (for development/testing):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Create the ssl directory
|
# Create the ssl directory
|
||||||
mkdir -p gitea/ssl
|
mkdir -p gitea/ssl
|
||||||
|
|
||||||
# Generate certificates using OpenSSL
|
# Generate certificates using OpenSSL
|
||||||
docker run --rm -v ${PWD}/gitea/ssl:/ssl alpine/openssl req -x509 -nodes \
|
docker run --rm -v ${PWD}/gitea/ssl:/ssl alpine/openssl req -x509 -nodes \
|
||||||
-days 365 -newkey rsa:2048 \
|
-days 365 -newkey rsa:2048 \
|
||||||
-keyout /ssl/key.pem -out /ssl/cert.pem \
|
-keyout /ssl/key.pem -out /ssl/cert.pem \
|
||||||
-subj "/CN=your.domain.here"
|
-subj "/CN=your.domain.here"
|
||||||
```
|
```
|
||||||
|
|
||||||
Replace `your.domain.here` with your actual domain name.
|
Replace `your.domain.here` with your actual domain name.
|
||||||
|
|
||||||
**Security Notes:**
|
**Security Notes:**
|
||||||
- Never commit SSL certificates to version control
|
- Never commit SSL certificates to version control
|
||||||
- Keep your private key (key.pem) secure
|
- Keep your private key (key.pem) secure
|
||||||
- For production use, consider using Let's Encrypt certificates
|
- For production use, consider using Let's Encrypt certificates
|
||||||
- Self-signed certificates will show browser security warnings
|
- Self-signed certificates will show browser security warnings
|
||||||
|
|
||||||
## Backup System
|
## Backup System
|
||||||
|
|
||||||
This setup includes a comprehensive backup strategy to ensure your Gitea data is always protected. The backup system provides two complementary methods:
|
This setup includes a comprehensive backup strategy to ensure your Gitea data is always protected. The backup system provides two complementary methods:
|
||||||
|
|
||||||
### Database Backups
|
### Database Backups
|
||||||
|
|
||||||
PowerShell scripts are included to manage database backups:
|
PowerShell scripts are included to manage database backups:
|
||||||
|
|
||||||
1. **Creating Backups**:
|
1. **Creating Backups**:
|
||||||
```powershell
|
```powershell
|
||||||
powershell -ExecutionPolicy Bypass -File .\backup-gitea-db.ps1
|
powershell -ExecutionPolicy Bypass -File .\backup-gitea-db.ps1
|
||||||
```
|
```
|
||||||
This creates a SQL dump of your PostgreSQL database, compressed as a ZIP file in the `backups` directory.
|
This creates a SQL dump of your PostgreSQL database, compressed as a ZIP file in the `backups` directory.
|
||||||
|
|
||||||
2. **Volume Backups**:
|
2. **Volume Backups**:
|
||||||
```powershell
|
```powershell
|
||||||
powershell -ExecutionPolicy Bypass -File .\backup-volume.ps1
|
powershell -ExecutionPolicy Bypass -File .\backup-volume.ps1
|
||||||
```
|
```
|
||||||
This backs up the entire PostgreSQL data volume as a TAR archive, compressed as a ZIP file.
|
This backs up the entire PostgreSQL data volume as a TAR archive, compressed as a ZIP file.
|
||||||
|
|
||||||
3. **Automated Backups**:
|
3. **Automated Backups**:
|
||||||
```powershell
|
```powershell
|
||||||
powershell -ExecutionPolicy Bypass -File .\schedule-backup.ps1
|
powershell -ExecutionPolicy Bypass -File .\schedule-backup.ps1
|
||||||
```
|
```
|
||||||
This creates a Windows Scheduled Task that runs database backups daily at 3 AM.
|
This creates a Windows Scheduled Task that runs database backups daily at 3 AM.
|
||||||
|
|
||||||
4. **Restoring from Backups**:
|
4. **Restoring from Backups**:
|
||||||
```powershell
|
```powershell
|
||||||
# Restore from database dump
|
# Restore from database dump
|
||||||
powershell -ExecutionPolicy Bypass -File .\restore-gitea-db.ps1 -BackupFile "backups\your-backup-file.sql.zip"
|
powershell -ExecutionPolicy Bypass -File .\restore-gitea-db.ps1 -BackupFile "backups\your-backup-file.sql.zip"
|
||||||
|
|
||||||
# Restore from volume backup
|
# Restore from volume backup
|
||||||
powershell -ExecutionPolicy Bypass -File .\restore-volume.ps1 -BackupFile "backups\your-volume-backup.tar.zip"
|
powershell -ExecutionPolicy Bypass -File .\restore-volume.ps1 -BackupFile "backups\your-volume-backup.tar.zip"
|
||||||
```
|
```
|
||||||
|
|
||||||
### Backup Best Practices
|
### Backup Best Practices
|
||||||
|
|
||||||
- Keep multiple backups using both methods (database dumps and volume backups)
|
- Keep multiple backups using both methods (database dumps and volume backups)
|
||||||
- Store backups in multiple locations (local and off-site)
|
- Store backups in multiple locations (local and off-site)
|
||||||
- Test restoring from backups periodically
|
- Test restoring from backups periodically
|
||||||
- Create a backup before upgrading Gitea or making significant changes
|
- Create a backup before upgrading Gitea or making significant changes
|
||||||
- **Never** run `docker-compose down -v` unless you have a recent backup
|
- **Never** run `docker-compose down -v` unless you have a recent backup
|
||||||
|
|
||||||
For more detailed information about the backup system, see [BACKUP-README.md](BACKUP-README.md).
|
For more detailed information about the backup system, see [BACKUP-README.md](BACKUP-README.md).
|
||||||
|
|
||||||
## Stopping the Services
|
## Stopping the Services
|
||||||
|
|
||||||
To stop the services, run:
|
To stop the services, run:
|
||||||
```bash
|
```bash
|
||||||
docker-compose down
|
docker-compose down
|
||||||
```
|
```
|
||||||
|
|
||||||
**Important**: Do not use the `-v` flag (`docker-compose down -v`) unless you intend to delete all data, as this will remove the Docker volumes containing your database.
|
**Important**: Do not use the `-v` flag (`docker-compose down -v`) unless you intend to delete all data, as this will remove the Docker volumes containing your database.
|
||||||
|
|
||||||
## Data Persistence
|
## Data Persistence
|
||||||
|
|
||||||
All data is stored in Docker volumes and local directories:
|
All data is stored in Docker volumes and local directories:
|
||||||
- `./gitea/` - Gitea configuration and data
|
- `./gitea/` - Gitea configuration and data
|
||||||
- `./gitea/ssl/` - SSL certificates
|
- `./gitea/ssl/` - SSL certificates
|
||||||
- `./gitea/conf/` - Gitea configuration
|
- `./gitea/conf/` - Gitea configuration
|
||||||
- Docker volumes (managed by Docker):
|
- Docker volumes (managed by Docker):
|
||||||
- `gitea-data` - Gitea repositories and application data
|
- `gitea-data` - Gitea repositories and application data
|
||||||
- `postgres-data` - PostgreSQL database files
|
- `postgres-data` - PostgreSQL database files
|
||||||
- `./backups/` - Database and volume backups
|
- `./backups/` - Database and volume backups
|
||||||
|
|
||||||
## Troubleshooting
|
## Troubleshooting
|
||||||
|
|
||||||
1. **Cannot access externally**:
|
1. **Cannot access externally**:
|
||||||
- Verify port 3000 (HTTP) and 222 (SSH) are forwarded on your router
|
- Verify port 3000 (HTTP) and 222 (SSH) are forwarded on your router
|
||||||
- Check your DDNS service is updating correctly
|
- Check your DDNS service is updating correctly
|
||||||
- Ensure your domain points to your correct IP
|
- Ensure your domain points to your correct IP
|
||||||
|
|
||||||
2. **SSL Certificate Warnings**:
|
2. **SSL Certificate Warnings**:
|
||||||
- This is normal with self-signed certificates
|
- This is normal with self-signed certificates
|
||||||
- For production, consider using Let's Encrypt certificates
|
- For production, consider using Let's Encrypt certificates
|
||||||
|
|
||||||
3. **Local Network Access**:
|
3. **Local Network Access**:
|
||||||
- If bee8333.ddns.net doesn't resolve locally, use localhost:3000 instead
|
- If bee8333.ddns.net doesn't resolve locally, use localhost:3000 instead
|
||||||
- Add an entry to your hosts file if needed
|
- Add an entry to your hosts file if needed
|
||||||
|
|
||||||
4. **Database Backup Issues**:
|
4. **Database Backup Issues**:
|
||||||
- Ensure Docker is running when attempting backups
|
- Ensure Docker is running when attempting backups
|
||||||
- Check that the container names match those in the backup scripts
|
- Check that the container names match those in the backup scripts
|
||||||
- For PowerShell execution issues, use the `-ExecutionPolicy Bypass` flag
|
- For PowerShell execution issues, use the `-ExecutionPolicy Bypass` flag
|
||||||
@@ -1,82 +1,82 @@
|
|||||||
# Gitea Database Backup Script
|
# Gitea Database Backup Script
|
||||||
$timestamp = Get-Date -Format "yyyy-MM-dd_HH-mm-ss"
|
$timestamp = Get-Date -Format "yyyy-MM-dd_HH-mm-ss"
|
||||||
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||||
$backupDir = Join-Path $scriptDir "backups"
|
$backupDir = Join-Path $scriptDir "backups"
|
||||||
$backupFile = Join-Path $backupDir "gitea-db-backup-$timestamp.sql"
|
$backupFile = Join-Path $backupDir "gitea-db-backup-$timestamp.sql"
|
||||||
$redundantBackupDir = "D:\Pr00jects\gitea-docker"
|
$redundantBackupDir = "D:\Pr00jects\gitea-docker"
|
||||||
|
|
||||||
# Ensure backup directory exists
|
# Ensure backup directory exists
|
||||||
if (-not (Test-Path $backupDir)) {
|
if (-not (Test-Path $backupDir)) {
|
||||||
New-Item -ItemType Directory -Path $backupDir
|
New-Item -ItemType Directory -Path $backupDir
|
||||||
}
|
}
|
||||||
|
|
||||||
# Ensure redundant backup directory exists
|
# Ensure redundant backup directory exists
|
||||||
if (-not (Test-Path $redundantBackupDir)) {
|
if (-not (Test-Path $redundantBackupDir)) {
|
||||||
try {
|
try {
|
||||||
New-Item -ItemType Directory -Path $redundantBackupDir -Force
|
New-Item -ItemType Directory -Path $redundantBackupDir -Force
|
||||||
} catch {
|
} catch {
|
||||||
"[$timestamp] Warning: Could not create redundant backup directory at $redundantBackupDir. Error: $_" | Out-File -Append -FilePath $logFile
|
"[$timestamp] Warning: Could not create redundant backup directory at $redundantBackupDir. Error: $_" | Out-File -Append -FilePath $logFile
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Log execution of the script
|
# Log execution of the script
|
||||||
$logFile = Join-Path $backupDir "backup-log.txt"
|
$logFile = Join-Path $backupDir "backup-log.txt"
|
||||||
"[$timestamp] Starting database backup..." | Out-File -Append -FilePath $logFile
|
"[$timestamp] Starting database backup..." | Out-File -Append -FilePath $logFile
|
||||||
|
|
||||||
# Check if Docker is running
|
# Check if Docker is running
|
||||||
$dockerRunning = $false
|
$dockerRunning = $false
|
||||||
try {
|
try {
|
||||||
$dockerStatus = docker info 2>&1
|
$dockerStatus = docker info 2>&1
|
||||||
$dockerRunning = $LASTEXITCODE -eq 0
|
$dockerRunning = $LASTEXITCODE -eq 0
|
||||||
} catch {
|
} catch {
|
||||||
$dockerRunning = $false
|
$dockerRunning = $false
|
||||||
}
|
}
|
||||||
|
|
||||||
if (-not $dockerRunning) {
|
if (-not $dockerRunning) {
|
||||||
"[$timestamp] Error: Docker is not running. Backup failed." | Out-File -Append -FilePath $logFile
|
"[$timestamp] Error: Docker is not running. Backup failed." | Out-File -Append -FilePath $logFile
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check if Gitea container is running
|
# Check if Gitea container is running
|
||||||
$containerRunning = docker ps --format "{{.Names}}" | Select-String -Pattern "gitea-db" -Quiet
|
$containerRunning = docker ps --format "{{.Names}}" | Select-String -Pattern "gitea-db" -Quiet
|
||||||
if (-not $containerRunning) {
|
if (-not $containerRunning) {
|
||||||
"[$timestamp] Error: Gitea database container is not running. Backup failed." | Out-File -Append -FilePath $logFile
|
"[$timestamp] Error: Gitea database container is not running. Backup failed." | Out-File -Append -FilePath $logFile
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
# Create database dump
|
# Create database dump
|
||||||
"[$timestamp] Creating database backup to $backupFile..." | Out-File -Append -FilePath $logFile
|
"[$timestamp] Creating database backup to $backupFile..." | Out-File -Append -FilePath $logFile
|
||||||
docker exec gitea-db pg_dump -U gitea -d gitea > $backupFile
|
docker exec gitea-db pg_dump -U gitea -d gitea > $backupFile
|
||||||
|
|
||||||
# Check if backup was successful
|
# Check if backup was successful
|
||||||
if ($LASTEXITCODE -eq 0 -and (Test-Path $backupFile) -and (Get-Item $backupFile).Length -gt 0) {
|
if ($LASTEXITCODE -eq 0 -and (Test-Path $backupFile) -and (Get-Item $backupFile).Length -gt 0) {
|
||||||
"[$timestamp] Backup completed successfully!" | Out-File -Append -FilePath $logFile
|
"[$timestamp] Backup completed successfully!" | Out-File -Append -FilePath $logFile
|
||||||
|
|
||||||
# Optional: Compress the backup file
|
# Optional: Compress the backup file
|
||||||
$zipFileName = "$backupFile.zip"
|
$zipFileName = "$backupFile.zip"
|
||||||
Compress-Archive -Path $backupFile -DestinationPath $zipFileName -Force
|
Compress-Archive -Path $backupFile -DestinationPath $zipFileName -Force
|
||||||
Remove-Item $backupFile
|
Remove-Item $backupFile
|
||||||
"[$timestamp] Backup compressed to $zipFileName" | Out-File -Append -FilePath $logFile
|
"[$timestamp] Backup compressed to $zipFileName" | Out-File -Append -FilePath $logFile
|
||||||
|
|
||||||
# Copy backup to redundant location
|
# Copy backup to redundant location
|
||||||
if (Test-Path $redundantBackupDir) {
|
if (Test-Path $redundantBackupDir) {
|
||||||
try {
|
try {
|
||||||
$redundantBackupFile = Join-Path $redundantBackupDir (Split-Path -Leaf $zipFileName)
|
$redundantBackupFile = Join-Path $redundantBackupDir (Split-Path -Leaf $zipFileName)
|
||||||
Copy-Item -Path $zipFileName -Destination $redundantBackupFile -Force
|
Copy-Item -Path $zipFileName -Destination $redundantBackupFile -Force
|
||||||
"[$timestamp] Backup copied to redundant location: $redundantBackupFile" | Out-File -Append -FilePath $logFile
|
"[$timestamp] Backup copied to redundant location: $redundantBackupFile" | Out-File -Append -FilePath $logFile
|
||||||
} catch {
|
} catch {
|
||||||
"[$timestamp] Error copying backup to redundant location: $_" | Out-File -Append -FilePath $logFile
|
"[$timestamp] Error copying backup to redundant location: $_" | Out-File -Append -FilePath $logFile
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
"[$timestamp] Warning: Redundant backup directory not found: $redundantBackupDir" | Out-File -Append -FilePath $logFile
|
"[$timestamp] Warning: Redundant backup directory not found: $redundantBackupDir" | Out-File -Append -FilePath $logFile
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
"[$timestamp] Backup failed!" | Out-File -Append -FilePath $logFile
|
"[$timestamp] Backup failed!" | Out-File -Append -FilePath $logFile
|
||||||
}
|
}
|
||||||
|
|
||||||
# Optional: Clean up old backups (keep last 10)
|
# Optional: Clean up old backups (keep last 10)
|
||||||
$oldBackups = Get-ChildItem -Path $backupDir -Filter "gitea-db-backup-*.zip" | Sort-Object LastWriteTime -Descending | Select-Object -Skip 10
|
$oldBackups = Get-ChildItem -Path $backupDir -Filter "gitea-db-backup-*.zip" | Sort-Object LastWriteTime -Descending | Select-Object -Skip 10
|
||||||
foreach ($backup in $oldBackups) {
|
foreach ($backup in $oldBackups) {
|
||||||
Remove-Item $backup.FullName
|
Remove-Item $backup.FullName
|
||||||
"[$timestamp] Removed old backup: $($backup.Name)" | Out-File -Append -FilePath $logFile
|
"[$timestamp] Removed old backup: $($backup.Name)" | Out-File -Append -FilePath $logFile
|
||||||
}
|
}
|
||||||
@@ -1,88 +1,88 @@
|
|||||||
# Script to backup the entire Postgres Docker volume
|
# Script to backup the entire Postgres Docker volume
|
||||||
$timestamp = Get-Date -Format "yyyy-MM-dd_HH-mm-ss"
|
$timestamp = Get-Date -Format "yyyy-MM-dd_HH-mm-ss"
|
||||||
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||||
$backupDir = Join-Path $scriptDir "backups"
|
$backupDir = Join-Path $scriptDir "backups"
|
||||||
$volumeName = "gitea-docker_postgres-data"
|
$volumeName = "gitea-docker_postgres-data"
|
||||||
$backupFile = "postgres-volume-backup-$timestamp.tar"
|
$backupFile = "postgres-volume-backup-$timestamp.tar"
|
||||||
$backupFilePath = Join-Path $backupDir $backupFile
|
$backupFilePath = Join-Path $backupDir $backupFile
|
||||||
$redundantBackupDir = "D:\Pr00jects\gitea-docker"
|
$redundantBackupDir = "D:\Pr00jects\gitea-docker"
|
||||||
$logFile = Join-Path $backupDir "volume-backup-log.txt"
|
$logFile = Join-Path $backupDir "volume-backup-log.txt"
|
||||||
$currentDir = Get-Location
|
$currentDir = Get-Location
|
||||||
|
|
||||||
# Ensure backup directory exists
|
# Ensure backup directory exists
|
||||||
if (-not (Test-Path $backupDir)) {
|
if (-not (Test-Path $backupDir)) {
|
||||||
New-Item -ItemType Directory -Path $backupDir
|
New-Item -ItemType Directory -Path $backupDir
|
||||||
}
|
}
|
||||||
|
|
||||||
# Ensure redundant backup directory exists
|
# Ensure redundant backup directory exists
|
||||||
if (-not (Test-Path $redundantBackupDir)) {
|
if (-not (Test-Path $redundantBackupDir)) {
|
||||||
try {
|
try {
|
||||||
New-Item -ItemType Directory -Path $redundantBackupDir -Force
|
New-Item -ItemType Directory -Path $redundantBackupDir -Force
|
||||||
} catch {
|
} catch {
|
||||||
Add-Content -Path $logFile -Value "[$timestamp] Warning: Could not create redundant backup directory at $redundantBackupDir. Error: $_"
|
Add-Content -Path $logFile -Value "[$timestamp] Warning: Could not create redundant backup directory at $redundantBackupDir. Error: $_"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Log start of backup
|
# Log start of backup
|
||||||
Add-Content -Path $logFile -Value "[$timestamp] Starting volume backup for $volumeName..."
|
Add-Content -Path $logFile -Value "[$timestamp] Starting volume backup for $volumeName..."
|
||||||
|
|
||||||
# Check if volume exists
|
# Check if volume exists
|
||||||
$volumeExists = docker volume ls --format "{{.Name}}" | Select-String -Pattern "^$volumeName$"
|
$volumeExists = docker volume ls --format "{{.Name}}" | Select-String -Pattern "^$volumeName$"
|
||||||
if (-not $volumeExists) {
|
if (-not $volumeExists) {
|
||||||
Write-Host "Volume $volumeName not found!" -ForegroundColor Red
|
Write-Host "Volume $volumeName not found!" -ForegroundColor Red
|
||||||
Add-Content -Path $logFile -Value "[$timestamp] Error: Volume $volumeName not found!"
|
Add-Content -Path $logFile -Value "[$timestamp] Error: Volume $volumeName not found!"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
# Create a temporary container to access the volume
|
# Create a temporary container to access the volume
|
||||||
Write-Host "Creating backup of Docker volume $volumeName..."
|
Write-Host "Creating backup of Docker volume $volumeName..."
|
||||||
Add-Content -Path $logFile -Value "[$timestamp] Creating backup to $backupFilePath..."
|
Add-Content -Path $logFile -Value "[$timestamp] Creating backup to $backupFilePath..."
|
||||||
|
|
||||||
# Change to backup directory and use simple relative paths for Docker
|
# Change to backup directory and use simple relative paths for Docker
|
||||||
Set-Location -Path $backupDir
|
Set-Location -Path $backupDir
|
||||||
docker run --rm -v ${volumeName}:/volume -v ${PWD}:/backup alpine tar -cf /backup/$backupFile -C /volume ./
|
docker run --rm -v ${volumeName}:/volume -v ${PWD}:/backup alpine tar -cf /backup/$backupFile -C /volume ./
|
||||||
|
|
||||||
# Restore original directory
|
# Restore original directory
|
||||||
Set-Location -Path $currentDir
|
Set-Location -Path $currentDir
|
||||||
|
|
||||||
# Check if backup was successful
|
# Check if backup was successful
|
||||||
if ($LASTEXITCODE -eq 0 -and (Test-Path $backupFilePath) -and (Get-Item $backupFilePath).Length -gt 0) {
|
if ($LASTEXITCODE -eq 0 -and (Test-Path $backupFilePath) -and (Get-Item $backupFilePath).Length -gt 0) {
|
||||||
Write-Host "Volume backup completed successfully to $backupFilePath!" -ForegroundColor Green
|
Write-Host "Volume backup completed successfully to $backupFilePath!" -ForegroundColor Green
|
||||||
Add-Content -Path $logFile -Value "[$timestamp] Volume backup completed successfully!"
|
Add-Content -Path $logFile -Value "[$timestamp] Volume backup completed successfully!"
|
||||||
|
|
||||||
# Optional: Compress the backup file
|
# Optional: Compress the backup file
|
||||||
Write-Host "Compressing backup file..."
|
Write-Host "Compressing backup file..."
|
||||||
Add-Content -Path $logFile -Value "[$timestamp] Compressing backup file..."
|
Add-Content -Path $logFile -Value "[$timestamp] Compressing backup file..."
|
||||||
$zipFileName = "$backupFilePath.zip"
|
$zipFileName = "$backupFilePath.zip"
|
||||||
Compress-Archive -Path $backupFilePath -DestinationPath $zipFileName -Force
|
Compress-Archive -Path $backupFilePath -DestinationPath $zipFileName -Force
|
||||||
Remove-Item $backupFilePath
|
Remove-Item $backupFilePath
|
||||||
Write-Host "Backup compressed to $zipFileName" -ForegroundColor Green
|
Write-Host "Backup compressed to $zipFileName" -ForegroundColor Green
|
||||||
Add-Content -Path $logFile -Value "[$timestamp] Backup compressed to $zipFileName"
|
Add-Content -Path $logFile -Value "[$timestamp] Backup compressed to $zipFileName"
|
||||||
|
|
||||||
# Copy backup to redundant location
|
# Copy backup to redundant location
|
||||||
if (Test-Path $redundantBackupDir) {
|
if (Test-Path $redundantBackupDir) {
|
||||||
try {
|
try {
|
||||||
$redundantBackupFile = Join-Path $redundantBackupDir (Split-Path -Leaf $zipFileName)
|
$redundantBackupFile = Join-Path $redundantBackupDir (Split-Path -Leaf $zipFileName)
|
||||||
Copy-Item -Path $zipFileName -Destination $redundantBackupFile -Force
|
Copy-Item -Path $zipFileName -Destination $redundantBackupFile -Force
|
||||||
Write-Host "Backup copied to redundant location: $redundantBackupFile" -ForegroundColor Green
|
Write-Host "Backup copied to redundant location: $redundantBackupFile" -ForegroundColor Green
|
||||||
Add-Content -Path $logFile -Value "[$timestamp] Backup copied to redundant location: $redundantBackupFile"
|
Add-Content -Path $logFile -Value "[$timestamp] Backup copied to redundant location: $redundantBackupFile"
|
||||||
} catch {
|
} catch {
|
||||||
Write-Host "Error copying backup to redundant location: $_" -ForegroundColor Red
|
Write-Host "Error copying backup to redundant location: $_" -ForegroundColor Red
|
||||||
Add-Content -Path $logFile -Value "[$timestamp] Error copying backup to redundant location: $_"
|
Add-Content -Path $logFile -Value "[$timestamp] Error copying backup to redundant location: $_"
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Write-Host "Warning: Redundant backup directory not found: $redundantBackupDir" -ForegroundColor Yellow
|
Write-Host "Warning: Redundant backup directory not found: $redundantBackupDir" -ForegroundColor Yellow
|
||||||
Add-Content -Path $logFile -Value "[$timestamp] Warning: Redundant backup directory not found: $redundantBackupDir"
|
Add-Content -Path $logFile -Value "[$timestamp] Warning: Redundant backup directory not found: $redundantBackupDir"
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Write-Host "Volume backup failed!" -ForegroundColor Red
|
Write-Host "Volume backup failed!" -ForegroundColor Red
|
||||||
Add-Content -Path $logFile -Value "[$timestamp] Volume backup failed!"
|
Add-Content -Path $logFile -Value "[$timestamp] Volume backup failed!"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Optional: Clean up old volume backups (keep last 5)
|
# Optional: Clean up old volume backups (keep last 5)
|
||||||
$oldBackups = Get-ChildItem -Path $backupDir -Filter "postgres-volume-backup-*.zip" | Sort-Object LastWriteTime -Descending | Select-Object -Skip 5
|
$oldBackups = Get-ChildItem -Path $backupDir -Filter "postgres-volume-backup-*.zip" | Sort-Object LastWriteTime -Descending | Select-Object -Skip 5
|
||||||
foreach ($backup in $oldBackups) {
|
foreach ($backup in $oldBackups) {
|
||||||
Remove-Item $backup.FullName
|
Remove-Item $backup.FullName
|
||||||
Write-Host "Removed old volume backup: $($backup.Name)"
|
Write-Host "Removed old volume backup: $($backup.Name)"
|
||||||
Add-Content -Path $logFile -Value "[$timestamp] Removed old volume backup: $($backup.Name)"
|
Add-Content -Path $logFile -Value "[$timestamp] Removed old volume backup: $($backup.Name)"
|
||||||
}
|
}
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
backups/gitea-db-backup-2025-04-21_03-03-47.sql.zip
Normal file
BIN
backups/gitea-db-backup-2025-04-21_03-03-47.sql.zip
Normal file
Binary file not shown.
BIN
backups/gitea-db-backup-2025-04-22_03-07-16.sql.zip
Normal file
BIN
backups/gitea-db-backup-2025-04-22_03-07-16.sql.zip
Normal file
Binary file not shown.
BIN
backups/gitea-db-backup-2025-04-23_03-00-49.sql.zip
Normal file
BIN
backups/gitea-db-backup-2025-04-23_03-00-49.sql.zip
Normal file
Binary file not shown.
BIN
backups/gitea-db-backup-2025-04-25_19-01-37.sql
Normal file
BIN
backups/gitea-db-backup-2025-04-25_19-01-37.sql
Normal file
Binary file not shown.
BIN
backups/gitea-db-backup-2025-05-18_01-16-38.sql.zip
Normal file
BIN
backups/gitea-db-backup-2025-05-18_01-16-38.sql.zip
Normal file
Binary file not shown.
BIN
backups/gitea-db-backup-2025-05-18_03-00-05.sql.zip
Normal file
BIN
backups/gitea-db-backup-2025-05-18_03-00-05.sql.zip
Normal file
Binary file not shown.
BIN
backups/gitea-db-backup-2025-05-19_03-00-05.sql.zip
Normal file
BIN
backups/gitea-db-backup-2025-05-19_03-00-05.sql.zip
Normal file
Binary file not shown.
BIN
backups/gitea-db-backup-2025-05-20_03-00-53.sql.zip
Normal file
BIN
backups/gitea-db-backup-2025-05-20_03-00-53.sql.zip
Normal file
Binary file not shown.
BIN
backups/gitea-db-backup-2025-05-21_03-03-22.sql.zip
Normal file
BIN
backups/gitea-db-backup-2025-05-21_03-03-22.sql.zip
Normal file
Binary file not shown.
BIN
backups/gitea-db-backup-2025-05-22_03-03-36.sql.zip
Normal file
BIN
backups/gitea-db-backup-2025-05-22_03-03-36.sql.zip
Normal file
Binary file not shown.
BIN
backups/gitea-db-backup-2025-05-23_03-21-26.sql
Normal file
BIN
backups/gitea-db-backup-2025-05-23_03-21-26.sql
Normal file
Binary file not shown.
BIN
backups/gitea-db-backup-2025-05-28_02-42-28.sql
Normal file
BIN
backups/gitea-db-backup-2025-05-28_02-42-28.sql
Normal file
Binary file not shown.
BIN
backups/gitea-db-backup-2025-06-09_21-22-55.sql.zip
Normal file
BIN
backups/gitea-db-backup-2025-06-09_21-22-55.sql.zip
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
backups/postgres-volume-backup-2025-05-22_03-03-49.tar.zip
Normal file
BIN
backups/postgres-volume-backup-2025-05-22_03-03-49.tar.zip
Normal file
Binary file not shown.
BIN
backups/postgres-volume-backup-2025-05-23_08-01-05.tar
Normal file
BIN
backups/postgres-volume-backup-2025-05-23_08-01-05.tar
Normal file
Binary file not shown.
BIN
backups/postgres-volume-backup-2025-06-09_21-30-15.tar.zip
Normal file
BIN
backups/postgres-volume-backup-2025-06-09_21-30-15.tar.zip
Normal file
Binary file not shown.
BIN
backups/postgres-volume-backup.tar
Normal file
BIN
backups/postgres-volume-backup.tar
Normal file
Binary file not shown.
@@ -1,24 +1,104 @@
|
|||||||
[2025-04-19_19-40-51] Starting volume backup for gitea-docker_postgres-data...
|
[2025-04-19_19-40-51] Starting volume backup for gitea-docker_postgres-data...
|
||||||
[2025-04-19_19-40-51] Creating backup to C:\Users\benne\Projects\gitea-docker\backups\postgres-volume-backup-2025-04-19_19-40-51.tar...
|
[2025-04-19_19-40-51] Creating backup to C:\Users\benne\Projects\gitea-docker\backups\postgres-volume-backup-2025-04-19_19-40-51.tar...
|
||||||
[2025-04-19_19-40-51] Volume backup failed!
|
[2025-04-19_19-40-51] Volume backup failed!
|
||||||
[2025-04-19_19-41-05] Starting volume backup for gitea-docker_postgres-data...
|
[2025-04-19_19-41-05] Starting volume backup for gitea-docker_postgres-data...
|
||||||
[2025-04-19_19-41-05] Creating backup to C:\Users\benne\Projects\gitea-docker\backups\postgres-volume-backup-2025-04-19_19-41-05.tar...
|
[2025-04-19_19-41-05] Creating backup to C:\Users\benne\Projects\gitea-docker\backups\postgres-volume-backup-2025-04-19_19-41-05.tar...
|
||||||
[2025-04-19_19-41-05] Volume backup failed!
|
[2025-04-19_19-41-05] Volume backup failed!
|
||||||
[2025-04-19_19-42-55] Starting volume backup for gitea-docker_postgres-data...
|
[2025-04-19_19-42-55] Starting volume backup for gitea-docker_postgres-data...
|
||||||
[2025-04-19_19-42-55] Creating backup to C:\Users\benne\Projects\gitea-docker\backups\postgres-volume-backup-2025-04-19_19-42-55.tar...
|
[2025-04-19_19-42-55] Creating backup to C:\Users\benne\Projects\gitea-docker\backups\postgres-volume-backup-2025-04-19_19-42-55.tar...
|
||||||
[2025-04-19_19-42-55] Volume backup completed successfully!
|
[2025-04-19_19-42-55] Volume backup completed successfully!
|
||||||
[2025-04-19_19-42-55] Compressing backup file...
|
[2025-04-19_19-42-55] Compressing backup file...
|
||||||
[2025-04-19_19-42-55] Backup compressed to C:\Users\benne\Projects\gitea-docker\backups\postgres-volume-backup-2025-04-19_19-42-55.tar.zip
|
[2025-04-19_19-42-55] Backup compressed to C:\Users\benne\Projects\gitea-docker\backups\postgres-volume-backup-2025-04-19_19-42-55.tar.zip
|
||||||
[2025-04-19_19-42-55] Backup copied to redundant location: D:\Pr00jects\gitea-docker\postgres-volume-backup-2025-04-19_19-42-55.tar.zip
|
[2025-04-19_19-42-55] Backup copied to redundant location: D:\Pr00jects\gitea-docker\postgres-volume-backup-2025-04-19_19-42-55.tar.zip
|
||||||
[2025-04-19_19-43-53] Starting volume backup for gitea-docker_postgres-data...
|
[2025-04-19_19-43-53] Starting volume backup for gitea-docker_postgres-data...
|
||||||
[2025-04-19_19-43-53] Creating backup to C:\Users\benne\Projects\gitea-docker\backups\postgres-volume-backup-2025-04-19_19-43-53.tar...
|
[2025-04-19_19-43-53] Creating backup to C:\Users\benne\Projects\gitea-docker\backups\postgres-volume-backup-2025-04-19_19-43-53.tar...
|
||||||
[2025-04-19_19-43-53] Volume backup completed successfully!
|
[2025-04-19_19-43-53] Volume backup completed successfully!
|
||||||
[2025-04-19_19-43-53] Compressing backup file...
|
[2025-04-19_19-43-53] Compressing backup file...
|
||||||
[2025-04-19_19-43-53] Backup compressed to C:\Users\benne\Projects\gitea-docker\backups\postgres-volume-backup-2025-04-19_19-43-53.tar.zip
|
[2025-04-19_19-43-53] Backup compressed to C:\Users\benne\Projects\gitea-docker\backups\postgres-volume-backup-2025-04-19_19-43-53.tar.zip
|
||||||
[2025-04-19_19-43-53] Backup copied to redundant location: D:\Pr00jects\gitea-docker\postgres-volume-backup-2025-04-19_19-43-53.tar.zip
|
[2025-04-19_19-43-53] Backup copied to redundant location: D:\Pr00jects\gitea-docker\postgres-volume-backup-2025-04-19_19-43-53.tar.zip
|
||||||
[2025-04-19_19-44-40] Starting volume backup for gitea-docker_postgres-data...
|
[2025-04-19_19-44-40] Starting volume backup for gitea-docker_postgres-data...
|
||||||
[2025-04-19_19-44-40] Creating backup to C:\Users\benne\Projects\gitea-docker\backups\postgres-volume-backup-2025-04-19_19-44-40.tar...
|
[2025-04-19_19-44-40] Creating backup to C:\Users\benne\Projects\gitea-docker\backups\postgres-volume-backup-2025-04-19_19-44-40.tar...
|
||||||
[2025-04-19_19-44-40] Volume backup completed successfully!
|
[2025-04-19_19-44-40] Volume backup completed successfully!
|
||||||
[2025-04-19_19-44-40] Compressing backup file...
|
[2025-04-19_19-44-40] Compressing backup file...
|
||||||
[2025-04-19_19-44-40] Backup compressed to C:\Users\benne\Projects\gitea-docker\backups\postgres-volume-backup-2025-04-19_19-44-40.tar.zip
|
[2025-04-19_19-44-40] Backup compressed to C:\Users\benne\Projects\gitea-docker\backups\postgres-volume-backup-2025-04-19_19-44-40.tar.zip
|
||||||
[2025-04-19_19-44-40] Backup copied to redundant location: D:\Pr00jects\gitea-docker\postgres-volume-backup-2025-04-19_19-44-40.tar.zip
|
[2025-04-19_19-44-40] Backup copied to redundant location: D:\Pr00jects\gitea-docker\postgres-volume-backup-2025-04-19_19-44-40.tar.zip
|
||||||
|
[2025-04-20_03-06-24] Starting volume backup for gitea-docker_postgres-data...
|
||||||
|
[2025-04-20_03-06-24] Creating backup to C:\Users\benne\Projects\gitea-docker\backups\postgres-volume-backup-2025-04-20_03-06-24.tar...
|
||||||
|
[2025-04-20_03-06-24] Volume backup completed successfully!
|
||||||
|
[2025-04-20_03-06-24] Compressing backup file...
|
||||||
|
[2025-04-20_03-06-24] Backup compressed to C:\Users\benne\Projects\gitea-docker\backups\postgres-volume-backup-2025-04-20_03-06-24.tar.zip
|
||||||
|
[2025-04-20_03-06-24] Backup copied to redundant location: D:\Pr00jects\gitea-docker\postgres-volume-backup-2025-04-20_03-06-24.tar.zip
|
||||||
|
[2025-04-21_03-05-47] Starting volume backup for gitea-docker_postgres-data...
|
||||||
|
[2025-04-21_03-05-47] Creating backup to C:\Users\benne\Projects\gitea-docker\backups\postgres-volume-backup-2025-04-21_03-05-47.tar...
|
||||||
|
[2025-04-21_03-05-47] Volume backup completed successfully!
|
||||||
|
[2025-04-21_03-05-47] Compressing backup file...
|
||||||
|
[2025-04-21_03-05-47] Backup compressed to C:\Users\benne\Projects\gitea-docker\backups\postgres-volume-backup-2025-04-21_03-05-47.tar.zip
|
||||||
|
[2025-04-21_03-05-47] Backup copied to redundant location: D:\Pr00jects\gitea-docker\postgres-volume-backup-2025-04-21_03-05-47.tar.zip
|
||||||
|
[2025-04-21_03-05-47] Removed old volume backup: postgres-volume-backup-2025-03-01_23-23-13.tar.zip
|
||||||
|
[2025-04-22_03-27-19] Starting volume backup for gitea-docker_postgres-data...
|
||||||
|
[2025-04-22_03-27-19] Creating backup to C:\Users\benne\Projects\gitea-docker\backups\postgres-volume-backup-2025-04-22_03-27-19.tar...
|
||||||
|
[2025-04-22_03-27-19] Volume backup completed successfully!
|
||||||
|
[2025-04-22_03-27-19] Compressing backup file...
|
||||||
|
[2025-04-22_03-27-19] Backup compressed to C:\Users\benne\Projects\gitea-docker\backups\postgres-volume-backup-2025-04-22_03-27-19.tar.zip
|
||||||
|
[2025-04-22_03-27-19] Backup copied to redundant location: D:\Pr00jects\gitea-docker\postgres-volume-backup-2025-04-22_03-27-19.tar.zip
|
||||||
|
[2025-04-22_03-27-19] Removed old volume backup: postgres-volume-backup-2025-04-19_19-42-55.tar.zip
|
||||||
|
[2025-04-23_08-10-53] Starting volume backup for gitea-docker_postgres-data...
|
||||||
|
[2025-04-23_08-10-53] Creating backup to C:\Users\benne\Projects\gitea-docker\backups\postgres-volume-backup-2025-04-23_08-10-53.tar...
|
||||||
|
[2025-04-23_08-10-53] Volume backup completed successfully!
|
||||||
|
[2025-04-23_08-10-53] Compressing backup file...
|
||||||
|
[2025-04-23_08-10-53] Backup compressed to C:\Users\benne\Projects\gitea-docker\backups\postgres-volume-backup-2025-04-23_08-10-53.tar.zip
|
||||||
|
[2025-04-23_08-10-53] Backup copied to redundant location: D:\Pr00jects\gitea-docker\postgres-volume-backup-2025-04-23_08-10-53.tar.zip
|
||||||
|
[2025-04-23_08-10-53] Removed old volume backup: postgres-volume-backup-2025-04-19_19-43-53.tar.zip
|
||||||
|
[2025-05-18_01-22-29] Starting volume backup for gitea-docker_postgres-data...
|
||||||
|
[2025-05-18_01-22-29] Creating backup to C:\Users\benne\Projects\gitea-docker\backups\postgres-volume-backup-2025-05-18_01-22-29.tar...
|
||||||
|
[2025-05-18_01-22-29] Volume backup completed successfully!
|
||||||
|
[2025-05-18_01-22-29] Compressing backup file...
|
||||||
|
[2025-05-18_01-22-29] Backup compressed to C:\Users\benne\Projects\gitea-docker\backups\postgres-volume-backup-2025-05-18_01-22-29.tar.zip
|
||||||
|
[2025-05-18_01-22-29] Backup copied to redundant location: D:\Pr00jects\gitea-docker\postgres-volume-backup-2025-05-18_01-22-29.tar.zip
|
||||||
|
[2025-05-18_01-22-29] Removed old volume backup: postgres-volume-backup-2025-04-19_19-44-40.tar.zip
|
||||||
|
[2025-05-18_03-00-14] Starting volume backup for gitea-docker_postgres-data...
|
||||||
|
[2025-05-18_03-00-14] Creating backup to C:\Users\benne\Projects\gitea-docker\backups\postgres-volume-backup-2025-05-18_03-00-14.tar...
|
||||||
|
[2025-05-18_03-00-14] Volume backup completed successfully!
|
||||||
|
[2025-05-18_03-00-14] Compressing backup file...
|
||||||
|
[2025-05-18_03-00-14] Backup compressed to C:\Users\benne\Projects\gitea-docker\backups\postgres-volume-backup-2025-05-18_03-00-14.tar.zip
|
||||||
|
[2025-05-18_03-00-14] Backup copied to redundant location: D:\Pr00jects\gitea-docker\postgres-volume-backup-2025-05-18_03-00-14.tar.zip
|
||||||
|
[2025-05-18_03-00-14] Removed old volume backup: postgres-volume-backup-2025-04-20_03-06-24.tar.zip
|
||||||
|
[2025-05-19_03-00-14] Starting volume backup for gitea-docker_postgres-data...
|
||||||
|
[2025-05-19_03-00-14] Creating backup to C:\Users\benne\Projects\gitea-docker\backups\postgres-volume-backup-2025-05-19_03-00-14.tar...
|
||||||
|
[2025-05-19_03-00-14] Volume backup completed successfully!
|
||||||
|
[2025-05-19_03-00-14] Compressing backup file...
|
||||||
|
[2025-05-19_03-00-14] Backup compressed to C:\Users\benne\Projects\gitea-docker\backups\postgres-volume-backup-2025-05-19_03-00-14.tar.zip
|
||||||
|
[2025-05-19_03-00-14] Backup copied to redundant location: D:\Pr00jects\gitea-docker\postgres-volume-backup-2025-05-19_03-00-14.tar.zip
|
||||||
|
[2025-05-19_03-00-14] Removed old volume backup: postgres-volume-backup-2025-04-21_03-05-47.tar.zip
|
||||||
|
[2025-05-20_03-14-23] Starting volume backup for gitea-docker_postgres-data...
|
||||||
|
[2025-05-20_03-14-23] Creating backup to C:\Users\benne\Projects\gitea-docker\backups\postgres-volume-backup-2025-05-20_03-14-23.tar...
|
||||||
|
[2025-05-20_03-14-23] Volume backup completed successfully!
|
||||||
|
[2025-05-20_03-14-23] Compressing backup file...
|
||||||
|
[2025-05-20_03-14-23] Backup compressed to C:\Users\benne\Projects\gitea-docker\backups\postgres-volume-backup-2025-05-20_03-14-23.tar.zip
|
||||||
|
[2025-05-20_03-14-23] Backup copied to redundant location: D:\Pr00jects\gitea-docker\postgres-volume-backup-2025-05-20_03-14-23.tar.zip
|
||||||
|
[2025-05-20_03-14-23] Removed old volume backup: postgres-volume-backup-2025-04-22_03-27-19.tar.zip
|
||||||
|
[2025-05-21_03-08-24] Starting volume backup for gitea-docker_postgres-data...
|
||||||
|
[2025-05-21_03-08-24] Creating backup to C:\Users\benne\Projects\gitea-docker\backups\postgres-volume-backup-2025-05-21_03-08-24.tar...
|
||||||
|
[2025-05-21_03-08-24] Volume backup completed successfully!
|
||||||
|
[2025-05-21_03-08-24] Compressing backup file...
|
||||||
|
[2025-05-21_03-08-24] Backup compressed to C:\Users\benne\Projects\gitea-docker\backups\postgres-volume-backup-2025-05-21_03-08-24.tar.zip
|
||||||
|
[2025-05-21_03-08-24] Backup copied to redundant location: D:\Pr00jects\gitea-docker\postgres-volume-backup-2025-05-21_03-08-24.tar.zip
|
||||||
|
[2025-05-21_03-08-24] Removed old volume backup: postgres-volume-backup-2025-04-23_08-10-53.tar.zip
|
||||||
|
[2025-05-22_03-03-49] Starting volume backup for gitea-docker_postgres-data...
|
||||||
|
[2025-05-22_03-03-49] Creating backup to C:\Users\benne\Projects\gitea-docker\backups\postgres-volume-backup-2025-05-22_03-03-49.tar...
|
||||||
|
[2025-05-22_03-03-49] Volume backup completed successfully!
|
||||||
|
[2025-05-22_03-03-49] Compressing backup file...
|
||||||
|
[2025-05-22_03-03-49] Backup compressed to C:\Users\benne\Projects\gitea-docker\backups\postgres-volume-backup-2025-05-22_03-03-49.tar.zip
|
||||||
|
[2025-05-22_03-03-49] Backup copied to redundant location: D:\Pr00jects\gitea-docker\postgres-volume-backup-2025-05-22_03-03-49.tar.zip
|
||||||
|
[2025-05-22_03-03-49] Removed old volume backup: postgres-volume-backup-2025-05-18_01-22-29.tar.zip
|
||||||
|
[2025-05-23_08-01-05] Starting volume backup for gitea-docker_postgres-data...
|
||||||
|
[2025-05-23_08-01-05] Creating backup to C:\Users\benne\Projects\gitea-docker\backups\postgres-volume-backup-2025-05-23_08-01-05.tar...
|
||||||
|
[2025-05-23_08-01-05] Volume backup completed successfully!
|
||||||
|
[2025-05-23_08-01-05] Compressing backup file...
|
||||||
|
[2025-06-09_21-30-15] Starting volume backup for gitea-docker_postgres-data...
|
||||||
|
[2025-06-09_21-30-15] Creating backup to C:\Users\benne\Projects\gitea-docker\backups\postgres-volume-backup-2025-06-09_21-30-15.tar...
|
||||||
|
[2025-06-09_21-30-15] Volume backup completed successfully!
|
||||||
|
[2025-06-09_21-30-15] Compressing backup file...
|
||||||
|
[2025-06-09_21-30-15] Backup compressed to C:\Users\benne\Projects\gitea-docker\backups\postgres-volume-backup-2025-06-09_21-30-15.tar.zip
|
||||||
|
[2025-06-09_21-30-15] Backup copied to redundant location: D:\Pr00jects\gitea-docker\postgres-volume-backup-2025-06-09_21-30-15.tar.zip
|
||||||
|
[2025-06-09_21-30-15] Removed old volume backup: postgres-volume-backup-2025-05-18_03-00-14.tar.zip
|
||||||
|
|||||||
20
docker-compose.headscale.yml
Normal file
20
docker-compose.headscale.yml
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
version: '3.8'
|
||||||
|
|
||||||
|
services:
|
||||||
|
headscale:
|
||||||
|
image: headscale/headscale:latest
|
||||||
|
container_name: headscale
|
||||||
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- "8081:8080" # Web UI and API (avoiding conflict with Traefik)
|
||||||
|
- "50443:50443" # gRPC
|
||||||
|
volumes:
|
||||||
|
- ./headscale/config:/etc/headscale
|
||||||
|
- ./headscale/data:/var/lib/headscale
|
||||||
|
command: serve
|
||||||
|
networks:
|
||||||
|
- headscale-net
|
||||||
|
|
||||||
|
networks:
|
||||||
|
headscale-net:
|
||||||
|
driver: bridge
|
||||||
@@ -3,6 +3,10 @@ version: "3"
|
|||||||
networks:
|
networks:
|
||||||
gitea:
|
gitea:
|
||||||
external: false
|
external: false
|
||||||
|
traefik:
|
||||||
|
external: true
|
||||||
|
immich_default:
|
||||||
|
external: true
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
gitea-data:
|
gitea-data:
|
||||||
@@ -15,18 +19,20 @@ services:
|
|||||||
container_name: traefik
|
container_name: traefik
|
||||||
restart: always
|
restart: always
|
||||||
ports:
|
ports:
|
||||||
- "80:80" # HTTP
|
- "8080:80" # HTTP (changed from 80 to 8080 for ISP testing)
|
||||||
- "443:443" # HTTPS
|
- "8443:443" # HTTPS (changed from 443 to 8443 for ISP testing)
|
||||||
- "8080:8080" # Dashboard
|
- "8081:8080" # Dashboard (changed to avoid conflict)
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
- gitea
|
- gitea
|
||||||
|
- traefik
|
||||||
volumes:
|
volumes:
|
||||||
- /var/run/docker.sock:/var/run/docker.sock:ro
|
- /var/run/docker.sock:/var/run/docker.sock:ro
|
||||||
- traefik-certs:/letsencrypt
|
- traefik-certs:/letsencrypt
|
||||||
command:
|
command:
|
||||||
- "--providers.docker=true"
|
- "--providers.docker=true"
|
||||||
- "--providers.docker.exposedbydefault=false"
|
- "--providers.docker.exposedbydefault=false"
|
||||||
- "--providers.docker.network=gitea-docker_gitea"
|
- "--providers.docker.network=traefik"
|
||||||
- "--entrypoints.web.address=:80"
|
- "--entrypoints.web.address=:80"
|
||||||
- "--entrypoints.websecure.address=:443"
|
- "--entrypoints.websecure.address=:443"
|
||||||
- "--entrypoints.web.http.redirections.entryPoint.to=websecure"
|
- "--entrypoints.web.http.redirections.entryPoint.to=websecure"
|
||||||
@@ -53,7 +59,7 @@ services:
|
|||||||
- GITEA__database__PASSWD=gitea
|
- GITEA__database__PASSWD=gitea
|
||||||
# Server Configuration
|
# Server Configuration
|
||||||
- GITEA__server__DOMAIN=bee8333.ddns.net
|
- GITEA__server__DOMAIN=bee8333.ddns.net
|
||||||
- GITEA__server__ROOT_URL=https://bee8333.ddns.net/
|
- GITEA__server__ROOT_URL=https://bee8333.ddns.net/gitea/
|
||||||
- GITEA__server__PROTOCOL=http
|
- GITEA__server__PROTOCOL=http
|
||||||
- GITEA__server__HTTP_PORT=3000
|
- GITEA__server__HTTP_PORT=3000
|
||||||
- GITEA__server__SSH_DOMAIN=bee8333.ddns.net
|
- GITEA__server__SSH_DOMAIN=bee8333.ddns.net
|
||||||
@@ -68,30 +74,63 @@ services:
|
|||||||
restart: always
|
restart: always
|
||||||
networks:
|
networks:
|
||||||
- gitea
|
- gitea
|
||||||
|
- traefik
|
||||||
volumes:
|
volumes:
|
||||||
- gitea-data:/data
|
- gitea-data:/data
|
||||||
- /etc/timezone:/etc/timezone:ro
|
# - /etc/timezone:/etc/timezone:ro
|
||||||
- /etc/localtime:/etc/localtime:ro
|
# - /etc/localtime:/etc/localtime:ro
|
||||||
ports:
|
ports:
|
||||||
- "2224:22" # SSH: Host port 2224 -> Container port 22
|
- "2224:22" # SSH: Host port 2224 -> Container port 22
|
||||||
depends_on:
|
depends_on:
|
||||||
- db
|
- db
|
||||||
labels:
|
labels:
|
||||||
- "traefik.enable=true"
|
- "traefik.enable=true"
|
||||||
# HTTP Configuration for HTTPS access
|
- "traefik.docker.network=traefik"
|
||||||
- "traefik.http.routers.gitea.rule=Host(`bee8333.ddns.net`)"
|
# HTTPS Configuration for /gitea subpath
|
||||||
|
- "traefik.http.routers.gitea.rule=Host(`bee8333.ddns.net`) && PathPrefix(`/gitea`)"
|
||||||
- "traefik.http.routers.gitea.entrypoints=websecure"
|
- "traefik.http.routers.gitea.entrypoints=websecure"
|
||||||
- "traefik.http.routers.gitea.tls.certresolver=letsencrypt"
|
- "traefik.http.routers.gitea.tls.certresolver=letsencrypt"
|
||||||
|
- "traefik.http.routers.gitea.priority=10"
|
||||||
- "traefik.http.services.gitea.loadbalancer.server.port=3000"
|
- "traefik.http.services.gitea.loadbalancer.server.port=3000"
|
||||||
|
- "traefik.http.middlewares.gitea-stripprefix.stripprefix.prefixes=/gitea"
|
||||||
- "traefik.http.middlewares.gitea-headers.headers.customrequestheaders.X-Forwarded-Proto=https"
|
- "traefik.http.middlewares.gitea-headers.headers.customrequestheaders.X-Forwarded-Proto=https"
|
||||||
- "traefik.http.routers.gitea.middlewares=gitea-headers@docker"
|
- "traefik.http.routers.gitea.middlewares=gitea-stripprefix@docker,gitea-headers@docker"
|
||||||
# HTTP Configuration for HTTP -> HTTPS redirection
|
# HTTP Configuration for HTTP -> HTTPS redirection
|
||||||
- "traefik.http.routers.gitea-http.rule=Host(`bee8333.ddns.net`)"
|
- "traefik.http.routers.gitea-http.rule=Host(`bee8333.ddns.net`) && PathPrefix(`/gitea`)"
|
||||||
- "traefik.http.routers.gitea-http.entrypoints=web"
|
- "traefik.http.routers.gitea-http.entrypoints=web"
|
||||||
- "traefik.http.middlewares.https-redirect.redirectscheme.scheme=https"
|
- "traefik.http.middlewares.https-redirect.redirectscheme.scheme=https"
|
||||||
- "traefik.http.middlewares.https-redirect.redirectscheme.permanent=true"
|
- "traefik.http.middlewares.https-redirect.redirectscheme.permanent=true"
|
||||||
- "traefik.http.routers.gitea-http.middlewares=https-redirect@docker"
|
- "traefik.http.routers.gitea-http.middlewares=https-redirect@docker"
|
||||||
|
|
||||||
|
headscale:
|
||||||
|
image: headscale/headscale:latest
|
||||||
|
container_name: headscale
|
||||||
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- "3478:3478/udp" # STUN for DERP relay
|
||||||
|
volumes:
|
||||||
|
- ./headscale/config:/etc/headscale
|
||||||
|
- ./headscale/data:/var/lib/headscale
|
||||||
|
command: serve
|
||||||
|
networks:
|
||||||
|
- gitea
|
||||||
|
- traefik
|
||||||
|
labels:
|
||||||
|
- "traefik.enable=true"
|
||||||
|
- "traefik.docker.network=traefik"
|
||||||
|
# HTTPS Configuration for /headscale subpath
|
||||||
|
- "traefik.http.routers.headscale.rule=Host(`bee8333.ddns.net`) && PathPrefix(`/headscale`)"
|
||||||
|
- "traefik.http.routers.headscale.entrypoints=websecure"
|
||||||
|
- "traefik.http.routers.headscale.tls.certresolver=letsencrypt"
|
||||||
|
- "traefik.http.services.headscale.loadbalancer.server.port=8080"
|
||||||
|
- "traefik.http.middlewares.headscale-stripprefix.stripprefix.prefixes=/headscale"
|
||||||
|
- "traefik.http.middlewares.headscale-headers.headers.customrequestheaders.X-Forwarded-Proto=https"
|
||||||
|
- "traefik.http.routers.headscale.middlewares=headscale-stripprefix@docker,headscale-headers@docker"
|
||||||
|
# HTTP Configuration for HTTP -> HTTPS redirection
|
||||||
|
- "traefik.http.routers.headscale-http.rule=Host(`bee8333.ddns.net`) && PathPrefix(`/headscale`)"
|
||||||
|
- "traefik.http.routers.headscale-http.entrypoints=web"
|
||||||
|
- "traefik.http.routers.headscale-http.middlewares=https-redirect@docker"
|
||||||
|
|
||||||
db:
|
db:
|
||||||
image: postgres:14
|
image: postgres:14
|
||||||
container_name: gitea-db
|
container_name: gitea-db
|
||||||
|
|||||||
@@ -1,83 +1,83 @@
|
|||||||
# Script to ensure Docker is running before scheduled backup
|
# Script to ensure Docker is running before scheduled backup
|
||||||
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||||
$logFile = Join-Path $scriptDir "backups\docker-status.log"
|
$logFile = Join-Path $scriptDir "backups\docker-status.log"
|
||||||
$timestamp = Get-Date -Format "yyyy-MM-dd_HH-mm-ss"
|
$timestamp = Get-Date -Format "yyyy-MM-dd_HH-mm-ss"
|
||||||
|
|
||||||
# Ensure log directory exists
|
# Ensure log directory exists
|
||||||
$backupDir = Join-Path $scriptDir "backups"
|
$backupDir = Join-Path $scriptDir "backups"
|
||||||
if (-not (Test-Path $backupDir)) {
|
if (-not (Test-Path $backupDir)) {
|
||||||
New-Item -ItemType Directory -Path $backupDir
|
New-Item -ItemType Directory -Path $backupDir
|
||||||
}
|
}
|
||||||
|
|
||||||
"[$timestamp] Checking Docker status..." | Out-File -Append -FilePath $logFile
|
"[$timestamp] Checking Docker status..." | Out-File -Append -FilePath $logFile
|
||||||
|
|
||||||
# Check if Docker Desktop is running
|
# Check if Docker Desktop is running
|
||||||
$dockerProcess = Get-Process "Docker Desktop" -ErrorAction SilentlyContinue
|
$dockerProcess = Get-Process "Docker Desktop" -ErrorAction SilentlyContinue
|
||||||
if ($null -eq $dockerProcess) {
|
if ($null -eq $dockerProcess) {
|
||||||
"[$timestamp] Docker Desktop is not running. Attempting to start..." | Out-File -Append -FilePath $logFile
|
"[$timestamp] Docker Desktop is not running. Attempting to start..." | Out-File -Append -FilePath $logFile
|
||||||
|
|
||||||
# Path to Docker Desktop
|
# Path to Docker Desktop
|
||||||
$dockerPath = "C:\Program Files\Docker\Docker\Docker Desktop.exe"
|
$dockerPath = "C:\Program Files\Docker\Docker\Docker Desktop.exe"
|
||||||
if (Test-Path $dockerPath) {
|
if (Test-Path $dockerPath) {
|
||||||
Start-Process $dockerPath
|
Start-Process $dockerPath
|
||||||
"[$timestamp] Started Docker Desktop." | Out-File -Append -FilePath $logFile
|
"[$timestamp] Started Docker Desktop." | Out-File -Append -FilePath $logFile
|
||||||
|
|
||||||
# Wait for Docker to start up (give it 60 seconds)
|
# Wait for Docker to start up (give it 60 seconds)
|
||||||
$maxWaitTime = 60
|
$maxWaitTime = 60
|
||||||
$waitTime = 0
|
$waitTime = 0
|
||||||
$dockerRunning = $false
|
$dockerRunning = $false
|
||||||
|
|
||||||
while (-not $dockerRunning -and $waitTime -lt $maxWaitTime) {
|
while (-not $dockerRunning -and $waitTime -lt $maxWaitTime) {
|
||||||
Start-Sleep -Seconds 5
|
Start-Sleep -Seconds 5
|
||||||
$waitTime += 5
|
$waitTime += 5
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$dockerStatus = docker info 2>&1
|
$dockerStatus = docker info 2>&1
|
||||||
if ($LASTEXITCODE -eq 0) {
|
if ($LASTEXITCODE -eq 0) {
|
||||||
$dockerRunning = $true
|
$dockerRunning = $true
|
||||||
"[$timestamp] Docker is now running after waiting $waitTime seconds." | Out-File -Append -FilePath $logFile
|
"[$timestamp] Docker is now running after waiting $waitTime seconds." | Out-File -Append -FilePath $logFile
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
# Keep waiting
|
# Keep waiting
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (-not $dockerRunning) {
|
if (-not $dockerRunning) {
|
||||||
"[$timestamp] Docker did not start successfully after waiting $maxWaitTime seconds." | Out-File -Append -FilePath $logFile
|
"[$timestamp] Docker did not start successfully after waiting $maxWaitTime seconds." | Out-File -Append -FilePath $logFile
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
"[$timestamp] Docker Desktop executable not found at expected location: $dockerPath" | Out-File -Append -FilePath $logFile
|
"[$timestamp] Docker Desktop executable not found at expected location: $dockerPath" | Out-File -Append -FilePath $logFile
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
"[$timestamp] Docker Desktop is already running." | Out-File -Append -FilePath $logFile
|
"[$timestamp] Docker Desktop is already running." | Out-File -Append -FilePath $logFile
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check if containers are running
|
# Check if containers are running
|
||||||
try {
|
try {
|
||||||
$containersRunning = docker ps 2>&1
|
$containersRunning = docker ps 2>&1
|
||||||
if ($LASTEXITCODE -eq 0) {
|
if ($LASTEXITCODE -eq 0) {
|
||||||
"[$timestamp] Docker containers status: " | Out-File -Append -FilePath $logFile
|
"[$timestamp] Docker containers status: " | Out-File -Append -FilePath $logFile
|
||||||
$runningContainers = docker ps --format "{{.Names}}" 2>&1
|
$runningContainers = docker ps --format "{{.Names}}" 2>&1
|
||||||
$runningContainers | Out-File -Append -FilePath $logFile
|
$runningContainers | Out-File -Append -FilePath $logFile
|
||||||
|
|
||||||
# Check specifically for gitea containers
|
# Check specifically for gitea containers
|
||||||
$giteaRunning = $runningContainers | Select-String -Pattern "gitea" -Quiet
|
$giteaRunning = $runningContainers | Select-String -Pattern "gitea" -Quiet
|
||||||
if (-not $giteaRunning) {
|
if (-not $giteaRunning) {
|
||||||
"[$timestamp] Gitea containers are not running. Starting containers..." | Out-File -Append -FilePath $logFile
|
"[$timestamp] Gitea containers are not running. Starting containers..." | Out-File -Append -FilePath $logFile
|
||||||
|
|
||||||
# Navigate to gitea-docker directory and start containers
|
# Navigate to gitea-docker directory and start containers
|
||||||
Set-Location $scriptDir
|
Set-Location $scriptDir
|
||||||
docker-compose up -d 2>&1 | Out-File -Append -FilePath $logFile
|
docker-compose up -d 2>&1 | Out-File -Append -FilePath $logFile
|
||||||
|
|
||||||
if ($LASTEXITCODE -eq 0) {
|
if ($LASTEXITCODE -eq 0) {
|
||||||
"[$timestamp] Successfully started Gitea containers." | Out-File -Append -FilePath $logFile
|
"[$timestamp] Successfully started Gitea containers." | Out-File -Append -FilePath $logFile
|
||||||
} else {
|
} else {
|
||||||
"[$timestamp] Failed to start Gitea containers." | Out-File -Append -FilePath $logFile
|
"[$timestamp] Failed to start Gitea containers." | Out-File -Append -FilePath $logFile
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
"[$timestamp] Failed to check running containers. Docker might not be ready yet." | Out-File -Append -FilePath $logFile
|
"[$timestamp] Failed to check running containers. Docker might not be ready yet." | Out-File -Append -FilePath $logFile
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
"[$timestamp] Error checking Docker containers: $_" | Out-File -Append -FilePath $logFile
|
"[$timestamp] Error checking Docker containers: $_" | Out-File -Append -FilePath $logFile
|
||||||
}
|
}
|
||||||
BIN
gitea-dump.zip
Normal file
BIN
gitea-dump.zip
Normal file
Binary file not shown.
@@ -1,37 +1,37 @@
|
|||||||
APP_NAME = BeeBrain
|
APP_NAME = BeeBrain
|
||||||
RUN_MODE = prod
|
RUN_MODE = prod
|
||||||
RUN_USER = git
|
RUN_USER = git
|
||||||
|
|
||||||
[server]
|
[server]
|
||||||
DOMAIN = bee8333.ddns.net
|
DOMAIN = bee8333.ddns.net
|
||||||
SSH_DOMAIN = bee8333.ddns.net
|
SSH_DOMAIN = bee8333.ddns.net
|
||||||
HTTP_PORT = 3000
|
HTTP_PORT = 3000
|
||||||
ROOT_URL = https://bee8333.ddns.net/
|
ROOT_URL = https://bee8333.ddns.net/
|
||||||
DISABLE_SSH = false
|
DISABLE_SSH = false
|
||||||
SSH_PORT = 222
|
SSH_PORT = 222
|
||||||
SSH_LISTEN_PORT = 22
|
SSH_LISTEN_PORT = 22
|
||||||
LFS_START_SERVER = true
|
LFS_START_SERVER = true
|
||||||
PROTOCOL = https
|
PROTOCOL = https
|
||||||
CERT_FILE = /data/gitea/cert.pem
|
CERT_FILE = /data/gitea/cert.pem
|
||||||
KEY_FILE = /data/gitea/key.pem
|
KEY_FILE = /data/gitea/key.pem
|
||||||
|
|
||||||
[database]
|
[database]
|
||||||
DB_TYPE = postgres
|
DB_TYPE = postgres
|
||||||
HOST = db:5432
|
HOST = db:5432
|
||||||
NAME = gitea
|
NAME = gitea
|
||||||
USER = gitea
|
USER = gitea
|
||||||
PASSWD = gitea
|
PASSWD = gitea
|
||||||
SSL_MODE = disable
|
SSL_MODE = disable
|
||||||
|
|
||||||
[repository]
|
[repository]
|
||||||
ROOT = /data/git/repositories
|
ROOT = /data/git/repositories
|
||||||
|
|
||||||
[security]
|
[security]
|
||||||
INSTALL_LOCK = true
|
INSTALL_LOCK = true
|
||||||
|
|
||||||
[service]
|
[service]
|
||||||
DISABLE_REGISTRATION = false
|
DISABLE_REGISTRATION = false
|
||||||
REQUIRE_SIGNIN_VIEW = true
|
REQUIRE_SIGNIN_VIEW = true
|
||||||
|
|
||||||
[indexer]
|
[indexer]
|
||||||
ISSUE_INDEXER_PATH = /data/gitea/indexers/issues.bleve
|
ISSUE_INDEXER_PATH = /data/gitea/indexers/issues.bleve
|
||||||
54
headscale/config/config.yaml
Normal file
54
headscale/config/config.yaml
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
server_url: https://bee8333.ddns.net/headscale/
|
||||||
|
listen_addr: 0.0.0.0:8080
|
||||||
|
metrics_listen_addr: 127.0.0.1:9090
|
||||||
|
grpc_listen_addr: 0.0.0.0:50443
|
||||||
|
grpc_allow_insecure: false
|
||||||
|
|
||||||
|
tls_cert_path: ""
|
||||||
|
tls_key_path: ""
|
||||||
|
|
||||||
|
private_key_path: /var/lib/headscale/private.key
|
||||||
|
noise:
|
||||||
|
private_key_path: /var/lib/headscale/noise_private.key
|
||||||
|
|
||||||
|
prefixes:
|
||||||
|
v4: 100.64.0.0/10
|
||||||
|
v6: fd7a:115c:a1e0::/48
|
||||||
|
|
||||||
|
derp:
|
||||||
|
server:
|
||||||
|
enabled: true
|
||||||
|
region_id: 900
|
||||||
|
region_code: "homelab"
|
||||||
|
region_name: "Home Lab"
|
||||||
|
stun_listen_addr: "0.0.0.0:3478"
|
||||||
|
private_key_path: /var/lib/headscale/derp_server_private.key
|
||||||
|
urls:
|
||||||
|
- https://controlplane.tailscale.com/derpmap/default
|
||||||
|
|
||||||
|
disable_check_updates: false
|
||||||
|
ephemeral_node_inactivity_timeout: 30m
|
||||||
|
database:
|
||||||
|
type: sqlite3
|
||||||
|
sqlite:
|
||||||
|
path: /var/lib/headscale/db.sqlite
|
||||||
|
|
||||||
|
log:
|
||||||
|
format: text
|
||||||
|
level: info
|
||||||
|
|
||||||
|
policy:
|
||||||
|
path: ""
|
||||||
|
|
||||||
|
dns:
|
||||||
|
override_local_dns: true
|
||||||
|
nameservers:
|
||||||
|
global:
|
||||||
|
- 1.1.1.1
|
||||||
|
- 8.8.8.8
|
||||||
|
search_domains: []
|
||||||
|
magic_dns: true
|
||||||
|
base_domain: headscale.bee8333.local
|
||||||
|
|
||||||
|
unix_socket: /var/run/headscale/headscale.sock
|
||||||
|
unix_socket_permission: "0770"
|
||||||
36
immich-https.conf
Normal file
36
immich-https.conf
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
events {
|
||||||
|
worker_connections 1024;
|
||||||
|
}
|
||||||
|
|
||||||
|
http {
|
||||||
|
upstream immich {
|
||||||
|
server immich_server:2283;
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 443 ssl;
|
||||||
|
server_name bee8333.ddns.net;
|
||||||
|
|
||||||
|
# Self-signed SSL certificate (will be generated at startup)
|
||||||
|
ssl_certificate /etc/ssl/certs/immich.crt;
|
||||||
|
ssl_certificate_key /etc/ssl/private/immich.key;
|
||||||
|
ssl_protocols TLSv1.2 TLSv1.3;
|
||||||
|
ssl_ciphers HIGH:!aNULL:!MD5;
|
||||||
|
|
||||||
|
client_max_body_size 50000M;
|
||||||
|
|
||||||
|
# Direct proxy to Immich - NO subpath manipulation
|
||||||
|
location / {
|
||||||
|
proxy_pass http://immich;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto https;
|
||||||
|
|
||||||
|
# WebSocket support for real-time features
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection "upgrade";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
49
immich-nginx.conf
Normal file
49
immich-nginx.conf
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
events {
|
||||||
|
worker_connections 1024;
|
||||||
|
}
|
||||||
|
|
||||||
|
http {
|
||||||
|
upstream immich {
|
||||||
|
server immich_server:2283;
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name bee8333.ddns.net;
|
||||||
|
|
||||||
|
client_max_body_size 50000M;
|
||||||
|
|
||||||
|
# Main application - all requests go to Immich
|
||||||
|
location / {
|
||||||
|
proxy_pass http://immich;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
|
||||||
|
# Critical headers for subpath handling
|
||||||
|
proxy_set_header X-Forwarded-Prefix /immich;
|
||||||
|
proxy_set_header X-Script-Name /immich;
|
||||||
|
|
||||||
|
# WebSocket support for real-time features
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection "upgrade";
|
||||||
|
|
||||||
|
# SPA support - handle client-side routing
|
||||||
|
proxy_intercept_errors on;
|
||||||
|
error_page 404 = @fallback;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Fallback for SPA routing
|
||||||
|
location @fallback {
|
||||||
|
proxy_pass http://immich;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
proxy_set_header X-Forwarded-Prefix /immich;
|
||||||
|
proxy_set_header X-Script-Name /immich;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
248
ob.md
248
ob.md
@@ -1,125 +1,125 @@
|
|||||||
# Setting Up Git Access with Gitea and Obsidian
|
# Setting Up Git Access with Gitea and Obsidian
|
||||||
|
|
||||||
## Part 1: Authorizing Git Client Access
|
## Part 1: Authorizing Git Client Access
|
||||||
|
|
||||||
### Prerequisites
|
### Prerequisites
|
||||||
- Gitea instance accessible through your domain (bee8333.ddns.net) via HTTPS
|
- Gitea instance accessible through your domain (bee8333.ddns.net) via HTTPS
|
||||||
- Administrative privileges for initial setup
|
- Administrative privileges for initial setup
|
||||||
|
|
||||||
### Repository Setup
|
### Repository Setup
|
||||||
- For new repositories using HTTPS:
|
- For new repositories using HTTPS:
|
||||||
```bash
|
```bash
|
||||||
git clone https://bee8333.ddns.net:3000/username/repository.git
|
git clone https://bee8333.ddns.net:3000/username/repository.git
|
||||||
```
|
```
|
||||||
|
|
||||||
- For new repositories using SSH:
|
- For new repositories using SSH:
|
||||||
```bash
|
```bash
|
||||||
git clone ssh://git@bee8333.ddns.net:222/username/repository.git
|
git clone ssh://git@bee8333.ddns.net:222/username/repository.git
|
||||||
```
|
```
|
||||||
|
|
||||||
- For existing repositories (HTTPS):
|
- For existing repositories (HTTPS):
|
||||||
```bash
|
```bash
|
||||||
git remote set-url origin https://bee8333.ddns.net:3000/username/repository.git
|
git remote set-url origin https://bee8333.ddns.net:3000/username/repository.git
|
||||||
```
|
```
|
||||||
|
|
||||||
- For existing repositories (SSH):
|
- For existing repositories (SSH):
|
||||||
```bash
|
```bash
|
||||||
git remote set-url origin ssh://git@bee8333.ddns.net:222/username/repository.git
|
git remote set-url origin ssh://git@bee8333.ddns.net:222/username/repository.git
|
||||||
```
|
```
|
||||||
|
|
||||||
### Authentication
|
### Authentication
|
||||||
When using HTTPS:
|
When using HTTPS:
|
||||||
1. You'll be prompted for your Gitea username and password
|
1. You'll be prompted for your Gitea username and password
|
||||||
2. For better security, create a Personal Access Token in Gitea:
|
2. For better security, create a Personal Access Token in Gitea:
|
||||||
- Go to Settings → Applications → Generate New Token
|
- Go to Settings → Applications → Generate New Token
|
||||||
- Give it a description
|
- Give it a description
|
||||||
- Copy the token immediately (it won't be shown again)
|
- Copy the token immediately (it won't be shown again)
|
||||||
- Use this token as your password when Git asks for credentials
|
- Use this token as your password when Git asks for credentials
|
||||||
|
|
||||||
When using SSH:
|
When using SSH:
|
||||||
1. Generate an SSH key pair if you haven't already:
|
1. Generate an SSH key pair if you haven't already:
|
||||||
```bash
|
```bash
|
||||||
ssh-keygen -t ed25519 -C "your_email@example.com"
|
ssh-keygen -t ed25519 -C "your_email@example.com"
|
||||||
```
|
```
|
||||||
2. Add your public key to Gitea:
|
2. Add your public key to Gitea:
|
||||||
- Go to Settings → SSH / GPG Keys
|
- Go to Settings → SSH / GPG Keys
|
||||||
- Click "Add Key"
|
- Click "Add Key"
|
||||||
- Paste your public key (from ~/.ssh/id_ed25519.pub)
|
- Paste your public key (from ~/.ssh/id_ed25519.pub)
|
||||||
3. SSH will use your key automatically for authentication
|
3. SSH will use your key automatically for authentication
|
||||||
|
|
||||||
### Important Note
|
### Important Note
|
||||||
When using non-standard HTTPS ports (like 3000):
|
When using non-standard HTTPS ports (like 3000):
|
||||||
1. Use an elevated (Administrator) PowerShell/Command Prompt for Git operations
|
1. Use an elevated (Administrator) PowerShell/Command Prompt for Git operations
|
||||||
2. Regular terminals in VS Code/Cursor may not have sufficient privileges
|
2. Regular terminals in VS Code/Cursor may not have sufficient privileges
|
||||||
3. If Git operations fail, try running your terminal as Administrator
|
3. If Git operations fail, try running your terminal as Administrator
|
||||||
|
|
||||||
## Part 2: Obsidian-Git Integration
|
## Part 2: Obsidian-Git Integration
|
||||||
|
|
||||||
### Plugin Installation
|
### Plugin Installation
|
||||||
1. Open Obsidian Settings → Community plugins
|
1. Open Obsidian Settings → Community plugins
|
||||||
2. Search for "Obsidian Git"
|
2. Search for "Obsidian Git"
|
||||||
3. Install and enable the plugin
|
3. Install and enable the plugin
|
||||||
|
|
||||||
### Plugin Configuration
|
### Plugin Configuration
|
||||||
1. Go to Settings → Community plugins → Obsidian Git
|
1. Go to Settings → Community plugins → Obsidian Git
|
||||||
2. Recommended settings:
|
2. Recommended settings:
|
||||||
- ❌ Auto pull interval (disable when using Syncthing)
|
- ❌ Auto pull interval (disable when using Syncthing)
|
||||||
- ✅ Show status bar
|
- ✅ Show status bar
|
||||||
- ✅ Source Control View
|
- ✅ Source Control View
|
||||||
- ✅ Show changes files count in status bar
|
- ✅ Show changes files count in status bar
|
||||||
- Configure default commit message
|
- Configure default commit message
|
||||||
|
|
||||||
### Essential Commands
|
### Essential Commands
|
||||||
Access these via Command Palette (Ctrl/Cmd + P):
|
Access these via Command Palette (Ctrl/Cmd + P):
|
||||||
- `Open source control view` - View changes and branch info
|
- `Open source control view` - View changes and branch info
|
||||||
- `List changed files` - See modifications
|
- `List changed files` - See modifications
|
||||||
- `View diff` - Check file changes
|
- `View diff` - Check file changes
|
||||||
- `Stage/Unstage current file` - Prepare for commit
|
- `Stage/Unstage current file` - Prepare for commit
|
||||||
- `Commit staged` - Save staged changes
|
- `Commit staged` - Save staged changes
|
||||||
- `Create/Switch branch` - Branch management
|
- `Create/Switch branch` - Branch management
|
||||||
|
|
||||||
### Recommended Workflow
|
### Recommended Workflow
|
||||||
1. Make changes in Obsidian
|
1. Make changes in Obsidian
|
||||||
2. Check Source Control View
|
2. Check Source Control View
|
||||||
3. Stage desired files
|
3. Stage desired files
|
||||||
4. Commit with meaningful message
|
4. Commit with meaningful message
|
||||||
5. Push to Gitea
|
5. Push to Gitea
|
||||||
|
|
||||||
### Status Bar Features
|
### Status Bar Features
|
||||||
- Current branch name
|
- Current branch name
|
||||||
- Number of changed files
|
- Number of changed files
|
||||||
- Sync status indicators
|
- Sync status indicators
|
||||||
|
|
||||||
## Important Configuration
|
## Important Configuration
|
||||||
|
|
||||||
### Gitignore Setup
|
### Gitignore Setup
|
||||||
Add these patterns to `.gitignore`:
|
Add these patterns to `.gitignore`:
|
||||||
```
|
```
|
||||||
.trash/
|
.trash/
|
||||||
.stversions/
|
.stversions/
|
||||||
.obsidian/workspace.json
|
.obsidian/workspace.json
|
||||||
.obsidian/workspace-mobile.json
|
.obsidian/workspace-mobile.json
|
||||||
```
|
```
|
||||||
|
|
||||||
### Security Best Practices
|
### Security Best Practices
|
||||||
- Keep SSH private keys secure
|
- Keep SSH private keys secure
|
||||||
- Use strong SSH key passphrases
|
- Use strong SSH key passphrases
|
||||||
- Regularly review and clean up SSH keys in Gitea
|
- Regularly review and clean up SSH keys in Gitea
|
||||||
- Never share private keys
|
- Never share private keys
|
||||||
|
|
||||||
### Syncthing Compatibility
|
### Syncthing Compatibility
|
||||||
- Wait for Syncthing sync before Git operations
|
- Wait for Syncthing sync before Git operations
|
||||||
- Commit/push before closing Obsidian
|
- Commit/push before closing Obsidian
|
||||||
- Ensure `.stversions` is in `.gitignore`
|
- Ensure `.stversions` is in `.gitignore`
|
||||||
|
|
||||||
### Performance Tips
|
### Performance Tips
|
||||||
- Stage files individually
|
- Stage files individually
|
||||||
- Use branches for major changes
|
- Use branches for major changes
|
||||||
- Commit regularly, push selectively
|
- Commit regularly, push selectively
|
||||||
- Monitor Source Control View
|
- Monitor Source Control View
|
||||||
|
|
||||||
## Collaboration Guidelines
|
## Collaboration Guidelines
|
||||||
- Pull before making changes
|
- Pull before making changes
|
||||||
- Use branches for significant changes
|
- Use branches for significant changes
|
||||||
- Check diff view for conflicts
|
- Check diff view for conflicts
|
||||||
- Let Syncthing sync complete before Git operations
|
- Let Syncthing sync complete before Git operations
|
||||||
@@ -1,67 +1,67 @@
|
|||||||
# Gitea Database Restore Script
|
# Gitea Database Restore Script
|
||||||
param (
|
param (
|
||||||
[Parameter(Mandatory=$true)]
|
[Parameter(Mandatory=$true)]
|
||||||
[string]$BackupFile
|
[string]$BackupFile
|
||||||
)
|
)
|
||||||
|
|
||||||
# Check if backup file exists
|
# Check if backup file exists
|
||||||
if (-not (Test-Path $BackupFile)) {
|
if (-not (Test-Path $BackupFile)) {
|
||||||
Write-Host "Backup file not found: $BackupFile" -ForegroundColor Red
|
Write-Host "Backup file not found: $BackupFile" -ForegroundColor Red
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
# Extract the backup if it's a zip file
|
# Extract the backup if it's a zip file
|
||||||
$tempFile = $null
|
$tempFile = $null
|
||||||
if ($BackupFile.EndsWith(".zip")) {
|
if ($BackupFile.EndsWith(".zip")) {
|
||||||
$tempDir = [System.IO.Path]::GetTempPath()
|
$tempDir = [System.IO.Path]::GetTempPath()
|
||||||
$tempFile = Join-Path $tempDir "gitea-db-restore-temp.sql"
|
$tempFile = Join-Path $tempDir "gitea-db-restore-temp.sql"
|
||||||
|
|
||||||
Write-Host "Extracting backup file..."
|
Write-Host "Extracting backup file..."
|
||||||
Expand-Archive -Path $BackupFile -DestinationPath $tempDir -Force
|
Expand-Archive -Path $BackupFile -DestinationPath $tempDir -Force
|
||||||
$extractedFile = Get-ChildItem -Path $tempDir -Filter "*.sql" | Select-Object -First 1
|
$extractedFile = Get-ChildItem -Path $tempDir -Filter "*.sql" | Select-Object -First 1
|
||||||
|
|
||||||
if ($extractedFile) {
|
if ($extractedFile) {
|
||||||
Copy-Item $extractedFile.FullName -Destination $tempFile
|
Copy-Item $extractedFile.FullName -Destination $tempFile
|
||||||
$BackupFile = $tempFile
|
$BackupFile = $tempFile
|
||||||
} else {
|
} else {
|
||||||
Write-Host "Failed to extract SQL file from backup" -ForegroundColor Red
|
Write-Host "Failed to extract SQL file from backup" -ForegroundColor Red
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Confirm before proceeding
|
# Confirm before proceeding
|
||||||
Write-Host "WARNING: This will overwrite the current database with the backup." -ForegroundColor Yellow
|
Write-Host "WARNING: This will overwrite the current database with the backup." -ForegroundColor Yellow
|
||||||
Write-Host "Make sure your Gitea service is stopped before proceeding." -ForegroundColor Yellow
|
Write-Host "Make sure your Gitea service is stopped before proceeding." -ForegroundColor Yellow
|
||||||
$confirmation = Read-Host "Do you want to continue? (y/n)"
|
$confirmation = Read-Host "Do you want to continue? (y/n)"
|
||||||
|
|
||||||
if ($confirmation -ne "y") {
|
if ($confirmation -ne "y") {
|
||||||
Write-Host "Restore cancelled."
|
Write-Host "Restore cancelled."
|
||||||
if ($tempFile -and (Test-Path $tempFile)) {
|
if ($tempFile -and (Test-Path $tempFile)) {
|
||||||
Remove-Item $tempFile
|
Remove-Item $tempFile
|
||||||
}
|
}
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
# Stop Gitea services
|
# Stop Gitea services
|
||||||
Write-Host "Stopping Gitea services..."
|
Write-Host "Stopping Gitea services..."
|
||||||
docker-compose stop
|
docker-compose stop
|
||||||
|
|
||||||
# Restore the database
|
# Restore the database
|
||||||
Write-Host "Restoring database from backup..."
|
Write-Host "Restoring database from backup..."
|
||||||
Get-Content $BackupFile | docker exec -i gitea-db psql -U gitea -d gitea
|
Get-Content $BackupFile | docker exec -i gitea-db psql -U gitea -d gitea
|
||||||
|
|
||||||
# Check restore status
|
# Check restore status
|
||||||
if ($LASTEXITCODE -eq 0) {
|
if ($LASTEXITCODE -eq 0) {
|
||||||
Write-Host "Database restore completed successfully!" -ForegroundColor Green
|
Write-Host "Database restore completed successfully!" -ForegroundColor Green
|
||||||
} else {
|
} else {
|
||||||
Write-Host "Database restore failed!" -ForegroundColor Red
|
Write-Host "Database restore failed!" -ForegroundColor Red
|
||||||
}
|
}
|
||||||
|
|
||||||
# Clean up temp file if created
|
# Clean up temp file if created
|
||||||
if ($tempFile -and (Test-Path $tempFile)) {
|
if ($tempFile -and (Test-Path $tempFile)) {
|
||||||
Remove-Item $tempFile
|
Remove-Item $tempFile
|
||||||
}
|
}
|
||||||
|
|
||||||
# Restart Gitea services
|
# Restart Gitea services
|
||||||
Write-Host "Starting Gitea services..."
|
Write-Host "Starting Gitea services..."
|
||||||
docker-compose start
|
docker-compose start
|
||||||
@@ -1,88 +1,88 @@
|
|||||||
# Script to restore the Postgres Docker volume from a backup
|
# Script to restore the Postgres Docker volume from a backup
|
||||||
param (
|
param (
|
||||||
[Parameter(Mandatory=$true)]
|
[Parameter(Mandatory=$true)]
|
||||||
[string]$BackupFile
|
[string]$BackupFile
|
||||||
)
|
)
|
||||||
|
|
||||||
$volumeName = "gitea-docker_postgres-data"
|
$volumeName = "gitea-docker_postgres-data"
|
||||||
$tempDir = Join-Path $env:TEMP "postgres-volume-restore"
|
$tempDir = Join-Path $env:TEMP "postgres-volume-restore"
|
||||||
|
|
||||||
# Check if backup file exists
|
# Check if backup file exists
|
||||||
if (-not (Test-Path $BackupFile)) {
|
if (-not (Test-Path $BackupFile)) {
|
||||||
Write-Host "Backup file not found: $BackupFile" -ForegroundColor Red
|
Write-Host "Backup file not found: $BackupFile" -ForegroundColor Red
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
# Extract the backup if it's a zip file
|
# Extract the backup if it's a zip file
|
||||||
$tarFile = $BackupFile
|
$tarFile = $BackupFile
|
||||||
if ($BackupFile.EndsWith(".zip")) {
|
if ($BackupFile.EndsWith(".zip")) {
|
||||||
# Create temp directory if it doesn't exist
|
# Create temp directory if it doesn't exist
|
||||||
if (-not (Test-Path $tempDir)) {
|
if (-not (Test-Path $tempDir)) {
|
||||||
New-Item -ItemType Directory -Path $tempDir -Force | Out-Null
|
New-Item -ItemType Directory -Path $tempDir -Force | Out-Null
|
||||||
} else {
|
} else {
|
||||||
# Clean temp directory
|
# Clean temp directory
|
||||||
Remove-Item -Path "$tempDir\*" -Force -Recurse -ErrorAction SilentlyContinue
|
Remove-Item -Path "$tempDir\*" -Force -Recurse -ErrorAction SilentlyContinue
|
||||||
}
|
}
|
||||||
|
|
||||||
Write-Host "Extracting backup file..."
|
Write-Host "Extracting backup file..."
|
||||||
Expand-Archive -Path $BackupFile -DestinationPath $tempDir -Force
|
Expand-Archive -Path $BackupFile -DestinationPath $tempDir -Force
|
||||||
$extractedFile = Get-ChildItem -Path $tempDir -Filter "*.tar" | Select-Object -First 1
|
$extractedFile = Get-ChildItem -Path $tempDir -Filter "*.tar" | Select-Object -First 1
|
||||||
|
|
||||||
if ($extractedFile) {
|
if ($extractedFile) {
|
||||||
$tarFile = $extractedFile.FullName
|
$tarFile = $extractedFile.FullName
|
||||||
} else {
|
} else {
|
||||||
Write-Host "Failed to extract TAR file from backup" -ForegroundColor Red
|
Write-Host "Failed to extract TAR file from backup" -ForegroundColor Red
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Confirm before proceeding
|
# Confirm before proceeding
|
||||||
Write-Host "WARNING: This will overwrite the current database volume with the backup." -ForegroundColor Yellow
|
Write-Host "WARNING: This will overwrite the current database volume with the backup." -ForegroundColor Yellow
|
||||||
Write-Host "Make sure your Gitea services are stopped before proceeding." -ForegroundColor Yellow
|
Write-Host "Make sure your Gitea services are stopped before proceeding." -ForegroundColor Yellow
|
||||||
$confirmation = Read-Host "Do you want to continue? (y/n)"
|
$confirmation = Read-Host "Do you want to continue? (y/n)"
|
||||||
|
|
||||||
if ($confirmation -ne "y") {
|
if ($confirmation -ne "y") {
|
||||||
Write-Host "Restore cancelled."
|
Write-Host "Restore cancelled."
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
# Stop Gitea services
|
# Stop Gitea services
|
||||||
Write-Host "Stopping Gitea services..."
|
Write-Host "Stopping Gitea services..."
|
||||||
docker-compose down
|
docker-compose down
|
||||||
|
|
||||||
# Check if volume exists and remove it
|
# Check if volume exists and remove it
|
||||||
$volumeExists = docker volume ls --format "{{.Name}}" | Select-String -Pattern "^$volumeName$"
|
$volumeExists = docker volume ls --format "{{.Name}}" | Select-String -Pattern "^$volumeName$"
|
||||||
if ($volumeExists) {
|
if ($volumeExists) {
|
||||||
Write-Host "Removing existing volume $volumeName..."
|
Write-Host "Removing existing volume $volumeName..."
|
||||||
docker volume rm $volumeName
|
docker volume rm $volumeName
|
||||||
if ($LASTEXITCODE -ne 0) {
|
if ($LASTEXITCODE -ne 0) {
|
||||||
Write-Host "Failed to remove existing volume. It might be in use by another container." -ForegroundColor Red
|
Write-Host "Failed to remove existing volume. It might be in use by another container." -ForegroundColor Red
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Create a new volume
|
# Create a new volume
|
||||||
Write-Host "Creating new volume $volumeName..."
|
Write-Host "Creating new volume $volumeName..."
|
||||||
docker volume create $volumeName
|
docker volume create $volumeName
|
||||||
|
|
||||||
# Restore from backup
|
# Restore from backup
|
||||||
Write-Host "Restoring volume from backup..."
|
Write-Host "Restoring volume from backup..."
|
||||||
docker run --rm -v ${volumeName}:/volume -v ${tarFile}:/backup.tar alpine sh -c "cd /volume && tar -xf /backup.tar"
|
docker run --rm -v ${volumeName}:/volume -v ${tarFile}:/backup.tar alpine sh -c "cd /volume && tar -xf /backup.tar"
|
||||||
|
|
||||||
if ($LASTEXITCODE -eq 0) {
|
if ($LASTEXITCODE -eq 0) {
|
||||||
Write-Host "Volume restore completed successfully!" -ForegroundColor Green
|
Write-Host "Volume restore completed successfully!" -ForegroundColor Green
|
||||||
} else {
|
} else {
|
||||||
Write-Host "Volume restore failed!" -ForegroundColor Red
|
Write-Host "Volume restore failed!" -ForegroundColor Red
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
# Clean up temp directory if created
|
# Clean up temp directory if created
|
||||||
if ($BackupFile.EndsWith(".zip") -and (Test-Path $tempDir)) {
|
if ($BackupFile.EndsWith(".zip") -and (Test-Path $tempDir)) {
|
||||||
Remove-Item -Path $tempDir -Force -Recurse -ErrorAction SilentlyContinue
|
Remove-Item -Path $tempDir -Force -Recurse -ErrorAction SilentlyContinue
|
||||||
}
|
}
|
||||||
|
|
||||||
# Start Gitea services
|
# Start Gitea services
|
||||||
Write-Host "Starting Gitea services..."
|
Write-Host "Starting Gitea services..."
|
||||||
docker-compose up -d
|
docker-compose up -d
|
||||||
|
|
||||||
Write-Host "Restore process completed. Check if your Gitea instance is working properly." -ForegroundColor Green
|
Write-Host "Restore process completed. Check if your Gitea instance is working properly." -ForegroundColor Green
|
||||||
@@ -1,17 +1,17 @@
|
|||||||
# This script is automatically generated - do not edit manually
|
# This script is automatically generated - do not edit manually
|
||||||
# It runs the Docker check script followed by database and volume backup scripts
|
# It runs the Docker check script followed by database and volume backup scripts
|
||||||
|
|
||||||
# Get the script directory
|
# Get the script directory
|
||||||
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||||
|
|
||||||
# Run the Docker check script first
|
# Run the Docker check script first
|
||||||
$dockerCheckScript = Join-Path $scriptDir "ensure-docker-running.ps1"
|
$dockerCheckScript = Join-Path $scriptDir "ensure-docker-running.ps1"
|
||||||
& $dockerCheckScript
|
& $dockerCheckScript
|
||||||
|
|
||||||
# Then run the database backup script
|
# Then run the database backup script
|
||||||
$dbBackupScript = Join-Path $scriptDir "backup-gitea-db.ps1"
|
$dbBackupScript = Join-Path $scriptDir "backup-gitea-db.ps1"
|
||||||
& $dbBackupScript
|
& $dbBackupScript
|
||||||
|
|
||||||
# Finally run the volume backup script
|
# Finally run the volume backup script
|
||||||
$volumeBackupScript = Join-Path $scriptDir "backup-volume.ps1"
|
$volumeBackupScript = Join-Path $scriptDir "backup-volume.ps1"
|
||||||
& $volumeBackupScript
|
& $volumeBackupScript
|
||||||
|
|||||||
@@ -1,67 +1,67 @@
|
|||||||
# Script to create a scheduled task for Gitea database backups
|
# Script to create a scheduled task for Gitea database backups
|
||||||
$workingDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
$workingDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||||
$scriptPath = Join-Path $workingDir "backup-gitea-db.ps1"
|
$scriptPath = Join-Path $workingDir "backup-gitea-db.ps1"
|
||||||
$dockerCheckScript = Join-Path $workingDir "ensure-docker-running.ps1"
|
$dockerCheckScript = Join-Path $workingDir "ensure-docker-running.ps1"
|
||||||
$taskName = "GiteaDatabaseBackup"
|
$taskName = "GiteaDatabaseBackup"
|
||||||
$taskDescription = "Regular backup of Gitea PostgreSQL database"
|
$taskDescription = "Regular backup of Gitea PostgreSQL database"
|
||||||
|
|
||||||
# Check if the backup script exists
|
# Check if the backup script exists
|
||||||
if (-not (Test-Path $scriptPath)) {
|
if (-not (Test-Path $scriptPath)) {
|
||||||
Write-Host "Backup script not found at: $scriptPath" -ForegroundColor Red
|
Write-Host "Backup script not found at: $scriptPath" -ForegroundColor Red
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check if the Docker check script exists
|
# Check if the Docker check script exists
|
||||||
if (-not (Test-Path $dockerCheckScript)) {
|
if (-not (Test-Path $dockerCheckScript)) {
|
||||||
Write-Host "Docker check script not found at: $dockerCheckScript" -ForegroundColor Red
|
Write-Host "Docker check script not found at: $dockerCheckScript" -ForegroundColor Red
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
# Create a batch script that runs both scripts
|
# Create a batch script that runs both scripts
|
||||||
$batchScriptPath = Join-Path $workingDir "run-backup.ps1"
|
$batchScriptPath = Join-Path $workingDir "run-backup.ps1"
|
||||||
@"
|
@"
|
||||||
# This script is automatically generated - do not edit manually
|
# This script is automatically generated - do not edit manually
|
||||||
# It runs the Docker check script followed by the backup script
|
# It runs the Docker check script followed by the backup script
|
||||||
|
|
||||||
# Get the script directory
|
# Get the script directory
|
||||||
`$scriptDir = Split-Path -Parent `$MyInvocation.MyCommand.Path
|
`$scriptDir = Split-Path -Parent `$MyInvocation.MyCommand.Path
|
||||||
|
|
||||||
# Run the Docker check script first
|
# Run the Docker check script first
|
||||||
`$dockerCheckScript = Join-Path `$scriptDir "ensure-docker-running.ps1"
|
`$dockerCheckScript = Join-Path `$scriptDir "ensure-docker-running.ps1"
|
||||||
& `$dockerCheckScript
|
& `$dockerCheckScript
|
||||||
|
|
||||||
# Then run the backup script
|
# Then run the backup script
|
||||||
`$backupScript = Join-Path `$scriptDir "backup-gitea-db.ps1"
|
`$backupScript = Join-Path `$scriptDir "backup-gitea-db.ps1"
|
||||||
& `$backupScript
|
& `$backupScript
|
||||||
"@ | Out-File -FilePath $batchScriptPath -Encoding utf8
|
"@ | Out-File -FilePath $batchScriptPath -Encoding utf8
|
||||||
|
|
||||||
# Create a scheduled task to run daily at 3 AM
|
# Create a scheduled task to run daily at 3 AM
|
||||||
$action = New-ScheduledTaskAction -Execute "PowerShell.exe" -Argument "-NoProfile -ExecutionPolicy Bypass -File `"$batchScriptPath`"" -WorkingDirectory "$workingDir"
|
$action = New-ScheduledTaskAction -Execute "PowerShell.exe" -Argument "-NoProfile -ExecutionPolicy Bypass -File `"$batchScriptPath`"" -WorkingDirectory "$workingDir"
|
||||||
$trigger = New-ScheduledTaskTrigger -Daily -At 3AM
|
$trigger = New-ScheduledTaskTrigger -Daily -At 3AM
|
||||||
$settings = New-ScheduledTaskSettingsSet -StartWhenAvailable -DontStopOnIdleEnd -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries
|
$settings = New-ScheduledTaskSettingsSet -StartWhenAvailable -DontStopOnIdleEnd -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries
|
||||||
|
|
||||||
# Create a principal that runs with highest privileges
|
# Create a principal that runs with highest privileges
|
||||||
$principal = New-ScheduledTaskPrincipal -UserId "NT AUTHORITY\SYSTEM" -LogonType ServiceAccount -RunLevel Highest
|
$principal = New-ScheduledTaskPrincipal -UserId "NT AUTHORITY\SYSTEM" -LogonType ServiceAccount -RunLevel Highest
|
||||||
|
|
||||||
# Register the scheduled task
|
# Register the scheduled task
|
||||||
$taskExists = Get-ScheduledTask -TaskName $taskName -ErrorAction SilentlyContinue
|
$taskExists = Get-ScheduledTask -TaskName $taskName -ErrorAction SilentlyContinue
|
||||||
|
|
||||||
if ($taskExists) {
|
if ($taskExists) {
|
||||||
Write-Host "Task '$taskName' already exists. Updating..." -ForegroundColor Yellow
|
Write-Host "Task '$taskName' already exists. Updating..." -ForegroundColor Yellow
|
||||||
# Get the existing task
|
# Get the existing task
|
||||||
$task = Get-ScheduledTask -TaskName $taskName
|
$task = Get-ScheduledTask -TaskName $taskName
|
||||||
# Update the task properties
|
# Update the task properties
|
||||||
$task.Actions = $action
|
$task.Actions = $action
|
||||||
$task.Triggers = $trigger
|
$task.Triggers = $trigger
|
||||||
$task.Settings = $settings
|
$task.Settings = $settings
|
||||||
$task.Principal = $principal
|
$task.Principal = $principal
|
||||||
$task.Description = $taskDescription
|
$task.Description = $taskDescription
|
||||||
# Save the updated task
|
# Save the updated task
|
||||||
Set-ScheduledTask -InputObject $task
|
Set-ScheduledTask -InputObject $task
|
||||||
} else {
|
} else {
|
||||||
Write-Host "Creating new scheduled task '$taskName'..." -ForegroundColor Green
|
Write-Host "Creating new scheduled task '$taskName'..." -ForegroundColor Green
|
||||||
Register-ScheduledTask -TaskName $taskName -Action $action -Trigger $trigger -Settings $settings -Description $taskDescription -Principal $principal
|
Register-ScheduledTask -TaskName $taskName -Action $action -Trigger $trigger -Settings $settings -Description $taskDescription -Principal $principal
|
||||||
}
|
}
|
||||||
|
|
||||||
Write-Host "Scheduled task setup complete. The database will be backed up daily at 3 AM." -ForegroundColor Green
|
Write-Host "Scheduled task setup complete. The database will be backed up daily at 3 AM." -ForegroundColor Green
|
||||||
Write-Host "Backup files will be stored in the 'backups' folder in your Gitea Docker directory." -ForegroundColor Green
|
Write-Host "Backup files will be stored in the 'backups' folder in your Gitea Docker directory." -ForegroundColor Green
|
||||||
Reference in New Issue
Block a user