Skip to content

Commit 5a9916c

Browse files
committed
issues/1650 Migrate Strongbox from OrientDB to JanusGraph
1 parent 0723cb2 commit 5a9916c

File tree

65 files changed

+2956
-1371
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+2956
-1371
lines changed

Jenkinsfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def notifyBranch = [recipients: [brokenTestsSuspects(), requestor()]]
1212
pipeline {
1313
agent {
1414
node {
15-
label 'alpine-jdk8-mvn-3.5'
15+
label 'alpine-jdk8-mvn3.6'
1616
}
1717
}
1818
parameters {

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
# strongbox-db
22

33
## The goal of this project
4-
This project has been created in order speed up the building of the OrientDB database snapshots during the initial [Strongbox](https://github.com/strongbox/strongbox) startup. Before this project was born, it took some time to do all of the database changes from the beginning of time up until the most recent version, so that the OrientDB database structure would be populated properly.
4+
This project has been created in order speed up the building of the JanusGraph database snapshots during the initial [Strongbox](https://github.com/strongbox/strongbox) startup. Before this project was born, it took some time to do all of the database changes from the beginning of time up until the most recent version, so that the JanusGraph database structure would be populated properly.
55

66
## Architecture
77
This application consists of the following modules:
8-
* `strongbox-db-liquibase` which creates a `jar` file consiting of the liquibase changesets that construct the [Strongbox](https://github.com/strongbox/strongbox) OrientDB database schema
8+
* `strongbox-db-liquibase` which creates a `jar` file consiting of the liquibase changesets that construct the [Strongbox](https://github.com/strongbox/strongbox) JanusGraph database schema
99
* `strongbox-db-import` which creates a `zip` file with packed built database snapshot built from the liquibase changesets
1010

1111
## How is this project used in [strongbox](https://github.com/strongbox/strongbox) ?
12-
[strongbox](https://github.com/strongbox/strongbox) uses this project submodules as required dependencies. During the startup of [Strongbox](https://github.com/strongbox/strongbox), the application detects if an OrientDB database already exists. If not, then the application uses an extracted empty OrientDB database snapshot from the `strongbox-db-import` artifact. If the OrientDB database already exists, then the application applies all missing liquibase changesets from the `strongbox-db-liquibase` artifact.
12+
[strongbox](https://github.com/strongbox/strongbox) uses this project submodules as required dependencies. During the startup of [Strongbox](https://github.com/strongbox/strongbox), the application detects if an JanusGraph database already exists. If not, then the application uses an extracted empty JanusGraph database snapshot from the `strongbox-db-import` artifact. If the JanusGraph database already exists, then the application applies all missing changesets from the `strongbox-db-schema` artifact.
1313

1414
## How to build this project ?
1515
To build the code, simply execute:
1616
`mvn clean install`
1717

1818
## What's the result of the build process ?
1919
This project produces the following artifacts:
20-
* `strongbox-db-liquibase-${version}.jar` : Located in `strongbox-db-liquibase/target`, which contains current database liquibase changesets
20+
* `strongbox-db-shcema-${version}.jar` : Located in `strongbox-db-schema/target`, which contains current database changesets
2121
* `strongbox-db-import-${version}.zip` : Located in `strongbox-db-import/target`, which contains zipped fresh database snapshot built from the above changesets

pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
<parent>
77
<groupId>org.carlspring.strongbox</groupId>
88
<artifactId>strongbox-parent</artifactId>
9-
<version>1.0-SNAPSHOT</version>
9+
<version>1.0-PR-62-SNAPSHOT</version>
1010
</parent>
1111

1212
<artifactId>strongbox-db</artifactId>
1313
<packaging>pom</packaging>
14-
<version>1.0-SNAPSHOT</version>
14+
<version>1.0-PR-19-SNAPSHOT</version>
1515

1616
<properties>
1717
<serverId />
@@ -48,7 +48,7 @@
4848
</dependencies>
4949

5050
<modules>
51-
<module>strongbox-db-liquibase</module>
51+
<module>strongbox-db-schema</module>
5252
<module>strongbox-db-import</module>
5353
<module>strongbox-db-server</module>
5454
</modules>

strongbox-db-import/pom.xml

Lines changed: 6 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -8,87 +8,38 @@
88
<parent>
99
<groupId>org.carlspring.strongbox</groupId>
1010
<artifactId>strongbox-db</artifactId>
11-
<version>1.0-SNAPSHOT</version>
11+
<version>1.0-PR-19-SNAPSHOT</version>
1212
<relativePath>../pom.xml</relativePath>
1313
</parent>
1414

1515
<artifactId>strongbox-db-import</artifactId>
1616
<inceptionYear>2019</inceptionYear>
1717

18-
<properties>
19-
<strongbox.orientdb.path>${project.build.directory}/db</strongbox.orientdb.path>
20-
</properties>
21-
2218
<dependencies>
2319
<dependency>
2420
<groupId>${project.groupId}</groupId>
25-
<artifactId>strongbox-db-liquibase</artifactId>
21+
<artifactId>strongbox-db-server</artifactId>
2622
<version>${project.version}</version>
2723
</dependency>
2824
<dependency>
2925
<groupId>${project.groupId}</groupId>
30-
<artifactId>strongbox-db-server</artifactId>
26+
<artifactId>strongbox-db-schema</artifactId>
3127
<version>${project.version}</version>
3228
</dependency>
33-
29+
3430
<dependency>
3531
<groupId>org.springframework.boot</groupId>
36-
<artifactId>spring-boot-starter-jdbc</artifactId>
37-
</dependency>
38-
39-
<dependency>
40-
<groupId>com.orientechnologies</groupId>
41-
<artifactId>orientdb-jdbc</artifactId>
32+
<artifactId>spring-boot-starter</artifactId>
4233
</dependency>
4334

4435
<dependency>
4536
<groupId>commons-beanutils</groupId>
4637
<artifactId>commons-beanutils</artifactId>
4738
</dependency>
4839

49-
<!-- liquibase -->
50-
<dependency>
51-
<groupId>org.apache.ant</groupId>
52-
<artifactId>ant</artifactId>
53-
<version>1.10.5</version>
54-
</dependency>
55-
<dependency>
56-
<groupId>org.liquibase</groupId>
57-
<artifactId>liquibase-core</artifactId>
58-
<exclusions>
59-
<exclusion>
60-
<groupId>org.apache.ant</groupId>
61-
<artifactId>ant</artifactId>
62-
</exclusion>
63-
</exclusions>
64-
</dependency>
65-
<dependency>
66-
<groupId>org.unbroken-dome.liquibase-orientdb</groupId>
67-
<artifactId>liquibase-orientdb</artifactId>
68-
</dependency>
69-
<dependency>
70-
<groupId>com.mattbertolini</groupId>
71-
<artifactId>liquibase-slf4j</artifactId>
72-
</dependency>
73-
<dependency>
74-
<groupId>org.hibernate.validator</groupId>
75-
<artifactId>hibernate-validator</artifactId>
76-
</dependency>
77-
78-
<!-- helpers -->
79-
<dependency>
80-
<groupId>org.apache.commons</groupId>
81-
<artifactId>commons-lang3</artifactId>
82-
</dependency>
8340
</dependencies>
8441

8542
<build>
86-
<resources>
87-
<resource>
88-
<directory>src/main/resources</directory>
89-
<filtering>true</filtering>
90-
</resource>
91-
</resources>
9243
<plugins>
9344
<plugin>
9445
<groupId>org.springframework.boot</groupId>
@@ -102,6 +53,7 @@
10253
</goals>
10354
<configuration>
10455
<jvmArguments>-Xmx1024m</jvmArguments>
56+
<arguments>--strongbox.db.janus-graph.storage-root=${project.build.directory}/db</arguments>
10557
</configuration>
10658
</execution>
10759
</executions>

strongbox-db-import/src/main/assembly/db-schema.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
</formats>
1010
<fileSets>
1111
<fileSet>
12-
<directory>${project.build.directory}/db/strongbox</directory>
13-
<outputDirectory>META-INF/resources/strongbox/db/strongbox</outputDirectory>
12+
<directory>${project.build.directory}/db</directory>
13+
<outputDirectory>META-INF/org/carlsparing/strongbox/db</outputDirectory>
1414
</fileSet>
1515
</fileSets>
1616
</assembly>

strongbox-db-import/src/main/java/org/carlspring/strongbox/db/Application.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22

33
import org.springframework.boot.SpringApplication;
44
import org.springframework.boot.autoconfigure.SpringBootApplication;
5+
import org.springframework.boot.autoconfigure.validation.ValidationAutoConfiguration;
56
import org.springframework.context.ConfigurableApplicationContext;
67

78
/**
89
* @author Przemyslaw Fusik
910
*/
10-
@SpringBootApplication
11+
@SpringBootApplication(exclude = ValidationAutoConfiguration.class)
1112
public class Application
1213
{
1314

strongbox-db-import/src/main/java/org/carlspring/strongbox/db/orient/OrientDbConfiguration.java

Lines changed: 0 additions & 106 deletions
This file was deleted.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package org.carlspring.strongbox.db.schema;
2+
3+
import org.springframework.context.annotation.Bean;
4+
import org.springframework.context.annotation.Configuration;
5+
6+
@Configuration
7+
public class SchemaConfig
8+
{
9+
10+
@Bean
11+
StrongboxSchema strongboxSchema()
12+
{
13+
return new StrongboxSchema();
14+
}
15+
16+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
package org.carlspring.strongbox.db.server;
2+
3+
import org.janusgraph.core.JanusGraph;
4+
import org.slf4j.Logger;
5+
import org.slf4j.LoggerFactory;
6+
import org.springframework.boot.context.properties.ConfigurationProperties;
7+
import org.springframework.context.annotation.Bean;
8+
import org.springframework.context.annotation.Configuration;
9+
import org.strongbox.db.server.CassandraEmbeddedConfiguration;
10+
import org.strongbox.db.server.CassandraEmbeddedProperties;
11+
import org.strongbox.db.server.EmbeddedDbServer;
12+
import org.strongbox.db.server.EmbeddedJanusGraphWithCassandraServer;
13+
import org.strongbox.db.server.JanusGraphConfiguration;
14+
import org.strongbox.db.server.JanusGraphProperties;
15+
16+
/**
17+
* @author Przemyslaw Fusik
18+
* @author sbespalov
19+
*/
20+
@Configuration
21+
class EmbeddedDbServerConfiguration
22+
{
23+
24+
private static final Logger logger = LoggerFactory.getLogger(EmbeddedDbServerConfiguration.class);
25+
26+
@Bean
27+
EmbeddedDbServer embeddedDbServer(CassandraEmbeddedConfiguration cassandraConfiguration,
28+
JanusGraphConfiguration janusGraphConfiguration)
29+
{
30+
return new EmbeddedJanusGraphWithCassandraServer(cassandraConfiguration, janusGraphConfiguration);
31+
}
32+
33+
@Bean
34+
JanusGraph JanusGraph(EmbeddedDbServer server)
35+
{
36+
return ((EmbeddedJanusGraphWithCassandraServer) server).getJanusGraph();
37+
}
38+
39+
@Bean
40+
@ConfigurationProperties(prefix = "strongbox.db.janus-graph")
41+
JanusGraphConfiguration janusGraphConfiguration()
42+
{
43+
return new JanusGraphProperties();
44+
}
45+
46+
@Bean
47+
CassandraEmbeddedConfiguration cassandraEmbeddedConfiguration(JanusGraphConfiguration janusGraphConfiguration)
48+
{
49+
return CassandraEmbeddedProperties.getInstance(janusGraphConfiguration.getStorageRoot(),
50+
janusGraphConfiguration.getStoragePort());
51+
}
52+
53+
}
Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,15 @@
11
spring:
22
main:
33
web-application-type: NONE
4-
liquibase:
5-
change-log: classpath:/db/changelog/db.changelog-master.xml
64
strongbox:
7-
orientdb:
8-
server:
9-
protocol: remote
10-
host: 127.0.0.1
11-
port: "2025"
12-
database: strongbox
13-
username: admin
14-
password: password
15-
path: @strongbox.orientdb.path@
16-
studio:
17-
ipAddress: 127.0.0.1
18-
port: 2480
19-
enabled: true
20-
path: @strongbox.orientdb.path@
5+
db:
6+
janus-graph:
7+
#TODO: [First start] randomize
8+
storage-username: cassandra
9+
storage-password: cassandra
10+
storage-host: 127.0.0.1
11+
storage-port: 49142
12+
storage-root: ./target/db
2113
logging:
2214
level:
2315
liquibase: INFO

0 commit comments

Comments
 (0)