Skip to content

Commit b91239a

Browse files
authored
Merge pull request #1292 from devstream-io/docs-update-quickstart
docs: update quickstart
2 parents b7d1842 + 1727786 commit b91239a

File tree

2 files changed

+104
-124
lines changed

2 files changed

+104
-124
lines changed

docs/quickstart.md

Lines changed: 102 additions & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
# Quick Start
22

3-
[Watch the demo](./index.md) first if you prefer to see DevStream in action.
4-
5-
> Note: currently, we only have Linux and macOS versions of DevStream. Windows support will come later.
6-
73
In this quickstart, we will do the following automatically with DevStream:
84

9-
- create a GitHub repository with Golang web app scaffolding;
10-
- set up GitHub Actions workflow for the Golang app we created, which contains test and build stages for our Go web app.
5+
- create a GitHub repository with automatically generated code for a web application written in Golang with the [gin](https://github.com/gin-gonic/gin) framework;
6+
- set up GitHub Actions workflow for the app created in the previous step.
7+
8+
---
119

1210
## 1 Download
1311

@@ -16,12 +14,18 @@ In your working directory, run:
1614
```shell
1715
sh -c "$(curl -fsSL https://raw.githubusercontent.com/devstream-io/devstream/main/hack/install/download.sh)"
1816
```
19-
20-
This will download the corresponding `dtm` binary to your working directory according to your OS and chip architecture, and grant the binary execution permission.
21-
17+
> Note: the command above does the following:
18+
>
19+
> - find out your OS and chip architecture
20+
> - find the latest version of the `dtm` binary
21+
> - download the correct `dtm` according to OS/architecture
22+
> - grant the binary execution permission.
23+
>
2224
> Optional: you can then move `dtm` to a place which is in your PATH. For example: `mv dtm /usr/local/bin/`.
25+
>
26+
> For more ways to install `dtm`, see [install dtm](./install.md).
2327
24-
_For more details on how to install, see [install dtm](./install.md)._
28+
---
2529

2630
## 2 Configuration
2731

@@ -31,129 +35,105 @@ Run the following command to generate the template configuration file `config.ya
3135
./dtm show config -t quickstart > config.yaml
3236
```
3337

34-
As aforementioned, we will handle GitHub repo scaffolding and CI workflows in GitHub Actions, so, we will need the following environment variables (env vars) to be set:
35-
36-
- GITHUB_USER
37-
- GITHUB_TOKEN
38-
- DOCKERHUB_USERNAME
39-
40-
Run the following commands to set values for these env vars (replace values within the double quotes):
38+
Then set the following environment variables by running (replace values within the double quotes):
4139

4240
```shell
4341
export GITHUB_USER="<YOUR_GITHUB_USER_NAME_HERE>"
4442
export GITHUB_TOKEN="<YOUR_GITHUB_PERSONAL_ACCESS_TOKEN_HERE>"
4543
export DOCKERHUB_USERNAME="<YOUR_DOCKER_HUB_USER_NAME_HERE>"
4644
```
4745

48-
> Tip: Go to [Personal Access Token](https://github.com/settings/tokens/new) to generate a new `GITHUB_TOKEN` for `dtm`.
46+
> Tip: go to [Personal Access Token](https://github.com/settings/tokens/new) to generate a new `GITHUB_TOKEN` for `dtm`.
4947
>
50-
> For "Quick Start", we only need `repo`,`workflow`,`delete_repo` scopes. However, we recommend that you check all and future plugins may require more scopes.
48+
> For "Quick Start", we only need `repo`,`workflow`,`delete_repo` permissions.
5149
5250
Then we run the following commands to update our config file with those env vars:
5351

54-
For **macOS** or **FreeBSD** based systems:
52+
Then, if you are using **macOS** or **FreeBSD** based systems\, run:
5553

5654
```shell
57-
sed -i.bak "s@YOUR_GITHUB_USERNAME_CASE_SENSITIVE@${GITHUB_USER}@g" quickstart.yaml
58-
sed -i.bak "s@YOUR_DOCKER_USERNAME@${DOCKERHUB_USERNAME}@g" quickstart.yaml
55+
sed -i.bak "s@YOUR_GITHUB_USERNAME_CASE_SENSITIVE@${GITHUB_USER}@g" config.yaml
56+
sed -i.bak "s@YOUR_DOCKER_USERNAME@${DOCKERHUB_USERNAME}@g" config.yaml
5957
```
6058

61-
For **GNU** Linux users:
59+
> For **GNU** Linux users, run:
60+
>
61+
> ```shell
62+
> sed -i "s@YOUR_GITHUB_USERNAME_CASE_SENSITIVE@${GITHUB_USER}@g" config.yaml
63+
> sed -i "s@YOUR_DOCKER_USERNAME@${DOCKERHUB_USERNAME}@g" config.yaml
64+
> ```
6265
63-
```shell
64-
sed -i "s@YOUR_GITHUB_USERNAME_CASE_SENSITIVE@${GITHUB_USER}@g" quickstart.yaml
65-
sed -i "s@YOUR_DOCKER_USERNAME@${DOCKERHUB_USERNAME}@g" quickstart.yaml
66-
```
66+
---
6767
6868
## 3 Init
6969
7070
Run:
7171
7272
```shell
73-
./dtm init -f quickstart.yaml
73+
./dtm init
7474
```
7575
76-
and you should see similar output to the following:
77-
76+
> You should see some output similar to the following:
7877
```
79-
2022-06-30 11:21:48 ℹ [INFO] Got Backend from config: local
80-
2022-06-30 11:21:48 ℹ [INFO] Using dir <.devstream> to store plugins.
81-
2022-06-30 11:21:48 ℹ [INFO] Downloading: [repo-scaffolding-darwin-arm64_0.7.0.so] ...
82-
15.05 MiB / 15.05 MiB [================================] 100.00% 21.17 MiB/s 0s
83-
2022-06-30 11:21:49 ✔ [SUCCESS] [repo-scaffolding-darwin-arm64_0.7.0.so] download succeeded.
84-
2022-06-30 11:21:49 ℹ [INFO] Downloading: [repo-scaffolding-darwin-arm64_0.7.0.md5] ...
85-
33 B / 33 B [==========================================] 100.00% 35.29 KiB/s 0s
86-
2022-06-30 11:21:49 ✔ [SUCCESS] [repo-scaffolding-darwin-arm64_0.7.0.md5] download succeeded.
87-
2022-06-30 11:21:49 ℹ [INFO] Plugin: repo-scaffolding-darwin-arm64_0.7.0.so doesn't match with .md5 and will be downloaded.
88-
2022-06-30 11:21:49 ℹ [INFO] Downloading: [repo-scaffolding-darwin-arm64_0.7.0.so] ...
89-
15.05 MiB / 15.05 MiB [================================] 100.00% 31.25 MiB/s 0s
90-
2022-06-30 11:21:50 ✔ [SUCCESS] [repo-scaffolding-darwin-arm64_0.7.0.so] download succeeded.
91-
2022-06-30 11:21:50 ℹ [INFO] Downloading: [repo-scaffolding-darwin-arm64_0.7.0.md5] ...
92-
33 B / 33 B [==========================================] 100.00% 43.43 KiB/s 0s
93-
2022-06-30 11:21:50 ✔ [SUCCESS] [repo-scaffolding-darwin-arm64_0.7.0.md5] download succeeded.
94-
2022-06-30 11:21:50 ℹ [INFO] Downloading: [githubactions-golang-darwin-arm64_0.7.0.so] ...
95-
17.49 MiB / 17.49 MiB [================================] 100.00% 31.18 MiB/s 0s
96-
2022-06-30 11:21:51 ✔ [SUCCESS] [githubactions-golang-darwin-arm64_0.7.0.so] download succeeded.
97-
2022-06-30 11:21:51 ℹ [INFO] Downloading: [githubactions-golang-darwin-arm64_0.7.0.md5] ...
98-
33 B / 33 B [=========================================] 100.00% 160.70 KiB/s 0s
99-
2022-06-30 11:21:51 ✔ [SUCCESS] [githubactions-golang-darwin-arm64_0.7.0.md5] download succeeded.
100-
2022-06-30 11:21:51 ℹ [INFO] Plugin: githubactions-golang-darwin-arm64_0.7.0.so doesn't match with .md5 and will be downloaded.
101-
2022-06-30 11:21:51 ℹ [INFO] Downloading: [githubactions-golang-darwin-arm64_0.7.0.so] ...
102-
17.49 MiB / 17.49 MiB [================================] 100.00% 31.78 MiB/s 0s
103-
2022-06-30 11:21:52 ✔ [SUCCESS] [githubactions-golang-darwin-arm64_0.7.0.so] download succeeded.
104-
2022-06-30 11:21:52 ℹ [INFO] Downloading: [githubactions-golang-darwin-arm64_0.7.0.md5] ...
105-
33 B / 33 B [==========================================] 100.00% 87.12 KiB/s 0s
106-
2022-06-30 11:21:52 ✔ [SUCCESS] [githubactions-golang-darwin-arm64_0.7.0.md5] download succeeded.
107-
2022-06-30 11:21:52 ✔ [SUCCESS] Initialize finished.
78+
2022-12-02 16:11:55 ℹ [INFO] Using dir </Users/tiexin/.devstream/plugins> to store plugins.
79+
2022-12-02 16:11:55 ℹ [INFO] -------------------- [ repo-scaffolding-darwin-arm64_0.10.1 ] --------------------
80+
2022-12-02 16:11:57 ℹ [INFO] Downloading: [repo-scaffolding-darwin-arm64_0.10.1.so] ...
81+
87.82 MiB / 87.82 MiB [================================] 100.00% 12.30 MiB/s 7s
82+
2022-12-02 16:12:04 ✔ [SUCCESS] [repo-scaffolding-darwin-arm64_0.10.1.so] download succeeded.
83+
2022-12-02 16:12:04 ℹ [INFO] Downloading: [repo-scaffolding-darwin-arm64_0.10.1.md5] ...
84+
33 B / 33 B [==========================================] 100.00% 50.98 KiB/s 0s
85+
2022-12-02 16:12:04 ✔ [SUCCESS] [repo-scaffolding-darwin-arm64_0.10.1.md5] download succeeded.
86+
2022-12-02 16:12:04 ℹ [INFO] Initialize [repo-scaffolding-darwin-arm64_0.10.1] finished.
87+
2022-12-02 16:12:04 ℹ [INFO] -------------------- [ repo-scaffolding-darwin-arm64_0.10.1 ] --------------------
88+
2022-12-02 16:12:04 ℹ [INFO] -------------------- [ githubactions-golang-darwin-arm64_0.10.1 ] --------------------
89+
2022-12-02 16:12:05 ℹ [INFO] Downloading: [githubactions-golang-darwin-arm64_0.10.1.so] ...
90+
86.44 MiB / 86.44 MiB [================================] 100.00% 15.12 MiB/s 5s
91+
2022-12-02 16:12:10 ✔ [SUCCESS] [githubactions-golang-darwin-arm64_0.10.1.so] download succeeded.
92+
2022-12-02 16:12:10 ℹ [INFO] Downloading: [githubactions-golang-darwin-arm64_0.10.1.md5] ...
93+
33 B / 33 B [==========================================] 100.00% 71.24 KiB/s 0s
94+
2022-12-02 16:12:10 ✔ [SUCCESS] [githubactions-golang-darwin-arm64_0.10.1.md5] download succeeded.
95+
2022-12-02 16:12:11 ℹ [INFO] Initialize [githubactions-golang-darwin-arm64_0.10.1] finished.
96+
2022-12-02 16:12:11 ℹ [INFO] -------------------- [ githubactions-golang-darwin-arm64_0.10.1 ] --------------------
97+
2022-12-02 16:12:11 ✔ [SUCCESS] Initialize finished.
10898
```
10999

100+
---
101+
110102
## 4 Apply
111103

112104
Run:
113105

114106
```shell
115-
./dtm apply -f quickstart.yaml
107+
./dtm apply -y
116108
```
117109

118-
When it prompts:
110+
> You should see similar output to the following
119111
120-
```shell
121-
...(omitted)
122-
Continue? [y/n]
123-
Enter a value (Default is n):
124112
```
125-
126-
input `y` and hit the enter key.
127-
128-
You should see similar output to the following
129-
113+
2022-12-02 16:18:00 ℹ [INFO] Apply started.
114+
2022-12-02 16:18:00 ℹ [INFO] Using local backend. State file: devstream.state.
115+
2022-12-02 16:18:00 ℹ [INFO] Tool (repo-scaffolding/golang-github) found in config but doesn't exist in the state, will be created.
116+
2022-12-02 16:18:00 ℹ [INFO] Tool (githubactions-golang/default) found in config but doesn't exist in the state, will be created.
117+
2022-12-02 16:18:00 ℹ [INFO] Start executing the plan.
118+
2022-12-02 16:18:00 ℹ [INFO] Changes count: 2.
119+
2022-12-02 16:18:00 ℹ [INFO] -------------------- [ Processing progress: 1/2. ] --------------------
120+
2022-12-02 16:18:00 ℹ [INFO] Processing: (repo-scaffolding/golang-github) -> Create ...
121+
2022-12-02 16:18:00 ℹ [INFO] github start to download repoTemplate...
122+
2022-12-02 16:18:04 ✔ [SUCCESS] The repo go-webapp-devstream-demo has been created.
123+
2022-12-02 16:18:12 ✔ [SUCCESS] Tool (repo-scaffolding/golang-github) Create done.
124+
2022-12-02 16:18:12 ℹ [INFO] -------------------- [ Processing progress: 2/2. ] --------------------
125+
2022-12-02 16:18:12 ℹ [INFO] Processing: (githubactions-golang/default) -> Create ...
126+
2022-12-02 16:18:13 ℹ [INFO] Creating GitHub Actions workflow pr-builder.yml ...
127+
2022-12-02 16:18:14 ✔ [SUCCESS] Github Actions workflow pr-builder.yml created.
128+
2022-12-02 16:18:14 ℹ [INFO] Creating GitHub Actions workflow main-builder.yml ...
129+
2022-12-02 16:18:15 ✔ [SUCCESS] Github Actions workflow main-builder.yml created.
130+
2022-12-02 16:18:15 ✔ [SUCCESS] Tool (githubactions-golang/default) Create done.
131+
2022-12-02 16:18:15 ℹ [INFO] -------------------- [ Processing done. ] --------------------
132+
2022-12-02 16:18:15 ✔ [SUCCESS] All plugins applied successfully.
133+
2022-12-02 16:18:15 ✔ [SUCCESS] Apply finished.
130134
```
131-
2022-06-30 11:25:47 ℹ [INFO] Apply started.
132-
2022-06-30 11:25:47 ℹ [INFO] Got Backend from config: local
133-
2022-06-30 11:25:47 ℹ [INFO] Using dir <.devstream> to store plugins.
134-
2022-06-30 11:25:47 ℹ [INFO] Using local backend. State file: devstream.state.
135-
2022-06-30 11:25:47 ℹ [INFO] Tool (repo-scaffolding/default) found in config but doesn't exist in the state, will be created.
136-
2022-06-30 11:25:47 ℹ [INFO] Tool (githubactions-golang/default) found in config but doesn't exist in the state, will be created.
137-
Continue? [y/n]
138-
Enter a value (Default is n): y
139135

140-
2022-06-30 11:26:20 ℹ [INFO] Start executing the plan.
141-
2022-06-30 11:26:20 ℹ [INFO] Changes count: 2.
142-
2022-06-30 11:26:20 ℹ [INFO] -------------------- [ Processing progress: 1/2. ] --------------------
143-
2022-06-30 11:26:20 ℹ [INFO] Processing: (repo-scaffolding/default) -> Create ...
144-
2022-06-30 11:26:24 ℹ [INFO] The repo go-webapp-devstream-demo has been created.
145-
2022-06-30 11:26:37 ✔ [SUCCESS] Tool (repo-scaffolding/default) Create done.
146-
2022-06-30 11:26:37 ℹ [INFO] -------------------- [ Processing progress: 2/2. ] --------------------
147-
2022-06-30 11:26:37 ℹ [INFO] Processing: (githubactions-golang/default) -> Create ...
148-
2022-06-30 11:26:38 ℹ [INFO] Creating GitHub Actions workflow pr-builder.yml ...
149-
2022-06-30 11:26:38 ✔ [SUCCESS] Github Actions workflow pr-builder.yml created.
150-
2022-06-30 11:26:38 ℹ [INFO] Creating GitHub Actions workflow main-builder.yml ...
151-
2022-06-30 11:26:39 ✔ [SUCCESS] Github Actions workflow main-builder.yml created.
152-
2022-06-30 11:26:39 ✔ [SUCCESS] Tool (githubactions-golang/default) Create done.
153-
2022-06-30 11:26:39 ℹ [INFO] -------------------- [ Processing done. ] --------------------
154-
2022-06-30 11:26:39 ✔ [SUCCESS] All plugins applied successfully.
155-
2022-06-30 11:26:39 ✔ [SUCCESS] Apply finished.
156-
```
136+
---
157137

158138
## 5 Check the Results
159139

@@ -165,46 +145,46 @@ The commits (made by DevStream when scaffolding the repo and creating workflows)
165145

166146
![](./images/repo-scaffolding.png)
167147

148+
---
149+
168150
## 6 Clean Up
169151

170152
Run:
171153

172154
```shell
173-
./dtm delete -f quickstart.yaml
155+
./dtm delete
174156
```
175157

176-
input `y` the same just like you did in the previous steps, and you should see similar output:
158+
Input `y` then press enter to continue, and you should see similar output:
177159

178160
```
179-
2022-06-30 11:31:01 ℹ [INFO] Delete started.
180-
2022-06-30 11:31:01 ℹ [INFO] Got Backend from config: local
181-
2022-06-30 11:31:01 ℹ [INFO] Using dir <.devstream> to store plugins.
182-
2022-06-30 11:31:01 ℹ [INFO] Using local backend. State file: devstream.state.
183-
2022-06-30 11:31:01 ℹ [INFO] Tool (githubactions-golang/default) will be deleted.
184-
2022-06-30 11:31:01 ℹ [INFO] Tool (repo-scaffolding/default) will be deleted.
161+
2022-12-02 16:19:07 ℹ [INFO] Delete started.
162+
2022-12-02 16:19:07 ℹ [INFO] Using local backend. State file: devstream.state.
163+
2022-12-02 16:19:07 ℹ [INFO] Tool (githubactions-golang/default) will be deleted.
164+
2022-12-02 16:19:07 ℹ [INFO] Tool (repo-scaffolding/golang-github) will be deleted.
185165
Continue? [y/n]
186166
Enter a value (Default is n): y
187167
188-
2022-06-30 11:31:03 ℹ [INFO] Start executing the plan.
189-
2022-06-30 11:31:03 ℹ [INFO] Changes count: 2.
190-
2022-06-30 11:31:03 ℹ [INFO] -------------------- [ Processing progress: 1/2. ] --------------------
191-
2022-06-30 11:31:03 ℹ [INFO] Processing: (githubactions-golang/default) -> Delete ...
192-
2022-06-30 11:31:04 ℹ [INFO] Deleting GitHub Actions workflow pr-builder.yml ...
193-
2022-06-30 11:31:05 ✔ [SUCCESS] GitHub Actions workflow pr-builder.yml removed.
194-
2022-06-30 11:31:05 ℹ [INFO] Deleting GitHub Actions workflow main-builder.yml ...
195-
2022-06-30 11:31:06 ✔ [SUCCESS] GitHub Actions workflow main-builder.yml removed.
196-
2022-06-30 11:31:06 ℹ [INFO] Prepare to delete 'githubactions-golang_default' from States.
197-
2022-06-30 11:31:06 ✔ [SUCCESS] Tool (githubactions-golang/default) delete done.
198-
2022-06-30 11:31:06 ℹ [INFO] -------------------- [ Processing progress: 2/2. ] --------------------
199-
2022-06-30 11:31:06 ℹ [INFO] Processing: (repo-scaffolding/default) -> Delete ...
200-
2022-06-30 11:31:06 ✔ [SUCCESS] GitHub repo go-webapp-devstream-demo removed.
201-
2022-06-30 11:31:06 ℹ [INFO] Prepare to delete 'repo-scaffolding_default' from States.
202-
2022-06-30 11:31:06 ✔ [SUCCESS] Tool (repo-scaffolding/default) delete done.
203-
2022-06-30 11:31:06 ℹ [INFO] -------------------- [ Processing done. ] --------------------
204-
2022-06-30 11:31:06 ✔ [SUCCESS] All plugins deleted successfully.
205-
2022-06-30 11:31:06 ✔ [SUCCESS] Delete finished.
168+
2022-12-02 16:19:08 ℹ [INFO] Start executing the plan.
169+
2022-12-02 16:19:08 ℹ [INFO] Changes count: 2.
170+
2022-12-02 16:19:08 ℹ [INFO] -------------------- [ Processing progress: 1/2. ] --------------------
171+
2022-12-02 16:19:08 ℹ [INFO] Processing: (githubactions-golang/default) -> Delete ...
172+
2022-12-02 16:19:09 ℹ [INFO] Deleting GitHub Actions workflow pr-builder.yml ...
173+
2022-12-02 16:19:09 ✔ [SUCCESS] GitHub Actions workflow pr-builder.yml removed.
174+
2022-12-02 16:19:10 ℹ [INFO] Deleting GitHub Actions workflow main-builder.yml ...
175+
2022-12-02 16:19:10 ✔ [SUCCESS] GitHub Actions workflow main-builder.yml removed.
176+
2022-12-02 16:19:10 ℹ [INFO] Prepare to delete 'githubactions-golang_default' from States.
177+
2022-12-02 16:19:10 ✔ [SUCCESS] Tool (githubactions-golang/default) delete done.
178+
2022-12-02 16:19:10 ℹ [INFO] -------------------- [ Processing progress: 2/2. ] --------------------
179+
2022-12-02 16:19:10 ℹ [INFO] Processing: (repo-scaffolding/golang-github) -> Delete ...
180+
2022-12-02 16:19:11 ✔ [SUCCESS] GitHub repo go-webapp-devstream-demo removed.
181+
2022-12-02 16:19:11 ℹ [INFO] Prepare to delete 'repo-scaffolding_golang-github' from States.
182+
2022-12-02 16:19:11 ✔ [SUCCESS] Tool (repo-scaffolding/golang-github) delete done.
183+
2022-12-02 16:19:11 ℹ [INFO] -------------------- [ Processing done. ] --------------------
184+
2022-12-02 16:19:11 ✔ [SUCCESS] All plugins deleted successfully.
185+
2022-12-02 16:19:11 ✔ [SUCCESS] Delete finished.
206186
```
207187

208188
Now if you check your GitHub repo list again, everything has been nuked by DevStream. Hooray!
209189

210-
> Optional: you can also remove the DevStream state file (which should be empty now) by running: `rm devstream.state`.
190+
You can also remove the DevStream state file (which should be empty now) by running: `rm devstream.state`.

internal/pkg/show/config/templates/quickstart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
config:
2-
state: # state config, backend can be local, s3 or k8s
2+
state:
33
backend: local
44
options:
55
stateFile: devstream.state
@@ -19,7 +19,7 @@ tools:
1919
repo: dtm-scaffolding-golang
2020
repoType: github
2121
vars:
22-
ImageRepo: YOUR_DOCKER_USERNAME/go-webapp-devstream-demo
22+
imageRepo: YOUR_DOCKER_USERNAME/go-webapp-devstream-demo
2323
- name: githubactions-golang
2424
instanceID: default
2525
dependsOn: ["repo-scaffolding.golang-github"]

0 commit comments

Comments
 (0)