Compare commits
10 Commits
v0.1.3
...
2fa5bdfa7f
| Author | SHA1 | Date | |
|---|---|---|---|
| 2fa5bdfa7f | |||
| 846485b2e5 | |||
| 9267c98156 | |||
| 9d691c5ff6 | |||
| 0c7dffa047 | |||
| aec2f05b00 | |||
| 3d856909c6 | |||
| eb740236d7 | |||
| a2a23a8393 | |||
| 4a78aabfdb |
@@ -1,72 +0,0 @@
|
|||||||
name: Build and Push Docker Image
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
tags:
|
|
||||||
- "v*"
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: prodesk
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
|
|
||||||
- name: Log in to Gitea Docker Registry
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
registry: gitea.calahilstudios.com
|
|
||||||
username: ${{ secrets.REGISTRY_USER }}
|
|
||||||
password: ${{ secrets.REGISTRY_TOKEN }}
|
|
||||||
|
|
||||||
- name: Log in to Docker Hub
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Gitea metadata
|
|
||||||
id: meta-gitea
|
|
||||||
uses: docker/metadata-action@v5
|
|
||||||
with:
|
|
||||||
images: gitea.calahilstudios.com/calahilstudios/${{ github.event.repository.name }}
|
|
||||||
tags: |
|
|
||||||
type=ref,event=branch
|
|
||||||
type=semver,pattern={{version}}
|
|
||||||
type=sha
|
|
||||||
type=raw,value=latest,enable={{is_default_branch}}
|
|
||||||
|
|
||||||
- name: Docker Hub metadata
|
|
||||||
id: meta-dockerhub
|
|
||||||
uses: docker/metadata-action@v5
|
|
||||||
with:
|
|
||||||
images: ${{ secrets.DOCKERHUB_USERNAME }}/${{ github.event.repository.name }}
|
|
||||||
tags: |
|
|
||||||
type=ref,event=branch
|
|
||||||
type=semver,pattern={{version}}
|
|
||||||
type=semver,pattern={{major}}.{{minor}}
|
|
||||||
type=sha
|
|
||||||
type=raw,value=latest,enable={{is_default_branch}}
|
|
||||||
|
|
||||||
- name: Build and push to Gitea
|
|
||||||
uses: docker/build-push-action@v6
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
file: ./Dockerfile
|
|
||||||
push: true
|
|
||||||
tags: ${{ steps.meta-gitea.outputs.tags }}
|
|
||||||
labels: ${{ steps.meta-gitea.outputs.labels }}
|
|
||||||
|
|
||||||
- name: Build and push to Docker Hub
|
|
||||||
uses: docker/build-push-action@v6
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
file: ./Dockerfile
|
|
||||||
push: true
|
|
||||||
tags: ${{ steps.meta-dockerhub.outputs.tags }}
|
|
||||||
labels: ${{ steps.meta-dockerhub.outputs.labels }}
|
|
||||||
77
.github/workflows/build.yml
vendored
Normal file
77
.github/workflows/build.yml
vendored
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
name: Build and Push Docker Image
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
tags:
|
||||||
|
- "v*"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
# 🧠 Login to Docker Hub
|
||||||
|
- name: Login to Docker Hub
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: docker.io
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
|
# 🧠 Login to GitHub Container Registry
|
||||||
|
- name: Login to GHCR
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
# 🧠 Login to Gitea
|
||||||
|
- name: Login to Gitea
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: gitea.calahilstudios.com
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITEA_TOKEN }}
|
||||||
|
|
||||||
|
- name: Docker metadata
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v5
|
||||||
|
with:
|
||||||
|
images: |
|
||||||
|
ghcr.io/${{ github.repository }}
|
||||||
|
gitea.calahilstudios.com/${{ github.repository }}
|
||||||
|
${{ github.repository }}
|
||||||
|
tags: |
|
||||||
|
# Always include short SHA
|
||||||
|
type=sha,format=short
|
||||||
|
|
||||||
|
# Include latest if on default branch (usually 'main' or 'develop')
|
||||||
|
type=raw,value=latest,enable={{is_default_branch}}
|
||||||
|
|
||||||
|
# If this is a semver tag (vX.X.X), add full + minor version tags
|
||||||
|
type=semver,pattern={{version}}
|
||||||
|
type=semver,pattern={{major}}.{{minor}}
|
||||||
|
|
||||||
|
- name: Debug GitHub context
|
||||||
|
run: |
|
||||||
|
echo "Tags: ${{ steps.meta.outputs.tags }}"
|
||||||
|
echo "Labels: ${{ steps.meta.outputs.labels }}"
|
||||||
|
|
||||||
|
- name: Build and push
|
||||||
|
uses: docker/build-push-action@v6
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: ./Dockerfile
|
||||||
|
push: true
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
cache-from: type=gha
|
||||||
|
cache-to: type=gha,mode=max
|
||||||
61
README.md
61
README.md
@@ -3,10 +3,8 @@
|
|||||||
|
|
||||||

