Debian Codegraph @

docstore/mongodocstore/localmongo.sh

raw
1 #!/usr/bin/env bash
2 # Copyright 2019 The Go Cloud Development Kit Authors
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 # https://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15
16 # Starts two local MongoDB instances (v3 and v4) via Docker listening on two
17 # different ports.
18
19 # https://coderwall.com/p/fkfaqq/safer-bash-scripts-with-set-euxo-pipefail
20 set -euo pipefail
21
22 echo "Starting MongoDB v4 listening on 27017..."
23 docker rm -f mongo4 mongosetup &> /dev/null || :
24 docker compose -f ./docstore/mongodocstore/docker-compose.yml up --wait &> /dev/null
25 sleep 3
26 echo "...done. Run \"docker rm -f mongo4 mongosetup\" to clean up the container."
27 echo
28
29 echo "Starting MongoDB v3 listening on 27020..."
30 docker rm -f mongo3 &> /dev/null || :
31 docker run -d --name mongo3 -p 27020:27017 mongo:3 &> /dev/null
32 echo "...done. Run \"docker rm -f mongo3\" to clean up the container."
33 echo
34