Skip to content

Commit 39c9ffa

Browse files
committed
chore: add CHANGELOG and update configuration references
- Introduced CHANGELOG.md to document notable changes and versioning. - Updated configuration file references from `.db-backup.yaml` to `.dbu.yaml` across various files. - Renamed Docker container names and binary from `db-backup` to `dbu` for consistency. - Enhanced documentation to reflect the new naming conventions and usage examples.
1 parent de3c7e6 commit 39c9ffa

26 files changed

+604
-221
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ jobs:
134134
release:
135135
runs-on: ubuntu-latest
136136
needs: [test, build]
137-
if: github.ref == 'refs/heads/main' && startsWith(github.ref, 'refs/tags/')
137+
if: startsWith(github.ref, 'refs/tags/')
138138

139139
steps:
140140
- uses: actions/checkout@v4

CHANGELOG.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [Unreleased]
9+
10+
### Added
11+
12+
- Initial release of database backup utility
13+
- Support for MySQL, PostgreSQL, MongoDB, and SQLite databases
14+
- Full, incremental, and differential backup types
15+
- Local and cloud storage options (AWS S3, Google Cloud Storage, Azure Blob Storage)
16+
- Compression support with gzip
17+
- Slack and Discord notifications
18+
- Comprehensive CLI interface with Cobra
19+
- Configuration management with Viper
20+
- Structured logging with Logrus
21+
- Cross-platform builds (Linux, macOS, Windows)
22+
- GitHub Actions CI/CD pipeline
23+
- Comprehensive documentation
24+
25+
### Features
26+
27+
- **Database Support**: MySQL, PostgreSQL, MongoDB, SQLite
28+
- **Backup Types**: Full, incremental, differential
29+
- **Storage**: Local filesystem, AWS S3, Google Cloud Storage, Azure Blob Storage
30+
- **Compression**: Built-in gzip compression
31+
- **Notifications**: Slack and Discord webhook support
32+
- **CLI**: Full command-line interface with subcommands
33+
- **Configuration**: YAML configuration file support
34+
- **Logging**: Structured logging with multiple levels and formats
35+
- **Cross-Platform**: Native binaries for Linux, macOS, and Windows
36+
37+
### Technical Details
38+
39+
- Built with Go 1.21+
40+
- Uses Cobra for CLI framework
41+
- Uses Viper for configuration management
42+
- Uses Logrus for structured logging
43+
- Uses official database drivers for each supported database
44+
- Docker support with multi-stage builds
45+
- GitHub Actions for automated testing and releases
46+
47+
## [v0.1.0] - 2024-09-03
48+
49+
### Added
50+
51+
- Initial release
52+
- Basic backup and restore functionality
53+
- Database connection testing
54+
- Configuration file support
55+
- Basic logging
56+
- Cross-platform builds
57+
58+
---
59+
60+
## Release Process
61+
62+
### Creating a New Release
63+
64+
1. Update this CHANGELOG.md with the new version
65+
2. Update version in relevant files if needed
66+
3. Create a Git tag: `git tag -a v1.0.0 -m "Release v1.0.0"`
67+
4. Push the tag: `git push origin v1.0.0`
68+
5. GitHub Actions will automatically create a release with binaries
69+
70+
### Version Format
71+
72+
- **v0.x.x** - Development releases
73+
- **v1.x.x** - Stable releases
74+
- **v1.0.0** - First stable release
75+
76+
### Breaking Changes
77+
78+
Breaking changes will be clearly marked in the changelog and will result in a major version bump.

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ RUN adduser -D -s /bin/sh dbbackup
3737
WORKDIR /app
3838

3939
# Copy binary from builder stage
40-
COPY --from=builder /app/build/db-backup /usr/local/bin/db-backup
40+
COPY --from=builder /app/build/dbu /usr/local/bin/dbu
4141

4242
# Create backup directory
4343
RUN mkdir -p /backups && chown dbbackup:dbbackup /backups
@@ -54,7 +54,7 @@ ENV LOG_FORMAT=json
5454
VOLUME ["/backups"]
5555

5656
# Set entrypoint
57-
ENTRYPOINT ["db-backup"]
57+
ENTRYPOINT ["dbu"]
5858

5959
# Default command
6060
CMD ["--help"]

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Database Backup Utility Makefile
22

33
# Variables
4-
BINARY_NAME=db-backup
4+
BINARY_NAME=dbu
55
BUILD_DIR=build
66
VERSION=$(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
77
LDFLAGS=-ldflags "-X main.version=$(VERSION)"

README.md

Lines changed: 55 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,41 @@ A comprehensive command-line interface (CLI) utility for backing up and restorin
1515

1616
## Installation
1717

18+
### Download Pre-built Binaries (Recommended)
19+
20+
Download the latest release for your platform:
21+
22+
**Linux (AMD64):**
23+
24+
```bash
25+
curl -L -o dbu https://github.com/ibrahimraimi/database-backup-utility/releases/latest/download/dbu-linux-amd64
26+
chmod +x dbu
27+
sudo mv dbu /usr/local/bin/
28+
```
29+
30+
**macOS (Intel):**
31+
32+
```bash
33+
curl -L -o dbu https://github.com/ibrahimraimi/database-backup-utility/releases/latest/download/dbu-darwin-amd64
34+
chmod +x dbu
35+
sudo mv dbu /usr/local/bin/
36+
```
37+
38+
**macOS (Apple Silicon):**
39+
40+
```bash
41+
curl -L -o dbu https://github.com/ibrahimraimi/database-backup-utility/releases/latest/download/dbu-darwin-arm64
42+
chmod +x dbu
43+
sudo mv dbu /usr/local/bin/
44+
```
45+
46+
**Windows (AMD64):**
47+
48+
```powershell
49+
# Download using PowerShell
50+
Invoke-WebRequest -Uri "https://github.com/ibrahimraimi/database-backup-utility/releases/latest/download/dbu-windows-amd64.exe" -OutFile "dbu.exe"
51+
```
52+
1853
### From Source
1954

2055
```bash
@@ -35,62 +70,64 @@ make build-all
3570
go install github.com/ibrahimraimi/database-backup-utility@latest
3671
```
3772

73+
> **Note:** For detailed download instructions and release information, see the [Releases Documentation](docs/releases.md).
74+
3875
## Quick Start
3976

4077
### Test Database Connection
4178

4279
```bash
4380
# Test MySQL connection
44-
./db-backup test --db-type mysql --host localhost --port 3306 --username root --password mypassword --database mydb
81+
./dbu test --db-type mysql --host localhost --port 3306 --username root --password mypassword --database mydb
4582

4683
# Test PostgreSQL connection
47-
./db-backup test --db-type postgres --host localhost --port 5432 --username postgres --password mypassword --database mydb
84+
./dbu test --db-type postgres --host localhost --port 5432 --username postgres --password mypassword --database mydb
4885

4986
# Test MongoDB connection
50-
./db-backup test --db-type mongodb --host localhost --port 27017 --username admin --password mypassword --database mydb
87+
./dbu test --db-type mongodb --host localhost --port 27017 --username admin --password mypassword --database mydb
5188

5289
# Test SQLite connection
53-
./db-backup test --db-type sqlite --database /path/to/database.db
90+
./dbu test --db-type sqlite --database /path/to/database.db
5491
```
5592

5693
### Create a Backup
5794

5895
```bash
5996
# MySQL backup
60-
./db-backup backup --db-type mysql --host localhost --username root --password mypassword --database mydb --type full --compress
97+
./dbu backup --db-type mysql --host localhost --username root --password mypassword --database mydb --type full --compress
6198

6299
# PostgreSQL backup
63-
./db-backup backup --db-type postgres --host localhost --username postgres --password mypassword --database mydb --type full --compress
100+
./dbu backup --db-type postgres --host localhost --username postgres --password mypassword --database mydb --type full --compress
64101

65102
# MongoDB backup
66-
./db-backup backup --db-type mongodb --host localhost --username admin --password mypassword --database mydb --type full --compress
103+
./dbu backup --db-type mongodb --host localhost --username admin --password mypassword --database mydb --type full --compress
67104

68105
# SQLite backup
69-
./db-backup backup --db-type sqlite --database /path/to/database.db --type full --compress
106+
./dbu backup --db-type sqlite --database /path/to/database.db --type full --compress
70107

71108
# Selective backup (specific tables)
72-
./db-backup backup --db-type mysql --host localhost --username root --password mypassword --database mydb --tables "users,orders,products" --compress
109+
./dbu backup --db-type mysql --host localhost --username root --password mypassword --database mydb --tables "users,orders,products" --compress
73110

74111
# Cloud storage backup
75-
./db-backup backup --db-type mysql --host localhost --username root --password mypassword --database mydb --storage cloud --cloud-provider aws --bucket my-backup-bucket --region us-east-1
112+
./dbu backup --db-type mysql --host localhost --username root --password mypassword --database mydb --storage cloud --cloud-provider aws --bucket my-backup-bucket --region us-east-1
76113
```
77114

78115
### Restore a Backup
79116

80117
```bash
81118
# Restore from local backup
82-
./db-backup restore --db-type mysql --host localhost --username root --password mypassword --database mydb --file ./backups/mysql_mydb_full_2024-01-15_10-30-00.sql.gz
119+
./dbu restore --db-type mysql --host localhost --username root --password mypassword --database mydb --file ./backups/mysql_mydb_full_2024-01-15_10-30-00.sql.gz
83120

84121
# Restore from cloud backup
85-
./db-backup restore --db-type mysql --host localhost --username root --password mypassword --database mydb --file s3://my-backup-bucket/mysql_mydb_full_2024-01-15_10-30-00.sql.gz
122+
./dbu restore --db-type mysql --host localhost --username root --password mypassword --database mydb --file s3://my-backup-bucket/mysql_mydb_full_2024-01-15_10-30-00.sql.gz
86123

87124
# Selective restore (specific tables)
88-
./db-backup restore --db-type mysql --host localhost --username root --password mypassword --database mydb --file ./backups/mysql_mydb_full_2024-01-15_10-30-00.sql.gz --tables "users,orders"
125+
./dbu restore --db-type mysql --host localhost --username root --password mypassword --database mydb --file ./backups/mysql_mydb_full_2024-01-15_10-30-00.sql.gz --tables "users,orders"
89126
```
90127

91128
## Configuration
92129

93-
Create a configuration file at `~/.db-backup.yaml`:
130+
Create a configuration file at `~/.dbu.yaml`:
94131

95132
```yaml
96133
# Logging configuration
@@ -137,7 +174,7 @@ export AZURE_STORAGE_KEY=your_storage_key
137174

138175
### Global Flags
139176

140-
- `--config`: Path to configuration file (default: ~/.db-backup.yaml)
177+
- `--config`: Path to configuration file (default: ~/.dbu.yaml)
141178
- `--log-level`: Log level (debug, info, warn, error)
142179
- `--log-format`: Log format (json, text)
143180

@@ -183,7 +220,7 @@ DB_NAME="mydb"
183220
BACKUP_DIR="/var/backups/db"
184221

185222
# Create backup
186-
./db-backup backup \
223+
./dbu backup \
187224
--db-type mysql \
188225
--host $DB_HOST \
189226
--username $DB_USER \
@@ -195,7 +232,7 @@ BACKUP_DIR="/var/backups/db"
195232
--path $BACKUP_DIR
196233

197234
# Upload to cloud
198-
./db-backup backup \
235+
./dbu backup \
199236
--db-type mysql \
200237
--host $DB_HOST \
201238
--username $DB_USER \
@@ -281,6 +318,7 @@ This project is licensed under the MIT License - see the LICENSE file for detail
281318
Comprehensive documentation is available in the `/docs` directory:
282319

283320
- [Getting Started](docs/getting-started.md) - Quick start guide and installation
321+
- [Releases](docs/releases.md) - Download pre-built binaries and release information
284322
- [MySQL Guide](docs/mysql.md) - Complete MySQL backup and restore guide
285323
- [PostgreSQL Guide](docs/postgresql.md) - Complete PostgreSQL backup and restore guide
286324
- [MongoDB Guide](docs/mongodb.md) - Complete MongoDB backup and restore guide

cmd/root.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ var cfgFile string
1212

1313
// rootCmd represents the base command when called without any subcommands
1414
var rootCmd = &cobra.Command{
15-
Use: "db-backup",
15+
Use: "dbu",
1616
Short: "A database backup utility that can backup and restore any DB",
1717
Long: `A command-line interface (CLI) utility for backing up any type of database.
1818
The utility supports various database management systems (DBMS) such as MySQL,
@@ -30,7 +30,7 @@ func init() {
3030
cobra.OnInitialize(initConfig)
3131

3232
// Global flags
33-
rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.db-backup.yaml)")
33+
rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.dbu.yaml)")
3434
rootCmd.PersistentFlags().String("log-level", "info", "log level (debug, info, warn, error)")
3535
rootCmd.PersistentFlags().String("log-format", "json", "log format (json, text)")
3636

