diff --git a/README.md b/README.md index 36043fd..a293c92 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,13 @@ # Localmongo -Local mongo replicaset running mongo:4.2-bionic for development using docker-compose. +Local mongo replicaset running mongo:4.2-bionic/4.4-bionic for development using docker-compose. ## Setup Switch to the directory of the version you want, and run: ``` -docker-compose up +docker-compose up -d ``` This should bring up 3 containers of mongodb, running a replicaset called `rs0`. @@ -23,6 +23,8 @@ docker-compose rm In your main application, you need to adjust your docker-compose in order for your application to be able to connect to the mongo containers. Use the below template of docker-compose.yml: +### For 4.2-bionic + ``` version: "3" services: @@ -38,12 +40,30 @@ services: networks: localmongo: external: - name: localmongo_default + name: 42_default ``` +### For 4.4-bionic +``` +version: "3" +services: + app: + build: . + networks: + - default + - localmongo + external_links: + - localmongo1:mongo1 + - localmongo2:mongo2 + - localmongo3:mongo3 +networks: + localmongo: + external: + name: 44_default +``` ## Troubleshooting -Assuming you clone this repo into a folder called `localmongo`, upon running docker-compose, docker will create a network called `localmongo_default`. You can view this by running `docker network ls`, and also by inspecting `docker inspect localmongo1`. +Assuming you run `docker-compose up` inside the 4.4 folder, docker will create a network called `44_default`. You can view this by running `docker network ls`, and also by inspecting `docker inspect localmongo1`. In the application's docker-compose.yml, we are specifying that the app must join 2 networks: the `default` one, as well as `localmongo` network, which is declared at the end of the file, pointing to an external network `localmongo_default`.