Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
ba1c39b
feat(daemon): added daemon loop and schedules loading
Nonolanlan1007 Jan 26, 2026
920824d
feat(db): added return value to DatabaseConnection.connect()
Nonolanlan1007 Jan 26, 2026
bbc25d6
refactor(config)!: added database_name field to backup config
Nonolanlan1007 Jan 26, 2026
caf0382
feat(config): added default value to ignore_collections properties to…
Nonolanlan1007 Jan 28, 2026
ed50eeb
feat(datastore): added open_write_stream function
Nonolanlan1007 Jan 29, 2026
c57bafa
refactor(datastores): removed useless `mut`
Nonolanlan1007 Jan 29, 2026
99500b4
feat(daemon): added collection backups
Nonolanlan1007 Jan 30, 2026
09969b8
fix(daemon): fixed json output from backup_collection function
Nonolanlan1007 Jan 31, 2026
ae6f5d8
fix(daemon): fixed typo error in log message
Nonolanlan1007 Jan 31, 2026
b93b873
feat(datastores): added get_object_hash function
Nonolanlan1007 Jan 31, 2026
684f7db
fix(datastores): fixed regex in list_objects method
Nonolanlan1007 Jan 31, 2026
f2e5865
feat(daemon): added collections hash support
Nonolanlan1007 Jan 31, 2026
aec64d1
refactor(daemon): removed useless brackets from Daemon structure decl…
Nonolanlan1007 Jan 31, 2026
fc6ee21
refactor(daemon): updated imports
Nonolanlan1007 Feb 8, 2026
2f25eb4
feat(cli): added `mbm backup start` command
Nonolanlan1007 Feb 8, 2026
c5bf467
refactor(daemon): removed useless println!()
Nonolanlan1007 Feb 8, 2026
d5d61fc
refactor(cli): updated imports
Nonolanlan1007 Feb 8, 2026
0318322
fix(daemon): fixed file names in .database.json
Nonolanlan1007 Feb 8, 2026
51d537a
refactor(config): made schedule property optional
Nonolanlan1007 Feb 8, 2026
40a52f2
fix(cli): fixed `mbm backup start` command
Nonolanlan1007 Feb 8, 2026
4754e44
feat(ci): added backup test to CI
Nonolanlan1007 Feb 8, 2026
6799a43
refactor(daemon): optimised .unwrap() usage
Nonolanlan1007 Feb 8, 2026
616d4e3
refactor(datastores): reordered imports
Nonolanlan1007 Feb 8, 2026
e0629f9
refactor(datastores): removed unused imports
Nonolanlan1007 Feb 8, 2026
3d088a5
refactor(ci): renamed CI step
Nonolanlan1007 Feb 8, 2026
ec6ed72
fix(datastores): fixed fs_datastore_list_unknown_objects test
Nonolanlan1007 Feb 8, 2026
e135389
chore: ignored unused warnings
Nonolanlan1007 Feb 8, 2026
bc3939b
chore: temporary removed crypto.rs file
Nonolanlan1007 Feb 8, 2026
e170388
fix(ci): fixed binary path
Nonolanlan1007 Feb 8, 2026
fa00003
fix(ci): added mongosh install step
Nonolanlan1007 Feb 8, 2026
0f03ff1
fix(ci): added mongosh install step
Nonolanlan1007 Feb 8, 2026
50af8fc
fix(ci): fixed artifact download
Nonolanlan1007 Feb 8, 2026
0173dc8
fix(ci): fixed artifact download
Nonolanlan1007 Feb 8, 2026
0b16dda
fix(ci): fixed artifact download
Nonolanlan1007 Feb 8, 2026
327b023
fix(ci): fixed artifact download
Nonolanlan1007 Feb 8, 2026
6757e14
fix(ci): fixed binary permissions
Nonolanlan1007 Feb 8, 2026
2688bdf
fix(ci): added debug cats
Nonolanlan1007 Feb 8, 2026
4926dd6
fix(ci): added debug cats
Nonolanlan1007 Feb 8, 2026
36fe172
fix(ci): added missing deps
Nonolanlan1007 Feb 8, 2026
72218da
fix(ci): added debug upload
Nonolanlan1007 Feb 8, 2026
e06f214
fix(ci): added debug ls
Nonolanlan1007 Feb 8, 2026
38cc7cc
fix(ci): added debug sha256sum
Nonolanlan1007 Feb 8, 2026
71e9741
fix(ci): fixed CI
Nonolanlan1007 Feb 8, 2026
8f96a45
fix(ci): fixed CI
Nonolanlan1007 Feb 8, 2026
dc4664e
fix(ci): updated sha
Nonolanlan1007 Feb 8, 2026
1e01dad
fix(ci): fixed CI
Nonolanlan1007 Feb 8, 2026
3e8b638
refactor(cli): enhanced variable declaration in `backup start` command
Nonolanlan1007 Feb 9, 2026
1059eb4
refactor: removed useless `pub`
Nonolanlan1007 Feb 9, 2026
7f881cd
fix(daemon): various fixes and enhancements
Nonolanlan1007 Feb 9, 2026
7adcb7b
fix(daemon): fix backup error handling
Nonolanlan1007 Feb 9, 2026
59ab0f2
fix(daemon): fix next cron run error handling
Nonolanlan1007 Feb 9, 2026
a61e116
refactor(daemon): changed Datastore::new() definition
Nonolanlan1007 Feb 9, 2026
722d7de
refactor(datastores): fixed imports in filesystem datastore
Nonolanlan1007 Feb 10, 2026
7b4bb0e
chore(deps): removed unused deps
Nonolanlan1007 Feb 10, 2026
e95cdb6
fix(ci): fixed CI
Nonolanlan1007 Feb 10, 2026
7e11175
refactor: fixed clippy errors
Nonolanlan1007 Feb 10, 2026
23b29d4
fix(ci): updated sha in CI
Nonolanlan1007 Feb 10, 2026
9fd3eb1
refactor: fixed clippy errors
Nonolanlan1007 Feb 10, 2026
5560c2b
refactor(datastores): fixed typo in error message
Nonolanlan1007 Feb 10, 2026
11c9dbb
fix(config): prevent duplicate backup ids and display names
ValDesign22 Feb 11, 2026
5000ab4
refactor(datastores): fixed imports
Nonolanlan1007 Feb 11, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .github/ci_database_seed.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
const dbName = 'example';
const db = db.getSiblingDB(dbName);

