Skip to content

Commit 6186add

Browse files
authored
Add mongodb + rabbitmq docs (#2051)
## Summary Add documentation for RabbitMQ + MongoD ## How was it tested? Localhost + `npm run build` to test broken links
1 parent 1a31e20 commit 6186add

File tree

3 files changed

+138
-0
lines changed

3 files changed

+138
-0
lines changed
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
---
2+
title: MongoDB
3+
---
4+
5+
MongoDB is a popular NoSQL database that is available on Nixpkgs. You can configure MongoDB for your Devbox project by using our official [MongoDB Plugin](https://github.com/jetify-com/devbox-plugins/tree/main/mongodb).
6+
7+
## Adding MongoDB to your Shell
8+
9+
You can start by adding the mongodb server to your project by running `devbox add mongodb`. We also recommend adding the MongoDB shell for interacting with your database using `devbox add mongosh`:
10+
11+
```json
12+
"packages": [
13+
"mongodb@latest",
14+
"mongosh@latest",
15+
]
16+
```
17+
18+
You can add the MongoDB Plugin to your `devbox.json` by adding it to your `include` list:
19+
20+
```json
21+
"include": [
22+
"github:jetify-com/devbox-plugins?dir=mongodb"
23+
]
24+
```
25+
26+
Adding these packages and the plugin will configure Devbox for working with MongoDB.
27+
28+
## Starting the MongoDB Service
29+
30+
The MongoDB plugin will automatically create a service for you that can be run with `devbox services up`. The process-compose.yaml for this default service is shown below:
31+
32+
```yaml
33+
processes:
34+
mongodb:
35+
command: "mongod --config=$MONGODB_CONFIG --dbpath=$MONGODB_DATA --bind_ip_all"
36+
availability:
37+
restart: on_failure
38+
max_restarts: 5
39+
```
40+
41+
You can configure this service by modifying the environment variable shown below.
42+
43+
If you want to create your own version of the mongodb service, you can create a process-compose.yaml in your project's root, and define a new process named `mongodb`. For more details, see the [process-compose documentation](https://f1bonacc1.github.io/process-compose/)
44+
45+
### Environment Variables
46+
47+
The MongoDB plugin will configure the following environment variables
48+
49+
```bash
50+
MONGODB_CONFIG = ./devbox.d/mongodb/mongod.conf
51+
# Tells Devbox where to look for your mongod.conf file
52+
MONGODB_DATA = ./devbox/virtenv/mongodb/data
53+
# Tells Devbox where MongoDB's data directory should be located
54+
```
55+
56+
You can override the default values of these variables using the `env` section of your devbox.json file.
57+
58+
### Files
59+
60+
The plugin will also create a default [`mongod.conf`] file in your `devbox.d` directory, if one doesn't already exist there. This default file mostly serves as a placeholder, and you can modify it as needed.
61+
62+
For a full list of configuration options, see the [MongoDB documentation](https://www.mongodb.com/docs/v6.0/reference/configuration-options/)
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
---
2+
title: RabbitMQ
3+
---
4+
5+
RabbitMQ is a reliable message and streaming broker. You can configure RabbitMQ for your Devbox project by using our official [RabbitMQ Plugin](https://github.com/jetify-com/devbox-plugins/tree/main/rabbitmq)
6+
7+
## Adding RabbitMQ to your shell
8+
9+
You can start by adding the RabbitMQ server to your project by running `devbox add rabbitmq-server`.
10+
11+
```json
12+
"packages": [
13+
"rabbitmq-server@latest"
14+
]
15+
```
16+
17+
You can then add the RabbitMQ Plugin to your devbox.json by adding it to your `include` list:
18+
19+
```json
20+
"include": [
21+
"github:jetify-com/devbox-plugins?dir=rabbitmq"
22+
]
23+
```
24+
25+
Adding these packages and the plugin will configure Devbox for working with RabbitMQ.
26+
27+
## Starting the RabbitMQ Service
28+
29+
The RabbitMQ plugin will automatically create a service for you that can be run with `devbox service up`. The process-compose.yaml for this service is shown below:
30+
31+
```yaml
32+
processes:
33+
rabbitmq:
34+
command: "rabbitmq-server"
35+
availability:
36+
restart: on_failure
37+
max_restarts: 5
38+
daemon: true
39+
shutdown:
40+
command: "rabbitmqctl shutdown"
41+
rabbitmq-logs:
42+
command: "tail -f $RABBITMQ_LOG_BASE/$RABBITMQ_NODENAME@$(hostname -s).log"
43+
availability:
44+
restart: "always"
45+
```
46+
47+
The `rabbitmq` process starts the server as a daemon in the background, and shuts it down whenever you terminate process compose. The `rabbitmq-logs` service will tail the logs of process-compose, and display them in the process-compose UI. You can configure the services by modifying the environment variables as described below.
48+
49+
If you want to create your own version of the mongodb service, you can create a process-compose.yaml in your project's root, and define a new process named `rabbitmq`. For more details, see the [process-compose documentation](https://f1bonacc1.github.io/process-compose/)
50+
51+
## Environment Variables
52+
53+
The plugin will create the following environment variables:
54+
55+
```bash
56+
RABBITMQ_CONFIG_FILE = {{.DevboxDir}}/conf.d
57+
# Points to the directory containing your rabbitmq.conf file
58+
RABBITMQ_MNESIA_BASE = {{.Virtenv}}/mnesia
59+
# Points to the directory where your node database store, and state files will be kept. Changing this variable is not recommended
60+
RABBITMQ_ENABLED_PLUGINS_FILE = {{.DevboxDir}}/conf.d/enabled_plugins
61+
# Tells rabbit mq where to store the file with your enabled plugins
62+
RABBITMQ_LOG_BASE = {{.Virtenv}}/log
63+
# Where the logs for your RabbitMQ instance will be stored
64+
RABBITMQ_NODENAME = rabbit
65+
# Default nodename for your rabbitmq instance. This variable is used in other settings
66+
RABBITMQ_PID_FILE = {{.Virtenv}}/pid/$RABBITMQ_NODENAME.pid
67+
# Creates RabbitMQ's pidfile in a local directory for your project. Changing this is not recommended.
68+
```
69+
70+
You can override the default values of these variables using the `env` section of your `devbox.json` file. For a full list of environment variables used by RabbitMQ, see the [RabbitMQ Configuration Docs](https://www.rabbitmq.com/docs/configure#customise-environment).
71+
72+
## Files
73+
74+
The plugin will also create a default [`rabbitmq.conf`](https://github.com/jetify-com/devbox-plugins/blob/main/rabbitmq/config/rabbitmq.conf) file in your devbox.d directory, if one doesn't already exist there. This default file serves as a starting point, and you can modify it as needed.
75+
76+
For a full list of configuration options, see the [RabbitMQ Configuration Docs](https://www.rabbitmq.com/docs/configure)

docs/app/docs/devbox_examples/databases/sqlite.md

Whitespace-only changes.

0 commit comments

Comments
 (0)