diff --git a/.gitea/workflows/deploy.yaml b/.gitea/workflows/deploy.yaml
index 3d8835a..8239a07 100644
--- a/.gitea/workflows/deploy.yaml
+++ b/.gitea/workflows/deploy.yaml
@@ -5,6 +5,12 @@ on:
push:
branches:
- master
+ workflow_run:
+ workflows:
+ - Build and test backend
+ - Build and test frontend
+ types:
+ - completed
workflow_dispatch:
jobs:
@@ -47,5 +53,5 @@ jobs:
scp -o "StrictHostKeyChecking=no" -o "LogLevel=ERROR" -i key -r * ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:api/
- name: restarting the backend
run: |
- ssh -o "StrictHostKeyChecking=no" -o "LogLevel=ERROR" -i key ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} "cd api/backend && docker build -t clyde/backend . && docker run --rm -d -p 4000:8080 clyde/backend && docker image prune -f"
+ ssh -o "StrictHostKeyChecking=no" -o "LogLevel=ERROR" -i key ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} "cd api/backend && docker build -t clyde/backend . && docker rm clyde_backend_prod -f || true && docker run --rm -d --name clyde_backend_prod -p 4000:8080 clyde/backend && docker image prune -f"
- run: echo "The backend has been deployed. running at https://clyde.herisson.ovh/api"
diff --git a/backend/Dockerfile b/backend/Dockerfile
index bcf424a..963bef3 100644
--- a/backend/Dockerfile
+++ b/backend/Dockerfile
@@ -1,4 +1,5 @@
FROM eclipse-temurin:21-jdk-alpine
VOLUME /tmp
+ENV SPRING_PROFILES_ACTIVE=prod
COPY build/libs/backend-0.0.1-SNAPSHOT.jar /app.jar
ENTRYPOINT ["java", "-jar", "/app.jar"]
diff --git a/backend/build.gradle.kts b/backend/build.gradle.kts
index 66019d7..91c7679 100644
--- a/backend/build.gradle.kts
+++ b/backend/build.gradle.kts
@@ -19,7 +19,7 @@ dependencies {
implementation("org.springframework.boot:spring-boot-starter-jdbc")
implementation("org.springframework.boot:spring-boot-starter-mail")
implementation("org.springframework.boot:spring-boot-starter-web")
- implementation("org.springframework.session:spring-session-jdbc")
+ // implementation("org.springframework.session:spring-session-jdbc")
developmentOnly("org.springframework.boot:spring-boot-devtools")
developmentOnly("org.springframework.boot:spring-boot-docker-compose")
runtimeOnly("org.postgresql:postgresql")
diff --git a/backend/src/main/java/ovh/herisson/Clyde/EndPoints/PingController.java b/backend/src/main/java/ovh/herisson/Clyde/EndPoints/PingController.java
index f4f010d..b937610 100644
--- a/backend/src/main/java/ovh/herisson/Clyde/EndPoints/PingController.java
+++ b/backend/src/main/java/ovh/herisson/Clyde/EndPoints/PingController.java
@@ -1,16 +1,18 @@
package ovh.herisson.Clyde.EndPoints;
import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RestController;
import ovh.herisson.Clyde.Ping;
@RestController
+@CrossOrigin(origins = "http://localhost:5173")
public class PingController {
@GetMapping("/ping")
public Ping ping(){
- return new Ping(1, "test");
+ return new Ping(1, "pong");
}
}
diff --git a/backend/src/main/java/ovh/herisson/Clyde/JdbcConfig.java b/backend/src/main/java/ovh/herisson/Clyde/JdbcConfig.java
index 1b6da6a..84c808f 100644
--- a/backend/src/main/java/ovh/herisson/Clyde/JdbcConfig.java
+++ b/backend/src/main/java/ovh/herisson/Clyde/JdbcConfig.java
@@ -4,12 +4,16 @@ import javax.sql.DataSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Profile;
import org.springframework.jdbc.datasource.DriverManagerDataSource;
+import org.springframework.web.servlet.config.annotation.CorsRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class JdbcConfig {
@Bean
+ @Profile("!prod")
public DataSource psqlSource(){
DriverManagerDataSource source = new DriverManagerDataSource();
source.setDriverClassName("org.postgresql.Driver");
@@ -20,4 +24,26 @@ public class JdbcConfig {
return source;
}
+ @Bean
+ @Profile("prod")
+ public DataSource psqlSourceProd(){
+ DriverManagerDataSource source = new DriverManagerDataSource();
+ source.setDriverClassName("org.postgresql.Driver");
+ source.setUrl("jdbc:postgresql://localhost:5432/clyde");
+ source.setUsername("clyde");
+
+ return source;
+ }
+
+
+ @Bean
+ public WebMvcConfigurer corsConfigurer() {
+ return new WebMvcConfigurer() {
+ @Override
+ public void addCorsMappings(CorsRegistry registry) {
+ registry.addMapping("/greeting-javaconfig").allowedOrigins("*");
+ }
+ };
+ }
+
}
diff --git a/frontend/package-lock.json b/frontend/package-lock.json
index 82e0ddf..1b6cf73 100644
--- a/frontend/package-lock.json
+++ b/frontend/package-lock.json
@@ -8,7 +8,8 @@
"name": "clyde",
"version": "0.0.0",
"dependencies": {
- "vue": "^3.4.15"
+ "vue": "^3.4.15",
+ "vue3-toastify": "^0.2.1"
},
"devDependencies": {
"@vitejs/plugin-vue": "^5.0.3",
@@ -2396,6 +2397,27 @@
"integrity": "sha512-0vOfAtI67UjeO1G6UiX5Kd76CqaQ67wrRZiOe7UAb9Jm6GzlUr/fC7CV90XfwapJRjpCMaZFhv1V0ajWRmE9Dg==",
"dev": true
},
+ "node_modules/vue3-toastify": {
+ "version": "0.2.1",
+ "resolved": "https://registry.npmjs.org/vue3-toastify/-/vue3-toastify-0.2.1.tgz",
+ "integrity": "sha512-u4i5LCu1q5qs4L4Kbjb4u8NipCS8ox1fCHQ6XFS62676xnA6Q/AJRpZEkAurTMp723LeH6eQX6k9+24bKf1T4Q==",
+ "workspaces": [
+ "docs",
+ "playground"
+ ],
+ "engines": {
+ "node": ">=16",
+ "npm": ">=7"
+ },
+ "peerDependencies": {
+ "vue": ">=3.2.0"
+ },
+ "peerDependenciesMeta": {
+ "vue": {
+ "optional": true
+ }
+ }
+ },
"node_modules/w3c-xmlserializer": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-5.0.0.tgz",
diff --git a/frontend/package.json b/frontend/package.json
index f28af85..7fef311 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -10,7 +10,8 @@
"test:unit": "vitest"
},
"dependencies": {
- "vue": "^3.4.15"
+ "vue": "^3.4.15",
+ "vue3-toastify": "^0.2.1"
},
"devDependencies": {
"@vitejs/plugin-vue": "^5.0.3",
diff --git a/frontend/src/App.vue b/frontend/src/App.vue
index 3efb969..647d10b 100644
--- a/frontend/src/App.vue
+++ b/frontend/src/App.vue
@@ -1,5 +1,15 @@
@@ -17,7 +27,7 @@
-
-
+
-
diff --git a/frontend/src/main.js b/frontend/src/main.js
index 0ac3a5f..977d357 100644
--- a/frontend/src/main.js
+++ b/frontend/src/main.js
@@ -1,5 +1,7 @@
import './assets/main.css'
+import 'vue3-toastify/dist/index.css';
+
import { createApp } from 'vue'
import App from './App.vue'