db.createCollection("telemetry", {
timeseries: {
timeField: "timestamp",
metaField: "sensorId",
granularity: "seconds"
}
});

db.createCollection("users", {
validator: {
$jsonSchema: {
bsonType: "object",
required: ["email", "status"],
properties: {
email: {bsonType: "string", pattern: "@"},
status: {enum: ["active", "inactive"]}
}
}
}
});
db.users.createIndex({email: 1}, {unique: true});

const batchSize = 10000;

const telemetryDocs = [];
for (let i = 0; i < batchSize; i++) {
telemetryDocs.push({
_id: ObjectId(i.toString(16).padStart(24, '0')),
timestamp: new Date('2026-01-01T00:00:00Z'),
sensorId: `sensor_${i}`,
value: i * 100
});
}
db.telemetry.insertMany(telemetryDocs);

const userDocs = [];
for (let i = 0; i < batchSize; i++) {
userDocs.push({
_id: ObjectId(i.toString(16).padStart(24, '0')),
email: `user_${i}@example.com`,
status: (i / 2) !== 0 ? "active" : "inactive",
metadata: {
loginCount: i,
lastSeen: new Date('2026-01-01T00:00:00Z')
}
});
}
db.users.insertMany(userDocs);
67 changes: 63 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: CI

on:
pull_request:
types: [opened, reopened, synchronize, ready_for_review]
types: [ opened, reopened, synchronize, ready_for_review ]
workflow_dispatch:

concurrency:
Expand Down Expand Up @@ -46,18 +46,23 @@ jobs:
env:
RUSTFLAGS: "-Dwarnings"

cargo_check:
cargo_build:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install rust stable toolchain
run: rustup update stable && rustup default stable
- uses: Swatinem/rust-cache@v2
- name: Run Cargo Check
run: cargo check
- name: Run Cargo Build
run: cargo build --release
env:
RUSTFLAGS: "-Dwarnings"
- uses: actions/upload-artifact@v6
with:
path: ./target/release/mbm
name: mbm_linux_x64
if-no-files-found: error

cargo_tests:
if: github.event.pull_request.draft == false
Expand All @@ -69,3 +74,57 @@ jobs:
- uses: Swatinem/rust-cache@v2
- name: Run Cargo Test
run: cargo test

backup_test:
needs: cargo_build
runs-on: ubuntu-latest
strategy:
matrix:
mongodb-version: [ '7.0', '8.0' ]
steps:
- uses: actions/checkout@v3
with:
sparse-checkout: .github

- uses: actions/download-artifact@v6
with:
path: .
name: mbm_linux_x64

- name: Start MongoDB
uses: supercharge/mongodb-github-action@1.12.1
with:
mongodb-version: ${{ matrix.mongodb-version }}
mongodb-username: mbm
mongodb-password: example
mongodb-db: example

- name: Install mongosh
run: |
sudo apt-get install gnupg
wget -qO- https://www.mongodb.org/static/pgp/server-8.0.asc | sudo tee /etc/apt/trusted.gpg.d/server-8.0.asc
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu noble/mongodb-org/8.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-8.0.list
sudo apt-get update
sudo apt-get install -y mongodb-mongosh coreutils
mongosh --version

- name: Seed Database
run: mongosh "mongodb://mbm:example@localhost:27017/example?authSource=admin" ./.github/ci_database_seed.js

- name: Create config
run: curl https://gist.githubusercontent.com/Nonolanlan1007/5af44878616e516abe253c18f62f2f6b/raw/0d862738749a19d3ef80b56faf89d5cf912f95e9/mbm_ci_test_config.toml > config.toml

- name: Run Backup
env:
CONFIG_FILE: ./config.toml
run: |
chmod a+x ./mbm
./mbm backup start test

- name: Check backup files
run: |
mv ./backups/**/*.json ./
sha256sum ./*.json
echo "a4055f4f744fdbd60d61709a3b180e61f1bfad2e07dfc388725bc21c93a1734c ./telemetry.json" > checksum.txt
echo "3b9e5af8209f86618eb148a11ee0cd2a8ba32452c8b6e1eadbfb9c2e686967d0 ./users.json" >> checksum.txt
sha256sum --check checksum.txt
Loading