@@ -49,11 +49,11 @@ func initConfig() {
4949
home, err := os.UserHomeDir()
5050
cobra.CheckErr(err)
5151

52-
// Search config in home directory with name ".db-backup" (without extension).
52+
// Search config in home directory with name ".dbu" (without extension).
5353
viper.AddConfigPath(home)
5454
viper.AddConfigPath(".")
5555
viper.SetConfigType("yaml")
56-
viper.SetConfigName(".db-backup")
56+
viper.SetConfigName(".dbu")
5757
}
5858

5959
viper.AutomaticEnv() // read in environment variables that match

config.example.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Database Backup Utility Configuration Example
2-
# Copy this file to ~/.db-backup.yaml and modify as needed
2+
# Copy this file to ~/.dbu.yaml and modify as needed
33

44
# Logging configuration
55
log:

docker-compose.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ services:
44
# Example MySQL database for testing
55
mysql:
66
image: mysql:8.0
7-
container_name: db-backup-mysql
7+
container_name: dbu-mysql
88
environment:
99
MYSQL_ROOT_PASSWORD: password
1010
MYSQL_DATABASE: example_db
@@ -22,7 +22,7 @@ services:
2222
# Example PostgreSQL database for testing
2323
postgres:
2424
image: postgres:15
25-
container_name: db-backup-postgres
25+
container_name: dbu-postgres
2626
environment:
2727
POSTGRES_DB: example_db
2828
POSTGRES_USER: testuser
@@ -40,7 +40,7 @@ services:
4040
# Example MongoDB for testing
4141
mongodb:
4242
image: mongo:7
43-
container_name: db-backup-mongodb
43+
container_name: dbu-mongodb
4444
environment:
4545
MONGO_INITDB_ROOT_USERNAME: admin
4646
MONGO_INITDB_ROOT_PASSWORD: password
@@ -56,9 +56,9 @@ services:
5656
retries: 5
5757

5858
# Database backup utility
59-
db-backup:
59+
dbu:
6060
build: .
61-
container_name: db-backup-utility
61+
container_name: dbu-utility
6262
depends_on:
6363
mysql:
6464
condition: service_healthy
@@ -68,7 +68,7 @@ services:
6868
condition: service_healthy
6969
volumes:
7070
- ./backups:/backups
71-
- ./config.example.yaml:/home/dbbackup/.db-backup.yaml
71+
- ./config.example.yaml:/home/dbbackup/.dbu.yaml
7272
environment:
7373
- BACKUP_DIR=/backups
7474
- LOG_LEVEL=info

docs/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,19 @@ This directory contains comprehensive documentation for using the Database Backu
2020
### Test Database Connection
2121

2222
```bash
23-
./db-backup test --db-type <database_type> --host <host> --username <user> --password <pass> --database <db_name>
23+
./dbu test --db-type <database_type> --host <host> --username <user> --password <pass> --database <db_name>
2424
```
2525

2626
### Create Backup
2727

2828
```bash
29-
./db-backup backup --db-type <database_type> --host <host> --username <user> --password <pass> --database <db_name> --compress
29+
./dbu backup --db-type <database_type> --host <host> --username <user> --password <pass> --database <db_name> --compress
3030
```
3131

3232
### Restore Backup
3333

3434
```bash
35-
./db-backup restore --db-type <database_type> --host <host> --username <user> --password <pass> --database <db_name> --file <backup_file>
35+
./dbu restore --db-type <database_type> --host <host> --username <user> --password <pass> --database <db_name> --file <backup_file>
3636
```
3737

3838
## Supported Database Types

0 commit comments

Comments
 (0)