Skip to content

Commit 211e9ad

Browse files
Lagojamikeland73
authored andcommitted
Merge Docs Changes (#566)
## Summary TSIA, ping for preview ## How was it tested? Localhost, Launchpad
1 parent 738dd87 commit 211e9ad

37 files changed

+849
-88
lines changed

docs/app/docs/cli_reference/devbox.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ devbox [flags]
1616
## SEE ALSO
1717

1818
* [devbox add](./devbox_add.md) - Add a new package to your devbox
19+
* [devbox cloud](./devbox_cloud.md) - [Preview] Create and manage a remote dev environment with Devbox Cloud
1920
* [devbox generate](devbox_generate.md) - Generate supporting files for your project
2021
* [devbox info](devbox_info.md) - Display package and plugin info
2122
* [devbox init](./devbox_init.md) - Initialize a directory as a devbox project
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# devbox cloud
2+
3+
Commands for managing remote development environments with Devbox Cloud.
4+
5+
:::note
6+
Devbox Cloud is currently available as an Open Beta and under active development. If you encounter any issues, please report them at https://github.com/jetpack-io/devbox/issues
7+
:::
8+
9+
```bash
10+
devbox cloud [subcommand] [flags]
11+
```
12+
13+
## Options
14+
15+
```bash
16+
-h, --help help for generate
17+
-q, --quiet Quiet mode: Suppresses logs.
18+
```
19+
20+
## SEE ALSO
21+
22+
* [devbox](devbox.md) - Instant, easy, predictable development environments
23+
* [devbox cloud forward](devbox_cloud_forward.md) - [Preview] Port forwards a local port to a remote devbox cloud port
24+
* [devbox cloud shell](devbox_cloud_shell.md) - [Preview] Shell into a cloud environment that matches your local devbox environment
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# devbox cloud forward
2+
Port forwards a local port to a remote devbox cloud port.
3+
4+
## Synopsis
5+
6+
7+
8+
```bash
9+
# Connect remote port 3000 to an automatically assigned local port
10+
$ devbox cloud forward :3000
11+
Port forwarding 54653:3000
12+
To view in browser, visit http://localhost:54653
13+
```
14+
```bash
15+
# Connect remote port 3000 to local port 3000
16+
$ devbox cloud forward 3000:3000
17+
Port forwarding 3000:3000
18+
To view in browser, visit http://localhost:3000
19+
```
20+
```bash
21+
# Close all open port-forwards
22+
$ devbox cloud forward stop
23+
```
24+
25+
Usage:
26+
devbox cloud forward \<local-port\>:\<remote-port\> | :\<remote-port\> | stop | list [flags]
27+
devbox cloud forward [command]
28+
29+
Available Commands:
30+
list Lists all port forwards managed by devbox
31+
stop Stops all port forwards managed by devbox
32+
33+
Flags:
34+
-h, --help help for forward
35+
36+
Global Flags:
37+
-q, --quiet suppresses logs.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# devbox cloud shell
2+
[Preview] Shell into a remote environment on Devbox Cloud.
3+
4+
5+
## Synopsis
6+
When run in a directory with a `devbox.json` file, this command will start a VM, sync your local files, and create an environment using the packages and configuration in your `devbox.json`.
7+
8+
If a `devbox.json` file is not detected in your current directory, the Devbox CLI will attempt to find a `devbox.json` file in parent directories, and return an error if one is not located.
9+
10+
To authenticate with Devbox Cloud, you must have a Github Account with a linked SSH key. Devbox will attempt to automatically detect your Github username and public key, and prompt you if one cannot be identified,
11+
12+
For more details on how to use Devbox Cloud, consult the [Getting Started Guide](../devbox_cloud/getting_started.md)
13+
14+
15+
```bash
16+
# Start a Cloud Shell
17+
devbox cloud shell
18+
```
19+
20+
## Options
21+
```text
22+
-c, --config string path to directory containing a devbox.json config file
23+
-h, --help help for shell
24+
-u, --username string Github username to use for ssh
25+
-q, --quiet suppresses logs.
26+
```
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
---
2+
title: Devbox Cloud Open Beta FAQ
3+
---
4+
5+
### What do I need to use Devbox Cloud?
6+
7+
To use Devbox Cloud from your Browser, you will need a Github Account.
8+
9+
To use Devbox Cloud from your CLI, you will need:
10+
11+
* A Github account with linked SSH keys
12+
* Devbox 0.3.0 or later
13+
14+
### Does my project need to use Devbox to use Devbox Cloud?
15+
16+
While you can open any Github Repo in a Devbox Cloud Shell, you will need a `devbox.json` to install packages or configure the environment. You can create a `devbox.json` in your shell by running `devbox init`
17+
18+
### Can I use my own IDE or editor with Devbox Cloud?
19+
20+
Yes! You can use your own tools when you start Devbox Cloud from the terminal. See our [Getting Started Guide](getting_started.md) for more details
21+
22+
### Do I have to pay to use Devbox Cloud during the Open Beta?
23+
24+
Devbox Cloud is free to use during the Open Beta period, subject to the restrictions listed below. We expect to continue offering a free tier for personal use after the Open Beta period, but we will offer Paid Plans that provide more resources, concurrency, and persistence.
25+
26+
### What are the resource limits for Devbox Cloud VMs
27+
28+
* **CPU**: 1 Core, shared
29+
* **RAM**: 1 GB
30+
* **SSD**: 8 GB
31+
32+
If you need additional resources for your project, please reach out to us for **[Early Access](https://jetpack-io.typeform.com/devbox-cloud)**
33+
34+
### I want to request more resources, persistence, or a different OS for my VM
35+
36+
Future releases will add more flexibility and features as part of our paid plans. If you'd like to sign up for early access to these plans, please sign up for **[Early Access](https://jetpack-io.typeform.com/devbox-cloud)**
37+
38+
### What OS does Devbox Cloud use?
39+
40+
Alpine Linux 3.17.1, running on a x86-64 platform
41+
42+
### How many VM's can I run concurrently?
43+
44+
You can have up to 3 concurrent VMs per Github Account.
45+
46+
### How long will my Devbox Cloud Shell stay alive for?
47+
48+
VMs will stay alive for up to 5 minutes after a user disconnects. After that point, the VM and all data will be deleted.
49+
50+
### Where will Devbox run my VM?
51+
52+
Devbox VMs are run as Fly Machines in local Data Centers. To minimize latency, Devbox Cloud will attempt to create a Fly Machine as close to your current location as possible.
53+
54+
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
title: Getting Started From Your Browser
3+
---
4+
5+
In addition to using [Devbox Cloud from your terminal](getting_started.md), you can use Devbox Cloud to preview Github projects directly in your browser. The Devbox Cloud Shell comes with the Devbox CLI preinstalled, so you can easily install your projects dependencies or run projects that include a `devbox.json`
6+
7+
![Devbox Cloud Browser](../../static/img/devbox_cloud_browser.png)
8+
9+
### Getting Started
10+
11+
:::note
12+
If you are trying to open a private repository in Devbox Cloud, you will first have to install the [**Devbox Cloud app**](https://github.com/apps/devbox-cloud) from the Github Marketplace. This gives Devbox Cloud permissions to clone your repositories to the cloud VMs
13+
:::
14+
15+
1. Navigate to the Github Repo that you want to preview in Devbox Cloud
16+
2. Copy the URL, and prepend it with `https://devbox.sh/`. For example, to open the Devbox repo, you would enter [https://devbox.sh/github.com/jetpack-io/devbox](http://devbox.sh/github.com/jetpack-io/devbox)
17+
3. Follow the prompts to sign in with your Github Account.
18+
4. Your project should now launch in a terminal session in your browser
19+
1. If the project has a `devbox.json` in the root directory, then Devbox will automatically install your packages and launch you into a devbox shell.
20+
2. If the project does not have a `devbox.json`, a blank one will be automatically created using `devbox init`. You can add packages to the VM using `devbox add`.
21+
22+
23+
### Opening a specific branch of a project
24+
25+
You can open a specific branch of your project using the `branch` query parameter. This is useful when you want to preview a PR or WIP changes for your project.
26+
27+
For example: https://devbox.sh/github.com/org/repo?branch=staging would clone the `staging` branch of your project, and open it in your Cloud Shell.
28+
29+
30+
### Opening a subfolder of a project
31+
32+
You can start your Devbox Cloud Shell in a subfolder of your project, using the `folder` query parameter. This can be useful when working with a monorepo where your project's `devbox.json` lives in a subfolder.
33+
34+
For example: https://devbox.sh/github.com/jetpack-io/devbox-examples?folder=development/ruby will start your terminal in the Ruby example in the Devbox Examples repo, load the configuration from the `devbox.json` in that folder, and then start a Devbox Shell.
35+
36+
37+
### Open in Devbox Badge
38+
39+
If your project uses Devbox, you can make it easy for developers to test your project in Devbox Cloud by adding the `Open in Devbox` badge to your repo
40+
41+
[![Open In Devbox.sh](https://jetpack.io/img/devbox/open-in-devbox.svg)](https://devbox.sh/github.com/jetpack-io/devbox)
42+
43+
Add the following code to your README.md:
44+
45+
```md
46+
[![Open In Devbox.sh](https://jetpack.io/img/devbox/open-in-devbox.svg)](https://devbox.sh/{path_to_repo})
47+
```
Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
# Getting Started from your Terminal
2+
3+
Devbox Cloud is a new way to create and run your Devbox Project in an isolated cloud environment.
4+
5+
Use cases for Devbox Cloud include:
6+
* Testing out Packages or Scripts in an Isolated Linux Environment -- Preview different combinations or environments in a remote VM
7+
* Easy Preview Environments for your project -- Developers or contributors can quickly test your project in a cloud development environment, using the same packages and configuration.
8+
* Develop in a consistent environment from any Machine -- Log on to your Cloud Shell from anywhere, and develop in a consistent Dev environment anywhere in the world. Our VMs are deployed at the edge using Fly.io to provide a low-latency environment
9+
10+
:::note
11+
Devbox Cloud is currently in Beta and under active development.
12+
:::
13+
14+
## How It Works
15+
16+
### Prerequisites
17+
Devbox Cloud Shell requires the following:
18+
19+
* **Devbox 0.3.0 or higher.** If you do not have Nix installed on your machine, Devbox will install it with the default configuration for your OS.
20+
* **A Github Account with an SSH Key Configured**. This is used by Devbox to authenticate and connect you to your Cloud VM.
21+
22+
23+
### Step 1: Authenticate with Github
24+
25+
Devbox provides an easy password-less login flow using the SSH keys attached to your Github Account. If you do not have SSH keys configured with Github, follow the instructions here: [Connecting to Github with SSH](https://docs.github.com/en/[email protected]/authentication/connecting-to-github-with-ssh/about-ssh)
26+
27+
When you run `devbox cloud shell`, Devbox will first attempt to infer your Github username from your local environment, and prompt you if a username cannot be found.
28+
29+
Once Devbox has your username, it will authenticate you over SSH using the private/public key pair associated with your Github Account.
30+
31+
:::note
32+
All authentication is handled via SSH. Devbox never reads or stores your private key.
33+
:::
34+
35+
### Step 2: Launch your Devbox Shell in a Cloud VM
36+
37+
Once you are authenticated, Devbox will provision and start your Cloud Shell:
38+
1. First, we will provision a VM within your region and connect using SSH.
39+
2. Your local project files will be synced to the VM using Mutagen
40+
3. Once your files are updated, Devbox will install your dependencies and start a `devbox shell` for your project
41+
42+
<!-- Diagram goes here -->
43+
44+
If you are using Devbox for the first time, this process may take over 1 minute to complete, depending on the size and number of your project's dependencies. Subsequent sessions will reuse your VM, and should boot up and start in a few seconds
45+
46+
#### Example: Initialize a Python Project in Cloud Shell
47+
48+
Let's create a simple project that uses Python 3.10 with Poetry to manage our packages. We'll start by running `devbox init` in our project directory, and then adding the packages:
49+
50+
```bash
51+
devbox init
52+
```
53+
```bash
54+
devbox add python310 poetry
55+
```
56+
57+
This should create a devbox.json in your directory that looks like the following:
58+
59+
```json
60+
{
61+
"packages": [
62+
"poetry",
63+
"python310"
64+
],
65+
"shell": {
66+
"init_hook": null
67+
},
68+
"nixpkgs": {
69+
"commit": "52e3e80afff4b16ccb7c52e9f0f5220552f03d04"
70+
}
71+
}
72+
```
73+
Now you can start your Cloud Shell by running `devbox cloud shell`
74+
75+
```md
76+
Devbox Cloud
77+
Remote development environments powered by Nix
78+
79+
✓ Created a virtual machine in Sunnyvale, California (US)
80+
✓ File syncing started
81+
✓ Connecting to virtual machine
82+
83+
84+
Installing nix packages. This may take a while... done.
85+
Starting a devbox shell...
86+
...
87+
88+
(devbox) ~/src/devbox-cloud-test 💫 watching for changes
89+
90+
```
91+
92+
You are now connected to your remote shell
93+
94+
95+
### Step 3: Sync your Local Changes to Devbox Cloud
96+
97+
When you start your cloud session, your files are kept locally, and synchronized with your Devbox Cloud VM when changes are detected. This means you can use your favorite tools and editors to develop your project, while running in an isolated cloud environment.
98+
99+
#### Example: Add a Simple Flask App
100+
101+
Let's add a simple Flask "Hello World" to our project to test the syncing.
102+
103+
1. On your local machine, create a pyproject.toml file with the following:
104+
105+
```toml
106+
[tool.poetry]
107+
name = "devbox-cloud-test"
108+
version = "0.1.0"
109+
description = ""
110+
authors = ["Your Name <[email protected]>"]
111+
packages = [{include = "devbox_cloud_test"}]
112+
113+
[tool.poetry.dependencies]
114+
python = "^3.10"
115+
Flask = "^2.2.2"
116+
117+
118+
[build-system]
119+
requires = ["poetry-core"]
120+
build-backend = "poetry.core.masonry.api"
121+
```
122+
123+
1. Create a file locally called `hello.py`, with the following contents:
124+
125+
```python
126+
from flask import Flask
127+
128+
app = Flask(__name__)
129+
130+
@app.route('/')
131+
def index():
132+
return '<h1>Hello from Devbox Cloud!</h1>'
133+
```
134+
135+
1. These files will be automatically synced to your Devbox Cloud Shell, meaning you can install and run the Flask server remotely:
136+
137+
```bash
138+
poetry install
139+
poetry run flask --app hello run
140+
```
141+
142+
This should start your Flask app with the development server:
143+
144+
```bash
145+
* Serving Flask app 'hello'
146+
* Debug mode: off
147+
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
148+
* Running on http://127.0.0.1:5000
149+
Press CTRL+C to quit
150+
```
151+
152+
### Step 4: Test your Services with Port-forwarding
153+
154+
Once your service is running, you may want to test it with your browser or local tools, or you may want to expose services running on your remote shell to your local machine.
155+
156+
You can do this using `devbox cloud forward :<remote_port>`, which will forward ports from your cloud instance to your local machine. If you provide just the remote port, Devbox will forward it to a randomly assigned local port.
157+
158+
You can view the full list of port-forwards on your machine using `devbox cloud forward ls`. You can also terminate port=forwarding with `devbox cloud forward termiante`.
159+
160+
#### Example: Port-forwarding our Flask App
161+
162+
Our Flask app in the example above is listening on port 5000 of the remote machine. Using `devbox cloud forward`, we can access that service from our localhost:
163+
164+
```bash
165+
devbox cloud forward 5000:5000
166+
167+
Port forwarding 5000:5000
168+
To view in browser, visit http://localhost:5000
169+
```
170+
171+
Now if we curl `localhost:5000`, we should see our message:
172+
173+
```bash
174+
curl localhost:5000
175+
<h1>Hello from Devbox Cloud!</h1>
176+
```
177+
178+
## Next Steps
179+
180+
* Learn how to activate **[Devbox Cloud Shell in your Browser](browser_getting_started.md)**
181+
* Try out one of our **[Examples](../devbox_examples/index.md)** in Devbox Cloud Shell
182+
* Learn more about the **[Devbox Cloud Shell Open Beta](index.md)**
183+
* Join the **[Discord Community](https://discord.gg/jetpack-io)**
184+
* File an Issue or Contribute on our **[Github Repo](https://github.com/jetpack-io/devbox)**

0 commit comments

Comments
 (0)