Initial Commit
This commit is contained in:
@@ -0,0 +1,7 @@
|
|||||||
|
# Flyway migration SQL
|
||||||
|
/db-migration.sql
|
||||||
|
|
||||||
|
/result
|
||||||
|
/.gradle
|
||||||
|
/.vscode
|
||||||
|
/.postgres
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
buildscript {
|
||||||
|
dependencies {
|
||||||
|
classpath 'org.flywaydb:flyway-database-postgresql:_'
|
||||||
|
classpath 'org.postgresql:postgresql:_'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
plugins {
|
||||||
|
id 'java'
|
||||||
|
id 'org.flywaydb.flyway' version '13.3.0'
|
||||||
|
id 'org.springframework.boot' version '4.1.1'
|
||||||
|
id 'io.spring.dependency-management' version '1.1.7'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
group = 'com.bernard'
|
||||||
|
version = '1.0'
|
||||||
|
|
||||||
|
java {
|
||||||
|
toolchain {
|
||||||
|
languageVersion = JavaLanguageVersion.of(21)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation Spring.boot.data.jpa
|
||||||
|
implementation Spring.boot.jdbc
|
||||||
|
implementation Spring.boot.thymeleaf
|
||||||
|
implementation Spring.boot.websocket
|
||||||
|
implementation Spring.boot.web
|
||||||
|
implementation 'org.springframework:spring-jdbc:_'
|
||||||
|
implementation 'org.flywaydb:flyway-core:_'
|
||||||
|
implementation 'org.flywaydb:flyway-database-postgresql:_'
|
||||||
|
implementation 'jakarta.validation:jakarta.validation-api:_'
|
||||||
|
runtimeOnly 'org.webjars:jquery:_'
|
||||||
|
runtimeOnly 'org.webjars:lodash:_'
|
||||||
|
developmentOnly Spring.boot.devTools
|
||||||
|
runtimeOnly 'org.postgresql:postgresql:_'
|
||||||
|
runtimeOnly 'org.hibernate.orm:hibernate-core:_'
|
||||||
|
testImplementation Spring.boot.test
|
||||||
|
testRuntimeOnly 'org.junit.platform:junit-platform-launcher:_'
|
||||||
|
|
||||||
|
//Lombok
|
||||||
|
compileOnly 'org.projectlombok:lombok:_'
|
||||||
|
annotationProcessor 'org.projectlombok:lombok:_'
|
||||||
|
|
||||||
|
testCompileOnly 'org.projectlombok:lombok:_'
|
||||||
|
testAnnotationProcessor 'org.projectlombok:lombok:_'
|
||||||
|
}
|
||||||
|
|
||||||
|
flyway {
|
||||||
|
url = "jdbc:postgresql://127.0.0.1:5432/nodecames"
|
||||||
|
user = 'nodecames'
|
||||||
|
password = 'nodecames-dev'
|
||||||
|
driver = 'org.postgresql.Driver'
|
||||||
|
schemas = ['nodecames']
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.named('test') {
|
||||||
|
useJUnitPlatform()
|
||||||
|
}
|
||||||
Generated
+100
@@ -0,0 +1,100 @@
|
|||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"build-gradle-application": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-parts": "flake-parts",
|
||||||
|
"nixpkgs": "nixpkgs",
|
||||||
|
"systems": "systems"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1778276441,
|
||||||
|
"narHash": "sha256-EcIds2qhx8XGnnqDYRHKgmZ/Sz5k8OGcta5inomRtE8=",
|
||||||
|
"ref": "refs/heads/main",
|
||||||
|
"rev": "3ffeebc94a4ba90850fa1afefa84f813c6c2078d",
|
||||||
|
"revCount": 123,
|
||||||
|
"type": "git",
|
||||||
|
"url": "file:/home/mysaa/Documents/Projets/buildGradleApplication"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "file:/home/mysaa/Documents/Projets/buildGradleApplication"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"flake-parts": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs-lib": [
|
||||||
|
"build-gradle-application",
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1777988971,
|
||||||
|
"narHash": "sha256-qIoWPDs+0/8JecyYgE3gpKQxW/4bLW/gp45vow9ioCQ=",
|
||||||
|
"owner": "hercules-ci",
|
||||||
|
"repo": "flake-parts",
|
||||||
|
"rev": "0678d8986be1661af6bb555f3489f2fdfc31f6ff",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "hercules-ci",
|
||||||
|
"repo": "flake-parts",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1777954456,
|
||||||
|
"narHash": "sha256-hGdgeU2Nk87RAuZyYjyDjFL6LK7dAZN5RE9+hrDTkDU=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "549bd84d6279f9852cae6225e372cc67fb91a4c1",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixos-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs_2": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1787209939,
|
||||||
|
"narHash": "sha256-WvvHR4kSQLAbtouMC/ruZ5UpLwlUcY3K4FAllMN+yGk=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "391b592eb44808b3bd0cb80bb71b63a5a118b8bb",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixpkgs-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"build-gradle-application": "build-gradle-application",
|
||||||
|
"nixpkgs": "nixpkgs_2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"systems": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1681028828,
|
||||||
|
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
{
|
||||||
|
description = "NodeCames game server";
|
||||||
|
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||||
|
|
||||||
|
build-gradle-application.url = "git+file:/home/mysaa/Documents/Projets/buildGradleApplication";#"github:raphiz/buildGradleApplication";
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs = { self, nixpkgs, build-gradle-application, ... }@inputs:
|
||||||
|
let system = "x86_64-linux";
|
||||||
|
pkgs = import nixpkgs { inherit system; overlays = [ build-gradle-application.overlays.default ]; };
|
||||||
|
lib = pkgs.lib;
|
||||||
|
jdk = pkgs.openjdk21;
|
||||||
|
gradle = pkgs.gradle;
|
||||||
|
version = "1.0";
|
||||||
|
|
||||||
|
nodecames = pkgs.buildGradleArtifact {
|
||||||
|
pname = "nodecames";
|
||||||
|
src = ./.;
|
||||||
|
buildTask = "bootJar";
|
||||||
|
installPhase = ''
|
||||||
|
cp -r "build/libs/" "$out"
|
||||||
|
'';
|
||||||
|
inherit version jdk gradle;
|
||||||
|
};
|
||||||
|
|
||||||
|
nodecames-launcher = pkgs.writeShellScriptBin "nodecames" ''
|
||||||
|
set -e
|
||||||
|
echo "Checking Database Migration"
|
||||||
|
${pkgs.flyway}/bin/flyway "-url=$NODECAMES_DATABASE" -user=nodecames "-password=$NODECAMES_PASSWORD" -locations="filesystem:${nodecames}/resources/main/db/migration/" -schemas=nodecames migrate
|
||||||
|
|
||||||
|
echo "Launching NodeCames"
|
||||||
|
${jdk}/bin/java -jar ${nodecames}/nodecames-${version}.jar --spring.datasource.url=$NODECAMES_DATABASE --spring.datasource.password=$NODECAMES_PASSWORD "$@"
|
||||||
|
'';
|
||||||
|
postgres-server = pkgs.writeShellScriptBin "postgres-server" ''
|
||||||
|
mkdir -p .postgres
|
||||||
|
${pkgs.podman}/bin/podman run -e POSTGRES_USER=nodecames -e POSTGRES_PASSWORD=nodecames-dev -e POSTGRES_DB=nodecames --volume ./.postgres:/var/lib/postgresql -p 127.0.0.1:5432:5432 postgres:18.4 &> .postgres/postgres.log &
|
||||||
|
'';
|
||||||
|
in {
|
||||||
|
packages.${system} = {
|
||||||
|
default = self.packages.${system}.nodecames;
|
||||||
|
inherit nodecames;
|
||||||
|
};
|
||||||
|
|
||||||
|
apps.${system} = {
|
||||||
|
default = self.apps.${system}.nodecames;
|
||||||
|
nodecames = { type = "app"; program = "${nodecames-launcher}/bin/nodecames"; };
|
||||||
|
postgres-server = { type = "app"; program = "${postgres-server}/bin/postgres-server"; };
|
||||||
|
};
|
||||||
|
|
||||||
|
devShells.${system} = {
|
||||||
|
default = pkgs.mkShell {
|
||||||
|
packages = [
|
||||||
|
jdk
|
||||||
|
gradle
|
||||||
|
(pkgs.vscode-with-extensions.override {
|
||||||
|
vscode = pkgs.vscodium;
|
||||||
|
vscodeExtensions = with pkgs.vscode-extensions; [
|
||||||
|
redhat.java
|
||||||
|
vscjava.vscode-java-debug
|
||||||
|
vscjava.vscode-java-test
|
||||||
|
vscjava.vscode-gradle
|
||||||
|
vscjava.vscode-java-dependency
|
||||||
|
sonarsource.sonarlint-vscode
|
||||||
|
bbenoist.nix
|
||||||
|
redhat.vscode-yaml
|
||||||
|
];
|
||||||
|
})
|
||||||
|
];
|
||||||
|
shellHook = ''
|
||||||
|
echo "Starting Gradle daemon ..."
|
||||||
|
gradle
|
||||||
|
echo "Gradle daemon started."
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
formatter.${system} = pkgs.nixpkgs-fmt;
|
||||||
|
};
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,11 @@
|
|||||||
|
plugins {
|
||||||
|
id 'de.fayard.refreshVersions' version '0.60.6'
|
||||||
|
}
|
||||||
|
dependencyResolutionManagement {
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
||||||
|
}
|
||||||
|
|
||||||
|
rootProject.name = 'nodecames'
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package com.bernard.nodecames;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
public class HttpController {
|
||||||
|
|
||||||
|
@GetMapping("/")
|
||||||
|
public String index() {
|
||||||
|
return "index.html";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package com.bernard.nodecames;
|
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
|
@SpringBootApplication
|
||||||
|
public class NodecamesApplication {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(NodecamesApplication.class, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package com.bernard.nodecames;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.web.servlet.HandlerMapping;
|
||||||
|
import org.springframework.web.servlet.handler.SimpleUrlHandlerMapping;
|
||||||
|
import org.springframework.web.socket.WebSocketHandler;
|
||||||
|
|
||||||
|
import com.bernard.nodecames.frontend.GameWebSocketHandler;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class ThymeleafConfig {
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public HandlerMapping webSocketHandler() {
|
||||||
|
Map<String, WebSocketHandler> map = new HashMap<>();
|
||||||
|
map.put("/path", new GameWebSocketHandler());
|
||||||
|
return new SimpleUrlHandlerMapping(map, -1);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package com.bernard.nodecames.frontend;
|
||||||
|
|
||||||
|
import org.springframework.web.socket.CloseStatus;
|
||||||
|
import org.springframework.web.socket.WebSocketHandler;
|
||||||
|
import org.springframework.web.socket.WebSocketMessage;
|
||||||
|
import org.springframework.web.socket.WebSocketSession;
|
||||||
|
|
||||||
|
public class GameWebSocketHandler implements WebSocketHandler {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handleMessage(WebSocketSession session, WebSocketMessage<?> message) throws Exception {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handleTransportError(WebSocketSession session, Throwable exception) throws Exception {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterConnectionClosed(WebSocketSession session, CloseStatus closeStatus) throws Exception {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterConnectionEstablished(WebSocketSession session) throws Exception {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean supportsPartialMessages() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.bernard.nodecames.model;
|
||||||
|
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class Game {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
spring:
|
||||||
|
datasource:
|
||||||
|
url: jdbc:postgresql://127.0.0.1:5432/nodecames
|
||||||
|
username: nodecames
|
||||||
|
password: nodecames-dev
|
||||||
|
driver-class-name: org.postgresql.Driver
|
||||||
|
hikari:
|
||||||
|
schema: nodecames
|
||||||
|
flyway:
|
||||||
|
enabled: true
|
||||||
|
locations: classpath:db/migration/structure, classpath:db/migration/data
|
||||||
|
validate-on-migrate: true
|
||||||
|
default-schema: nodecames
|
||||||
|
create-schemas: true
|
||||||
|
session:
|
||||||
|
jdbc:
|
||||||
|
initialize-schema: always
|
||||||
|
security:
|
||||||
|
user:
|
||||||
|
name: mysaa
|
||||||
|
|
||||||
|
jpa:
|
||||||
|
properties:
|
||||||
|
javax:
|
||||||
|
persistence:
|
||||||
|
schema-generation:
|
||||||
|
create-source: metadata
|
||||||
|
scripts:
|
||||||
|
action: update
|
||||||
|
create-target: db-migration.sql
|
||||||
|
database:
|
||||||
|
action: none
|
||||||
|
hibernate:
|
||||||
|
ddl-auto: none
|
||||||
|
generate-ddl: true
|
||||||
|
|
||||||
|
logging:
|
||||||
|
level:
|
||||||
|
root: INFO
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@200;300;400;500;600;700&display=swap');
|
||||||
|
*{
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
box-sizing: border-box;
|
||||||
|
font-family: 'Poppins', sans-serif;
|
||||||
|
}
|
||||||
|
main{
|
||||||
|
display: flex;
|
||||||
|
width: 100%;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
color: #3d7091;
|
||||||
|
font-size: 24px;
|
||||||
|
flex-direction: column;
|
||||||
|
margin-top: 115px;
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>NodeCames</title>
|
||||||
|
<link rel="stylesheet" th:href="@{/css/style.css}"/>
|
||||||
|
<!-- Fontawesome CDN Link -->
|
||||||
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.2/css/all.min.css" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="fr" dir="ltr">
|
||||||
|
<head>
|
||||||
|
<div th:replace="~{html-head}"/>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<main>
|
||||||
|
Vous voulez jouer à Node Cames ? Ben c'est pas encore prêt :/
|
||||||
|
</main>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package com.bernard.nodecames;
|
||||||
|
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
|
||||||
|
@SpringBootTest
|
||||||
|
class NodeCamesApplicationTests {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
#### Dependencies and Plugin versions with their available updates.
|
||||||
|
#### Generated by `./gradlew refreshVersions` version 0.60.6
|
||||||
|
####
|
||||||
|
#### Don't manually edit or split the comments that start with four hashtags (####),
|
||||||
|
#### they will be overwritten by refreshVersions.
|
||||||
|
####
|
||||||
|
#### suppress inspection "SpellCheckingInspection" for whole file
|
||||||
|
#### suppress inspection "UnusedProperty" for whole file
|
||||||
|
|
||||||
|
version.com.fasterxml.jackson.core..jackson-databind=2.22.2
|
||||||
|
|
||||||
|
version.com.fasterxml.jackson.datatype..jackson-datatype-hibernate5=2.22.2
|
||||||
|
|
||||||
|
version.jakarta.validation..jakarta.validation-api=3.1.1
|
||||||
|
## # available=4.0.0-M1
|
||||||
|
|
||||||
|
version.jakarta.websocket..jakarta.websocket-api=2.2.0
|
||||||
|
## # available=2.3.0-M1
|
||||||
|
## # available=2.3.0-M2
|
||||||
|
|
||||||
|
version.org.flywaydb..flyway-core=13.3.0
|
||||||
|
|
||||||
|
version.org.flywaydb..flyway-database-postgresql=13.3.0
|
||||||
|
|
||||||
|
version.org.hibernate.orm..hibernate-core=7.4.6.Final
|
||||||
|
## # available=8.0.0.Alpha1
|
||||||
|
## # available=8.0.0.Beta1
|
||||||
|
|
||||||
|
version.org.junit.platform..junit-platform-launcher=6.1.3
|
||||||
|
|
||||||
|
version.org.postgresql..postgresql=42.7.13
|
||||||
|
|
||||||
|
version.org.projectlombok..lombok=1.18.46
|
||||||
|
|
||||||
|
version.org.springframework..spring-jdbc=7.0.9
|
||||||
|
## # available=7.1.0-M1
|
||||||
|
|
||||||
|
version.org.thymeleaf.extras..thymeleaf-extras-springsecurity6=3.1.5.RELEASE
|
||||||
|
|
||||||
|
version.org.webjars..jquery=4.0.0
|
||||||
|
|
||||||
|
version.org.webjars..lodash=4.17.21
|
||||||
Reference in New Issue
Block a user