Skip to content

Commit

Permalink
Merge pull request #889 from amazeeio/mongo-shared
Browse files Browse the repository at this point in the history
mongodb-shared lagoon.type.
  • Loading branch information
Schnitzel committed Feb 26, 2019
2 parents dd53be7 + b9c879e commit 25ccaeb
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
3 changes: 2 additions & 1 deletion docs/using_lagoon/service_types.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ This table lists all service types that can be defined via `lagoon.type` within
| `node` | Nodejs container. | TCP connection on `3000` | `3000` | yes | - |
| `node-persistent` | Like `node`, will generate persistent storage, define mount location via `lagoon.persistent` | TCP connection on `3000` | `3000` | yes | `lagoon.persistent`, `lagoon.persistent.name`, `lagoon.persistent.size`, `lagoon.persistent.class` |
| `mongo` | MongoDB container, will generate persistent storage of min 1GB mounted at `/data/db` | TCP connection on `27017` | `27017` | - | - |
| `mongo-shared` | Uses a shared mongodb server via a service broker | not needed | `27017` | - | - |
| `kibana` | Kibana container. | TCP connection on `5601` | `5601` | yes | - |
| `logstash` | Logstash container. | TCP connection on `9600` | `9600` | - | - |
| `elasticsearch` | Elasticsearch container, will auto generate persistent storage under `/usr/share/elasticsearch/data` | HTTP on `localhost:9200/_cluster/health?local=true` | `9200` | - | `lagoon.persistent.size` |
| `elasticsearch-cluster` | Elasticsearch Cluster with 3 nodes, users Statefulset, will auto generate persistent storage for each cluster node under `/usr/share/elasticsearch/data` | HTTP on `localhost:9200/_cluster/health?local=true` | `9200`, `9300` | - | - |
| `none` | Instructs Lagoon to completely ignore this service | - | - | - | - |
| `custom` | Full custom definition, see [documentation](./docker-compose_yml.md) | - | - | - | - |
| `custom` | Full custom definition, see [documentation](./docker-compose_yml.md) | - | - | - | - |
14 changes: 14 additions & 0 deletions images/oc-build-deploy-dind/build-deploy-docker-compose.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ COMPOSE_SERVICES=($(cat $DOCKER_COMPOSE_YAML | shyaml keys services))

# Default shared mariadb service broker
MARIADB_SHARED_DEFAULT_CLASS="lagoon-dbaas-mariadb-apb"
MONGODB_SHARED_DEFAULT_CLASS="lagoon-maas-mongodb-apb"

# Figure out which services should we handle
SERVICE_TYPES=()
Expand Down Expand Up @@ -110,6 +111,19 @@ do
fi
fi

if [ "$SERVICE_TYPE" == "mongodb-shared" ]; then
MONGODB_SHARED_CLASS=$(cat $DOCKER_COMPOSE_YAML | shyaml get-value services.$COMPOSE_SERVICE.labels.lagoon\\.mongo-shared\\.class "${MONGODB_SHARED_DEFAULT_CLASS}")
MONGODB_SHARED_PLAN=$(cat $DOCKER_COMPOSE_YAML | shyaml get-value services.$COMPOSE_SERVICE.labels.lagoon\\.mongo-shared\\.plan "${ENVIRONMENT_TYPE}")

# Check if the defined service broker plan exists
if svcat --scope cluster get plan --class "${MONGODB_SHARED_CLASS}" "${MONGODB_SHARED_PLAN}" > /dev/null; then
MAP_SERVICE_NAME_TO_SERVICEBROKER_PLAN["${SERVICE_NAME}"]="${MONGODB_SHARED_PLAN}"
else
echo "defined service broker plan '${MONGODB_SHARED_PLAN}' for service '$SERVICE_NAME' and service broker '$MONGODB_SHARED_CLASS' not found in cluster";
exit 1
fi
fi

if [ "$SERVICE_TYPE" == "none" ]; then
continue
fi
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# just an empty file which tells build-deploy-docker-compose.sh that
# for this service type the servicebroker should be used

0 comments on commit 25ccaeb

Please sign in to comment.