Skip to content
Snippets Groups Projects
Commit 2993534f authored by Moritz Staudinger's avatar Moritz Staudinger
Browse files

Fixed Seeder Calls @mweise

Former-commit-id: 2184d8fd
parent ba8fe610
Branches
Tags
No related merge requests found
...@@ -28,7 +28,7 @@ services: ...@@ -28,7 +28,7 @@ services:
image: fda-metadata-db image: fda-metadata-db
networks: networks:
fda-public: fda-public:
ipv4_address: 172.29.0.5 # ipv4_address: 172.29.0.5
volumes: volumes:
- fda-metadata-db-data:/var/lib/postgresql/data - fda-metadata-db-data:/var/lib/postgresql/data
ports: ports:
...@@ -49,7 +49,7 @@ services: ...@@ -49,7 +49,7 @@ services:
image: fda-discovery-service image: fda-discovery-service
networks: networks:
fda-public: fda-public:
ipv4_address: 172.29.0.4 # ipv4_address: 172.29.0.4
environment: environment:
SPRING_PROFILES_ACTIVE: docker SPRING_PROFILES_ACTIVE: docker
TZ: Europe/Vienna TZ: Europe/Vienna
...@@ -69,7 +69,7 @@ services: ...@@ -69,7 +69,7 @@ services:
image: fda-gateway-service image: fda-gateway-service
networks: networks:
fda-public: fda-public:
ipv4_address: 172.29.0.2 # ipv4_address: 172.29.0.2
environment: environment:
SPRING_PROFILES_ACTIVE: docker SPRING_PROFILES_ACTIVE: docker
TZ: Europe/Vienna TZ: Europe/Vienna
...@@ -87,7 +87,7 @@ services: ...@@ -87,7 +87,7 @@ services:
networks: networks:
fda-userdb: fda-userdb:
fda-public: fda-public:
ipv4_address: 172.29.0.9 # ipv4_address: 172.29.0.9
environment: environment:
SPRING_PROFILES_ACTIVE: docker SPRING_PROFILES_ACTIVE: docker
TZ: Europe/Vienna TZ: Europe/Vienna
...@@ -109,7 +109,7 @@ services: ...@@ -109,7 +109,7 @@ services:
image: fda-container-service image: fda-container-service
networks: networks:
fda-public: fda-public:
ipv4_address: 172.29.0.8 # ipv4_address: 172.29.0.8
environment: environment:
SPRING_PROFILES_ACTIVE: docker SPRING_PROFILES_ACTIVE: docker
TZ: Europe/Vienna TZ: Europe/Vienna
...@@ -131,7 +131,7 @@ services: ...@@ -131,7 +131,7 @@ services:
build: fda-authentication-service build: fda-authentication-service
networks: networks:
fda-public: fda-public:
ipv4_address: 172.29.0.14 # ipv4_address: 172.29.0.14
environment: environment:
SPRING_PROFILES_ACTIVE: docker SPRING_PROFILES_ACTIVE: docker
TZ: Europe/Vienna TZ: Europe/Vienna
...@@ -151,7 +151,7 @@ services: ...@@ -151,7 +151,7 @@ services:
image: fda-query-service image: fda-query-service
networks: networks:
fda-public: fda-public:
ipv4_address: 172.29.0.12 # ipv4_address: 172.29.0.12
fda-userdb: fda-userdb:
environment: environment:
SPRING_PROFILES_ACTIVE: docker SPRING_PROFILES_ACTIVE: docker
...@@ -174,7 +174,7 @@ services: ...@@ -174,7 +174,7 @@ services:
image: fda-table-service image: fda-table-service
networks: networks:
fda-public: fda-public:
ipv4_address: 172.29.0.11 # ipv4_address: 172.29.0.11
fda-userdb: fda-userdb:
environment: environment:
SPRING_PROFILES_ACTIVE: docker SPRING_PROFILES_ACTIVE: docker
...@@ -199,7 +199,7 @@ services: ...@@ -199,7 +199,7 @@ services:
image: fda-identifier-service image: fda-identifier-service
networks: networks:
fda-public: fda-public:
ipv4_address: 172.29.0.13 # ipv4_address: 172.29.0.13
environment: environment:
SPRING_PROFILES_ACTIVE: docker SPRING_PROFILES_ACTIVE: docker
TZ: Europe/Vienna TZ: Europe/Vienna
...@@ -217,7 +217,7 @@ services: ...@@ -217,7 +217,7 @@ services:
image: fda-analyse-service image: fda-analyse-service
networks: networks:
fda-public: fda-public:
ipv4_address: 172.29.0.10 # ipv4_address: 172.29.0.10
fda-userdb: fda-userdb:
command: sh -c "/wait && flask run" # docker-compose should not test the implementation command: sh -c "/wait && flask run" # docker-compose should not test the implementation
environment: environment:
...@@ -241,7 +241,7 @@ services: ...@@ -241,7 +241,7 @@ services:
image: fda-units-service image: fda-units-service
networks: networks:
fda-public: fda-public:
ipv4_address: 172.29.0.7 # ipv4_address: 172.29.0.7
environment: environment:
EUREKA_SERVER: http://fda-discovery-service:9090/eureka/ EUREKA_SERVER: http://fda-discovery-service:9090/eureka/
TZ: Europe/Vienna TZ: Europe/Vienna
...@@ -266,7 +266,7 @@ services: ...@@ -266,7 +266,7 @@ services:
TZ: Europe/Vienna TZ: Europe/Vienna
networks: networks:
fda-public: fda-public:
ipv4_address: 172.29.0.3 # ipv4_address: 172.29.0.3
ports: ports:
- "5672:5672" - "5672:5672"
- "15672:15672" - "15672:15672"
...@@ -286,7 +286,7 @@ services: ...@@ -286,7 +286,7 @@ services:
command: [ "elasticsearch" ] command: [ "elasticsearch" ]
networks: networks:
fda-public: fda-public:
ipv4_address: 172.29.0.6 # ipv4_address: 172.29.0.6
environment: environment:
- discovery.type=single-node - discovery.type=single-node
- "ES_JAVA_OPTS=-Xms512m -Xmx512m" - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
...@@ -308,7 +308,7 @@ services: ...@@ -308,7 +308,7 @@ services:
image: fda-ui image: fda-ui
networks: networks:
fda-public: fda-public:
ipv4_address: 172.29.0.15 # ipv4_address: 172.29.0.15
ports: ports:
- "3000:3000" - "3000:3000"
volumes: volumes:
......
package at.tuwien.seeder; package at.tuwien.seeder;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.event.EventListener;
public interface Seeder { public interface Seeder {
@EventListener(ApplicationReadyEvent.class)
void seed(); void seed();
} }
...@@ -5,6 +5,5 @@ import org.springframework.context.event.EventListener; ...@@ -5,6 +5,5 @@ import org.springframework.context.event.EventListener;
public interface Seeder { public interface Seeder {
@EventListener(ApplicationReadyEvent.class)
void seed(); void seed();
} }
package at.tuwien.config; package at.tuwien.config;
import at.tuwien.seeder.Seeder;
import com.google.common.io.Files; import com.google.common.io.Files;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.event.ApplicationReadyEvent; import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.context.event.EventListener; import org.springframework.context.event.EventListener;
import org.springframework.core.env.Environment;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.Arrays;
@Configuration @Configuration
public class ReadyConfig { public class ReadyConfig {
...@@ -15,8 +19,20 @@ public class ReadyConfig { ...@@ -15,8 +19,20 @@ public class ReadyConfig {
@Value("${fda.ready.path}") @Value("${fda.ready.path}")
private String readyPath; private String readyPath;
private final Environment environment;
private final Seeder seederImpl;
@Autowired
public ReadyConfig(Environment environment, Seeder seederImpl) {
this.environment = environment;
this.seederImpl = seederImpl;
}
@EventListener(ApplicationReadyEvent.class) @EventListener(ApplicationReadyEvent.class)
public void init() throws IOException { public void init() throws IOException {
if (Arrays.asList(environment.getActiveProfiles()).contains("seeder")) {
seederImpl.seed();
}
Files.touch(new File(readyPath)); Files.touch(new File(readyPath));
} }
......
...@@ -5,6 +5,5 @@ import org.springframework.context.event.EventListener; ...@@ -5,6 +5,5 @@ import org.springframework.context.event.EventListener;
public interface Seeder { public interface Seeder {
@EventListener(ApplicationReadyEvent.class)
void seed(); void seed();
} }
...@@ -20,7 +20,6 @@ public class SeederImpl implements Seeder { ...@@ -20,7 +20,6 @@ public class SeederImpl implements Seeder {
} }
@Override @Override
@EventListener(ApplicationReadyEvent.class)
public void seed() { public void seed() {
databaseSeederImpl.seed(); databaseSeederImpl.seed();
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment