Skip to content

Commit

Permalink
Add MongoDB to Sail doc
Browse files Browse the repository at this point in the history
  • Loading branch information
GromNaN committed Nov 7, 2024
1 parent 1ae07b0 commit dff07ca
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions sail.md
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,23 @@ Your application's `docker-compose.yml` file also contains an entry for a [Redis

To connect to your application's Redis database from your local machine, you may use a graphical database management application such as [TablePlus](https://tableplus.com). By default, the Redis database is accessible at `localhost` port 6379.

<a name="mongodb"></a>
### MongoDB

If you chose to install the [MongoDB](https://www.mongodb.com/) service when installing Sail, your application's `docker-compose.yml` file contains an entry for a [MongoDB Atlas Local](https://www.mongodb.com/docs/atlas/cli/current/atlas-cli-local-cloud/) container which provides the document database with Atlas features like [Search Indexes](https://www.mongodb.com/docs/atlas/atlas-search/). This container uses a [Docker volume](https://docs.docker.com/storage/volumes/) so that the data stored in your database is persisted even when stopping and restarting your containers.

Once you have started your containers, you may connect to the MongoDB instance within your application by setting your `MONGODB_URI` environment variable within your application's `.env` file to `mongodb://mongodb:27017`. The authentication is disabled by default, but you can set the `MONGODB_USERNAME` and `MONGODB_PASSWORD` environment variables to enable authentication before starting the `mongodb` container. Then you need to set the credentials to the connection string: `mongodb://${MONGODB_USERNAME}:${MONGODB_PASSWORD}@mongodb:27017`.

```ini
MONGODB_USERNAME=user
MONGODB_PASSWORD=laravel
MONGODB_URI=mongodb://${MONGODB_USERNAME}:${MONGODB_PASSWORD}@mongodb:27017
```

For seamless integration of MongoDB with your application, you can install the [package maintained by MongoDB](https://www.mongodb.com/docs/drivers/php/laravel-mongodb/).

To connect to your application's MongoDB database from your local machine, you may use a graphical interface such as [Compass](https://www.mongodb.com/products/tools/compass). By default, the MongoDB database is accessible at `localhost` port `27017`, with authentication only if you modified the `MONGODB_USERNAME` and `MONGODB_PASSWORD` environment variables.

<a name="meilisearch"></a>
### Meilisearch

Expand Down

0 comments on commit dff07ca

Please sign in to comment.