Skip to content

Extracted ArtifactArchiveListing to separate Vertex from Artifact #20

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: issues/1649
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def notifyBranch = [recipients: [brokenTestsSuspects(), requestor()]]
pipeline {
agent {
node {
label 'alpine-jdk8-mvn-3.5'
label 'alpine-jdk8-mvn3.6'
}
}
parameters {
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
# strongbox-db

## The goal of this project
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.
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.

## Architecture
This application consists of the following modules:
* `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
* `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
* `strongbox-db-import` which creates a `zip` file with packed built database snapshot built from the liquibase changesets

## How is this project used in [strongbox](https://github.com/strongbox/strongbox) ?
[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.
[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.

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

## What's the result of the build process ?
This project produces the following artifacts:
* `strongbox-db-liquibase-${version}.jar` : Located in `strongbox-db-liquibase/target`, which contains current database liquibase changesets
* `strongbox-db-shcema-${version}.jar` : Located in `strongbox-db-schema/target`, which contains current database changesets
* `strongbox-db-import-${version}.zip` : Located in `strongbox-db-import/target`, which contains zipped fresh database snapshot built from the above changesets
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
<parent>
<groupId>org.carlspring.strongbox</groupId>
<artifactId>strongbox-parent</artifactId>
<version>1.0-SNAPSHOT</version>
<version>1.0-PR-62-SNAPSHOT</version>
</parent>

<artifactId>strongbox-db</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<version>1.0-PR-20-SNAPSHOT</version>

<properties>
<serverId />
Expand Down Expand Up @@ -48,7 +48,7 @@
</dependencies>

<modules>
<module>strongbox-db-liquibase</module>
<module>strongbox-db-schema</module>
<module>strongbox-db-import</module>
<module>strongbox-db-server</module>
</modules>
Expand Down
60 changes: 6 additions & 54 deletions strongbox-db-import/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,87 +8,38 @@
<parent>
<groupId>org.carlspring.strongbox</groupId>
<artifactId>strongbox-db</artifactId>
<version>1.0-SNAPSHOT</version>
<version>1.0-PR-20-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<artifactId>strongbox-db-import</artifactId>
<inceptionYear>2019</inceptionYear>

<properties>
<strongbox.orientdb.path>${project.build.directory}/db</strongbox.orientdb.path>
</properties>

<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>strongbox-db-liquibase</artifactId>
<artifactId>strongbox-db-server</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>strongbox-db-server</artifactId>
<artifactId>strongbox-db-schema</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>

<dependency>
<groupId>com.orientechnologies</groupId>
<artifactId>orientdb-jdbc</artifactId>
<artifactId>spring-boot-starter</artifactId>
</dependency>

<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
</dependency>

<!-- liquibase -->
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
<version>1.10.5</version>
</dependency>
<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
<exclusions>
<exclusion>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.unbroken-dome.liquibase-orientdb</groupId>
<artifactId>liquibase-orientdb</artifactId>
</dependency>
<dependency>
<groupId>com.mattbertolini</groupId>
<artifactId>liquibase-slf4j</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate.validator</groupId>
<artifactId>hibernate-validator</artifactId>
</dependency>

<!-- helpers -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
</dependencies>

<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
Expand All @@ -102,6 +53,7 @@
</goals>
<configuration>
<jvmArguments>-Xmx1024m</jvmArguments>
<arguments>--strongbox.db.janus-graph.storage-root=${project.build.directory}/db</arguments>
</configuration>
</execution>
</executions>
Expand Down
4 changes: 2 additions & 2 deletions strongbox-db-import/src/main/assembly/db-schema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
</formats>
<fileSets>
<fileSet>
<directory>${project.build.directory}/db/strongbox</directory>
<outputDirectory>META-INF/resources/strongbox/db/strongbox</outputDirectory>
<directory>${project.build.directory}/db</directory>
<outputDirectory>META-INF/org/carlsparing/strongbox/db</outputDirectory>
</fileSet>
</fileSets>
</assembly>
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.validation.ValidationAutoConfiguration;
import org.springframework.context.ConfigurableApplicationContext;

/**
* @author Przemyslaw Fusik
*/
@SpringBootApplication
@SpringBootApplication(exclude = ValidationAutoConfiguration.class)
public class Application
{

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package org.carlspring.strongbox.db.schema;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class SchemaConfig
{

@Bean
StrongboxSchema strongboxSchema()
{
return new StrongboxSchema();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package org.carlspring.strongbox.db.server;

import org.janusgraph.core.JanusGraph;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.strongbox.db.server.CassandraEmbeddedConfiguration;
import org.strongbox.db.server.CassandraEmbeddedProperties;
import org.strongbox.db.server.EmbeddedDbServer;
import org.strongbox.db.server.EmbeddedJanusGraphWithCassandraServer;
import org.strongbox.db.server.JanusGraphConfiguration;
import org.strongbox.db.server.JanusGraphProperties;

/**
* @author Przemyslaw Fusik
* @author sbespalov
*/
@Configuration
class EmbeddedDbServerConfiguration
{

private static final Logger logger = LoggerFactory.getLogger(EmbeddedDbServerConfiguration.class);

@Bean
EmbeddedDbServer embeddedDbServer(CassandraEmbeddedConfiguration cassandraConfiguration,
JanusGraphConfiguration janusGraphConfiguration)
{
return new EmbeddedJanusGraphWithCassandraServer(cassandraConfiguration, janusGraphConfiguration);
}

@Bean
JanusGraph JanusGraph(EmbeddedDbServer server)
{
return ((EmbeddedJanusGraphWithCassandraServer) server).getJanusGraph();
}

@Bean
@ConfigurationProperties(prefix = "strongbox.db.janus-graph")
JanusGraphConfiguration janusGraphConfiguration()
{
return new JanusGraphProperties();
}

@Bean
CassandraEmbeddedConfiguration cassandraEmbeddedConfiguration(JanusGraphConfiguration janusGraphConfiguration)
{
return CassandraEmbeddedProperties.getInstance(janusGraphConfiguration.getStorageRoot(),
janusGraphConfiguration.getStoragePort());
}

}
24 changes: 8 additions & 16 deletions strongbox-db-import/src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,15 @@
spring:
main:
web-application-type: NONE
liquibase:
change-log: classpath:/db/changelog/db.changelog-master.xml
strongbox:
orientdb:
server:
protocol: remote
host: 127.0.0.1
port: "2025"
database: strongbox
username: admin
password: password
path: @strongbox.orientdb.path@
studio:
ipAddress: 127.0.0.1
port: 2480
enabled: true
path: @strongbox.orientdb.path@
db:
janus-graph:
#TODO: [First start] randomize
storage-username: cassandra
storage-password: cassandra
storage-host: 127.0.0.1
storage-port: 49142
storage-root: ./target/db
logging:
level:
liquibase: INFO
Loading