docker operations

This commit is contained in:
Florian Baumann 2022-01-03 12:16:56 +01:00
parent f408381266
commit 7bfd73f505
5 changed files with 29 additions and 4 deletions

7
.gitignore vendored
View File

@ -1,3 +1,6 @@
./archivar ./serra
inventory/ _db/*
!_db/.placeholder
_backup/*
!_backup/.placeholder
dist/ dist/

0
_backup/.placeholder Normal file
View File

0
_db/.placeholder Normal file
View File

View File

@ -10,8 +10,21 @@ services:
MONGO_INITDB_ROOT_USERNAME: root MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: root MONGO_INITDB_ROOT_PASSWORD: root
volumes: volumes:
- mongodb:/data/db - 'mongodb:/data/db'
- 'mongodbbackup:/backup'
volumes: volumes:
mongodb: mongodb:
driver: local
driver_opts:
type: none
device: "$PWD/_db"
o: bind
mongodbbackup:
driver: local
driver_opts:
type: none
device: "$PWD/_backup"
o: bind

View File

@ -9,7 +9,6 @@
mvp mvp
* refactor storage to have a storage object.
* single view for card, with history * single view for card, with history
* docker with local mounted volume and git ignore * docker with local mounted volume and git ignore
* mongodb backup container * mongodb backup container
@ -29,3 +28,13 @@ optional
Find cards that increased prices Find cards that increased prices
db.cards.find({$expr: {$gt: [{$arrayElemAt: ["$serra_prices", -2]}, {$arrayElemAt: ["$serra_prices", -1]}]}}, {name:1}) db.cards.find({$expr: {$gt: [{$arrayElemAt: ["$serra_prices", -2]}, {$arrayElemAt: ["$serra_prices", -1]}]}}, {name:1})
# MongoDB Operations
Do a database dump
mongodump -u root -p root --authenticationDatabase admin -d serra -o /backup/
Do a collection export to json
mongoexport -u root -p root --authenticationDatabase admin -d serra -c cards