diff --git a/Back-end/Dockerfile b/Back-end/Dockerfile new file mode 100644 index 0000000..e717a79 --- /dev/null +++ b/Back-end/Dockerfile @@ -0,0 +1,25 @@ +# Stage 1: Build the Maven artifact +FROM maven:3.9-eclipse-temurin-17 AS build +WORKDIR /app + +# Optimize build by caching dependencies where possible +COPY pom.xml . +# Download dependencies +RUN mvn dependency:go-offline -B + +# Copy source code and build the JAR +COPY src ./src +RUN mvn clean package -DskipTests + +# Stage 2: Setup the runtime environment +FROM eclipse-temurin:17-jre +WORKDIR /app + +# Copy the constructed fat JAR from the builder stage +COPY --from=build /app/target/starter-1.0.0-SNAPSHOT-fat.jar ./app.jar +COPY keystore.jceks ./ + +EXPOSE 8888 + +# Start the Vert.x application +ENTRYPOINT ["java", "-jar", "app.jar"] diff --git a/Back-end/pom.xml b/Back-end/pom.xml index b221038..416e008 100644 --- a/Back-end/pom.xml +++ b/Back-end/pom.xml @@ -115,6 +115,16 @@ shade + + + *:* + + META-INF/*.SF + META-INF/*.DSA + META-INF/*.RSA + + + diff --git a/Back-end/src/main/java/com/example/starter/DatabaseService.java b/Back-end/src/main/java/com/example/starter/DatabaseService.java index 8742f41..2572260 100644 --- a/Back-end/src/main/java/com/example/starter/DatabaseService.java +++ b/Back-end/src/main/java/com/example/starter/DatabaseService.java @@ -12,9 +12,9 @@ public class DatabaseService { public DatabaseService(Vertx vertx) { pool = JDBCPool.pool(vertx, new JDBCConnectOptions() - .setJdbcUrl("jdbc:postgresql://localhost:5432/postgres?useUnicode=true&characterEncoding=UTF-8") //Url de la bdd - .setUser("postgres") // Nom d'utilisateur PostgreSQL - .setPassword("admin"), // Mot de passe PostgreSQL + .setJdbcUrl("jdbc:postgresql://" + (System.getenv("DB_HOST") != null ? System.getenv("DB_HOST") : "localhost") + ":" + (System.getenv("DB_PORT") != null ? System.getenv("DB_PORT") : "5432") + "/" + (System.getenv("DB_NAME") != null ? System.getenv("DB_NAME") : "postgres") + "?useUnicode=true&characterEncoding=UTF-8") + .setUser(System.getenv("DB_USER") != null ? System.getenv("DB_USER") : "postgres") + .setPassword(System.getenv("DB_PASSWORD") != null ? System.getenv("DB_PASSWORD") : "admin"), new PoolOptions() .setName("") .setMaxSize(16) diff --git a/Front-end/Dockerfile b/Front-end/Dockerfile new file mode 100644 index 0000000..d741d86 --- /dev/null +++ b/Front-end/Dockerfile @@ -0,0 +1,25 @@ +# Stage 1: Build the React application +FROM node:18-alpine AS build +WORKDIR /app + +COPY package.json package-lock.json* ./ +RUN npm install + +COPY . . +RUN npm run build + +# Stage 2: Serve the application using Nginx +FROM nginx:alpine + +# Remove default Nginx static assets +RUN rm -rf /usr/share/nginx/html/* + +# Copy built app from the first stage +COPY --from=build /app/dist /usr/share/nginx/html + +# Replace the default Nginx configuration +COPY nginx.conf /etc/nginx/conf.d/default.conf + +EXPOSE 80 + +CMD ["nginx", "-g", "daemon off;"] diff --git a/Front-end/index.html b/Front-end/index.html index 63968ac..9b72c45 100644 --- a/Front-end/index.html +++ b/Front-end/index.html @@ -4,7 +4,7 @@ - + Projet Dev Web diff --git a/Front-end/nginx.conf b/Front-end/nginx.conf new file mode 100644 index 0000000..34f1760 --- /dev/null +++ b/Front-end/nginx.conf @@ -0,0 +1,12 @@ +server { + listen 80; + server_name localhost; + root /usr/share/nginx/html; + + index index.html; + + # Fallback to index.html for Single Page Applications handling client-side routing + location / { + try_files $uri $uri/ /index.html; + } +} diff --git a/Front-end/package-lock.json b/Front-end/package-lock.json index d7b9ad1..4ac76c5 100644 --- a/Front-end/package-lock.json +++ b/Front-end/package-lock.json @@ -88,6 +88,7 @@ "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.26.10.tgz", "integrity": "sha512-vMqyb7XCDMPvJFFOaT9kxtiRh42GwlZEg1/uIgtZshS5a/8OaduUfCi7kynKgc3Tw/6Uo2D+db9qBttghhmxwQ==", "dev": true, + "peer": true, "dependencies": { "@ampproject/remapping": "^2.2.0", "@babel/code-frame": "^7.26.2", @@ -390,6 +391,7 @@ "resolved": "https://registry.npmjs.org/@emotion/react/-/react-11.14.0.tgz", "integrity": "sha512-O000MLDBDdk/EohJPFUqvnp4qnHeYkVP5B0xEG0D/L7cOKP9kefu2DXn8dj74cQfsEzUqh+sr1RzFqiL1o+PpA==", "license": "MIT", + "peer": true, "dependencies": { "@babel/runtime": "^7.18.3", "@emotion/babel-plugin": "^11.13.5", @@ -433,6 +435,7 @@ "resolved": "https://registry.npmjs.org/@emotion/styled/-/styled-11.14.0.tgz", "integrity": "sha512-XxfOnXFffatap2IyCeJyNov3kiDQWoR08gPUQxvbL7fxKryGBKUZUkG6Hz48DZwVrJSVh9sJboyV1Ds4OW6SgA==", "license": "MIT", + "peer": true, "dependencies": { "@babel/runtime": "^7.18.3", "@emotion/babel-plugin": "^11.13.5", @@ -1786,6 +1789,7 @@ "resolved": "https://registry.npmjs.org/@types/react/-/react-17.0.85.tgz", "integrity": "sha512-5oBDUsRDsrYq4DdyHaL99gE1AJCfuDhyxqF6/55fvvOIRkp1PpKuwJ+aMiGJR+GJt7YqMNclPROTHF20vY2cXA==", "license": "MIT", + "peer": true, "dependencies": { "@types/prop-types": "*", "@types/scheduler": "^0.16", @@ -1840,6 +1844,7 @@ "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.1.tgz", "integrity": "sha512-OvQ/2pUDKmgfCg++xsTX1wGxfTaszcHVcTctW4UJB4hibJx2HXxxO5UmVgyjMa+ZDsiaf5wWLXYpRWMmBI0QHg==", "dev": true, + "peer": true, "bin": { "acorn": "bin/acorn" }, @@ -2218,6 +2223,7 @@ "url": "https://github.com/sponsors/ai" } ], + "peer": true, "dependencies": { "caniuse-lite": "^1.0.30001688", "electron-to-chromium": "^1.5.73", @@ -2298,9 +2304,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001707", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001707.tgz", - "integrity": "sha512-3qtRjw/HQSMlDWf+X79N206fepf4SOOU6SQLMaq/0KkZLmSjPxAkBOQQ+FxbHKfHmYLZFfdWsO3KA90ceHPSnw==", + "version": "1.0.30001781", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001781.tgz", + "integrity": "sha512-RdwNCyMsNBftLjW6w01z8bKEvT6e/5tpPVEgtn22TiLGlstHOVecsX2KHFkD5e/vRnIE4EGzpuIODb3mtswtkw==", "dev": true, "funding": [ { @@ -2315,7 +2321,8 @@ "type": "github", "url": "https://github.com/sponsors/ai" } - ] + ], + "license": "CC-BY-4.0" }, "node_modules/chalk": { "version": "4.1.2", @@ -3052,6 +3059,7 @@ "integrity": "sha512-jV7AbNoFPAY1EkFYpLq5bslU9NLNO8xnEeQXwErNibVryjk67wHVmddTBilc5srIttJDBrB0eMHKZBFbSIABCw==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.12.1", @@ -4301,6 +4309,7 @@ "resolved": "https://registry.npmjs.org/jiti/-/jiti-1.21.7.tgz", "integrity": "sha512-/imKNG4EbWNrVjoNC/1H5/9GFy+tqjGBHCaSsN+P2RnPqjsLmv6UD3Ej+Kj8nBWaRAwyk7kK5ZUc+OEatnTR3A==", "dev": true, + "peer": true, "bin": { "jiti": "bin/jiti.js" } @@ -4959,6 +4968,7 @@ "url": "https://github.com/sponsors/ai" } ], + "peer": true, "dependencies": { "nanoid": "^3.3.8", "picocolors": "^1.1.1", @@ -5148,6 +5158,7 @@ "version": "18.3.1", "resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz", "integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==", + "peer": true, "dependencies": { "loose-envify": "^1.1.0" }, @@ -5200,6 +5211,7 @@ "resolved": "https://registry.npmjs.org/react/-/react-16.14.0.tgz", "integrity": "sha512-0X2CImDkJGApiAlcf0ODKIneSwBPhqJawOa5wCtKbu7ZECrmS26NvtSILynQ66cgkT/RJ4LidJOc3bUESwmU8g==", "license": "MIT", + "peer": true, "dependencies": { "loose-envify": "^1.1.0", "object-assign": "^4.1.1", @@ -5238,6 +5250,7 @@ "version": "18.3.1", "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz", "integrity": "sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==", + "peer": true, "dependencies": { "loose-envify": "^1.1.0", "scheduler": "^0.23.2" @@ -6400,6 +6413,7 @@ "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.15.tgz", "integrity": "sha512-6ANcZRivqL/4WtwPGTKNaosuNJr5tWiftOC7liM7G9+rMb8+oeJeyzymDu4rTN93seySBmbjSfsS3Vzr19KNtA==", "dev": true, + "peer": true, "dependencies": { "esbuild": "^0.21.3", "postcss": "^8.4.43", diff --git a/Front-end/public/images/snow.jpg b/Front-end/public/images/snow.jpg deleted file mode 100644 index a9e9abd..0000000 Binary files a/Front-end/public/images/snow.jpg and /dev/null differ diff --git a/Front-end/src/components/WindInfo.jsx b/Front-end/src/components/WindInfo.jsx index 8d94648..f9a58f5 100644 --- a/Front-end/src/components/WindInfo.jsx +++ b/Front-end/src/components/WindInfo.jsx @@ -32,7 +32,7 @@ function WindInfo({ object, setGraphStates, graphStates, graphRefs, reference}) {lastData ? (
Wind Direction diff --git a/Front-end/src/pages/About.jsx b/Front-end/src/pages/About.jsx index 416ee62..125d056 100644 --- a/Front-end/src/pages/About.jsx +++ b/Front-end/src/pages/About.jsx @@ -25,14 +25,14 @@ function About() {
Notre mission {/* Section Qui sommes-nous */} IoT et météo
@@ -70,7 +70,7 @@ function About() {
Surveillance météo @@ -84,7 +84,7 @@ function About() { {/* Objectif 1 */}
Surveillance en temps réel @@ -104,7 +104,7 @@ function About() { {/* Objectif 2 */}
Précision fiable @@ -122,7 +122,7 @@ function About() { {/* Objectif 3 */}
Gestion IoT @@ -142,7 +142,7 @@ function About() { {/* Objectif 4 */}
Réponse rapide