Compare commits
No commits in common. "94be7062269d7e1b242986bc90096b5631f33733" and "881b30e5c9de0823496c608204728637e5aa49c5" have entirely different histories.
94be706226
...
881b30e5c9
29
README.md
29
README.md
@ -9,33 +9,10 @@ Projet du groupe 01:
|
|||||||
- William Karpinski: Extension gestion des horaires
|
- William Karpinski: Extension gestion des horaires
|
||||||
- Léo Moulin: Extension inscription des étudiants
|
- Léo Moulin: Extension inscription des étudiants
|
||||||
|
|
||||||
## Running
|
|
||||||
|
|
||||||
Le projet peut être lancé grace à docker compose.
|
|
||||||
|
|
||||||
```sh
|
|
||||||
$ docker compose up
|
|
||||||
```
|
|
||||||
|
|
||||||
Dans le cas ou vous modifiers des fichiers, pour éviter que les images de docker soient recrées avec les changement
|
|
||||||
|
|
||||||
```sh
|
|
||||||
$ docker compose up --force-recreate --build
|
|
||||||
```
|
|
||||||
|
|
||||||
## Dévelopement
|
## Dévelopement
|
||||||
|
|
||||||
Dans le cas ou vous êtes dans une phase de développement, il est plus simple d'utiliser gradle pour lancer le backend et frontend dans un mode de développement.
|
|
||||||
**Attention**: Ce mode n'est pas fait pour être utilisé en production!
|
|
||||||
|
|
||||||
```sh
|
|
||||||
$ ./gradlew run --parallel
|
|
||||||
```
|
```
|
||||||
|
$ ./gradlew backend:run frontend:run --parallel
|
||||||
|
```
|
||||||
|
|
||||||
permet de lancer le frontend sur [http://localhost:5173](http://localhost:5173) ansi que le frontend sur [http://localhost:8080](http://localhost:8080)
|
permet de lancer le frontend sur [http://localhost:5173](http://localhost:5173) ansi que le frontend sur [http://localhost:8080](http://localhost:8080)
|
||||||
|
|
||||||
Ceci requière également docker pour lancer une instance de postgresql pris en charge par spring.
|
|
||||||
|
|
||||||
Il est possible de se passer entièrement de docker en supprimant la dépendance dans le fichier `backend/build.gradle.kts`: ~~`developmentOnly("org.springframework.boot:spring-boot-docker-compose")`~~
|
|
||||||
Il est alors nécéssaire d'avoir une instance de postgresql tournant sur `localhost:5432` avec une table `clyde`, utilisateur: `devel` et password: `devel`
|
|
||||||
(cette configuration peut également être changée dans le fichier resources/application.properties de spring)
|
|
||||||
|
|
||||||
|
@ -1,15 +1,6 @@
|
|||||||
## Building phase
|
|
||||||
FROM gradle:jdk21-alpine AS BUILD
|
|
||||||
WORKDIR /backend
|
|
||||||
|
|
||||||
COPY . .
|
|
||||||
RUN gradle build -x test
|
|
||||||
|
|
||||||
## Running Phase
|
|
||||||
FROM eclipse-temurin:21-jdk-alpine
|
FROM eclipse-temurin:21-jdk-alpine
|
||||||
WORKDIR /backend
|
VOLUME /tmp
|
||||||
VOLUME /cdn
|
VOLUME /cdn
|
||||||
# ENV SPRING_PROFILES_ACTIVE=prod
|
ENV SPRING_PROFILES_ACTIVE=prod
|
||||||
COPY --from=BUILD /backend/build/libs/Clyde-0.0.1-SNAPSHOT.jar /backend/app.jar
|
COPY build/libs/backend-0.0.1-SNAPSHOT.jar /app.jar
|
||||||
EXPOSE 8080
|
ENTRYPOINT ["java", "-jar", "/app.jar"]
|
||||||
ENTRYPOINT ["java", "-jar", "/backend/app.jar"]
|
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file was generated by the Gradle 'init' task.
|
|
||||||
*
|
|
||||||
* The settings file is used to specify which projects to include in your build.
|
|
||||||
* For more detailed information on multi-project builds, please refer to https://docs.gradle.org/8.6/userguide/multi_project_builds.html in the Gradle documentation.
|
|
||||||
*/
|
|
||||||
|
|
||||||
plugins {
|
|
||||||
// Apply the foojay-resolver plugin to allow automatic download of JDKs
|
|
||||||
id("org.gradle.toolchains.foojay-resolver-convention") version "0.7.0"
|
|
||||||
}
|
|
||||||
|
|
||||||
rootProject.name = "Clyde"
|
|
37
backend/src/main/java/ovh/herisson/Clyde/JdbcConfig.java
Normal file
37
backend/src/main/java/ovh/herisson/Clyde/JdbcConfig.java
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
package ovh.herisson.Clyde;
|
||||||
|
|
||||||
|
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.scheduling.annotation.EnableScheduling;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
@EnableScheduling
|
||||||
|
public class JdbcConfig {
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
@Profile("!prod")
|
||||||
|
public DataSource psqlSource(){
|
||||||
|
DriverManagerDataSource source = new DriverManagerDataSource();
|
||||||
|
source.setDriverClassName("org.postgresql.Driver");
|
||||||
|
source.setUrl("jdbc:postgresql://localhost:5442/clyde");
|
||||||
|
source.setUsername("devel");
|
||||||
|
source.setPassword("devel");
|
||||||
|
|
||||||
|
return source;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
@Profile("prod")
|
||||||
|
public DataSource psqlSourceProd(){
|
||||||
|
DriverManagerDataSource source = new DriverManagerDataSource();
|
||||||
|
source.setDriverClassName("org.postgresql.Driver");
|
||||||
|
source.setUrl("jdbc:postgresql:clyde?socketFactory=org.newsclub.net.unix.AFUNIXSocketFactory$FactoryArg&socketFactoryArg=/var/run/postgresql/.s.PGSQL.5432");
|
||||||
|
source.setUsername("clyde");
|
||||||
|
|
||||||
|
return source;
|
||||||
|
}
|
||||||
|
}
|
@ -1,12 +1,3 @@
|
|||||||
spring.jpa.hibernate.ddl-auto=create-drop
|
spring.jpa.hibernate.ddl-auto=create-drop
|
||||||
spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect
|
spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect
|
||||||
spring.sql.init.mode=always
|
spring.sql.init.mode=always
|
||||||
|
|
||||||
# spring.datasource.url=jdbc:postgresql://localhost:5442/clyde
|
|
||||||
spring.datasource.url=jdbc:postgresql://db:5432/clyde
|
|
||||||
spring.datasource.username=devel
|
|
||||||
spring.datasource.password=devel
|
|
||||||
|
|
||||||
# spring.config.activate.on-profile=prod
|
|
||||||
# spring.datasource.url=jdbc:postgresql:clyde?socketFactory=org.newsclub.net.unix.AFUNIXSocketFactory$FactoryArg&socketFactoryArg=/var/run/postgresql/.s.PGSQL.5432
|
|
||||||
# spring.datasource.username=clyde
|
|
||||||
|
29
compose.yaml
29
compose.yaml
@ -1,29 +0,0 @@
|
|||||||
services:
|
|
||||||
db:
|
|
||||||
image: 'postgres:16'
|
|
||||||
environment:
|
|
||||||
- 'POSTGRES_DB=clyde'
|
|
||||||
- 'POSTGRES_USER=devel'
|
|
||||||
- 'POSTGRES_PASSWORD=devel'
|
|
||||||
# Uncomment this to allow connections to the db from outside the container
|
|
||||||
# ports:
|
|
||||||
# - '5442:5432'
|
|
||||||
back:
|
|
||||||
build: backend/.
|
|
||||||
ports:
|
|
||||||
- "8080:8080"
|
|
||||||
volumes:
|
|
||||||
- cdn:/backend/cdn
|
|
||||||
ulimits:
|
|
||||||
nofile:
|
|
||||||
soft: 65536
|
|
||||||
hard: 65536
|
|
||||||
front:
|
|
||||||
build: frontend/.
|
|
||||||
volumes:
|
|
||||||
- cdn:/app/front/dist/cdn
|
|
||||||
ports:
|
|
||||||
- "8000:8080"
|
|
||||||
|
|
||||||
volumes:
|
|
||||||
cdn:
|
|
@ -1,11 +0,0 @@
|
|||||||
# https://v2.vuejs.org/v2/cookbook/dockerize-vuejs-app
|
|
||||||
FROM node:lts-alpine
|
|
||||||
RUN npm install -g http-server
|
|
||||||
WORKDIR /app/front
|
|
||||||
COPY package*.json ./
|
|
||||||
RUN npm install
|
|
||||||
COPY . .
|
|
||||||
ENV VITE_CLYDE_MODE=container
|
|
||||||
RUN npm run build
|
|
||||||
EXPOSE 8080
|
|
||||||
CMD [ "http-server", "dist" ]
|
|
@ -1,7 +1,7 @@
|
|||||||
import { getCookie } from '../utils.js'
|
import { getCookie } from '../utils.js'
|
||||||
import { toast } from 'vue3-toastify'
|
import { toast } from 'vue3-toastify'
|
||||||
|
|
||||||
const restURL = import.meta.env.VITE_CLYDE_MODE === 'container' ? "http://localhost:8080": import.meta.env.DEV ? "http://localhost:8080" : "https://clyde.herisson.ovh/api"
|
const restURL = import.meta.env.PROD ? "https://clyde.herisson.ovh/api" : "http://localhost:8080"
|
||||||
|
|
||||||
export async function restGet(endPoint) {
|
export async function restGet(endPoint) {
|
||||||
return await _rest(endPoint, {method: "GET"});
|
return await _rest(endPoint, {method: "GET"});
|
||||||
|
Loading…
Reference in New Issue
Block a user