Created
April 19, 2021 11:42
-
-
Save mmmcorpsvit/f2ac889dd174f29fec62cdf61fe971a6 to your computer and use it in GitHub Desktop.
Postgres 13.2 + mongo_fdw 5.2.8 + opendatacam 3.0.1 + mongo + mongo-express + pgadmin4 + adminer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3.8" | |
services: | |
opendatacam: | |
restart: always | |
#runtime: nvidia | |
image: opendatacam/opendatacam:v3.0.1-desktop | |
privileged: true | |
volumes: | |
- './config.json:/var/local/opendatacam/config.json' | |
ports: | |
- 8086:8080 | |
- 8070:8070 | |
- 8090:8090 | |
networks: | |
- mongodb_network | |
mongo: | |
image: mongo:3.4 | |
container_name: mongodb | |
environment: | |
- MONGO_INITDB_ROOT_USERNAME=root | |
- MONGO_INITDB_ROOT_PASSWORD=pass12345 | |
networks: | |
- mongodb_network | |
ports: | |
- 27017:27017 | |
restart: unless-stopped | |
volumes: | |
- mongodb_data_container:/data/db | |
mongo-express: | |
image: mongo-express | |
container_name: mongo-express | |
environment: | |
- ME_CONFIG_MONGODB_SERVER=mongodb | |
- ME_CONFIG_MONGODB_ENABLE_ADMIN=true | |
- ME_CONFIG_MONGODB_ADMINUSERNAME=root | |
- ME_CONFIG_MONGODB_ADMINPASSWORD=pass12345 | |
- ME_CONFIG_BASICAUTH_USERNAME=admin | |
- ME_CONFIG_BASICAUTH_PASSWORD=admin123 | |
volumes: | |
- mongodb-data | |
depends_on: | |
- mongo | |
networks: | |
- mongodb_network | |
ports: | |
- 8081:8081 | |
restart: unless-stopped | |
postgres: | |
container_name: postgres_container | |
#image: postgres:13.2-alpine | |
# https://hub.docker.com/r/toleg/postgres_mongo_fdw | |
#image: toleg/postgres_mongo_fdw | |
build: . | |
restart: always | |
environment: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgrespassword1password | |
POSTGRES_DB: test | |
PGDATA: /data/postgres | |
volumes: | |
- ./sql/postgres_mongo_setup.sql:/docker-entrypoint-initdb.d/postgres_mongo_setup.sql | |
- postgres:/data/postgres | |
#ports: | |
#- 5432:5432 | |
networks: | |
- mongodb_network | |
- postgres | |
depends_on: | |
- mongo | |
pgadmin4: | |
container_name: pgadmin_container | |
image: dpage/pgadmin4 | |
restart: always | |
environment: | |
PGADMIN_DEFAULT_EMAIL: email@email.com | |
PGADMIN_DEFAULT_PASSWORD: postgrespassword1password | |
ports: | |
- "8092:80" | |
volumes: | |
- pgadmin:/root/.pgadmin | |
networks: | |
- postgres | |
depends_on: | |
- postgres | |
adminer: | |
image: adminer | |
restart: always | |
ports: | |
- 8087:8080 | |
depends_on: | |
- postgres | |
networks: | |
- postgres | |
volumes: | |
mongodb_data_container: | |
postgres: | |
adminer: | |
pgadmin: | |
networks: | |
mongodb_network: | |
postgres: | |
# name: mongodb_network |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM postgres:13.2 | |
ARG MONGO_FDW_VERSION=5_2_8 | |
ARG MONGO_FDW_URL=https://github.com/EnterpriseDB/mongo_fdw/archive/REL-${MONGO_FDW_VERSION}.tar.gz | |
ARG SOURCE_FILES=tmp/mongo_fdw | |
RUN apt-get update | |
RUN apt-get install -y --no-install-recommends wget ca-certificates make gcc cmake pkg-config postgresql-server-dev-13 libssl-dev libzstd-dev libtool | |
RUN mkdir -p ${SOURCE_FILES} && wget -O - ${MONGO_FDW_URL} | tar -zx --strip-components=1 -C ${SOURCE_FILES} | |
RUN cd ${SOURCE_FILES} && ./autogen.sh --with-master | |
# RUN cd ${SOURCE_FILES} && make -j8 && make install | |
RUN cd ${SOURCE_FILES} && ldconfig | |
RUN cd ${SOURCE_FILES} && make clean && make && make install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- file sql/postgres_mongo_setup.sql | |
create schema mongo_fdw; | |
create extension mongo_fdw schema mongo_fdw; | |
create server mongo foreign data wrapper mongo_fdw options (address 'mongo', port '27017'); | |
create user mapping for postgres server mongo options (username 'root', dbname 'opendatacam', password 'pass12345'); | |
create foreign table users | |
( _id name | |
, id int | |
, name text | |
) server mongo; | |
select * FROM users; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
clear && docker-compose build --no-cache --parallel && docker-compose up |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment