@@ -193,20 +193,7 @@ public String getConnectionString() {
193193 protected void configure () {
194194 super .configure ();
195195
196- addExposedPorts (
197- MGMT_PORT ,
198- MGMT_SSL_PORT ,
199- VIEW_PORT ,
200- VIEW_SSL_PORT ,
201- QUERY_PORT ,
202- QUERY_SSL_PORT ,
203- SEARCH_PORT ,
204- SEARCH_SSL_PORT ,
205- ANALYTICS_PORT ,
206- ANALYTICS_SSL_PORT ,
207- KV_PORT ,
208- KV_SSL_PORT
209- );
196+ exposePorts ();
210197
211198 WaitAllStrategy waitStrategy = new WaitAllStrategy ();
212199
@@ -254,6 +241,31 @@ protected void configure() {
254241 waitingFor (waitStrategy );
255242 }
256243
244+ /**
245+ * Configures the exposed ports based on the enabled services.
246+ * <p>
247+ * Note that the MGMT_PORTs are always enabled since there must always be a cluster
248+ * manager. Also, the View engine ports are implicitly available on the same nodes
249+ * where the KV service is enabled - it is not possible to configure them individually.
250+ */
251+ private void exposePorts () {
252+ addExposedPorts (MGMT_PORT , MGMT_SSL_PORT );
253+
254+ if (enabledServices .contains (CouchbaseService .KV )) {
255+ addExposedPorts (KV_PORT , KV_SSL_PORT );
256+ addExposedPorts (VIEW_PORT , VIEW_SSL_PORT );
257+ }
258+ if (enabledServices .contains (CouchbaseService .ANALYTICS )) {
259+ addExposedPorts (ANALYTICS_PORT , ANALYTICS_SSL_PORT );
260+ }
261+ if (enabledServices .contains (CouchbaseService .QUERY )) {
262+ addExposedPorts (QUERY_PORT , QUERY_SSL_PORT );
263+ }
264+ if (enabledServices .contains (CouchbaseService .SEARCH )) {
265+ addExposedPorts (SEARCH_PORT , SEARCH_SSL_PORT );
266+ }
267+ }
268+
257269 @ Override
258270 protected void containerIsStarting (final InspectContainerResponse containerInfo ) {
259271 logger ().debug ("Couchbase container is starting, performing configuration." );
@@ -275,6 +287,7 @@ protected void containerIsStarted(InspectContainerResponse containerInfo) {
275287 timePhase ("createBuckets" , this ::createBuckets );
276288
277289 logger ().info ("Couchbase container is ready! UI available at http://{}:{}" , getHost (), getMappedPort (MGMT_PORT ));
290+ logger ().info ("https://{}:{}" , getHost (), getMappedPort (MGMT_SSL_PORT ));
278291 }
279292
280293 /**
0 commit comments