diff --git a/Jenkinsfile b/Jenkinsfile deleted file mode 100644 index 86d9401..0000000 --- a/Jenkinsfile +++ /dev/null @@ -1,84 +0,0 @@ -pipeline { - agent any - - stages { - stage('Configuration') { - steps { - dir('codiki-properties') { - git url:'https://gitea.takiguchi.ovh/Codiki/codiki-properties.git', branch: 'hexagonal-reforged', credentialsId: 'Jenkins-gitea' - } - script { - sh 'sed -i "s//$(cat ./codiki-properties/passwords/postgresql/codiki_user)/g" ./codiki-properties/application-prod.yml' - sh 'cp ./codiki-properties/application-prod.yml ./backend/codiki-launcher/src/main/resources/application-prod.yml' - sh 'sed -i "s//$(cat ./codiki-properties/passwords/postgresql/codiki_admin)/g" ./docker-compose.yml' - } - } - } - stage('Build') { - steps { - script { - sh """ - sudo /usr/bin/docker build -t codiki-backend -f ./Dockerfile-backend . --no-cache - sudo /usr/bin/docker build -t codiki-frontend -f ./Dockerfile-frontend . --no-cache - sudo /usr/bin/docker save codiki-backend:latest -o ./codiki-backend.tar - sudo /usr/bin/docker save codiki-frontend:latest -o ./codiki-frontend.tar - sudo chown jenkins:jenkins ./codiki-backend.tar - sudo chown jenkins:jenkins ./codiki-frontend.tar - chmod 644 ./codiki-backend.tar - chmod 644 ./codiki-frontend.tar - """ - } - } - } - stage('Deploy') { - steps { - sshPublisher( - publishers: [ - sshPublisherDesc( - configName: 'DebianServer [codiki]', - transfers: [ - sshTransfer( - cleanRemote: false, - excludes: '', - execCommand: '', - execTimeout: 120000, - flatten: false, - makeEmptyDirs: false, - noDefaultExcludes: false, - patternSeparator: '[, ]+', - remoteDirectory: '', - remoteDirectorySDF: false, - removePrefix: '', - sourceFiles: 'codiki-backend.tar,codiki-frontend.tar,docker-compose.yml' - ), - sshTransfer( - cleanRemote: false, - excludes: '', - execCommand: """ - cd /opt/codiki - sudo /usr/bin/docker load < /opt/codiki/codiki-backend.tar - sudo /usr/bin/docker load < /opt/codiki/codiki-frontend.tar - sudo /usr/bin/docker compose down - sudo /usr/bin/docker compose up --detach - """, - execTimeout: 120000, - flatten: false, - makeEmptyDirs: false, - noDefaultExcludes: false, - patternSeparator: '[, ]+', - remoteDirectory: '', - remoteDirectorySDF: false, - removePrefix: '', - sourceFiles: '' - ) - ], - usePromotionTimestamp: false, - useWorkspaceInPromotion: false, - verbose: true - ) - ] - ) - } - } - } -} diff --git a/backend/build.gradle.kts b/backend/build.gradle.kts index faefff4..e1704b3 100644 --- a/backend/build.gradle.kts +++ b/backend/build.gradle.kts @@ -32,6 +32,8 @@ subprojects { testImplementation("org.assertj:assertj-core:3.27.4") testImplementation("org.junit.jupiter:junit-jupiter-api") testImplementation("org.junit.jupiter:junit-jupiter-params") + testImplementation("org.springframework.boot:spring-boot-starter-test") + testImplementation("org.junit.platform:junit-platform-launcher") } tasks.withType { diff --git a/backend/codiki-application/src/test/java/org/codiki/application/publication/KeyGeneratorTest.java b/backend/codiki-application/src/test/java/org/codiki/application/publication/KeyGeneratorTest.java index b71863b..f38bc26 100644 --- a/backend/codiki-application/src/test/java/org/codiki/application/publication/KeyGeneratorTest.java +++ b/backend/codiki-application/src/test/java/org/codiki/application/publication/KeyGeneratorTest.java @@ -27,7 +27,4 @@ class KeyGeneratorTest { assertThat(validationRegex.matcher(result).matches()).isTrue(); }); } - - - } diff --git a/backend/codiki-exposition/pom.xml b/backend/codiki-exposition/pom.xml deleted file mode 100644 index e69de29..0000000 diff --git a/backend/codiki-exposition/src/main/java/org/codiki/exposition/configuration/security/SecurityConfiguration.java b/backend/codiki-exposition/src/main/java/org/codiki/exposition/configuration/security/SecurityConfiguration.java index 74d6d27..ef03e88 100644 --- a/backend/codiki-exposition/src/main/java/org/codiki/exposition/configuration/security/SecurityConfiguration.java +++ b/backend/codiki-exposition/src/main/java/org/codiki/exposition/configuration/security/SecurityConfiguration.java @@ -29,7 +29,7 @@ public class SecurityConfiguration { public SecurityFilterChain securityFilterChain( HttpSecurity httpSecurity, JwtAuthenticationFilter jwtAuthenticationFilter - ) { + ) throws Exception { httpSecurity .csrf(AbstractHttpConfigurer::disable) .httpBasic(Customizer.withDefaults()) diff --git a/backend/codiki-infrastructure/build.gradle.kts b/backend/codiki-infrastructure/build.gradle.kts index 04dab2b..8bfeab6 100644 --- a/backend/codiki-infrastructure/build.gradle.kts +++ b/backend/codiki-infrastructure/build.gradle.kts @@ -1,10 +1,8 @@ plugins { id("io.spring.dependency-management") version "1.1.7" -// kotlin("plugin.jpa") version "2.1.20" } dependencies { -// implementation(kotlin("stdlib")) implementation(project(":codiki-application")) implementation(project(":codiki-domain")) implementation("org.springframework:spring-context") diff --git a/backend/codiki-infrastructure/src/main/java/org/codiki/infrastructure/configuration/JpaConfiguration.java b/backend/codiki-infrastructure/src/main/java/org/codiki/infrastructure/configuration/JpaConfiguration.java index 9025bf6..d75d941 100644 --- a/backend/codiki-infrastructure/src/main/java/org/codiki/infrastructure/configuration/JpaConfiguration.java +++ b/backend/codiki-infrastructure/src/main/java/org/codiki/infrastructure/configuration/JpaConfiguration.java @@ -1,6 +1,6 @@ package org.codiki.infrastructure.configuration; -import org.springframework.boot.persistence.autoconfigure.EntityScan; +import org.springframework.boot.autoconfigure.domain.EntityScan; import org.springframework.context.annotation.Configuration; import org.springframework.data.jpa.repository.config.EnableJpaRepositories; diff --git a/backend/codiki-launcher/src/main/resources/application-docker.yml b/backend/codiki-launcher/src/main/resources/application-docker.yml new file mode 100644 index 0000000..70c9f6e --- /dev/null +++ b/backend/codiki-launcher/src/main/resources/application-docker.yml @@ -0,0 +1,33 @@ +application: + security: + jwt: + secretKey: "secret-key" + expirationDelayInMinutes: 30 + refreshToken: + expirationDelayInDays: 7 + pictures: + path: /opt/codiki/pictures/ + temp-path: /opt/codiki/pictures/temp/ + +logging: + level: + org.springframework.security: DEBUG + +server: + http2: + enabled: true + error: + whitelabel: + enabled: false # Disable html error responses. + include-stacktrace: never + +spring: + datasource: + driverClassName: org.postgresql.Driver + url: jdbc:postgresql://codiki-database:5432/codiki_db + username: codiki_user + password: password + servlet: + multipart: + max-file-size: 150MB + max-request-size: 151MB diff --git a/backend/docker-compose.yml b/backend/docker-compose.yml index 0c8df73..28a78de 100644 --- a/backend/docker-compose.yml +++ b/backend/docker-compose.yml @@ -3,7 +3,7 @@ version: '3.9' services: codiki-database: container_name: "codiki-database" - image: "postgres:17" + image: "postgres:16" ports: - "50001:5432" networks: diff --git a/backend/gradle/wrapper/gradle-wrapper.jar b/backend/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..61285a6 Binary files /dev/null and b/backend/gradle/wrapper/gradle-wrapper.jar differ diff --git a/backend/gradle/wrapper/gradle-wrapper.properties b/backend/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..19a6bde --- /dev/null +++ b/backend/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.0-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/backend/gradlew b/backend/gradlew index ef07e01..adff685 100755 --- a/backend/gradlew +++ b/backend/gradlew @@ -114,7 +114,6 @@ case "$( uname )" in #( NONSTOP* ) nonstop=true ;; esac -CLASSPATH="\\\"\\\"" # Determine the Java command to use to start the JVM. @@ -172,7 +171,6 @@ fi # For Cygwin or MSYS, switch paths to Windows format before running java if "$cygwin" || "$msys" ; then APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) - CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) JAVACMD=$( cygpath --unix "$JAVACMD" ) @@ -212,7 +210,6 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ - -classpath "$CLASSPATH" \ -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ "$@" diff --git a/backend/gradlew.bat b/backend/gradlew.bat index db3a6ac..c4bdd3a 100644 --- a/backend/gradlew.bat +++ b/backend/gradlew.bat @@ -70,11 +70,10 @@ goto fail :execute @rem Setup the command line -set CLASSPATH= @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* :end @rem End local scope for the variables with windows NT shell diff --git a/backend/pom.xml b/backend/pom.xml deleted file mode 100644 index e69de29..0000000 diff --git a/frontend/conf/nginx.conf b/frontend/conf/nginx.conf index 9e37b94..d986ada 100644 --- a/frontend/conf/nginx.conf +++ b/frontend/conf/nginx.conf @@ -20,7 +20,7 @@ http { server_name codiki.org; root /usr/share/nginx/html; - # Fallback to default language if no preference defined by browser + # Fallback to default language if no preference defined by browser if ($accept_language ~ "^$") { set $accept_language "fr"; } @@ -44,11 +44,11 @@ http { } location ~ ^/api { - proxy_pass http://192.168.1.154:50011; + proxy_pass http://codiki-backend:8080; proxy_set_header Host $host:$server_port; proxy_set_header X-Forwarded-Host $server_name; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } } -} \ No newline at end of file +}