Skip to content

Commit 207b2c5

Browse files
Rethinking the "Getting started" doc
My primary goal here is to make this doc as short as possible while still getting the user their first win using defang.
1 parent 225b23a commit 207b2c5

File tree

1 file changed

+77
-39
lines changed

1 file changed

+77
-39
lines changed

docs/getting-started/getting-started.md

Lines changed: 77 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -8,66 +8,104 @@ description: Get started with Defang.
88
# Getting Started
99

1010

11-
### Install the CLI
11+
## Install the CLI
1212

1313
First, you'll need to install the Defang CLI. The CLI is the primary way to interact with Defang. It allows you to create, deploy, and manage your services. You can find the [different installation methods here](./installing.md).
1414

15-
### Authenticate with Defang
15+
## Generate a project
1616

17-
To do pretty much anything with Defang, you'll need to authenticate with the platform. You can do this by running the following command:
18-
19-
```bash
20-
defang login
17+
```
18+
$ defang generate nodejs-http
2119
```
2220

23-
:::info
24-
To learn more about how authentication works in defang, check out the [authenticating page](./authenticating.md).
25-
:::
26-
27-
### Agree to the terms of service
21+
You should see the following prompt:
22+
```
23+
? What folder would you like to create the project in?
24+
```
25+
Type in the name of the folder you'd like to use for your new project and press ENTER.
2826

29-
Before you can deploy code you should read and agree to our the terms of service. You can do this by running:
27+
I'll type `"welcome-to-defang"`. Now, you'll see the following output:
3028

31-
```bash
32-
defang terms
29+
```
30+
? What folder would you like to create the project in? welcome-to-defang
31+
* Fetching sample from the Defang repository...
32+
* Writing files to disk...
33+
- .github/
34+
- .github/workflows/
35+
- .github/workflows/deploy.yaml
36+
- README.md
37+
- app/
38+
- app/Dockerfile
39+
- app/main.js
40+
- compose.yaml
41+
* Code generated successfully in folder welcome-to-defang
42+
43+
Check the files in your favorite editor.
44+
To deploy the service, do `cd welcome-to-defang` and
45+
46+
defang compose up
3347
```
3448

35-
### Build and Deploy Services
49+
Now, navigate to the folder you just created:
3650

37-
Defang supports various ways of creating and deploying services to the cloud. The following tutorials dive into each one in more detail:
51+
```
52+
$ cd welcome-to-defang
53+
```
3854

39-
1. [Deploy an outline using AI](../tutorials/generate-new-code-using-ai.mdx)
40-
2. [Build and deploy your code](../tutorials/deploy-code-compose.mdx)
41-
3. [Deploy existing containers](../tutorials/deploy-container-using-the-cli.mdx)
42-
4. [Deploy using Pulumi](../tutorials/deploy-using-pulumi.mdx)
55+
You can open the folder in your favorite editor and see the files that were generated for you:
56+
* The `app` folder contains the code for your service.
57+
* The `Dockerfile` is used to build the container image for your service.
58+
* The `compose.yaml` file is used to define the services you want to deploy.
4359

60+
## Deploy to the playground
4461

45-
### Monitor Services
62+
Go back to your shell and type the following:
4663

47-
By default, all the output (stdout and stderr) from your app is logged. You can view these logs in real-time. You can view logs for all your services, one service, or even one specific deployment of a service.
64+
```
65+
$ defang up
66+
```
4867

49-
- From the CLI:
50-
51-
```tsx
52-
defang tail --name service1
53-
```
54-
55-
- From the Defang Portal:
56-
57-
[https://portal.defang.dev/](https://portal.defang.dev/)
68+
If you have not used defang before, you'll be prompted to log in.
5869

70+
```
71+
! Please log in to continue.
72+
Please visit http://127.0.0.1:49154 and log in. (Right click the URL or press ENTER to open browser)
73+
```
5974

6075
:::info
61-
* To learn more about observability in Defang, check out the [observability page](../concepts/observability.md).
62-
* Note that the Defang Portal only displays services deployed to Defang Playground.
76+
To learn more about how authentication works in defang, check out the [authenticating page](./authenticating.md).
6377
:::
64-
6578

66-
### Update Services
79+
You'll see the following output:
6780

68-
To update your app (for example, updating the base image of your container, or making changes to your code) you can run the `defang compose up` command and it will build and deploy a new version with zero downtime. Your current version of the service will keep running and handling traffic while the new version is being built and deployed. Only after the new version passes the health checks and accepts traffic will the older version be stopped.
81+
```
82+
* Compressing build context for app at /Users/me/welcome-to-defang/app
83+
* Uploading build context for app
84+
* Deploying service app
85+
* Monitor your services' status in the defang portal
86+
- https://portal.defang.dev/service/app
87+
* Tailing logs for deployment ID lurnaezbvoxp ; press Ctrl+C to detach:
88+
* Press V to toggle verbose mode
89+
2024-09-18T08:17:16.119532-07:00 cd Update started for stack me-prod1
90+
2024-09-18T08:18:13.272207-07:00 cd Update succeeded in 57.183437801s ; provisioning...
91+
2024-09-18T08:18:51.767417-07:00 app Server running at http://127.0.0.1:3000/
92+
```
6993

70-
:::info
71-
If you are using [compose files](../concepts/compose.md) to define your services, you can add/remove services, make changes to code, etc. When you run `defang compose up`, the update will be diffed against the current state and any necessary changes will be applied to make the current state match the desired state.
72-
:::
94+
Now we can go to [https://portal.defang.dev/service/app](https://portal.defang.dev/service/app) to see our service listed in the defang portal.
95+
96+
Click on the arrow next to the service name to see your service running in the browser.
97+
98+
## Next Steps
99+
100+
Congratulations! You've successfully deployed your first service with Defang. Now, where do you go from here?
101+
102+
Defang supports various ways of creating and deploying services to the cloud. The following tutorials dive into each one in more detail:
103+
104+
1. [Update the code and redeploy](/docs/getting-started/update.mdx)
105+
2. [Monitor your services](/docs/getting-started/update.mdx)
106+
3. [Deploy an outline using AI](../tutorials/generate-new-code-using-ai.mdx)
107+
4. [Build and deploy your code](../tutorials/deploy-code-compose.mdx)
108+
5. [Deploy existing containers](../tutorials/deploy-container-using-the-cli.mdx)
109+
6. [Deploy using Pulumi](../tutorials/deploy-using-pulumi.mdx)
73110

111+
Choose the direction that seems the most interesting. If you have any questions, join the [Defang Discord](https://discord.gg/defang) and we'll be happy to help you out.

0 commit comments

Comments
 (0)