|

|
||||||

|

|
||||||
|
|
||||||

|

|
||||||
|

|
||||||

|
|
||||||

|

|
||||||
|
|
||||||
|
|
||||||
@@ -47,19 +45,12 @@ BackupBot is a comprehensive backup solution that automatically discovers and ba
|
|||||||
cd backupbot
|
cd backupbot
|
||||||
```
|
```
|
||||||
|
|
||||||
2. **Create environment file:**
|
2. **Start the container:**
|
||||||
```bash
|
|
||||||
cp .env.example .env
|
|
||||||
# Edit .env with your settings
|
|
||||||
nano .env
|
|
||||||
```
|
|
||||||
|
|
||||||
3. **Start the container:**
|
|
||||||
```bash
|
```bash
|
||||||
docker-compose up -d
|
docker-compose up -d
|
||||||
```
|
```
|
||||||
|
|
||||||
4. **Access the interfaces:**
|
3. **Access the interfaces:**
|
||||||
- BackupBot Config: http://localhost:8201
|
- BackupBot Config: http://localhost:8201
|
||||||
- Duplicati Web UI: http://localhost:8200
|
- Duplicati Web UI: http://localhost:8200
|
||||||
|
|
||||||
@@ -69,8 +60,6 @@ BackupBot is a comprehensive backup solution that automatically discovers and ba
|
|||||||
|
|
||||||
### Environment Variables
|
### Environment Variables
|
||||||
|
|
||||||
Create a `.env` file in the project root:
|
|
||||||
|
|
||||||
```env
|
```env
|
||||||
# Duplicati encryption key (required)
|
# Duplicati encryption key (required)
|
||||||
KEY=your_encryption_key_here
|
KEY=your_encryption_key_here
|
||||||
@@ -121,16 +110,16 @@ Additional patterns can be added by modifying the `KNOWN_IMAGES` list in `backup
|
|||||||
```yaml
|
```yaml
|
||||||
volumes:
|
volumes:
|
||||||
# Duplicati configuration
|
# Duplicati configuration
|
||||||
- /srv/appdata/duplicati/config:/config
|
- /path/to/duplicati/config:/config
|
||||||
|
|
||||||
# Backup storage (where dumps are stored)
|
# Backup storage (where dumps are stored)
|
||||||
- /srv/backups:/backups:rshared
|
- /path/to/backups:/backups:rshared
|
||||||
|
|
||||||
# Docker socket (for container discovery)
|
# Docker socket (for container discovery)
|
||||||
- /var/run/docker.sock:/var/run/docker.sock:ro
|
- /var/run/docker.sock:/var/run/docker.sock:ro
|
||||||
|
|
||||||
# Source data for snapshots (optional)
|
# Source data for snapshots (optional)
|
||||||
- /srv/appdata:/source/appdata:ro
|
- /path/to/appdata:/source:ro
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -158,12 +147,12 @@ docker logs -f backupbot
|
|||||||
Backups are organized by container name:
|
Backups are organized by container name:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
ls -lh /srv/backups/postgres_dumps/
|
ls -lh /backups/postgres_dumps/
|
||||||
```
|
```
|
||||||
|
|
||||||
Example structure:
|
Example structure:
|
||||||
```
|
```
|
||||||
/srv/backups/
|
/backups/
|
||||||
├── postgres_dumps/
|
├── postgres_dumps/
|
||||||
│ ├── myapp_db/
|
│ ├── myapp_db/
|
||||||
│ │ ├── 2024-10-23_03-00-00.sql
|
│ │ ├── 2024-10-23_03-00-00.sql
|
||||||
@@ -182,7 +171,7 @@ Example structure:
|
|||||||
1. **Discovery Phase**: BackupBot scans running Docker containers and identifies PostgreSQL instances
|
1. **Discovery Phase**: BackupBot scans running Docker containers and identifies PostgreSQL instances
|
||||||
2. **Extraction**: For each database, credentials are extracted from environment variables
|
2. **Extraction**: For each database, credentials are extracted from environment variables
|
||||||
3. **Backup**: `pg_dumpall` creates a complete SQL dump of all databases
|
3. **Backup**: `pg_dumpall` creates a complete SQL dump of all databases
|
||||||
4. **Snapshot**: A read-only btrfs snapshot is created of `/srv/appdata`
|
4. **Snapshot**: A read-only btrfs snapshot is created of `/source`
|
||||||
5. **Retention**: Old backups exceeding the retention period are automatically deleted
|
5. **Retention**: Old backups exceeding the retention period are automatically deleted
|
||||||
6. **Notification**: On failure after retries, Gotify notifications are sent (if configured)
|
6. **Notification**: On failure after retries, Gotify notifications are sent (if configured)
|
||||||
|
|
||||||
@@ -204,24 +193,6 @@ Example structure:
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 🛠️ Development
|
|
||||||
|
|
||||||
### Building from Source
|
|
||||||
|
|
||||||
```bash
|
|
||||||
docker build -t backupbot:latest .
|
|
||||||
```
|
|
||||||
|
|
||||||
### CI/CD Pipeline
|
|
||||||
|
|
||||||
BackupBot uses Gitea Actions for automated builds:
|
|
||||||
|
|
||||||
- **Trigger**: Push to `main` or `develop` branches
|
|
||||||
- **Registry**: `gitea.calahilstudios.com`
|
|
||||||
- **Tags**: `develop` and commit SHA
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 📊 Monitoring
|
## 📊 Monitoring
|
||||||
|
|
||||||
### Web Interfaces
|
### Web Interfaces
|
||||||
@@ -253,7 +224,7 @@ Contributions are welcome! Please feel free to submit a Pull Request.
|
|||||||
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
|
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
|
||||||
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
|
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
|
||||||
4. Push to the branch (`git push origin feature/amazing-feature`)
|
4. Push to the branch (`git push origin feature/amazing-feature`)
|
||||||
5. Open a Pull Request on Gitea
|
5. Open a Pull Request on Github
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -261,12 +232,6 @@ Contributions are welcome! Please feel free to submit a Pull Request.
|
|||||||
|
|
||||||
This project is licensed under the GNU Affero General Public License v3.0 - see the [LICENSE](LICENSE) file for details.
|
This project is licensed under the GNU Affero General Public License v3.0 - see the [LICENSE](LICENSE) file for details.
|
||||||
|
|
||||||
**AGPL-3.0 Key Points:**
|
|
||||||
- ✅ Free to use, modify, and distribute
|
|
||||||
- ✅ Source code must be made available
|
|
||||||
- ✅ Network use is considered distribution
|
|
||||||
- ✅ Modifications must also be AGPL-3.0
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 🙏 Acknowledgments
|
## 🙏 Acknowledgments
|
||||||
@@ -279,7 +244,7 @@ This project is licensed under the GNU Affero General Public License v3.0 - see
|
|||||||
|
|
||||||
## 📞 Support
|
## 📞 Support
|
||||||
|
|
||||||
- 🐛 **Issues**: [Report bugs on Gitea](https://gitea.calahilstudios.com/owner/backupbot/issues)
|
- 🐛 **Issues**: [Report bugs on Github](https://github.com/calahil/backupbot/issues)
|
||||||
- 📚 **Documentation**: This README and inline code comments
|
- 📚 **Documentation**: This README and inline code comments
|
||||||
- 💬 **Discussions**: Open an issue for questions
|
- 💬 **Discussions**: Open an issue for questions
|
||||||
|
|
||||||
@@ -297,6 +262,4 @@ This project is licensed under the GNU Affero General Public License v3.0 - see
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
**Made with ❤️ by Calahil Studios**
|
**Made by Calahil Studios**
|
||||||
|
|
||||||
[](https://gitea.calahilstudios.com)
|
|
||||||
|
|||||||
Reference in New Issue
Block a user