Compare commits
7 Commits
1c1035ba95
...
ad4544ab3b
Author | SHA1 | Date | |
---|---|---|---|
ad4544ab3b | |||
7c9fe9235c | |||
56df39b584 | |||
4c79b9e51f | |||
6559462f2b | |||
43adb6d31f | |||
9c92e7d1e9 |
@ -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"
|
||||
|
@ -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"]
|
||||
|
@ -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")
|
||||
|
@ -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");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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("*");
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
24
frontend/package-lock.json
generated
24
frontend/package-lock.json
generated
@ -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",
|
||||
|
@ -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",
|
||||
|
@ -1,5 +1,15 @@
|
||||
<script setup>
|
||||
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>
|
||||
|
||||
<template>
|
||||
@ -17,7 +27,7 @@
|
||||
<ul class="horizontal" style="box-shadow: 0px 3px 3px rgb(0, 0, 0);">
|
||||
<li title="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>
|
||||
</li>
|
||||
<li title="Home">
|
||||
|
@ -1,5 +1,7 @@
|
||||
import './assets/main.css'
|
||||
|
||||
import 'vue3-toastify/dist/index.css';
|
||||
|
||||
import { createApp } from 'vue'
|
||||
import App from './App.vue'
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user