-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding command for exporting database dump to JSON file
- Loading branch information
1 parent
610b8b0
commit dcc5fa7
Showing
13 changed files
with
127 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
backend/src/main/java/ai/dragon/command/DatabaseExportCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package ai.dragon.command; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.ApplicationArguments; | ||
import org.springframework.boot.ApplicationRunner; | ||
import org.springframework.stereotype.Component; | ||
|
||
import ai.dragon.service.DatabaseService; | ||
|
||
@Component | ||
public class DatabaseExportCommand implements ApplicationRunner { | ||
private final Logger logger = LoggerFactory.getLogger(this.getClass()); | ||
|
||
@Autowired | ||
private DatabaseService databaseService; | ||
|
||
@Override | ||
public void run(ApplicationArguments args) throws Exception { | ||
if (args.containsOption("command") && args.containsOption("database-export")) { | ||
logger.info("Database export command received"); | ||
|
||
if(!args.containsOption("output")) { | ||
logger.error("Database export path not provided : --output=/tmp/dump.json"); | ||
System.exit(1); | ||
} | ||
|
||
databaseService.exportDatabase(args.getOptionValues("output").get(0)); | ||
logger.info("Database export completed"); | ||
|
||
System.exit(0); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
label: 'API' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import WIPS from '../../src/components/Admonitions/_wip_section.mdx'; | ||
|
||
# Using API | ||
<WIPS /> | ||
|
||
## Swagger UI | ||
The API documentation is available at [http://localhost:1985/api/swagger-ui/index.html](http://localhost:1985/api/swagger-ui/index.html). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
label: 'Commands' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import WIPS from '../../src/components/Admonitions/_wip_section.mdx'; | ||
|
||
# Database Export | ||
This command is used to export the database to a JSON file. It can be used to backup the database or to move the database to another instance. | ||
|
||
## Offline Export | ||
:::info | ||
|
||
This command should only be used when the backend server is offline. Running this command while the backend server is running may not work as the database could be locked. To export the database while the backend server is running, use the API endpoint below. | ||
|
||
::: | ||
|
||
### Using Gradle | ||
gradle bootRun --args="--command --database-export --output=/path/to/dump.json" | ||
|
||
### Using Java | ||
java -jar backend.jar --command --database-export --output=/path/to/dump.json | ||
|
||
### Using Docker | ||
docker run -v /path/to/output:/output dragon --command --database-export --output=/output/dump.json | ||
|
||
## Online Export | ||
<WIPS /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
label: 'Contributing' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
--- | ||
sidebar_position: 1 | ||
--- | ||
# dRAGon Development Mode | ||
:::warning[Visual Studio Code Dev Containers] | ||
|
||
In order to be as close as possible to the development environment, we **strongly** recommend using Visual Studio Code Dev Containers. You can find the configuration file in the `.devcontainer` folder. | ||
|
||
If it's not possible please make sure you have the following tools installed with the **correct** versions: | ||
* Java 17 | ||
* Gradle 8.7 | ||
* Node.js 20 | ||
* NPM 10 | ||
* "Unix like" System (Linux, MacOS) | ||
|
||
However we do **NOT** accept any issues related to troubles encountered by **NOT** using the Dev Containers. | ||
|
||
::: | ||
|
||
## Clone Repository | ||
```shell | ||
git clone https://github.com/dRAGon-Okinawa/dRAGon | ||
``` | ||
|
||
## Prepare Dependencies | ||
```shell | ||
gradle npmInstall build | ||
``` | ||
|
||
## Launching dRAGon | ||
```shell | ||
gradle bootRun | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,16 @@ | ||
--- | ||
sidebar_position: 1 | ||
--- | ||
import WIPS from '../src/components/Admonitions/_wip_section.mdx'; | ||
|
||
# Getting Started | ||
|
||
Let's discover **dRAGon in less than 5 minutes**. | ||
|
||
## Launching dRAGon | ||
<WIPS /> | ||
|
||
Soon | ||
### Gradle | ||
```shell | ||
gradle bootRun | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import Admonition from '@theme/Admonition'; | ||
|
||
<Admonition type="note" icon="🚧" title={props.title ? props.title : 'Work In Progress'}> | ||
This section lacks useful information. It is a work in progress and will be updated soon. | ||
</Admonition> |
This file was deleted.
Oops, something went wrong.