A command-line interface for managing SurrealDB instances. This CLI allows you to initialize, start, stop, configure, and check the status of SurrealDB databases.
- Initialize a new SurrealDB database
- Start and stop SurrealDB instances
- Configure database settings
- Check the status of running instances
- Background process management
npm install surrealctl --save-dev
npm install -g surrealctl
-
Clone this repository:
git clone https://github.com/daviddyess/surrealctl.git cd surrealctl -
Install dependencies:
npm install
The CLI uses a config.json file for configuration. If this file doesn't exist, it will check for the following environment variables:
SURREAL_PATH: The full path to your database file, including the database file with .db extension. This will be created if it doesn't existSURREAL_USER: The username for database accessSURREAL_PASS: The password for database access
Adding these to your environment variables is preferred if you are using the module as a dependency.
You can create a config.json file manually or use the configure command to set these values, if you are using the CLI as a standalone tool.
config.json:
{
"dataDir": "./data",
"username": "root",
"password": "root"
}init: Initialize a new SurrealDB databasestart: Start a SurrealDB instancestop: Stop the running SurrealDB instanceconfigure: Update configuration settingsstatus: Check the status of the SurrealDB instance
Use npm run help or ./index.js --help for more information on available commands and options.
All commands can be run with npm run if in the surrealctl project directory or directly with npx surrealctl.
npx surrealctl init
npm run init
This command creates a new SurrealDB database using the configured settings.
npx surrealctl start
npm start
Starts the SurrealDB instance in the background.
npx surrealctl stop
npm stop
Stops the running SurrealDB instance.
npx configure -- -d ./my-data -u myuser -p mypassword
npm configure -- -d ./my-data -u myuser -p mypassword
Updates the configuration with new settings.
npx surrealctl status
npm run status
Displays the current status of the SurrealDB instance.
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the Apache 2.0 License - see the LICENSE file for details.