Skip to content

Commit

Permalink
Detect Bitnami image in Docker Compose factories
Browse files Browse the repository at this point in the history
  • Loading branch information
scottfrederick committed Nov 17, 2023
1 parent caeffc4 commit 609218e
Show file tree
Hide file tree
Showing 20 changed files with 16 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ private boolean hasRequiredClasses() {
.allMatch((requiredClassName) -> ClassUtils.isPresent(requiredClassName, null));
}

protected static Predicate<DockerComposeConnectionSource> connectionName(String connectionName) {
return new ConnectionNamePredicate(connectionName);
}

/**
* Get the {@link ConnectionDetails} from the given {@link RunningService}
* {@code source}. May return {@code null} if no connection can be created. Result
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class CassandraDockerComposeConnectionDetailsFactory
private static final int CASSANDRA_PORT = 9042;

CassandraDockerComposeConnectionDetailsFactory() {
super("cassandra");
super(connectionName("cassandra").or(connectionName("bitnami/cassandra")));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class ElasticsearchDockerComposeConnectionDetailsFactory
private static final int ELASTICSEARCH_PORT = 9200;

protected ElasticsearchDockerComposeConnectionDetailsFactory() {
super("elasticsearch");
super(connectionName("elasticsearch").or(connectionName("bitnami/elasticsearch")));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class MariaDbJdbcDockerComposeConnectionDetailsFactory
extends DockerComposeConnectionDetailsFactory<JdbcConnectionDetails> {

protected MariaDbJdbcDockerComposeConnectionDetailsFactory() {
super("mariadb");
super(connectionName("mariadb").or(connectionName("bitnami/mariadb")));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class MariaDbR2dbcDockerComposeConnectionDetailsFactory
extends DockerComposeConnectionDetailsFactory<R2dbcConnectionDetails> {

MariaDbR2dbcDockerComposeConnectionDetailsFactory() {
super("mariadb", "io.r2dbc.spi.ConnectionFactoryOptions");
super(connectionName("mariadb").or(connectionName("bitnami/mariadb")), "io.r2dbc.spi.ConnectionFactoryOptions");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class MongoDockerComposeConnectionDetailsFactory extends DockerComposeConnection
private static final int MONGODB_PORT = 27017;

protected MongoDockerComposeConnectionDetailsFactory() {
super("mongo", "com.mongodb.ConnectionString");
super(connectionName("mongo").or(connectionName("bitnami/mongodb")), "com.mongodb.ConnectionString");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class MySqlJdbcDockerComposeConnectionDetailsFactory
extends DockerComposeConnectionDetailsFactory<JdbcConnectionDetails> {

protected MySqlJdbcDockerComposeConnectionDetailsFactory() {
super("mysql");
super(connectionName("mysql").or(connectionName("bitnami/mysql")));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class MySqlR2dbcDockerComposeConnectionDetailsFactory
extends DockerComposeConnectionDetailsFactory<R2dbcConnectionDetails> {

MySqlR2dbcDockerComposeConnectionDetailsFactory() {
super("mysql", "io.r2dbc.spi.ConnectionFactoryOptions");
super(connectionName("mysql").or(connectionName("bitnami/mysql")), "io.r2dbc.spi.ConnectionFactoryOptions");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class PostgresJdbcDockerComposeConnectionDetailsFactory
extends DockerComposeConnectionDetailsFactory<JdbcConnectionDetails> {

protected PostgresJdbcDockerComposeConnectionDetailsFactory() {
super("postgres");
super(connectionName("postgres").or(connectionName("bitnami/postgresql")));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ class PostgresR2dbcDockerComposeConnectionDetailsFactory
extends DockerComposeConnectionDetailsFactory<R2dbcConnectionDetails> {

PostgresR2dbcDockerComposeConnectionDetailsFactory() {
super("postgres", "io.r2dbc.spi.ConnectionFactoryOptions");
super(connectionName("postgres").or(connectionName("bitnami/postgresql")),
"io.r2dbc.spi.ConnectionFactoryOptions");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class RabbitDockerComposeConnectionDetailsFactory
private static final int RABBITMQ_PORT = 5672;

protected RabbitDockerComposeConnectionDetailsFactory() {
super("rabbitmq");
super(connectionName("rabbitmq").or(connectionName("bitnami/rabbitmq")));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class RedisDockerComposeConnectionDetailsFactory extends DockerComposeConnection
private static final int REDIS_PORT = 6379;

RedisDockerComposeConnectionDetailsFactory() {
super("redis");
super(connectionName("redis").or(connectionName("bitnami/redis")));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,3 @@ services:
environment:
- 'CASSANDRA_ENDPOINT_SNITCH=GossipingPropertyFileSnitch'
- 'CASSANDRA_DC=dc1'
labels:
org.springframework.boot.service-connection: cassandra
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,3 @@ services:
ports:
- '9200'
- '9300'
labels:
org.springframework.boot.service-connection: elasticsearch
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,3 @@ services:
- 'MARIADB_USER=myuser'
- 'MARIADB_PASSWORD=secret'
- 'MARIADB_DATABASE=mydatabase'
labels:
org.springframework.boot.service-connection: mariadb
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,3 @@ services:
- 'MONGO_INITDB_ROOT_USERNAME=root'
- 'MONGO_INITDB_ROOT_PASSWORD=secret'
- 'MONGO_INITDB_DATABASE=mydatabase'
labels:
org.springframework.boot.service-connection: mongo
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,3 @@ services:
- 'MYSQL_USER=myuser'
- 'MYSQL_PASSWORD=secret'
- 'MYSQL_DATABASE=mydatabase'
labels:
org.springframework.boot.service-connection: mysql
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,3 @@ services:
- 'POSTGRES_USER=myuser'
- 'POSTGRES_DB=mydatabase'
- 'POSTGRES_PASSWORD=secret'
labels:
org.springframework.boot.service-connection: postgres
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,3 @@ services:
- 'RABBITMQ_DEFAULT_PASS=secret'
ports:
- '5672'
labels:
org.springframework.boot.service-connection: rabbitmq
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ services:
- '6379'
environment:
- 'ALLOW_EMPTY_PASSWORD=yes'
labels:
org.springframework.boot.service-connection: redis

0 comments on commit 609218e

Please sign in to comment.