Skip to content

Commit 68f47a5

Browse files
authored
Merge pull request #93 from DefangLabs/jordan/shorter-getting-started
Focusing on "Getting Started"
2 parents 859e22f + fc4d8dd commit 68f47a5

File tree

2 files changed

+76
-36
lines changed

2 files changed

+76
-36
lines changed

docs/getting-started/getting-started.md

Lines changed: 76 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -4,69 +4,109 @@ title: Getting Started
44
description: Get started with Defang.
55
---
66

7-
87
# Getting Started
98

109

11-
### Install the CLI
10+
## Install the CLI
1211

1312
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).
1413

15-
### Authenticate with Defang
14+
## Generate a project
1615

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:
16+
```
17+
$ defang generate nodejs-http
18+
```
1819

19-
```bash
20-
defang login
20+
You should see the following prompt:
2121
```
22+
? What folder would you like to create the project in?
23+
```
24+
Type in the name of the folder you'd like to use for your new project and press ENTER.
2225

23-
:::info
24-
To learn more about how authentication works in defang, check out the [authenticating page](./authenticating.md).
25-
:::
26+
I'll type `"welcome-to-defang"`. Now, you'll see the following output:
2627

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

29-
Before you can deploy code you should read and agree to our the terms of service. You can do this by running:
48+
Now, navigate to the folder you just created:
3049

31-
```bash
32-
defang terms
50+
```
51+
$ cd welcome-to-defang
3352
```
3453

35-
### Build and Deploy Services
54+
You can open the folder in your favorite editor and see the files that were generated for you:
55+
* The `app` folder contains the code for your service.
56+
* The `Dockerfile` is used to build the container image for your service.
57+
* The `compose.yaml` file is used to define the services you want to deploy.
3658

37-
Defang supports various ways of creating and deploying services to the cloud. The following tutorials dive into each one in more detail:
59+
## Deploy to the playground
3860

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)
61+
Go back to your shell and type the following:
4362

63+
```
64+
$ defang up
65+
```
4466

45-
### Monitor Services
67+
If you have not used defang before, you'll be prompted to log in.
4668

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.
69+
```
70+
! Please log in to continue.
71+
Please visit http://127.0.0.1:49154 and log in. (Right click the URL or press ENTER to open browser)
72+
```
4873

49-
- From the CLI:
74+
:::info
75+
To learn more about how authentication works in defang, check out the [authenticating page](/docs/getting-started/authenticating).
76+
:::
5077

51-
```tsx
52-
defang tail --name service1
53-
```
78+
When you do this, you should see something similar to the output below:
5479

55-
- From the Defang Portal:
80+
```
81+
* Uploading build context for app
82+
* Deploying service app
83+
* Monitor your services' status in the defang portal
84+
- https://portal.defang.dev/service/app
85+
* Tailing logs for deployment ID o59k89vk3qc8 ; press Ctrl+C to detach:
86+
* Press V to toggle verbose mode
87+
2024-09-19T10:50:53.572443-07:00 cd Update started for stack jordanstephens-prod1
88+
2024-09-19T10:51:05.536299-07:00 cd Update succeeded in 11.99769745s ; provisioning...
89+
2024-09-19T10:51:39.419693-07:00 app Server running at http://0.0.0.0:3000/
90+
* Service app is in state DEPLOYMENT_COMPLETED and will be available at:
91+
- https://jordanstephens-app--3000.prod1.defang.dev
92+
* Done.
93+
```
5694

57-
[https://portal.defang.dev/](https://portal.defang.dev/)
95+
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.
5896

97+
![screenshot of the defang portal](/img/getting-started-portal.png)
5998

60-
:::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.
63-
:::
99+
## Next Steps
64100

101+
Congratulations! You've successfully deployed your first service with Defang. Now, where do you go from here?
65102

66-
### Update Services
103+
Defang supports various ways of creating and deploying services to the cloud. The following tutorials dive into each one in more detail:
67104

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.
105+
1. [Update the code and redeploy](/docs/getting-started/build-and-deploy)
106+
2. [Monitor your services](/docs/getting-started/monitor)
107+
3. [Deploy an outline using AI](/docs/tutorials/generate-new-code-using-ai)
108+
4. [Build and deploy your code](/docs/tutorials/deploy-code-compose)
109+
5. [Deploy existing containers](/docs/tutorials/deploy-container-using-the-cli)
110+
6. [Deploy using Pulumi](/docs/tutorials/deploy-using-pulumi)
69111

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-
:::
112+
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.
463 KB
Loading

0 commit comments

Comments
 (0)