Compare commits

..

7 Commits

Author SHA1 Message Date
ad4544ab3b
Merge branch 'master' into loginProto 2024-02-29 17:07:00 +01:00
7c9fe9235c
Example of toaster
All checks were successful
Build and test backend / Build-backend (push) Successful in 2m27s
Build and test backend / Test-backend (push) Successful in 1m21s
deploy to production / deploy-frontend (push) Successful in 25s
deploy to production / deploy-backend (push) Successful in 2m3s
Build and test FrontEnd / Build-frontend (push) Successful in 24s
Build and test FrontEnd / Test-frontend (push) Successful in 22s
2024-02-28 17:57:47 +01:00
56df39b584
[fix] wrong file
All checks were successful
Build and test backend / Build-backend (push) Successful in 2m4s
Build and test backend / Test-backend (push) Successful in 1m15s
deploy to production / deploy-frontend (push) Successful in 24s
deploy to production / deploy-backend (push) Successful in 1m58s
Build and test FrontEnd / Build-frontend (push) Successful in 22s
Build and test FrontEnd / Test-frontend (push) Successful in 22s
2024-02-27 19:15:36 +01:00
4c79b9e51f
dependants
All checks were successful
Build and test backend / Build-backend (push) Successful in 1m51s
Build and test backend / Test-backend (push) Successful in 1m19s
deploy to production / deploy-frontend (push) Successful in 24s
deploy to production / deploy-backend (push) Successful in 1m57s
Build and test FrontEnd / Build-frontend (push) Successful in 22s
Build and test FrontEnd / Test-frontend (push) Successful in 22s
2024-02-27 17:16:01 +01:00
6559462f2b
docker pipeline
Some checks failed
deploy to production / deploy-frontend (push) Waiting to run
deploy to production / deploy-backend (push) Waiting to run
Build and test FrontEnd / Build-frontend (push) Waiting to run
Build and test FrontEnd / Test-frontend (push) Waiting to run
Build and test backend / Build-backend (push) Successful in 1m55s
Build and test backend / Test-backend (push) Has been cancelled
2024-02-27 17:12:56 +01:00
43adb6d31f
database on deploy
Some checks failed
Build and test backend / Build-backend (pull_request) Successful in 1m41s
Build and test backend / Test-backend (pull_request) Successful in 1m43s
Build and test FrontEnd / Build-frontend (pull_request) Successful in 24s
Build and test FrontEnd / Test-frontend (pull_request) Successful in 22s
Build and test backend / Build-backend (push) Successful in 1m52s
Build and test backend / Test-backend (push) Successful in 1m20s
deploy to production / deploy-frontend (push) Successful in 24s
deploy to production / deploy-backend (push) Failing after 2m0s
Build and test FrontEnd / Build-frontend (push) Successful in 23s
Build and test FrontEnd / Test-frontend (push) Successful in 22s
2024-02-27 16:55:16 +01:00
9c92e7d1e9
Ajout du CORS Pour le dev local + toastify + exmpl
All checks were successful
Build and test backend / Build-backend (pull_request) Successful in 1m43s
Build and test backend / Test-backend (pull_request) Successful in 1m39s
Build and test FrontEnd / Build-frontend (pull_request) Successful in 23s
Build and test FrontEnd / Test-frontend (pull_request) Successful in 23s
Build and test backend / Build-backend (push) Successful in 1m54s
Build and test backend / Test-backend (push) Successful in 1m15s
deploy to production / deploy-frontend (push) Successful in 23s
deploy to production / deploy-backend (push) Successful in 1m58s
Build and test FrontEnd / Build-frontend (push) Successful in 22s
Build and test FrontEnd / Test-frontend (push) Successful in 22s
tout est dans le titre
2024-02-27 14:24:26 +01:00
9 changed files with 76 additions and 6 deletions

View File

@ -5,6 +5,12 @@ on:
push: push:
branches: branches:
- master - master
workflow_run:
workflows:
- Build and test backend
- Build and test frontend
types:
- completed
workflow_dispatch: workflow_dispatch:
jobs: jobs:
@ -47,5 +53,5 @@ jobs:
scp -o "StrictHostKeyChecking=no" -o "LogLevel=ERROR" -i key -r * ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:api/ scp -o "StrictHostKeyChecking=no" -o "LogLevel=ERROR" -i key -r * ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:api/
- name: restarting the backend - name: restarting the backend
run: | 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" - run: echo "The backend has been deployed. running at https://clyde.herisson.ovh/api"

View File

@ -1,4 +1,5 @@
FROM eclipse-temurin:21-jdk-alpine FROM eclipse-temurin:21-jdk-alpine
VOLUME /tmp VOLUME /tmp
ENV SPRING_PROFILES_ACTIVE=prod
COPY build/libs/backend-0.0.1-SNAPSHOT.jar /app.jar COPY build/libs/backend-0.0.1-SNAPSHOT.jar /app.jar
ENTRYPOINT ["java", "-jar", "/app.jar"] ENTRYPOINT ["java", "-jar", "/app.jar"]

