11# Configuration — External Database
22
3- Buggregator supports the configuration of external databases for storing events, allows for greater flexibility and
4- scalability in handling event data.
3+ Buggregator typically uses [ DoltDB] ( https://github.com/dolthub/dolt ) by default, which is a MySQL-compatible server.
4+ However, for those who need more flexibility or plan to scale up, Buggregator also supports external databases such as
5+ PostgreSQL and MySQL for data storage.
56
6- ## Configuration Overview
7+ This guide will walk you through how to set up and configure an external database with Buggregator.
78
8- Events in Buggregator are traditionally stored in local in-memory storage by default. After release 1.7.0, users can
9- opt to store events in external databases like ** MongoDB** or ** PostgreSQL** . This configuration is managed via
10- environment variables, enabling easy integration and setup.
11-
12- Buggregator supports the following databases:
13-
14- - PostgreSQL
15- - MongoDB
16-
17- To use an external database, set the ` PERSISTENCE_DRIVER ` environment variable to ` database ` for PostgreSQL or ` mongodb `
18- for MongoDB.
9+ > ** Warning** : Buggregator cannot work with SQLite. SQLite’s architecture does not support non-blocking, asynchronous
10+ > operations.
1911
2012## PostgreSQL
2113
22- Provide the connection details specific to the type of database you are using.
14+ Here’s how you can configure PostgreSQL:
15+
16+ > ** Warning** : Buggregator doesn’t create the database; it only sets up the tables inside it.
2317
2418``` dotenv
25- PERSISTENCE_DRIVER=database
19+ PERSISTENCE_DRIVER=db # database or cycle are also supported as an alias for db
2620
2721DB_DRIVER=pgsql
2822DB_DATABASE=buggregator
@@ -32,56 +26,54 @@ DB_USERNAME=homestead
3226DB_PASSWORD=secret
3327```
3428
35- ### Ensuring the Database is Ready
29+ ## MySQL
3630
37- Before starting Buggregator, make sure that the database is already created and accessible as specified in your
38- environment settings.
31+ Provide the connection details specific to the type of database you are using.
3932
40- > ** Warning** : Buggregator does not create the database itself; it only creates the tables within the existing
41- > database.
33+ > ** Warning** : Buggregator doesn’t create the database; it only sets up the tables inside it.
4234
43- ### Running Migrations
35+ ``` dotenv
36+ PERSISTENCE_DRIVER=db # database or cycle are also supported as an alias for db
37+
38+ DB_DRIVER=mysql
39+ DB_DATABASE=buggregator
40+ DB_HOST=127.0.0.1
41+ DB_PORT=3306
42+ DB_USERNAME=homestead
43+ DB_PASSWORD=secret
44+ ```
45+
46+ ## Migrations
4447
4548Buggregator automatically runs migrations when it starts. However, if you encounter any issues with the automatic
4649migrations, or if they were not executed for some reason, you can run them manually:
4750
48- 1 . ** Connect to the Buggregator container:**
49- Depending on your setup, you might use Docker, Kubernetes, or any other container service. Use the appropriate
50- command to access the shell of the running Buggregator container.
51+ 1 . ** Connect to the container:**
52+ Depending on your setup, you might use Docker, Kubernetes, or any other container service.
5153
5254 For example, if you are using Docker, you can use the following command:
5355
5456 ``` bash
5557 docker exec -it buggregator /bin/bash
5658 ```
5759
58- Replace ` buggregator ` with the name of your Buggregator container.
60+ Replace ` buggregator ` with the name of your container.
5961
6062 If you are using Kubernetes, you can use the following command:
6163
6264 ``` bash
6365 kubectl exec -it buggregator -- /bin/bash
6466 ```
6567
66- Replace ` buggregator` with the name of your Buggregator pod.
68+ Replace ` buggregator` with the name of your pod.
6769
6870
69712. ** Run the migration command:**
70- Within the Buggregator container, execute the following command to force the migrations:
72+ Within the container, execute the following command to force the migrations:
7173
7274 ` ` ` bash
7375 php app.php migrate --force
7476 ` ` `
7577
7678 This command forcefully runs the migrations regardless of the current state, ensuring that all necessary tables are
77- properly set up in the database.
78-
79- # # MongoDB
80-
81- Provide the connection details specific to the type of database you are using.
82-
83- ` ` ` dotenv
84- PERSISTENCE_DRIVER=mongodb
85- MONGODB_CONNECTION=mongodb://127.0.0.1:27017
86- MONGODB_DATABASE=buggregator
87- ` ` `
79+ properly set up in the database.
0 commit comments