Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3279747

Browse files
marcpaqmatifalibpmct
authored
docs: improve workspaces and templates doc (#9139)
* Reorg, updated/new screenshots, consistent terminology* First pass* Another pass* Added integration section* New outline for template pages, small updates* Revised outline for templates, added tutorial* First pass at tutorial* Some feedback from Ben.* Update docs/workspaces.mdCo-authored-by: Muhammad Atif Ali <matifali@live.com>* Update docs/workspaces.mdCo-authored-by: Muhammad Atif Ali <matifali@live.com>* Update docs/workspaces.mdCo-authored-by: Muhammad Atif Ali <matifali@live.com>* Fixed typos* Expanded tutorialI have read the CLA Document and I hereby sign the CLA* New screenshots, improved tutorial, revised anatomy* Improved tutorial. Anatomy is now a guided tour.* First pass at guided tour* Updated authentication info* Reorganized the guided tour* Edited more template pages* Update docs/templates/tour.mdCo-authored-by: Muhammad Atif Ali <matifali@live.com>* Update docs/templates/tour.mdCo-authored-by: Muhammad Atif Ali <matifali@live.com>* Update docs/templates/tour.mdCo-authored-by: Muhammad Atif Ali <matifali@live.com>* Update docs/templates/tutorial.mdCo-authored-by: Muhammad Atif Ali <matifali@live.com>* Update docs/templates/tour.mdCo-authored-by: Muhammad Atif Ali <matifali@live.com>* Update docs/templates/tour.mdCo-authored-by: Muhammad Atif Ali <matifali@live.com>* Update docs/templates/tour.mdCo-authored-by: Muhammad Atif Ali <matifali@live.com>* Update docs/templates/tour.mdCo-authored-by: Muhammad Atif Ali <matifali@live.com>* Update docs/templates/tour.mdCo-authored-by: Muhammad Atif Ali <matifali@live.com>* Revised devcontainers and docker-in-workspaces* Edited and added screenshots* Prepared first draft, except docs/templates/open-in-coder.md* Fix typo* remove legacy parameters and migration guide* Use coder templates create* Added screenshot for workspace template variables* Made it prettier* Fixed minor typos and markdown problems* edits to repairing workspaces* fix broken links in product* Added troubleshooting, minor corrections.* fix terminal links* fmt---------Co-authored-by: Muhammad Atif Ali <matifali@live.com>Co-authored-by: Ben Potter <me@bpmct.net>Co-authored-by: Atif Ali <atif@coder.com>
1 parent2c84f2e commit3279747

File tree

55 files changed

+1384
-655
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1384
-655
lines changed

‎docs/admin/provisioners.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#Provisioners
1+
#External provisioners
22

33
By default, the Coder server runs[built-in provisioner daemons](../cli/server.md#provisioner-daemons), which execute`terraform` during workspace and template builds. However, there are sometimes benefits to running external provisioner daemons:
44

‎docs/images/autostart.png

-30.4 KB
Loading

‎docs/images/autostop.png

-10.2 KB
Loading

‎docs/images/creating-workspace-ui.png

69.7 KB
Loading

‎docs/images/schedule.png

-12.3 KB
Loading

‎docs/images/template-variables.png

89.9 KB
Loading
54.2 KB
Loading
Loading
46.9 KB
Loading
55.9 KB
Loading
93.4 KB
Loading
75.6 KB
Loading
Loading

‎docs/images/templates/edit-files.png

50.1 KB
Loading
32.8 KB
Loading
63.6 KB
Loading

‎docs/images/templates/publish.png

79.1 KB
Loading
45 KB
Loading

‎docs/images/templates/source-code.png

59.3 KB
Loading
Loading
140 KB
Loading
39.6 KB
Loading
61.5 KB
Loading
226 KB
Loading

‎docs/images/templates/update.png

171 KB
Loading
67.5 KB
Loading
497 KB
Loading
110 KB
Loading

‎docs/images/workspace-update.png

33.6 KB
Loading

‎docs/manifest.json

Lines changed: 54 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -134,75 +134,86 @@
134134
},
135135
{
136136
"title":"Templates",
137-
"description":"Learn about templates, whichdefine the infrastructureunderlying workspaces",
137+
"description":"Templatesdefine the infrastructurefor workspaces",
138138
"path":"./templates/index.md",
139139
"icon_path":"./images/icons/picture.svg",
140140
"children": [
141141
{
142-
"title":"Templates & Terraform",
143-
"description":"Learn what makes up a template",
144-
"path":"./templates/concepts.md",
142+
"title":"Working with templates",
143+
"description":"Creating, editing, and updating templates",
144+
"path":"./templates/creating.md"
145+
},
146+
{
147+
"title":"Your first template",
148+
"description":"A tutorial for creating and editing your first template",
149+
"path":"./templates/tutorial.md"
150+
},
151+
{
152+
"title":"Guided tour",
153+
"description":"Create a template from scratch",
154+
"path":"./templates/tour.md"
155+
},
156+
{
157+
"title":"Setting up templates",
158+
"description":"Best practices for writing templates",
159+
"path":"./templates/best-practices.md",
145160
"children": [
146161
{
147-
"title":"Parameters",
148-
"description":"Use parameters to customize templates",
149-
"path":"./templates/parameters.md",
150-
"icon_path":"./images/icons/code.svg"
162+
"title":"Change management",
163+
"description":"Versioning templates with git and CI",
164+
"path":"./templates/change-management.md",
165+
"icon_path":"./images/icons/git.svg"
151166
},
152167
{
153-
"title":"Terraform Modules",
154-
"description":"Reuse code across Coder templates",
155-
"path":"./templates/modules.md"
168+
"title":"Provider authentication",
169+
"description":"Authenticate the provisioner",
170+
"path":"./templates/authentication.md",
171+
"icon_path":"./images/icons/key.svg"
156172
},
157173
{
158-
"title":"Agent Metadata",
159-
"description":"Learn how to expose live agent information to users",
160-
"path":"./templates/agent-metadata.md",
161-
"icon_path":"./images/icons/table-rows.svg"
174+
"title":"Resource persistence",
175+
"description":"How resource persistence works in Coder",
176+
"path":"./templates/resource-persistence.md",
177+
"icon_path":"./images/icons/infinity.svg"
162178
},
163179
{
164-
"title":"Resource Metadata",
165-
"description":"Learn how to expose resource data to users",
166-
"path":"./templates/resource-metadata.md",
167-
"icon_path":"./images/icons/table-rows.svg"
180+
"title":"Terraform modules",
181+
"description":"Reuse code across Coder templates",
182+
"path":"./templates/modules.md"
168183
}
169184
]
170185
},
171186
{
172-
"title":"Best Practices",
173-
"description":"Best practices for writing/managing templates",
174-
"path":"./templates/best-practices.md",
187+
"title":"Customizing templates",
188+
"description":"Give information and options to workspace users",
189+
"path":"./templates/customizing.md",
175190
"children": [
176191
{
177-
"title":"Provider Authentication",
178-
"description":"Learn how to authenticate the provisioner",
179-
"path":"./templates/authentication.md",
180-
"icon_path":"./images/icons/key.svg"
192+
"title":"Agent metadata",
193+
"description":"Show operational metrics in the workspace",
194+
"path":"./templates/agent-metadata.md"
181195
},
182196
{
183-
"title":"Resource Persistence",
184-
"description":"Learn how resource persistence works in Coder",
185-
"path":"./templates/resource-persistence.md",
186-
"icon_path":"./images/icons/infinity.svg"
197+
"title":"Resource metadata",
198+
"description":"Show information in the workspace about template resources",
199+
"path":"./templates/resource-metadata.md"
187200
},
188201
{
189-
"title":"Change Management",
190-
"description":"Learn how to source-control templates with git and CI",
191-
"path":"./templates/change-management.md",
192-
"icon_path":"./images/icons/git.svg"
202+
"title":"Parameters",
203+
"description":"Prompt the user for additional information about a workspace",
204+
"path":"./templates/parameters.md"
193205
}
194206
]
195207
},
196-
197208
{
198209
"title":"Open in Coder",
199-
"description":"Learn how to add an\"Open in Coder\" button to your repos",
210+
"description":"Add an\"Open in Coder\" button to your repos",
200211
"path":"./templates/open-in-coder.md",
201212
"icon_path":"./images/icons/key.svg"
202213
},
203214
{
204-
"title":"Docker inWorkspaces",
205-
"description":"Usedocker inside containerized templates",
215+
"title":"Docker inworkspaces",
216+
"description":"UseDocker inside containerized templates",
206217
"path":"./templates/docker-in-workspaces.md",
207218
"icon_path":"./images/icons/docker.svg"
208219
},
@@ -211,6 +222,11 @@
211222
"description":"Use devcontainers in workspaces",
212223
"path":"./templates/devcontainers.md",
213224
"state":"alpha"
225+
},
226+
{
227+
"title":"Troubleshooting templates",
228+
"description":"Fix common template problems",
229+
"path":"./templates/troubleshooting.md"
214230
}
215231
]
216232
},