View File

@ -19,7 +19,7 @@ dependencies {
implementation("org.springframework.boot:spring-boot-starter-jdbc") implementation("org.springframework.boot:spring-boot-starter-jdbc")
implementation("org.springframework.boot:spring-boot-starter-mail") implementation("org.springframework.boot:spring-boot-starter-mail")
implementation("org.springframework.boot:spring-boot-starter-web") 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-devtools")
developmentOnly("org.springframework.boot:spring-boot-docker-compose") developmentOnly("org.springframework.boot:spring-boot-docker-compose")
runtimeOnly("org.postgresql:postgresql") runtimeOnly("org.postgresql:postgresql")

View File

@ -1,16 +1,18 @@
package ovh.herisson.Clyde.EndPoints; package ovh.herisson.Clyde.EndPoints;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import ovh.herisson.Clyde.Ping; import ovh.herisson.Clyde.Ping;
@RestController @RestController
@CrossOrigin(origins = "http://localhost:5173")
public class PingController { public class PingController {
@GetMapping("/ping") @GetMapping("/ping")
public Ping ping(){ public Ping ping(){
return new Ping(1, "test"); return new Ping(1, "pong");
} }
} }

View File

@ -4,12 +4,16 @@ import javax.sql.DataSource;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import org.springframework.jdbc.datasource.DriverManagerDataSource; import org.springframework.jdbc.datasource.DriverManagerDataSource;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration @Configuration
public class JdbcConfig { public class JdbcConfig {
@Bean @Bean
@Profile("!prod")
public DataSource psqlSource(){ public DataSource psqlSource(){
DriverManagerDataSource source = new DriverManagerDataSource(); DriverManagerDataSource source = new DriverManagerDataSource();
source.setDriverClassName("org.postgresql.Driver"); source.setDriverClassName("org.postgresql.Driver");
@ -20,4 +24,26 @@ public class JdbcConfig {
return source; 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("*");
}
};
}
} }

View File

@ -8,7 +8,8 @@
"name": "clyde", "name": "clyde",
"version": "0.0.0", "version": "0.0.0",
"dependencies": { "dependencies": {
"vue": "^3.4.15" "vue": "^3.4.15",
"vue3-toastify": "^0.2.1"
}, },
"devDependencies": { "devDependencies": {
"@vitejs/plugin-vue": "^5.0.3", "@vitejs/plugin-vue": "^5.0.3",
@ -2396,6 +2397,27 @@
"integrity": "sha512-0vOfAtI67UjeO1G6UiX5Kd76CqaQ67wrRZiOe7UAb9Jm6GzlUr/fC7CV90XfwapJRjpCMaZFhv1V0ajWRmE9Dg==", "integrity": "sha512-0vOfAtI67UjeO1G6UiX5Kd76CqaQ67wrRZiOe7UAb9Jm6GzlUr/fC7CV90XfwapJRjpCMaZFhv1V0ajWRmE9Dg==",
"dev": true "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": { "node_modules/w3c-xmlserializer": {
"version": "5.0.0", "version": "5.0.0",
"resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-5.0.0.tgz", "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-5.0.0.tgz",

View File

@ -10,7 +10,8 @@
"test:unit": "vitest" "test:unit": "vitest"
}, },
"dependencies": { "dependencies": {
"vue": "^3.4.15" "vue": "^3.4.15",
"vue3-toastify": "^0.2.1"
}, },
"devDependencies": { "devDependencies": {
"@vitejs/plugin-vue": "^5.0.3", "@vitejs/plugin-vue": "^5.0.3",

View File

@ -1,5 +1,15 @@
<script setup> <script setup>
import 'https://kit.fontawesome.com/fb3bbd0a95.js' import 'https://kit.fontawesome.com/fb3bbd0a95.js'
import { toast } from 'vue3-toastify';
import { ref } from 'vue'
const test = ref();
async function draw(e) {
test.value = (await fetch("http://localhost:8080/ping"));
test.value = await test.value.json();
toast(test.value['txt']);
}
</script> </script>
<template> <template>
@ -17,7 +27,7 @@
<ul class="horizontal" style="box-shadow: 0px 3px 3px rgb(0, 0, 0);"> <ul class="horizontal" style="box-shadow: 0px 3px 3px rgb(0, 0, 0);">
<li title="Home"> <li title="Home">
<a href="#home"> <a href="#home">
<img src="./assets/Clyde.png" style="width: 40px; height: auto; margin-top:4px"> <img @click="draw" src="./assets/Clyde.png" style="width: 40px; height: auto; margin-top:4px">
</a> </a>
</li> </li>
<li title="Home"> <li title="Home">

View File

@ -1,5 +1,7 @@
import './assets/main.css' import './assets/main.css'
import 'vue3-toastify/dist/index.css';
import { createApp } from 'vue' import { createApp } from 'vue'
import App from './App.vue' import App from './App.vue'