Skip to content

Commit

Permalink
Upgrade (#43)
Browse files Browse the repository at this point in the history
* Bump dependencies and force Neo4J 5 dialect

* Refactor docker-compose.yml with env vars
  • Loading branch information
AlexPresso authored Apr 2, 2024
1 parent 00ad93a commit ce3eb3c
Show file tree
Hide file tree
Showing 13 changed files with 41 additions and 32 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM openjdk:17-jdk-slim
FROM amazoncorretto:22.0.0-alpine3.19

LABEL authors="alexpresso"

Expand Down
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ For Kubernetes clusters, there is a helm chart available in [helm.alexpresso.me]
## Docker
- Download the `docker-compose.yml` file ([docker-compose.yml example](https://github.com/AlexPresso/ZUnivers-Ninja/blob/main/docker-compose.yml))
- Set a Neo4J password in `docker-compose.yml` (i.e: `NEO4J_AUTH=neo4j/MyVeryStrongPassword`)
- Create a `/config` directory next to the docker-compose file
- Create a `/config/application.yml` file (see [config file example](https://github.com/AlexPresso/ZUnivers-Ninja/blob/main/src/main/resources/application.yml))
- Set the Neo4J URI to `bolt://neo4j:7687` and set the password and the webhook URL in `application.yml`
- Don't forget to put the same password for zunivers-ninja's `NEO4J_PASSWORD`
- (Optional) Set a Discord Webhook endpoint if you want to receive advices directly inside a Discord Channel.
- Run `docker compose up -d`

Expand Down
9 changes: 6 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@ services:
app:
image: ghcr.io/alexpresso/zunivers-ninja:latest
container_name: zunivers-ninja
volumes:
- ./config:/app/config
environment:
- NEO4J_URI=bolt://neo4j:7687
- NEO4J_PASSWORD=PASSWORD # change PASSWORD
- DISCORD_TAGS=alexpresso # discord usernames (coma separated)
# - WEBHOOK_URL=https://discord.com/api/webhooks/123456789/token-abcd # (Optional) Set your channel Discord webhook URL
depends_on:
neo4j:
condition: service_healthy
neo4j:
image: neo4j:4.4
image: neo4j:latest
container_name: zunivers-ninja-neo4j
environment:
- NEO4J_AUTH=neo4j/PASSWORD # change PASSWORD
Expand Down
18 changes: 9 additions & 9 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
<version>${zuninjaversion}</version>

<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<zuninjaversion>1.8.6</zuninjaversion>
<springversion>3.0.4</springversion>
<spring.version>3.2.4</spring.version>
</properties>

<distributionManagement>
Expand All @@ -27,19 +27,19 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.4</version>
<version>3.2.4</version>
</parent>

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-neo4j</artifactId>
<version>${springversion}</version>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>${springversion}</version>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
Expand All @@ -49,7 +49,7 @@
<dependency>
<groupId>club.minnced</groupId>
<artifactId>discord-webhooks</artifactId>
<version>0.8.2</version>
<version>0.8.4</version>
</dependency>
<dependency>
<groupId>org.pf4j</groupId>
Expand Down Expand Up @@ -82,8 +82,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>14</source>
<target>14</target>
<source>21</source>
<target>21</target>
</configuration>
</plugin>
<plugin>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package me.alexpresso.zuninja;

import me.alexpresso.zuninja.classes.cache.MemoryCache;
import org.neo4j.cypherdsl.core.renderer.Dialect;
import org.pf4j.spring.SpringPluginManager;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
Expand All @@ -20,4 +21,11 @@ public SpringPluginManager pluginManager() {
public MemoryCache memoryCache() {
return new MemoryCache();
}

@Bean
public org.neo4j.cypherdsl.core.renderer.Configuration cypherDslConfiguration() {
return org.neo4j.cypherdsl.core.renderer.Configuration.newConfig()
.withDialect(Dialect.NEO4J_5)
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
public class BaseGraphObject {
@Id
@GeneratedValue
protected Long graphObjectId;
protected String graphObjectId;
protected String id;

public Long getGraphObjectId() {
public String getGraphObjectId() {
return this.graphObjectId;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import java.time.LocalDateTime;
import java.util.Set;

public interface EventRepository extends Neo4jRepository<Event, Long> {
public interface EventRepository extends Neo4jRepository<Event, String> {
@Query(
"MATCH (e:Event) WHERE e.beginDate <= $0 AND $0 <= e.endDate " +
"RETURN e"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
import me.alexpresso.zuninja.domain.nodes.item.Fusion;
import org.springframework.data.neo4j.repository.Neo4jRepository;

public interface FusionRepository extends Neo4jRepository<Fusion, Long> {
public interface FusionRepository extends Neo4jRepository<Fusion, String> {
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
import me.alexpresso.zuninja.domain.nodes.item.Item;
import org.springframework.data.neo4j.repository.Neo4jRepository;

public interface ItemRepository extends Neo4jRepository<Item, Long> {
public interface ItemRepository extends Neo4jRepository<Item, String> {
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
import me.alexpresso.zuninja.domain.nodes.item.Pack;
import org.springframework.data.neo4j.repository.Neo4jRepository;

public interface PackRepository extends Neo4jRepository<Pack, Long> {
public interface PackRepository extends Neo4jRepository<Pack, String> {
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@

import java.util.Optional;

public interface UserRepository extends Neo4jRepository<User, Long> {
public interface UserRepository extends Neo4jRepository<User, String> {
Optional<User> findByDiscordUserName(String username);
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
import me.alexpresso.zuninja.domain.nodes.user.UserStatistics;
import org.springframework.data.neo4j.repository.Neo4jRepository;

public interface UserStatisticsRepository extends Neo4jRepository<UserStatistics, Long> {
public interface UserStatisticsRepository extends Neo4jRepository<UserStatistics, String> {
}
16 changes: 8 additions & 8 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
spring.neo4j:
uri: bolt://127.0.0.1:7687
uri: ${NEO4J_URI:bolt://127.0.0.1:7687}
authentication:
username: neo4j
password: changeme
username: ${NEO4J_USERNAME:neo4j}
password: ${NEO4J_PASSWORD:changeme}

toolkit:
discordTags: alexpresso
runAutomatedTasks: false
discordTags: ${DISCORD_TAGS:alexpresso}
runAutomatedTasks: ${RUN_AUTOMATED_TASKS:false}

zunivers:
apiBaseUrl: zunivers-api.zerator.com
frontBaseUrl: zunivers.zerator.com
apiBaseUrl: ${API_BASE_URL:zunivers-api.zerator.com}
frontBaseUrl: ${FRONT_BASE_URL:zunivers.zerator.com}

webhookUrl: #Use your own
webhookUrl: ${WEBHOOK_URL} #Use your own

logging:
level:
Expand Down

0 comments on commit ce3eb3c

Please sign in to comment.