Skip to content

Commit

Permalink
Fixed Skipper startup
Browse files Browse the repository at this point in the history
  • Loading branch information
corneil committed Sep 20, 2023
1 parent 1e9f102 commit a137494
Show file tree
Hide file tree
Showing 16 changed files with 41 additions and 80 deletions.
2 changes: 1 addition & 1 deletion spring-cloud-dataflow-build/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<modules>
<module>spring-cloud-dataflow-build-dependencies</module>
<module>spring-cloud-dataflow-dependencies-parent</module>
<!-- <module>spring-cloud-dataflow-build-tools</module>-->
<module>spring-cloud-dataflow-build-tools</module>
</modules>
<url>https://spring.io/projects/spring-cloud-dataflow</url>
<properties>
Expand Down
42 changes: 4 additions & 38 deletions spring-cloud-dataflow-server/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,41 +3,7 @@ info:
name: "@project.artifactId@"
description: "@project.name@"
version: "@project.version@"
#server:
# port: 8443
# ssl:
# enabled: true
# key-alias: dataflow
# key-store: "/your/path/to/dataflow.keystore"
# key-store-type: jks
# key-store-password: dataflow
# key-password: dataflow

# Security (Oauth 2):

#security:
# oauth2:
# client:
# client-id: myclient
# client-secret: mysecret
# access-token-uri: http://127.0.0.1:9999/oauth/token
# user-authorization-uri: http://127.0.0.1:9999/oauth/authorize
# resource:
# user-info-uri: http://127.0.0.1:9999/me
# token-info-uri: http://127.0.0.1:9999/oauth/check_token

# If you prefer to use Eureka to locate the Config Server, you can do that by setting
# spring.cloud.config.discovery.enabled=true (default "false"). The net result of that is
# that client apps all need a bootstrap.yml (or an environment variable) with the Eureka
# server address, e.g. in eureka.client.serviceUrl.defaultZone
#
#---
#spring:
# cloud:
# config:
# discovery:
# enabled: true
#eureka:
# client:
# serviceUrl:
# defaultZone: http://localhost:8761/eureka/
spring:
jpa:
hibernate:
ddl-auto: none
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
import java.net.URISyntaxException;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.jdk8.Jdk8Module;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand All @@ -36,10 +34,6 @@
import org.springframework.cloud.dataflow.rest.client.DataFlowTemplate;
import org.springframework.cloud.dataflow.rest.resource.StreamDefinitionResource;
import org.springframework.cloud.dataflow.rest.support.jackson.Jackson2DataflowModule;
import org.springframework.http.ResponseEntity;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.util.UriComponents;
import org.springframework.web.util.UriComponentsBuilder;

import static org.assertj.core.api.Assertions.assertThat;

Expand Down Expand Up @@ -105,7 +99,7 @@ public void testMigration_210_211() throws URISyntaxException {
StreamDefinitionResource timelogger = dataFlowTemplate.streamOperations().getStreamDefinition("timelogger");
assertThat(timelogger.getDslText()).isEqualTo("time | log");
assertThat(timelogger.getDescription()).isEqualTo("timelogger");

dataFlowTemplate.streamOperations().undeploy("timelogger");

this.dataflowCluster.replaceSkipperAndDataflow(TagNames.SKIPPER_main, TagNames.DATAFLOW_main);
assertDataflowServerRunning(this.dataflowCluster);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
spring.datasource.url=jdbc:h2:mem:testdb
spring.cloud.dataflow.client.skip-ssl-validation=true
spring.autoconfigure.exclude=org.springframework.cloud.dataflow.rest.client.config.DataFlowClientAutoConfiguration
spring.jpa.hibernate.ddl-auto=validate
spring.jpa.hibernate.ddl-auto=none

logging.level.root=info
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@
package org.springframework.cloud.skipper.server.db.migration;

import java.sql.Connection;
import java.sql.JDBCType;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Types;

import javax.sql.DataSource;

Expand Down Expand Up @@ -52,9 +54,9 @@ public static void convertColumnToOID(String table, String id, String column, Da
try (Connection connection = dataSource.getConnection()) {
try (ResultSet resultSet = connection.getMetaData().getColumns(null, null, table.toUpperCase(), column.toUpperCase())) {
while (resultSet.next()) {
String dataType = resultSet.getString("DATA_TYPE");
if (dataType.equalsIgnoreCase("OID")) {
logger.info("Found {}:{}:{}", table, column, dataType);
int dataType = resultSet.getInt("DATA_TYPE");
logger.info("Found {}:{}:{}", table, column, JDBCType.valueOf(dataType));
if (dataType == Types.BIGINT) {
return;
}
}
Expand Down Expand Up @@ -90,9 +92,9 @@ public static void convertColumnFromOID(String table, String id, String column,
try (Connection connection = dataSource.getConnection()) {
try (ResultSet resultSet = connection.getMetaData().getColumns(null, null, table.toUpperCase(), column.toUpperCase())) {
while (resultSet.next()) {
String dataType = resultSet.getString("DATA_TYPE");
if (!dataType.equalsIgnoreCase("OID")) {
logger.info("Found {}:{}:{}", table, column, dataType);
int dataType = resultSet.getInt("DATA_TYPE");
logger.info("Found {}:{}:{}", table, column, JDBCType.valueOf(dataType));
if (dataType != Types.BIGINT) {
return;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,25 @@
import org.flywaydb.core.api.migration.Context;

import org.springframework.cloud.dataflow.common.flyway.AbstractMigration;
import org.springframework.cloud.skipper.server.db.migration.PostgreSQLTextToOID;

import static org.springframework.cloud.skipper.server.db.migration.PostgreSQLTextToOID.convertColumnFromOID;
public class V3__ChangeTextTypes extends AbstractMigration {
public V3__ChangeTextTypes() {
super(null);
}

@Override
public void migrate(Context context) {
PostgreSQLTextToOID.convertColumnFromOID("skipper_app_deployer_data", "id", "deployment_data", context.getConfiguration().getDataSource());
PostgreSQLTextToOID.convertColumnFromOID("skipper_package_metadata", "id", "description", context.getConfiguration().getDataSource());
PostgreSQLTextToOID.convertColumnFromOID("skipper_package_metadata", "id", "icon_url", context.getConfiguration().getDataSource());
PostgreSQLTextToOID.convertColumnFromOID("skipper_package_metadata", "id", "package_home_url", context.getConfiguration().getDataSource());
PostgreSQLTextToOID.convertColumnFromOID("skipper_package_metadata", "id", "package_source_url", context.getConfiguration().getDataSource());
PostgreSQLTextToOID.convertColumnFromOID("skipper_package_metadata", "id", "tags", context.getConfiguration().getDataSource());
PostgreSQLTextToOID.convertColumnFromOID("skipper_release", "id", "config_values_string", context.getConfiguration().getDataSource());
PostgreSQLTextToOID.convertColumnFromOID("skipper_release", "id", "pkg_json_string", context.getConfiguration().getDataSource());
PostgreSQLTextToOID.convertColumnFromOID("skipper_repository", "id", "source_url", context.getConfiguration().getDataSource());
PostgreSQLTextToOID.convertColumnFromOID("skipper_repository", "id", "url", context.getConfiguration().getDataSource());
PostgreSQLTextToOID.convertColumnFromOID("skipper_status", "id", "platform_status", context.getConfiguration().getDataSource());
convertColumnFromOID("skipper_app_deployer_data", "id", "deployment_data", context.getConfiguration().getDataSource());
convertColumnFromOID("skipper_package_metadata", "id", "description", context.getConfiguration().getDataSource());
convertColumnFromOID("skipper_package_metadata", "id", "icon_url", context.getConfiguration().getDataSource());
convertColumnFromOID("skipper_package_metadata", "id", "package_home_url", context.getConfiguration().getDataSource());
convertColumnFromOID("skipper_package_metadata", "id", "package_source_url", context.getConfiguration().getDataSource());
convertColumnFromOID("skipper_package_metadata", "id", "tags", context.getConfiguration().getDataSource());
convertColumnFromOID("skipper_release", "id", "config_values_string", context.getConfiguration().getDataSource());
convertColumnFromOID("skipper_release", "id", "pkg_json_string", context.getConfiguration().getDataSource());
convertColumnFromOID("skipper_repository", "id", "source_url", context.getConfiguration().getDataSource());
convertColumnFromOID("skipper_repository", "id", "url", context.getConfiguration().getDataSource());
convertColumnFromOID("skipper_status", "id", "platform_status", context.getConfiguration().getDataSource());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@
*
* @author Corneil du Plessis
*/
@SpringBootTest(classes = AbstractSmokeTest.LocalTestSkipperServer.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@SpringBootTest(classes = AbstractSkipperSmokeTest.LocalTestSkipperServer.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@ActiveProfiles({"local", "repo-test"})
@TestPropertySource(properties = {
"spring.jpa.hibernate.ddl-auto=none",
"logging.level.org.springframework.cloud=info",
"logging.level.org.hibernate=debug"
})
public abstract class AbstractSmokeTest {
private static final Logger logger = LoggerFactory.getLogger(AbstractSmokeTest.class);
public abstract class AbstractSkipperSmokeTest {
private static final Logger logger = LoggerFactory.getLogger(AbstractSkipperSmokeTest.class);

protected static JdbcDatabaseContainer<?> container;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*
* @author Corneil du Plessis
*/
public class DB2SmokeTest extends AbstractSmokeTest {
public class DB2SkipperSmokeTest extends AbstractSkipperSmokeTest {
@BeforeAll
static void startContainer() {
container = new Db2Container(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
@TestPropertySource(properties = {
"spring.jpa.database-platform=org.hibernate.dialect.MariaDB106Dialect"
})
public class MariaDBSmokeTest extends AbstractSmokeTest {
public class MariaDBSkipperSmokeTest extends AbstractSkipperSmokeTest {

@BeforeAll
static void startContainer() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*
* @author Corneil du Plessis
*/
public class MySQL57SmokeTest extends AbstractSmokeTest {
public class MySQL57SkipperSmokeTest extends AbstractSkipperSmokeTest {
@BeforeAll
static void startContainer() {
container = new MySQLContainer<>("mysql:5.7");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*
* @author Corneil du Plessis
*/
public class MySQL8SmokeTest extends AbstractSmokeTest {
public class MySQL8SkipperSmokeTest extends AbstractSkipperSmokeTest {
@BeforeAll
static void startContainer() {
container = new MySQLContainer<>(DockerImageName.parse("mysql:8"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*
* @author Corneil du Plessis
*/
public class OracleSmokeTest extends AbstractSmokeTest {
public class OracleSkipperSmokeTest extends AbstractSkipperSmokeTest {
@BeforeAll
static void startContainer() {
container = new OracleContainer();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*
* @author Corneil du Plessis
*/
public class PostgreSQLSmokeTest extends AbstractSmokeTest {
public class PostgreSQLSkipperSmokeTest extends AbstractSkipperSmokeTest {
@BeforeAll
static void startContainer() {
container = new PostgreSQLContainer<>(DockerImageName.parse("postgres:14"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*
* @author Corneil du Plessis
*/
public class SqlServerSmokeTest extends AbstractSmokeTest {
public class SqlServerSkipperSmokeTest extends AbstractSkipperSmokeTest {
@SuppressWarnings("resource")
@BeforeAll
static void startContainer() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<configuration>
<include resource="org/springframework/boot/logging/logback/base.xml" />
<logger name="org.springframework.web" level="INFO"/>
<logger name="org.springframework.cloud.dataflow" level="DEBUG"/>
<logger name="org.springframework.cloud.skipper" level="DEBUG"/>
<logger name="org.springframework.boot" level="DEBUG"/>
<logger name="org.flywaydb" level="DEBUG"/>
</configuration>
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>spring-cloud-starter-skipper-server</artifactId>
<packaging>pom</packaging>
<name>Spring Cloud Starter :: Skipper Server</name>

<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-skipper-parent</artifactId>
<version>2.11.0-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>spring-cloud-starter-skipper-server</artifactId>
<packaging>jar</packaging>
<name>Spring Cloud Starter :: Skipper Server</name>
<properties>
<maven-javadoc-plugin.version>3.4.1</maven-javadoc-plugin.version>
</properties>
Expand Down

0 comments on commit a137494

Please sign in to comment.