Skip to content

Commit

Permalink
Removing redundant postgres docker directory.
Browse files Browse the repository at this point in the history
  • Loading branch information
dartartem committed Apr 11, 2018
1 parent 81d01be commit 5a24d0e
Show file tree
Hide file tree
Showing 19 changed files with 66 additions and 128 deletions.
2 changes: 1 addition & 1 deletion docker-compose-postgres-wal.yml
Expand Up @@ -17,7 +17,7 @@ kafka:
- ZOOKEEPER_SERVERS=zookeeper:2181

postgres:
build: ./postgres-wal
build: ./postgres
ports:
- 5432:5432
environment:
Expand Down
Expand Up @@ -2,14 +2,12 @@

import io.eventuate.local.db.log.test.util.AbstractDatabaseOffsetKafkaStoreTest;
import org.junit.runner.RunWith;
import org.springframework.boot.test.IntegrationTest;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

@ActiveProfiles("PostgresWal")
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = PostgresWalCdcIntegrationTestConfiguration.class)
@IntegrationTest
@SpringBootTest(classes = PostgresWalCdcIntegrationTestConfiguration.class)
public class DatabaseOffsetKafkaStoreTest extends AbstractDatabaseOffsetKafkaStoreTest {
}
Expand Up @@ -2,14 +2,12 @@

import io.eventuate.local.db.log.test.util.AbstractDuplicatePublishingDetectorTest;
import org.junit.runner.RunWith;
import org.springframework.boot.test.IntegrationTest;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

@ActiveProfiles("PostgresWal")
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = PostgresWalCdcIntegrationTestConfiguration.class)
@IntegrationTest
@SpringBootTest(classes = PostgresWalCdcIntegrationTestConfiguration.class)
public class DuplicatePublishingDetectorTest extends AbstractDuplicatePublishingDetectorTest {
}
Expand Up @@ -6,17 +6,13 @@
import org.junit.Before;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.IntegrationTest;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.util.stream.Collectors;

@ActiveProfiles("PostgresWal")
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = {CustomDBTestConfiguration.class, PostgresWalCdcIntegrationTestConfiguration.class})
@IntegrationTest
@SpringBootTest(classes = {CustomDBTestConfiguration.class, PostgresWalCdcIntegrationTestConfiguration.class})
public class PostgresWalCdcCustomDBIntegrationTest extends AbstractPostgresWalCdcIntegrationTest {

@Autowired
Expand Down
Expand Up @@ -6,15 +6,13 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.IntegrationTest;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

@ActiveProfiles("PostgresWal")
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = {EmptyDBTestConfiguration.class, PostgresWalCdcIntegrationTestConfiguration.class})
@IntegrationTest
@SpringBootTest(classes = {EmptyDBTestConfiguration.class, PostgresWalCdcIntegrationTestConfiguration.class})
public class PostgresWalCdcEmptyDBIntegrationTest extends AbstractPostgresWalCdcIntegrationTest {

@Value("${eventuate.database.schema}")
Expand Down
@@ -1,14 +1,12 @@
package io.eventuate.local.postgres.wal;

import org.junit.runner.RunWith;
import org.springframework.boot.test.IntegrationTest;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

@ActiveProfiles("PostgresWal")
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = PostgresWalCdcIntegrationTestConfiguration.class)
@IntegrationTest
@SpringBootTest(classes = PostgresWalCdcIntegrationTestConfiguration.class)
public class PostgresWalCdcIntegrationTest extends AbstractPostgresWalCdcIntegrationTest {
}
Expand Up @@ -10,13 +10,11 @@
import io.eventuate.local.testutil.SqlScriptEditor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.Profile;

import java.util.List;
import java.util.stream.Collectors;

@Configuration
Expand Down Expand Up @@ -103,7 +101,12 @@ public PublishingStrategy<PublishedEvent> publishingStrategy() {
public SqlScriptEditor sqlScriptEditor() {
return sqlList -> {
sqlList.set(0, sqlList.get(0).replace("CREATE SCHEMA", "CREATE SCHEMA IF NOT EXISTS"));
return sqlList.stream().map(s -> s.replace("eventuate", "custom")).collect(Collectors.toList());

return sqlList
.stream()
.limit(sqlList.size() - 1)
.map(s -> s.replace("eventuate", "custom"))
.collect(Collectors.toList());
};
}
}
Expand Up @@ -2,15 +2,13 @@

import io.eventuate.local.db.log.test.util.AbstractDbLogBasedCdcKafkaPublisherTest;
import org.junit.runner.RunWith;
import org.springframework.boot.test.IntegrationTest;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;


@ActiveProfiles("PostgresWal")
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = PostgresWalCdcIntegrationTestConfiguration.class)
@IntegrationTest
@SpringBootTest(classes = PostgresWalCdcIntegrationTestConfiguration.class)
public class PostgresWalCdcKafkaPublisherTest extends AbstractDbLogBasedCdcKafkaPublisherTest {
}
Expand Up @@ -7,17 +7,13 @@
import org.junit.Before;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.IntegrationTest;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.util.stream.Collectors;

@ActiveProfiles("PostgresWal")
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = {CustomDBTestConfiguration.class, PostgresWalCdcIntegrationTestConfiguration.class})
@IntegrationTest
@SpringBootTest(classes = {CustomDBTestConfiguration.class, PostgresWalCdcIntegrationTestConfiguration.class})
public class PostgresWalCdcProcessorCustomDBTest extends AbstractPostgresWalCdcProcessorTest {

@Autowired
Expand Down
Expand Up @@ -6,15 +6,13 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.IntegrationTest;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

@ActiveProfiles("PostgresWal")
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = {EmptyDBTestConfiguration.class, PostgresWalCdcIntegrationTestConfiguration.class})
@IntegrationTest
@SpringBootTest(classes = {EmptyDBTestConfiguration.class, PostgresWalCdcIntegrationTestConfiguration.class})
public class PostgresWalCdcProcessorEmptyDBTest extends AbstractPostgresWalCdcProcessorTest {

@Value("${eventuate.database.schema}")
Expand Down
@@ -1,14 +1,12 @@
package io.eventuate.local.postgres.wal;

import org.junit.runner.RunWith;
import org.springframework.boot.test.IntegrationTest;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

@ActiveProfiles("PostgresWal")
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = PostgresWalCdcIntegrationTestConfiguration.class)
@IntegrationTest
@SpringBootTest(classes = PostgresWalCdcIntegrationTestConfiguration.class)
public class PostgresWalCdcProcessorTest extends AbstractPostgresWalCdcProcessorTest {
}
38 changes: 0 additions & 38 deletions postgres-wal/Dockerfile

This file was deleted.

1 change: 0 additions & 1 deletion postgres-wal/build-docker.sh

This file was deleted.

40 changes: 0 additions & 40 deletions postgres-wal/initialize-database.sql

This file was deleted.

38 changes: 37 additions & 1 deletion postgres/Dockerfile
@@ -1,2 +1,38 @@
FROM postgres:9.6.5
FROM postgres:9.6

ENV PLUGIN_VERSION=v0.7.0
ENV WAL2JSON_COMMIT_ID=f68cb0096c669a2ee5a2d32b54a535513e3cb23b

# Install the packages which will be required to get everything to compile
RUN apt-get update \
&& apt-get install -f -y --no-install-recommends \
software-properties-common \
build-essential \
pkg-config \
git \
postgresql-server-dev-9.6 \
libproj-dev \
&& apt-get clean && apt-get update && apt-get install -f -y --no-install-recommends \
liblwgeom-dev \
&& add-apt-repository "deb http://ftp.debian.org/debian testing main contrib" \
&& apt-get install nano \
&& apt-get update && apt-get install -f -y --no-install-recommends \
libprotobuf-c-dev=1.2.* \
&& rm -rf /var/lib/apt/lists/*

RUN git clone https://github.com/eulerto/wal2json -b master --single-branch \
&& cd /wal2json \
&& git checkout $WAL2JSON_COMMIT_ID \
&& make && make install \
&& cd / \
&& rm -rf wal2json

# Copy the custom configuration which will be passed down to the server (using a .sample file is the preferred way of doing it by
# the base Docker image)
COPY postgresql.conf.sample /usr/share/postgresql/postgresql.conf.sample

# Copy the script which will initialize the replication permissions
COPY docker-entrypoint-initdb.d /docker-entrypoint-initdb.d

# Initialize schema
COPY initialize-database.sql /docker-entrypoint-initdb.d
4 changes: 1 addition & 3 deletions postgres/build-docker.sh 100755 → 100644
@@ -1,3 +1 @@
#! /bin/bash -e

docker build -t test-eventuateio-local-postgres .
docker build -t test-postgres-wal .
4 changes: 3 additions & 1 deletion postgres/initialize-database.sql
Expand Up @@ -35,4 +35,6 @@ CREATE TABLE eventuate.snapshots (
snapshot_json VARCHAR(1000) NOT NULL,
triggering_events VARCHAR(1000),
PRIMARY KEY(entity_type, entity_id, entity_version)
);
);

SELECT * FROM pg_create_logical_replication_slot('eventuate_slot', 'wal2json');
File renamed without changes.

0 comments on commit 5a24d0e

Please sign in to comment.