Skip to content

Commit

Permalink
Remove own mongodb image and use original mongo image directly (#688)
Browse files Browse the repository at this point in the history
  • Loading branch information
mpfeil authored Jan 4, 2023
1 parent 84ec180 commit 2094417
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 23 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,9 @@ dev_run_migration.sh

development.json
userimages*

# exclude everything
dumps/*

# exception to the rule
!dumps/.gitkeep
File renamed without changes.
10 changes: 10 additions & 0 deletions .scripts/mongodb/osem_seed_boxes.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

#!/bin/bash

USER=${OSEM_dbuser:-"admin"}
DATABASE=OSeM-api
PASS=${OSEM_dbuserpass:-"admin"}

echo "Going to restore openSenseMap boxes export"
mongorestore --db OSeM-api --username $USER --password $PASS --authenticationDatabase OSeM-api --gzip --archive=./exports/boxes
echo "Export was restored"
9 changes: 9 additions & 0 deletions .scripts/mongodb/osem_seed_measurements.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

USER=${OSEM_dbuser:-"admin"}
DATABASE=OSeM-api
PASS=${OSEM_dbuserpass:-"admin"}

echo "Going to restore openSenseMap measurements export"
mongorestore --db OSeM-api --username $USER --password $PASS --authenticationDatabase OSeM-api --gzip --archive=./exports/measurements
echo "Export was restored"
7 changes: 3 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,10 @@ To install all dependencies, run

### Starting the project locally

Before starting the development database, create the following network
If you have some MongoDB dumps of `boxes` or `measurements` place them within the `dumps` folder and comment in the
volume mappings within the `docker-compose.yml`. The dumps will be seeded for you.

docker network create api-db-network

Afterwards, start your development database
Start your development database

docker-compose up -d

Expand Down
19 changes: 9 additions & 10 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
version: "3.9"

volumes:
mongo-data:

services:
db:
build:
context: ./images/mongodb
image: mongo:5
container_name: osem-dev-mongo
ports:
- "27017:27017"
volumes:
- mongo-data:/data/db
networks:
- api-db-network

volumes:
mongo-data:
networks:
api-db-network:
external: true
# - ./dumps/boxes:/exports/boxes
# - ./dumps/measurements:/exports/measurements
- ./.scripts/mongodb/osem_admin.sh:/docker-entrypoint-initdb.d/osem_admin.sh
# - ./.scripts/mongodb/osem_seed_boxes.sh:/docker-entrypoint-initdb.d/osem_seed_boxes.sh
# - ./.scripts/mongodb/osem_seed_measurements.sh:/docker-entrypoint-initdb.d/osem_seed_measurements.sh
Empty file added dumps/.gitkeep
Empty file.
6 changes: 0 additions & 6 deletions images/mongodb/Dockerfile

This file was deleted.

3 changes: 0 additions & 3 deletions images/mongodb/README.md

This file was deleted.

0 comments on commit 2094417

Please sign in to comment.