Skip to content

Commit 5748d0c

Browse files
authored
Update docs to use versions + Global commands (#1068)
## Summary - [x] Update Docs to show latest Global commands in CLI Reference - [x] Update examples to use versions - [x] Add Template Docs - [x] Document Autolatest ## How was it tested? Localhost
1 parent 5ff0bdb commit 5748d0c

27 files changed

+297
-181
lines changed

devbox.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@
2323
"nixpkgs": {
2424
"commit": "3364b5b117f65fe1ce65a3cdd5612a078a3b31e3"
2525
}
26-
}
26+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# devbox create
2+
3+
Initialize a directory as a devbox project using a template
4+
5+
## Synopsis
6+
7+
Initialize a directory as a devbox project. This will create an empty devbox.json in the current directory. You can then add packages using `devbox add`
8+
9+
```bash
10+
devbox create [dir] --template <template> [flags]
11+
```
12+
13+
## List of templates
14+
15+
* [**go**](https://github.com/jetpack-io/devbox/tree/main/examples/development/go)
16+
* [**node-npm**](https://github.com/jetpack-io/devbox/tree/main/examples/development/nodejs/nodejs-npm/)
17+
* [**node-typescript**](https://github.com/jetpack-io/devbox/tree/main/examples/development/nodejs/nodejs-typescript/)
18+
* [**node-yarn**](https://github.com/jetpack-io/devbox/tree/main/examples/development/nodejs/nodejs-yarn/)
19+
* [**php**](https://github.com/jetpack-io/devbox/tree/main/examples/development/php/)
20+
* [**python-pip**](https://github.com/jetpack-io/devbox/tree/main/examples/development/python/pip/)
21+
* [**python-pipenv**](https://github.com/jetpack-io/devbox/tree/main/examples/development/python/pipenv/)
22+
* [**python-poetry**](https://github.com/jetpack-io/devbox/tree/main/examples/development/python/poetry/)
23+
* [**ruby**](https://github.com/jetpack-io/devbox/tree/main/examples/development/ruby/)
24+
* [**rust**](https://github.com/jetpack-io/devbox/tree/main/examples/development/rust/)
25+
26+
27+
## Options
28+
29+
<!--Markdown Table of Options -->
30+
| Option | Description |
31+
| --- | --- |
32+
| `-h, --help` | help for init |
33+
| `-t, --template string` | Template to use for the project.
34+
| `-q, --quiet` | Quiet mode: Suppresses logs. |
35+
36+
## SEE ALSO
37+
38+
* [devbox](./devbox.md) - Instant, easy, predictable shells and containers
39+
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# devbox global install
2+
3+
Install all packages mentioned in your global devbox.json.
4+
5+
```bash
6+
devbox global install <pkg>... [flags]
7+
```
8+
9+
## Options
10+
11+
<!-- Markdown Table of Options -->
12+
| Option | Description |
13+
| --- | --- |
14+
| `-h, --help` | help for global install |
15+
| `-q, --quiet` | suppresses logs |
16+
17+
## SEE ALSO
18+
19+
* [devbox global](devbox_global.md) - Manages global Devbox packages
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# devbox global run
2+
3+
Starts a new shell and runs your script or command in it, exiting when done.
4+
5+
The script must be defined in `devbox.json`, or else it will be interpreted as an arbitrary command. You can pass arguments to your script or command. Everything after `--` will be passed verbatim into your command (see example)
6+
7+
```bash
8+
devbox global run <pkg>... [flags]
9+
```
10+
11+
## Examples
12+
13+
Run a command directly:
14+
15+
```bash
16+
devbox add cowsay
17+
devbox global run cowsay hello
18+
devbox global run -- cowsay -d hello
19+
```
20+
21+
Run a script (defined as `"moo": "cowsay moo"`) in your devbox.json:
22+
23+
```bash
24+
devbox global run moo
25+
```
26+
27+
## Options
28+
29+
<!-- Markdown Table of Options -->
30+
| Option | Description |
31+
| --- | --- |
32+
| `-h, --help` | help for global run |
33+
| `-q, --quiet` | suppresses logs |
34+
35+
## SEE ALSO
36+
37+
* [devbox global](devbox_global.md) - Manages global Devbox packages
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# devbox global services
2+
3+
Interact with Devbox services for your global packages. This command replicates the subcommands for [devbox services](devbox_services.md) but for your global packages.
4+
5+
```bash
6+
devbox global services [command]
7+
```
8+
9+
## Options
10+
11+
<!-- Markdown Table of Options -->
12+
| Option | Description |
13+
| --- | --- |
14+
| `-h, --help` | help for global services |
15+
| `-q, --quiet` | suppresses logs |
16+
17+
## SEE ALSO
18+
19+
* [devbox global](devbox_global.md) - Manages global Devbox packages
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# devbox global update
2+
3+
Updates packages in your Devbox global config to the latest available version.
4+
5+
## Synopsis
6+
7+
If you provide this command with a list of packages, it will update those packages to the latest available version based on the version tag provided.
8+
9+
For example: if your global config has `[email protected]` in your package list, running `devbox update` will update to the latest patch version of `python 3.11`.
10+
11+
If no packages are provided, this command will update all the versioned packages to the latest acceptable version.
12+
13+
```bash
14+
devbox update [pkg]... [flags]
15+
```
16+
17+
## Options
18+
19+
<!-- Markdown Table of Options -->
20+
| Option | Description |
21+
| --- | --- |
22+
| `-h, --help` | help for update |
23+
| `-q, --quiet` | suppresses logs |
24+
25+
## SEE ALSO
26+
27+
* [devbox global](devbox_global.md) - Manages global Devbox packages
Lines changed: 35 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: MariaDB
33
---
4-
To use a local MariaDB for development with Devbox and Nix, you will need to configure MariaDB to install and manage the configuration locally. This can be done using Environment variables to create the data directory, pidfile, and unix sock locally.
4+
MariaDB can be automatically configured for your dev environment by Devbox via the built-in MariaDB Plugin. This plugin will activate automatically when you install MariaDB using `devbox add mariadb`, or when you use a versioned Nix package like `devbox add mariadb_1010`
55

66
[**Example Repo**](https://github.com/jetpack-io/devbox/tree/main/examples/databases/mariadb)
77

@@ -13,47 +13,50 @@ To use a local MariaDB for development with Devbox and Nix, you will need to con
1313

1414
```json
1515
"packages": [
16-
"mariadb"
16+
"mariadb@latest"
1717
]
1818
```
1919

20-
## Environment Variables
20+
You can manually add the MariaDB Plugin to your `devbox.json` by adding it to your `includes` list:
2121

22-
This script should be sourced in the `init_hook` of our devbox.json. This sets environment variables needed to configure and start MariaDB, as well as setting the data directory to a local folder.
23-
24-
```bash
25-
# Environment variables for running MariaDB with local configuration
26-
export MYSQL_BASEDIR=$(which mariadb | sed -r "s/\/bin\/mariadb//g")
27-
export MYSQL_HOME=$PWD/conf/mysql # or another folder in your project directory
28-
# Store DB data in a local folder
29-
export MYSQL_DATADIR=$MYSQL_HOME/data
30-
# Keep the socket and pidfile in our conf folder, and out of the Nix Store
31-
export MYSQL_UNIX_PORT=$MYSQL_HOME/mysql.sock
32-
export MYSQL_PID_FILE=$MYSQL_HOME/mysql.pid
22+
```json
23+
"includes": [
24+
"plugin:mariadb"
25+
]
3326
```
3427

35-
## Installing the Database
36-
We can check if the MySQL data directory exists, and if not install the database using the environment variables we configured:
28+
## MariaDB Plugin Support
29+
30+
Devbox will automatically create the following configuration when you run `devbox add mariadb`. You can view the full configuration by running `devbox info mariadb`
3731

38-
```bash
39-
if [ ! -d "$MYSQL_DATADIR" ]; then
40-
# Install the Database
41-
mysql_install_db --auth-root-authentication-method=normal \
42-
--datadir=$MYSQL_DATADIR --basedir=$MYSQL_BASEDIR \
43-
--pid-file=$MYSQL_PID_FILE
44-
fi
45-
```
4632

47-
## Starting the Daemon
48-
Similarly, we can start the database using mysqld, passing the environment variables where needed
33+
### Services
34+
* mariadb
35+
36+
You can use `devbox services up|stop mariadb` to start or stop the MariaDB Server.
37+
38+
### Environment Variables
4939

5040
```bash
51-
mysqld --datadir=$MYSQL_DATADIR --pid-file=$MYSQL_PID_FILE \
52-
--socket=$MYSQL_UNIX_PORT 2> $MYSQL_HOME/mysql.log & MYSQL_PID=$!
41+
MYSQL_BASEDIR=.devbox/nix/profile/default
42+
MYSQL_HOME=./.devbox/virtenv/mariadb/run
43+
MYSQL_DATADIR=./.devbox/virtenv/mariadb/data
44+
MYSQL_UNIX_PORT=./.devbox/virtenv/mariadb/run/mysql.sock
45+
MYSQL_PID_FILE=./.devbox/mariadb/run/mysql.pid
5346
```
5447

55-
The daemon can be terminated using `mysqladmin`:
48+
### Files
5649

57-
```bash
58-
mysqladmin -u root --socket=$MYSQL_UNIX_PORT shutdown
59-
```
50+
The plugin will also create the following helper files in your project's `.devbox/virtenv` folder:
51+
52+
* mariadb/flake.nix
53+
* mariadb/setup_db.sh
54+
* mariadb/process-compose.yaml
55+
56+
These files are used to setup your database and service, and should not be modified
57+
58+
### Notes
59+
60+
* This plugin wraps mysqld and mysql_install_db to work in your local project. For more information, see the `flake.nix` created in your `.devbox/virtenv/mariadb` folder.
61+
* This plugin will create a new database for your project in MYSQL_DATADIR if one doesn't exist on shell init.
62+
* You can use `mysqld` to manually start the server, and `mysqladmin -u root shutdown` to manually stop it

docs/app/docs/devbox_examples/databases/postgres.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,13 @@ PostgreSQL can be automatically configured by Devbox via the built-in Postgres P
1313

1414
```json
1515
"packages": [
16-
"postgresql",
17-
"glibcLocales"
16+
"postgresql@latest",
17+
"glibcLocales@latest"
1818
]
1919
```
2020

21+
This will install the latest version of Postgres. You can find other installable versions of Postgres by running `devbox search postgresql`.
22+
2123
## PostgreSQL Plugin Support
2224

2325
Devbox will automatically create the following configuration when you run `devbox add postgresql`:
@@ -32,7 +34,7 @@ You can use `devbox services start|stop postgresql` to start or stop the Postgre
3234
`PGHOST=./.devbox/virtenv/postgresql`
3335
`PGDATA=./.devbox/virtenv/postgresql/data`
3436

35-
This variable tells PostgreSQL which directory to use for creating and storing databases.
37+
This variable tells PostgreSQL which directory to use for creating and storing databases.
3638

3739
### Notes
3840

docs/app/docs/devbox_examples/databases/redis.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@ Redis can be configured automatically using Devbox's built in Redis plugin. This
1414

1515
```json
1616
"packages": [
17-
"redis"
17+
"redis@latest "
1818
],
1919
```
2020

21+
This will install the latest version of Redis. You can find other installable versions of Redis by running `devbox search redis`.
22+
2123
## Redis Plugin Details
2224

2325
The Redis plugin will automatically create the following configuration when you install Redis with `devbox add`
@@ -48,4 +50,4 @@ Running `devbox services start redis` will start redis as a daemon in the backgr
4850

4951
You can manually start Redis in the foreground by running `redis-server $REDIS_CONF --port $REDIS_PORT`.
5052

51-
Logs, pidfile, and data dumps are stored in `.devbox/virtenv/redis`. You can change this by modifying the `dir` directive in `devbox.d/redis/redis.conf`
53+
Logs, pidfile, and data dumps are stored in `.devbox/virtenv/redis`. You can change this by modifying the `dir` directive in `devbox.d/redis/redis.conf`

docs/app/docs/devbox_examples/languages/csharp.md

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,11 @@ C# and .NET projects can be easily generated in Devbox by adding the dotnet SDK
1414

1515
```json
1616
"packages": [
17-
"dotnet-sdk"
17+
"dotnet-sdk@latest"
1818
],
1919
```
20-
This will install .NET SDK 6.0
21-
22-
Other versions available include:
23-
24-
* dotnet-sdk_7 (version 7.0)
25-
* dotnet-sdk_5 (version 5.0)
26-
* dotnet-sdk_3 (version 3.1)
20+
This will install the latest version of the dotnet SDK. You can find other installable versions of the dotnet SDK by running `devbox search dotnet-sdk`.
2721

2822
## Creating a new C# Project
2923

30-
`dotnet new console -lang "C#" -o <name>`
24+
`dotnet new console -lang "C#" -o <name>`

0 commit comments

Comments
 (0)