Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions auth-service/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ FROM eclipse-temurin:21-jre
WORKDIR /app

COPY auth-service/target/*.jar app.jar
COPY database/migrations /app/database/migrations

EXPOSE 8082

ENTRYPOINT ["java","-jar","app.jar"]
ENTRYPOINT ["java", "-jar", "app.jar"]
1 change: 1 addition & 0 deletions auth-service/src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ spring:
properties:
hibernate:
format_sql: true
default_schema: auth

flyway:
enabled: true
Expand Down
1 change: 1 addition & 0 deletions auth-service/target/classes/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ spring:
properties:
hibernate:
format_sql: true
default_schema: auth

flyway:
enabled: true
Expand Down
20 changes: 20 additions & 0 deletions database/migrations/V2__create_worker_tasks.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
CREATE TABLE worker_tasks (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
workflow_execution_id UUID,
node_id UUID,
type VARCHAR(50) NOT NULL,
payload TEXT,
status VARCHAR(20) NOT NULL DEFAULT 'PENDING',
result TEXT,
error TEXT,
created_at TIMESTAMP,
updated_at TIMESTAMP
);

CREATE TABLE dead_letter_tasks (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
original_topic VARCHAR(255) NOT NULL,
task_payload TEXT NOT NULL,
exception_message TEXT,
failed_at TIMESTAMP NOT NULL
);
10 changes: 0 additions & 10 deletions database/migrations/V3__create_worker_tasks.sql

This file was deleted.

6 changes: 0 additions & 6 deletions database/migrations/V4__add_worker_task_execution_columns.sql

This file was deleted.

22 changes: 0 additions & 22 deletions database/migrations/V5__create_worker_tables.sql

This file was deleted.

13 changes: 6 additions & 7 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ services:
ports:
- "8083:8082"
volumes:
- ./database/auth:/app/database/migrations
- ./database/migrations:/app/database/migrations

db:
image: postgres:16-alpine
Expand Down Expand Up @@ -67,10 +67,7 @@ services:
- ./database:/app/database

worker-service:
build:
context: .
dockerfile: worker-service/Dockerfile
image: flowforge/worker-service:local
image: aswinrj/worker-service
container_name: worker-service
restart: always
depends_on:
Expand All @@ -80,6 +77,8 @@ services:
- mailpit
ports:
- "8084:8084"
volumes:
- ./database/migrations:/app/database/migrations

kafka:
image: apache/kafka:latest
Expand All @@ -92,7 +91,7 @@ services:
KAFKA_NODE_ID: 1
KAFKA_PROCESS_ROLES: broker,controller
KAFKA_LISTENERS: PLAINTEXT://:9092,PLAINTEXT_HOST://:29092,CONTROLLER://:9093
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://flowforge-kafka:9092,PLAINTEXT_HOST://localhost:29092
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9092,PLAINTEXT_HOST://localhost:9092
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT,CONTROLLER:PLAINTEXT
KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
KAFKA_CONTROLLER_LISTENER_NAMES: CONTROLLER
Expand All @@ -104,4 +103,4 @@ services:

volumes:
postgres_data:
kafka_data:
kafka_data:
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import org.springframework.kafka.config.ConcurrentKafkaListenerContainerFactory;
import org.springframework.kafka.core.ConsumerFactory;
import org.springframework.kafka.core.DefaultKafkaConsumerFactory;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;

import java.util.HashMap;
import java.util.Map;
Expand All @@ -35,4 +37,13 @@ public ConcurrentKafkaListenerContainerFactory<String, String> kafkaListenerCont
factory.setConsumerFactory(consumerFactory);
return factory;
}

@Bean
public TaskScheduler taskScheduler() {
ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();
scheduler.setPoolSize(5);
scheduler.setThreadNamePrefix("retry-topic-scheduler-");
scheduler.initialize();
return scheduler;
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.flowforge.worker_service.domain.model;

import com.flowforge.worker_service.domain.enums.TaskStatus;
import jakarta.persistence.Table;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
Expand Down
6 changes: 4 additions & 2 deletions worker-service/src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ spring:

flyway:
enabled: true
locations: filesystem:/app/database/migrations
locations: classpath:db/migration
schemas: worker
default-schema: worker
create-schemas: true

kafka:
bootstrap-servers: flowforge-kafka:9092
bootstrap-servers: flowforge-kafka:29092
producer:
key-serializer: org.apache.kafka.common.serialization.StringSerializer
value-serializer: org.springframework.kafka.support.serializer.JsonSerializer
Expand Down
Loading