‎docs/templates/agent-metadata.md

Lines changed: 35 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,26 @@
1-
#AgentMetadata
1+
#Agentmetadata
22

33
![agent-metadata](../images/agent-metadata.png)
44

5-
With Agent Metadata, template admins can expose operational metrics from
6-
their workspaces to their users. It is the dynamic complement of[Resource Metadata](./resource-metadata.md).
5+
You can show live operational metrics to workspace users with agent
6+
metadata. It is the dynamic complement of[Resource
7+
Metadata](./resource-metadata.md).
78

8-
See the[Terraform reference](https://registry.terraform.io/providers/coder/coder/latest/docs/resources/agent#metadata).
9+
You specify agent metadata in the
10+
[`coder_agent`](https://registry.terraform.io/providers/coder/coder/latest/docs/resources/agent).
911

1012
##Examples
1113

12-
All of these examples use[heredoc strings](https://developer.hashicorp.com/terraform/language/expressions/strings#heredoc-strings) for the script declaration. With heredoc strings, you
13-
can script without messy escape codes, just as if you were working in your terminal.
14+
All of these examples use[heredoc
15+
strings](https://developer.hashicorp.com/terraform/language/expressions/strings#heredoc-strings)
16+
for the script declaration. With heredoc strings, you can script
17+
without messy escape codes, just as if you were working in your
18+
terminal.
1419

15-
Some of the below examples use the[`coder stat`](../cli/stat.md) command.
16-
This is useful for determining CPU/memory usage inside a container, which
17-
can be tricky otherwise.
20+
Some of the examples use the[`coder stat`](../cli/stat.md) command.
21+
This is useful for determining CPU and memory usage of the VM or
22+
container that the workspace is running in, which is more accurate
23+
than resource usage about the workspace's host.
1824

1925
Here's a standard set of metadata snippets for Linux agents:
2026

@@ -82,44 +88,46 @@ resource "coder_agent" "main" {
8288
}
8389
```
8490

85-
##Utilities
91+
##Useful utilities
92+
93+
You can also show agent metadata for information about the workspace's host.
8694

8795
[top](https://linux.die.net/man/1/top) is available in most Linux
88-
distributions and provides virtual memory, CPU and IO statistics. Running`top`
89-
produces output that looks like:
96+
distributions and provides virtual memory, CPU and IO statistics.
97+
Running`top`produces output that looks like:
9098

9199
```text
92100
%Cpu(s): 65.8 us, 4.4 sy, 0.0 ni, 29.3 id, 0.3 wa, 0.0 hi, 0.2 si, 0.0 st
93101
MiB Mem : 16009.0 total, 493.7 free, 4624.8 used, 10890.5 buff/cache
94102
MiB Swap: 0.0 total, 0.0 free, 0.0 used. 11021.3 avail Mem
95103
```
96104

97-
[vmstat](https://linux.die.net/man/8/vmstat) is available in most Linux
98-
distributions and provides virtual memory, CPU and IO statistics. Running`vmstat`
99-
produces output that looks like:
105+
[vmstat](https://linux.die.net/man/8/vmstat) is available in most
106+
Linuxdistributions and provides virtual memory, CPU and IO
107+
statistics. Running`vmstat`produces output that looks like:
100108

101109
```text
102110
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
103111
r b swpd free buff cache si so bi bo in cs us sy id wa st
104112
0 0 19580 4781680 12133692 217646944 0 2 4 32 1 0 1 1 98 0 0
105113
```
106114

107-
[dstat](https://linux.die.net/man/1/dstat) is considerably more parseable
108-
than`vmstat` but often not included in base images. It is easily installed by
109-
most package managers under the name`dstat`. The output of running`dstat 1 1` looks
110-
like:
115+
[dstat](https://linux.die.net/man/1/dstat) is considerably more
116+
parseablethan`vmstat` but often not included in base images. It is
117+
easily installed bymost package managers under the name`dstat`. The
118+
output of running`dstat 1 1` lookslike:
111119

112120
```text
113121
--total-cpu-usage-- -dsk/total- -net/total- ---paging-- ---system--
114122
usr sys idl wai stl| read writ| recv send| in out | int csw
115123
1 1 98 0 0|3422k 25M| 0 0 | 153k 904k| 123k 174k
116124
```
117125

118-
##DB Write Load
126+
##Managing the database load
119127

120-
Agent metadata can generate a significant write load and overwhelm your
121-
database if you're not careful. The approximate writes per second can be
122-
calculated using the formula:
128+
Agent metadata can generate a significant write load and overwhelm
129+
your Coderdatabase if you're not careful. The approximate writes per
130+
second can becalculated using the formula:
123131

124132
```text
125133
(metadata_count * num_running_agents * 2) / metadata_avg_interval
@@ -131,7 +139,8 @@ For example, let's say you have
131139
- each with 6 metadata snippets
132140
- with an average interval of 4 seconds
133141

134-
You can expect`(10 * 6 * 2) / 4` or 30 writes per second.
142+
You can expect`(10 * 6 * 2) / 4`, or 30 writes per second.
135143

136-
One of the writes is to the`UNLOGGED``workspace_agent_metadata` table and
137-
the other to the`NOTIFY` query that enables live stats streaming in the UI.
144+
One of the writes is to the`UNLOGGED``workspace_agent_metadata`
145+
table and the other to the`NOTIFY` query that enables live stats
146+
streaming in the UI.

‎docs/templates/authentication.md

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,42 @@
77
</p>
88
</blockquote>
99

10-
Coder's provisioner process needs to authenticate with cloud provider APIs to provision
11-
workspaces. You can either pass credentials to the provisioner as parameters or execute Coder
12-
in an environment that is authenticated with the cloud provider.
10+
The Coder server's
11+
[provisioner](https://registry.terraform.io/providers/coder/coder/latest/docs/data-sources/provisioner)
12+
process needs to authenticate with other provider APIs to provision
13+
workspaces. There are two approaches to do this:
1314

14-
We encourage the latter where supported. This approach simplifies the template, keeps cloud
15-
provider credentials out of Coder's database (making it a less valuable target for attackers),
16-
and is compatible with agent-based authentication schemes (that handle credential rotation
17-
and/or ensure the credentials are not written to disk).
15+
- Pass credentials to the provisioner as parameters.
16+
- Preferred: Execute the Coder server in an environment that is
17+
authenticated with the provider.
1818

19-
Cloud providers for which the Terraform provider supports authenticated environments include
19+
We encourage the latter approach where supported:
20+
21+
- Simplifies the template.
22+
- Keeps provider credentials out of Coder's database, making it
23+
a less valuable target for attackers.
24+
- Compatible with agent-based authentication schemes, which handle
25+
credential rotation or ensure the credentials are not written to disk.
26+
27+
Generally, you can set up an environment to provide credentials to
28+
Coder in these ways:
29+
30+
- A well-known location on disk. For example,`~/.aws/credentials` for
31+
AWS on POSIX systems.
32+
- Environment variables.
33+
34+
It is usually sufficient to authenticate using the CLI or SDK for the
35+
provider before running Coder, but check the Terraform provider's
36+
documentation for details.
37+
38+
These platforms have Terraform providers that support authenticated
39+
environments:
2040

2141
-[Google Cloud](https://registry.terraform.io/providers/hashicorp/google/latest/docs)
2242
-[Amazon Web Services](https://registry.terraform.io/providers/hashicorp/aws/latest/docs)
2343
-[Microsoft Azure](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs)
2444
-[Kubernetes](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs)
2545

26-
Additional providers may be supported; check the
27-
[documentation of the Terraform provider](https://registry.terraform.io/browse/providers) for
28-
details.
29-
30-
The way these generally work is via the credentials being available to Coder either in some
31-
well-known location on disk (e.g.`~/.aws/credentials` for AWS on posix systems), or via
32-
environment variables. It is usually sufficient to authenticate using the CLI or SDK for the
33-
cloud provider before running Coder for this to work, but check the Terraform provider
34-
documentation for details.
46+
Other providers might also support authenticated environments. Check
47+
the[documentation of the Terraform
48+
provider](https://registry.terraform.io/browse/providers) for details.

‎docs/templates/best-practices.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
#Template best practices
22

3-
Templates are very flexible
3+
We recommend a few ways to manage workspace resources, authentication,
4+
and versioning.
5+
6+
<children>
7+
</children>

‎docs/templates/change-management.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#Template Change Management
22

3-
We recommend source controlling your templates as you would other code.[Install Coder](../install/) in CI/CD pipelines to push new template versions.
3+
We recommend source-controlling your templates as you would other
4+
code. You can[install Coder](../install/) in CI/CD pipelines to push new
5+
template versions.
46

57
```console
68
#Install the Coder CLI
@@ -25,7 +27,7 @@ coder templates push --yes $CODER_TEMPLATE_NAME \
2527
--name=$CODER_TEMPLATE_VERSION # Version name is optional
2628
```
2729

28-
>Looking for an example? See how we push our development image
29-
>and template[via GitHub actions](https://github.com/coder/coder/blob/main/.github/workflows/dogfood.yaml).
30-
31-
>To cap token lifetime on creation,[configure Coder server to set a shorter max token lifetime](../cli/server.md#--max-token-lifetime)
30+
To cap token lifetime on creation,[configure Coder server to set a
31+
shorter max token lifetime](../cli/server.md#--max-token-lifetime).
32+
For an example, see how we push our development image and template
33+
[with GitHub actions](https://github.com/coder/coder/blob/main/.github/workflows/dogfood.yaml).

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp