Skip to content

Commit

Permalink
Setup KPI event types by default
Browse files Browse the repository at this point in the history
Now that we are automatically creating such event types, we can enable
the usage of this feature by default.
  • Loading branch information
rcillo committed Nov 12, 2018
1 parent 3b751ae commit 8366702
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 45 deletions.
2 changes: 0 additions & 2 deletions README.md
Expand Up @@ -126,8 +126,6 @@ The project is built with [Gradle](http://gradle.org).
The `./gradlew` [wrapper script](http://www.gradle.org/docs/current/userguide/gradle_wrapper.html) will bootstrap
the right Gradle version if it's not already installed.

[Mac OS specific configuration](https://zalando.github.io/nakadi/manual.html#macos)

### Install

To get the source, clone the git repository.
Expand Down
12 changes: 4 additions & 8 deletions docker-compose.yml
Expand Up @@ -20,11 +20,10 @@ services:
- NAKADI_FEATURES_DEFAULT_FEATURES_KPI_COLLECTION
- NAKADI_FEATURES_DEFAULT_FEATURES_DISABLE_DB_WRITE_OPERATIONS
- NAKADI_FEATURES_DEFAULT_FEATURES_DISABLE_LOG_COMPACTION
- NAKADI_ZOOKEEPER_BROKERS=localhost:2181
- SPRING_DATASOURCE_URL=jdbc:postgresql://localhost:5432/local_nakadi_db
- NAKADI_ZOOKEEPER_BROKERS=zookeeper:2181
- SPRING_DATASOURCE_URL=jdbc:postgresql://postgres:5432/local_nakadi_db
- SPRING_DATASOURCE_USERNAME=nakadi
- SPRING_DATASOURCE_PASSWORD=nakadi
network_mode: "host"

postgres:
image: postgres:9.5
Expand All @@ -36,25 +35,22 @@ services:
POSTGRES_USER: nakadi
POSTGRES_PASSWORD: nakadi
POSTGRES_DB: local_nakadi_db
network_mode: "host"

zookeeper:
image: wurstmeister/zookeeper:3.4.6
network_mode: "host"
ports:
- "2181:2181"

kafka:
image: wurstmeister/kafka:2.11-1.1.1
network_mode: "host"
ports:
- "9092:9092"
depends_on:
- zookeeper
environment:
KAFKA_ADVERTISED_HOST_NAME: localhost
KAFKA_ADVERTISED_HOST_NAME: kafka
KAFKA_ADVERTISED_PORT: 9092
KAFKA_ZOOKEEPER_CONNECT: localhost:2181
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
KAFKA_AUTO_CREATE_TOPICS_ENABLE: 'false'
KAFKA_DELETE_TOPIC_ENABLE: 'true'
KAFKA_BROKER_ID: 0
Expand Down
35 changes: 7 additions & 28 deletions docs/_documentation/getting-started.md
Expand Up @@ -50,35 +50,14 @@ Some ports need to be available to run the service:
- 9092 for Kafka
- 2181 for Zookeeper

They allow the services to communicate with each other and should not be used
by other applications.
Even though users of the API interact with port 8080, the other ports are exposed
in order to run integration tests.

If you are not running the tests, it's safe to modify docker-compose.yaml by removing
the port forwarding from dependencies.

<a name="macos"></a>
### Mac OS Docker Settings

Since Docker for Mac OS runs inside Virtual Box, you will want to expose
some ports first to allow Nakadi to access its dependencies:

```sh
docker-machine ssh default \
-L 9092:localhost:9092 \
-L 8080:localhost:8080 \
-L 5432:localhost:5432 \
-L 2181:localhost:2181
```

Alternatively you can set up port forwarding on the "default" machine through
its network settings in the VirtualBox UI.

![vbox](./img/vbox.png)

If you get the message "Is the
docker daemon running on this host?" but you know Docker and VirtualBox are
running, you might want to run this command:

```sh
eval "$(docker-machine env default)"
```

**Note:** Docker for Mac OS (previously in beta) version 1.12 (1.12.0 or 1.12.1) currently is not supported due to the [bug](https://github.com/docker/docker/issues/22753#issuecomment-242711639) in networking host configuration.

Nakadi no longer supports the old docker-machine. Please, install the most recent
version of Docker for Mac.
Expand Up @@ -46,10 +46,10 @@ public NakadiKpiInitialization(final ObjectMapper objectMapper, final EventTypeS

@EventListener
public void onApplicationEvent(final ContextRefreshedEvent event) throws IOException {
// if (!featureToggleService.isFeatureEnabled(FeatureToggleService.Feature.KPI_COLLECTION)) {
// LOG.debug("KPI collection is disabled, skip creation of kpi event types");
// return;
// }
if (!featureToggleService.isFeatureEnabled(FeatureToggleService.Feature.KPI_COLLECTION)) {
LOG.debug("KPI collection is disabled, skip creation of kpi event types");
return;
}

LOG.debug("Initializing KPI event types");

Expand All @@ -75,7 +75,7 @@ public void onApplicationEvent(final ContextRefreshedEvent event) throws IOExcep
try {
eventTypeService.create(et);
} catch (final DuplicatedEventTypeNameException e) {
LOG.debug("KPI event type already exists " + et.getName(), e);
LOG.debug("KPI event type already exists " + et.getName());
} catch (final NakadiBaseException e) {
LOG.debug("Problem creating KPI event type " + et.getName(), e);
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/application.yml
Expand Up @@ -139,7 +139,7 @@ nakadi:
DISABLE_EVENT_TYPE_DELETION: false
DISABLE_SUBSCRIPTION_CREATION: false
REMOTE_TOKENINFO: true
KPI_COLLECTION: false
KPI_COLLECTION: true
DISABLE_DB_WRITE_OPERATIONS: false
kpi:
config:
Expand All @@ -160,5 +160,5 @@ nakadi.features.defaultFeatures:
DISABLE_EVENT_TYPE_DELETION: false
DISABLE_SUBSCRIPTION_CREATION: false
REMOTE_TOKENINFO: true
KPI_COLLECTION: false
KPI_COLLECTION: true
DISABLE_DB_WRITE_OPERATIONS: false

0 comments on commit 8366702

Please sign in to comment.