Database commands
Create, deploy and manage Postgres, MySQL, MariaDB, MongoDB and Redis databases from the CLI.
Each database type has its own group: postgres, mysql, mariadb, mongo and redis. You must be authenticated.
Commands
All groups share the same actions. Replace <group> with the type and <id> with its ID option: --postgresId, --mysqlId, --mariadbId, --mongoId or --redisId.
| Command | What it does |
|---|---|
wtree-cloud-cli <group> create | Create a database. |
wtree-cloud-cli <group> one <id> | Get the details of a database. |
wtree-cloud-cli <group> search | Search databases. |
wtree-cloud-cli <group> deploy <id> | Deploy a database. |
wtree-cloud-cli <group> start <id> | Start a database. |
wtree-cloud-cli <group> stop <id> | Stop a running database. |
wtree-cloud-cli <group> rebuild <id> | Rebuild a database. |
wtree-cloud-cli <group> update <id> | Update the settings of a database. |
wtree-cloud-cli <group> save-environment <id> --env <value> | Save the environment variables. |
wtree-cloud-cli <group> save-external-port <id> --externalPort <port> | Set the external port. |
wtree-cloud-cli <group> move <id> --targetEnvironmentId <id> | Move a database to another environment. |
wtree-cloud-cli <group> remove <id> | Delete a database. |
Create options
| Group | Required options |
|---|---|
postgres | --name, --databaseName, --databaseUser, --databasePassword, --environmentId |
mysql | --name, --databaseName, --databaseUser, --databasePassword, --environmentId |
mariadb | --name, --databaseName, --databaseUser, --databasePassword, --environmentId |
mongo | --name, --databaseUser, --databasePassword, --environmentId |
redis | --name, --databasePassword, --environmentId |
Every group also accepts --appName, --dockerImage, --description and --serverId.
Examples
# Create a postgres database
wtree-cloud-cli postgres create \
--name "my-db" \
--databaseName app \
--databaseUser app \
--databasePassword "a-strong-password" \
--environmentId env123
# Deploy it
wtree-cloud-cli postgres deploy --postgresId pg123
# Stop a redis database
wtree-cloud-cli redis stop --redisId redis123
# Delete a mysql database
wtree-cloud-cli mysql remove --mysqlId mysql123