Bonjour à tous.
Je débute complètment en web et j'essaye d'utiliser les dernières technologies du web (docker compose, api 100% restful...)
Je suis sur un projet d'API spring restful avec docker-compose et plusieurs services:
- mon API meetzicker(image créée automatiquement via Maven à partir du pom.xml et récupérée lors de l'appel docker-compose up)
- db (bdd postgres)
- pgadmin
- je vais aussi ajouter flyway + tard en service mais pour l'instant je veux le supprimer de mon api sur le host, et je ne sais pas comment m'en débarrasser, 3 jours que je suis bloqué.
Code yaml : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59 # meetzicker/docker-compose.yml version: "3.3" services: db: image: postgres:${POSTGRES_VERSION} container_name: db network_mode: bridge volumes: - db-data:/var/lib/postgresql/data expose: - 5432 ports: - 5432:5432 environment: - POSTGRES_DB=${POSTGRES_DB} - POSTGRES_USER=${POSTGRES_USER} - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} restart: unless-stopped pgadmin: image: dpage/pgadmin4 network_mode: bridge container_name: pgadmin4 volumes: - pgadmin-data:/var/lib/pgadmin expose: - 5050 ports: - 5051:5050 links: - db:pgsql-server environment: PGADMIN_DEFAULT_EMAIL: praline40@hotmail.fr PGADMIN_DEFAULT_PASSWORD: ${POSTGRES_PASSWORD} PGADMIN_PORT: 5050 restart: unless-stopped meetzicker: image: meetzicker network_mode: bridge container_name: meetzicker volumes: - meetzicker-data:/var/lib/meetzicker expose: - 8080 ports: - 8080:8080 restart: unless-stopped depends_on: - db volumes: db-data: pgadmin-data: meetzicker-data:
Mon fichier pom.xml ==>> autogénération de l'image de mon API lors de l'appel :
mvn clean install -DskipTests=true
Code XML : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119 <?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> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.3.4.RELEASE</version> <relativePath/> <!-- lookup parent from repository --> </parent> <groupId>com.praline40</groupId> <artifactId>meetzicker</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>jar</packaging> <name>${project.artifactId}</name> <description>MeetZicker REST API</description> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <java.version>1.8</java.version> </properties> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency> <dependency> <groupId>org.hibernate.validator</groupId> <artifactId>hibernate-validator</artifactId> <version>6.0.18.Final</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-validation</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-hateoas</artifactId> </dependency> <dependency> <groupId>org.postgresql</groupId> <artifactId>postgresql</artifactId> <scope>runtime</scope> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> <exclusions> <exclusion> <groupId>org.junit.vintage</groupId> <artifactId>junit-vintage-engine</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> </dependency> <dependency> <groupId>javax.validation</groupId> <artifactId>validation-api</artifactId> <version> 2.0.1.Final </version> </dependency> </dependencies> <build> <finalName>${project.artifactId}</finalName> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> <plugin> <groupId>io.fabric8</groupId> <artifactId>docker-maven-plugin</artifactId> <version>0.20.1</version> <configuration> <images> <image> <name>${project.artifactId}</name> <build> <dockerFileDir>${project.basedir}/src/main/docker</dockerFileDir> <assembly> <mode>dir</mode> <targetDir>/var/lib/${project.artifactId}</targetDir> <descriptor>${project.basedir}/src/main/docker/assembly.xml</descriptor> </assembly> </build> </image> </images> </configuration> <executions> <execution> <id>build</id> <phase>install</phase> <goals> <goal>build</goal> </goals> </execution> </executions> </plugin> </plugins> </build> </project>
Sinon voilà un aperçu de mon application:
Lors du docker-compose up, voici l'erreur que j'obtiens sur le lancement de l'image de mon API:
Code x : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44 meetzicker exited with code 1 meetzicker | wait-for-it.sh: waiting 15 seconds for db:5432 meetzicker | wait-for-it.sh: timeout occurred after waiting 15 seconds for db:5432 meetzicker | meetzicker | . ____ _ __ _ _ meetzicker | /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ meetzicker | ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ meetzicker | \\/ ___)| |_)| | | | | || (_| | ) ) ) ) meetzicker | ' |____| .__|_| |_|_| |_\__, | / / / / meetzicker | =========|_|==============|___/=/_/_/_/ meetzicker | :: Spring Boot :: (v2.3.4.RELEASE) meetzicker | meetzicker | 2021-04-25 14:53:40.815 INFO 42 --- [ main] c.p.MeetZicker.MeetZickerApplication : Starting MeetZickerApplication v0.0.1-SNAPSHOT on 42374ffcaa05 with PID 42 (/var/lib/meetzicker/meetzicker.jar started by root in /var/lib/meetzicker) meetzicker | 2021-04-25 14:53:40.816 INFO 42 --- [ main] c.p.MeetZicker.MeetZickerApplication : The following profiles are active: dev meetzicker | 2021-04-25 14:53:41.268 INFO 42 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFERRED mode. meetzicker | 2021-04-25 14:53:41.337 INFO 42 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 62ms. Found 12 JPA repository interfaces. meetzicker | 2021-04-25 14:53:41.741 INFO 42 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http) meetzicker | 2021-04-25 14:53:41.749 INFO 42 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat] meetzicker | 2021-04-25 14:53:41.749 INFO 42 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.38] meetzicker | 2021-04-25 14:53:41.786 INFO 42 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext meetzicker | 2021-04-25 14:53:41.786 INFO 42 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 939 ms meetzicker | 2021-04-25 14:53:41.877 WARN 42 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'flywayInitializer' defined in class path resource [org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration$FlywayConfiguration.class]: Unsatisfied dependency expressed through method 'flywayInitializer' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flyway' defined in class path resource [org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration$FlywayConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.flywaydb.core.Flyway]: Factory method 'flyway' threw exception; nested exception is org.springframework.boot.autoconfigure.flyway.FlywayMigrationScriptMissingException: Cannot find migration scripts in: [classpath:db/migration] (please add migration scripts or check your Flyway configuration) meetzicker | 2021-04-25 14:53:41.878 INFO 42 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat] meetzicker | 2021-04-25 14:53:41.885 INFO 42 --- [ main] ConditionEvaluationReportLoggingListener : meetzicker | meetzicker | Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. meetzicker | 2021-04-25 14:53:41.886 ERROR 42 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter : meetzicker | meetzicker | *************************** meetzicker | APPLICATION FAILED TO START meetzicker | *************************** meetzicker | meetzicker | Description: meetzicker | meetzicker | Flyway failed to initialize: none of the following migration scripts locations could be found: meetzicker | meetzicker | - classpath:db/migration meetzicker | meetzicker | meetzicker | Action: meetzicker | meetzicker | Review the locations above or check your Flyway configuration meetzicker | meetzicker exited with code 1
Bref la question est simple ! tout est dans le titre: je souhaite me débarrasser de Flyway dans mon api.
Partager