build: Include Mongo dump with init in local deployment (#448)

Added the latest data from the internet-facing staging DB as json files
to the repo (Git LFS) and added another container to the local
deployment that ingests the files upon creation.

---------

Co-authored-by: Philipp Horstenkamp <philipp@horstenkamp.de>
This commit is contained in:
Tristan Nolde 2023-12-10 11:43:15 +01:00 committed by GitHub
parent 043501a784
commit c917cac58a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 125 additions and 106 deletions

1
.gitattributes vendored Normal file
View File

@ -0,0 +1 @@
assets/*.json filter=lfs diff=lfs merge=lfs -text

3
.gitignore vendored
View File

@ -2,6 +2,9 @@
**/*.xml **/*.xml
**/*.json **/*.json
# Keep assets
!assets/**/*
# LaTeX temp files # LaTeX temp files
**/*.aux **/*.aux
**/*-blx.bib **/*-blx.bib

3
assets/mongo_import.sh Normal file
View File

@ -0,0 +1,3 @@
#!/bin/sh
mongoimport --host ${MONGO_HOST}:${MONGO_PORT} -u ${MONGO_USERNAME} -p ${MONGO_PASSWORD} --authenticationDatabase admin --db ${MONGO_DATABASE} --collection companies --file /tmp/transparenzregister.companies.json --jsonArray
mongoimport --host ${MONGO_HOST}:${MONGO_PORT} -u ${MONGO_USERNAME} -p ${MONGO_PASSWORD} --authenticationDatabase admin --db ${MONGO_DATABASE} --collection news --file /tmp/transparenzregister.news.json --jsonArray

BIN
assets/transparenzregister.companies.json (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/transparenzregister.news.json (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -35,6 +35,21 @@ services:
deploy: deploy:
replicas: 1 # set to one to activate replicas: 1 # set to one to activate
mongodb-init:
image: mongo:4.4.6
depends_on:
- mongodb
restart: no
volumes:
- ./assets:/tmp
environment:
MONGO_PASSWORD: ${PYTHON_MONGO_PASSWORD:?error}
MONGO_USERNAME: ${PYTHON_MONGO_USERNAME:-root}
MONGO_HOST: ${PYTHON_MONGO_HOST:-mongodb}
MONGO_PORT: ${PYTHON_MONGO_PORT:-27017}
MONGO_DATABASE: ${PYTHON_MONGO_DATABASE:-transparenzregister}
entrypoint: [/tmp/mongo_import.sh]
postgres: postgres:
image: postgres:15.4 image: postgres:15.4
restart: always restart: always
@ -95,12 +110,3 @@ volumes:
postgres_data: postgres_data:
mongo_data: mongo_data:
ingest_data: ingest_data:
networks:
default:
driver: bridge
ipam:
driver: default
config:
- subnet: 192.168.7.0/24
gateway: 192.168.7.1