Skip to content

Commit e9e3369

Browse files
committed
chore: Merge branch 'main' of github.com:coder/coder into bq/add-org-id-to-the-user-response
2 parents 14f9f0f + 8661f92 commit e9e3369

File tree

20 files changed

+531
-158
lines changed

20 files changed

+531
-158
lines changed

cli/server.go

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,13 @@ import (
4747
"github.com/coder/coder/provisionersdk/proto"
4848
)
4949

50+
var defaultDevUser = codersdk.CreateFirstUserRequest{
51+
Email: "admin@coder.com",
52+
Username: "developer",
53+
Password: "password",
54+
OrganizationName: "acme-corp",
55+
}
56+
5057
// nolint:gocyclo
5158
func server() *cobra.Command {
5259
var (
@@ -275,6 +282,9 @@ func server() *cobra.Command {
275282
if err != nil {
276283
return xerrors.Errorf("create first user: %w", err)
277284
}
285+
_, _ = fmt.Fprintf(cmd.ErrOrStderr(), "email: %s\n", defaultDevUser.Email)
286+
_, _ = fmt.Fprintf(cmd.ErrOrStderr(), "password: %s\n", defaultDevUser.Password)
287+
_, _ = fmt.Fprintln(cmd.ErrOrStderr())
278288

279289
_, _ = fmt.Fprintf(cmd.ErrOrStderr(), cliui.Styles.Wrap.Render(`Started in dev mode. All data is in-memory! `+cliui.Styles.Bold.Render("Do not use in production")+`. Press `+
280290
cliui.Styles.Field.Render("ctrl+c")+` to clean up provisioned infrastructure.`)+"\n\n")
@@ -441,18 +451,13 @@ func server() *cobra.Command {
441451
}
442452

443453
func createFirstUser(cmd *cobra.Command, client *codersdk.Client, cfg config.Root) error {
444-
_, err := client.CreateFirstUser(cmd.Context(), codersdk.CreateFirstUserRequest{
445-
Email: "admin@coder.com",
446-
Username: "developer",
447-
Password: "password",
448-
OrganizationName: "acme-corp",
449-
})
454+
_, err := client.CreateFirstUser(cmd.Context(), defaultDevUser)
450455
if err != nil {
451456
return xerrors.Errorf("create first user: %w", err)
452457
}
453458
token, err := client.LoginWithPassword(cmd.Context(), codersdk.LoginWithPasswordRequest{
454-
Email: "admin@coder.com",
455-
Password: "password",
459+
Email: defaultDevUser.Email,
460+
Password: defaultDevUser.Password,
456461
})
457462
if err != nil {
458463
return xerrors.Errorf("login with first user: %w", err)

cli/server_test.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package cli_test
22

33
import (
4+
"bytes"
45
"context"
56
"crypto/ecdsa"
67
"crypto/elliptic"
@@ -18,6 +19,7 @@ import (
1819
"testing"
1920
"time"
2021

22+
"github.com/stretchr/testify/assert"
2123
"github.com/stretchr/testify/require"
2224
"go.uber.org/goleak"
2325

@@ -73,9 +75,17 @@ func TestServer(t *testing.T) {
7375
ctx, cancelFunc := context.WithCancel(context.Background())
7476
defer cancelFunc()
7577
root, cfg := clitest.New(t, "server", "--dev", "--skip-tunnel", "--address", ":0")
78+
var stdoutBuf bytes.Buffer
79+
root.SetOutput(&stdoutBuf)
7680
go func() {
7781
err := root.ExecuteContext(ctx)
7882
require.ErrorIs(t, err, context.Canceled)
83+
84+
// Verify that credentials were output to the terminal.
85+
wantEmail := "email: admin@coder.com"
86+
wantPassword := "password: password"
87+
assert.Contains(t, stdoutBuf.String(), wantEmail, "expected output %q; got no match", wantEmail)
88+
assert.Contains(t, stdoutBuf.String(), wantPassword, "expected output %q; got no match", wantPassword)
7989
}()
8090
var token string
8191
require.Eventually(t, func() bool {

docs/CONTRIBUTING.md

Lines changed: 31 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,53 @@
1+
12
# Contributing
23

34
## Requirements
45

5-
`coder` requires Go 1.18+, Node 14+, and GNU Make.
6+
Coder requires Go 1.18+, Node 14+, and GNU Make.
67

7-
### Development Workflow
8+
### Development workflow
89

9-
The following `make` commands and scripts used in development:
10+
Use the following `make` commands and scripts in development:
1011

1112
- `make bin` builds binaries
1213
- `make install` installs binaries to `$GOPATH/bin`
1314
- `make test`
14-
- `make release` dry-runs a new release
15-
- `./develop.sh` hot-reloads for frontend development
15+
- `make release` dry runs a new release
16+
- `./develop.sh` hot reloads for front-end development
1617

1718
## Styling
1819

19-
### Go Style
20+
### Use Go style
2021

21-
Contributions must adhere to [Effective Go](https://go.dev/doc/effective_go). Linting rules should
22-
be preferred over documenting styles (run ours with `make lint`); humans are error prone!
22+
Contributions must adhere to the guidelines outlined in [Effective
23+
Go](https://go.dev/doc/effective_go). We prefer linting rules over documenting
24+
styles (run ours with `make lint`); humans are error-prone!
2325

24-
Read [Go's Code Review Comments Wiki](https://github.com/golang/go/wiki/CodeReviewComments) to find
26+
Read [Go's Code Review Comments
27+
Wiki](https://github.com/golang/go/wiki/CodeReviewComments) for information on
2528
common comments made during reviews of Go code.
2629

27-
#### No Unused Packages
28-
29-
Coders write packages that are used during implementation. It's difficult to validate whether an
30-
abstraction is valid until it's checked against an implementation. This results in a larger
31-
changeset but provides reviewers with an educated perspective on the contribution.
30+
### Avoid unused packages
3231

33-
## Review
32+
Coder writes packages that are used during implementation. It isn't easy to
33+
validate whether an abstraction is valid until it's checked against an
34+
implementation. This results in a larger changeset, but it provides reviewers
35+
with a holistic perspective regarding the contribution.
3436

35-
> Taken from [Go's review philosophy](https://go.dev/doc/contribute#reviews).
37+
## Reviews
3638

37-
Coders value thorough reviews. Think of each review comment like a ticket: you are expected to
38-
somehow "close" it by acting on it, either by implementing the suggestion or convincing the reviewer
39-
otherwise.
39+
> The following information has been borrowed from [Go's review
40+
> philosophy](https://go.dev/doc/contribute#reviews).
4041
41-
After you update the change, go through the review comments and make sure to reply to every one. You
42-
can click the "Done" button to reply indicating that you've implemented the reviewer's suggestion;
43-
otherwise, click on "Reply" and explain why you have not, or what you have done instead.
42+
Coder values thorough reviews. For each review comment that you receive, please
43+
"close" it by implementing the suggestion or providing an explanation on why the
44+
suggestion isn't the best option. Be sure to do this for each comment; you can
45+
click **Done** to indicate that you've implemented the suggestion, or you can
46+
add a comment explaining why you aren't implementing the suggestion (or what you
47+
chose to implement instead).
4448

45-
It is perfectly normal for changes to go through several round of reviews, with one or more
46-
reviewers making new comments every time and then waiting for an updated change before reviewing
47-
again. All contributors, including experienced maintainers, are subject to the same review cycle;
48-
this process is not meant to be applied selectively or discourage anyone from contribution.
49+
It is perfectly normal for changes to go through several rounds of reviews, with
50+
one or more reviewers making new comments every time, then waiting for an
51+
updated change before reviewing again. All contributors, including those from
52+
maintainers, are subject to the same review cycle; this process is not meant to
53+
be applied selectively or to discourage anyone from contributing.

docs/README.md

Lines changed: 63 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,105 @@
11
# Coder
22

3-
[!["GitHub Discussions"](https://img.shields.io/badge/%20GitHub-%20Discussions-gray.svg?longCache=true&logo=github&colorB=purple)](https://github.com/coder/coder/discussions) [!["Join us on Slack"](https://img.shields.io/badge/join-us%20on%20slack-gray.svg?longCache=true&logo=slack&colorB=brightgreen)](https://coder.com/community) [![Twitter Follow](https://img.shields.io/twitter/follow/CoderHQ?label=%40CoderHQ&style=social)](https://twitter.com/coderhq) [![codecov](https://codecov.io/gh/coder/coder/branch/main/graph/badge.svg?token=TNLW3OAP6G)](https://codecov.io/gh/coder/coder)
3+
[!["GitHub
4+
Discussions"](https://img.shields.io/badge/%20GitHub-%20Discussions-gray.svg?longCache=true&logo=github&colorB=purple)](https://github.com/coder/coder/discussions)
5+
[!["Join us on
6+
Slack"](https://img.shields.io/badge/join-us%20on%20slack-gray.svg?longCache=true&logo=slack&colorB=brightgreen)](https://coder.com/community)
7+
[![Twitter
8+
Follow](https://img.shields.io/twitter/follow/CoderHQ?label=%40CoderHQ&style=social)](https://twitter.com/coderhq)
9+
[![codecov](https://codecov.io/gh/coder/coder/branch/main/graph/badge.svg?token=TNLW3OAP6G)](https://codecov.io/gh/coder/coder)
410

511
Provision remote development environments with Terraform.
612

713
## Highlights
814

9-
- Automate development environments for Linux, Windows, and MacOS in your cloud
15+
- Automate development environments for Linux, Windows, and macOS
1016
- Start writing code with a single command
11-
- Use one of many [examples](./examples) to get started
17+
- Get started quickly using one of the [examples](./examples) provided
1218

13-
## Getting Started
19+
## Installing Coder
1420

15-
Install [the latest release](https://github.com/coder/coder/releases).
21+
Install [the latest release](https://github.com/coder/coder/releases) on a system with
22+
at least 1 CPU core and 2 GB RAM.
1623

17-
To tinker, start with dev-mode (all data is in-memory, and is destroyed on exit):
24+
To test, start with dev mode (all data is in-memory and is destroyed on exit):
1825

1926
```bash
20-
$ coder server --dev
27+
coder server --dev
2128
```
2229

2330
To run a production deployment with PostgreSQL:
2431

2532
```bash
26-
$ CODER_PG_CONNECTION_URL="postgres://<username>@<host>/<database>?password=<password>" \
33+
CODER_PG_CONNECTION_URL="postgres://<username>@<host>/<database>?password=<password>" \
2734
coder server
2835
```
2936

30-
To run as a system service, install with `.deb` or `.rpm`:
37+
To run as a system service, install with `.deb` (Debian, Ubuntu) or `.rpm`
38+
(Fedora, CentOS, RHEL, SUSE):
3139

3240
```bash
3341
# Edit the configuration!
34-
$ sudo vim /etc/coder.d/coder.env
35-
$ sudo service coder restart
42+
sudo vim /etc/coder.d/coder.env
43+
sudo service coder restart
3644
```
3745

38-
### Your First Workspace
46+
Use `coder start --help` to get a complete list of flags and environment
47+
variables.
3948

40-
In a new terminal, create a new project (eg. Develop in Linux on Google Cloud):
49+
### Your first workspace
4150

42-
```
43-
$ coder templates init
44-
$ coder templates create
51+
In a new terminal, create a template (e.g., a template to **Develop in Linux on
52+
Google Cloud**):
53+
54+
```bash
55+
coder templates init
56+
coder templates create
4557
```
4658

47-
Create a new workspace and SSH in:
59+
Create a workspace and connect to it via SSH:
4860

49-
```
50-
$ coder workspaces create my-first-workspace
51-
$ coder ssh my-first-workspace
61+
```bash
62+
coder workspaces create my-first-workspace
63+
coder ssh my-first-workspace
5264
```
5365

54-
### Working with Projects
66+
### Modifying templates
5567

56-
You can edit the Terraform from a sample project:
68+
You can edit the Terraform template using a sample template:
5769

5870
```sh
59-
$ coder templates init
60-
$ cd gcp-linux/
61-
$ vim main.tf
62-
$ coder templates update gcp-linux
71+
coder templates init
72+
cd gcp-linux/
73+
vim main.tf
74+
coder templates update gcp-linux
6375
```
6476

77+
## Documentation
78+
79+
- [About Coder](./about.md#about-coder)
80+
- [Why remote development](about.md#why-remote-development)
81+
- [Why Coder](about.md#why-coder)
82+
- [What Coder is not](about.md#what-coder-is-not)
83+
- [Templates](./templates.md)
84+
- [Manage templates](./templates.md#manage-templates)
85+
- [Persistent and ephemeral
86+
resources](./templates.md#persistent-and-ephemeral-resources)
87+
- [Variables](./templates.md#variables)
88+
- [Workspaces](./workspaces.md)
89+
- [Create workspaces](./workspaces.md#create-workspaces)
90+
- [Connect with SSH](./workspaces.md#connect-with-ssh)
91+
- [Editors and IDEs](./workspaces.md#editors-and-ides)
92+
- [Workspace lifecycle](./workspaces.md#workspace-lifecycle)
93+
- [Updating workspaces](./workspaces.md#updating-workspaces)
94+
6595
## Contributing
6696

6797
Read the [contributing docs](./CONTRIBUTING.md).
6898

99+
## Contributors
100+
101+
<!--- Add your row by date (mm/dd/yyyy), most recent date at end of list --->
102+
103+
| Name | Start Date | First PR Date |Organization| GitHub User Link |
104+
| ------------- | :--------: | :-----------: |:----------:| ------------------------------: |
105+
| Mathias Fredriksson | 04/25/2022 | 04/25/2022 | [Coder](https://github.com/coder) | [mafredri](https://github.com/mafredri) |

docs/SECURITY.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Security Policy
22

3-
Keeping your code secure is core to what we do. If you find a vulnerability,
4-
please send an email to security@coder.com, and our team will respond to you.
3+
Keeping your code secure is central to what we do. If you find a vulnerability,
4+
please send an email to security@coder.com.

docs/about.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# About Coder
2+
3+
Coder is an open source platform for creating and managing developer workspaces
4+
on your preferred clouds and servers.
5+
6+
By building on top of common development interfaces (SSH) and infrastructure tools (Terraform), Coder aims to make the process of **provisioning** and **accessing** remote workspaces approachable for organizations of various sizes and stages of cloud-native maturity.
7+
8+
> ⚠️ Coder v2 is in **alpha** state and is not ready for production use. For
9+
> production environments, please consider [Coder v1](https://coder.com/docs) or
10+
> [code-server](https://github.com/cdr/code-server).
11+
12+
## Why remote development
13+
14+
Migrating from local developer machines to workspaces hosted by cloud services
15+
is an increasingly common solution for developers[^1] and organizations[^2]
16+
alike. There are several benefits, including:
17+
18+
- **Increased speed:** Server-grade compute speeds up operations in software
19+
development, such as IDE loading, code compilation and building, and the
20+
running of large workloads (such as those for monolith or microservice
21+
applications)
22+
23+
- **Easier environment management:** Tools such as Terraform, nix, Docker,
24+
devcontainers, and so on make developer onboarding and the troubleshooting of
25+
development environments easier
26+
27+
- **Increase security:** Centralize source code and other data onto private
28+
servers or cloud services instead of local developer machines
29+
30+
- **Improved compatibility:** Remote workspaces share infrastructure
31+
configuration with other development, staging, and production environments,
32+
reducing configuration drift
33+
34+
- **Improved accessibility:** Devices such as lightweight notebooks,
35+
Chromebooks, and iPads can connect to remote workspaces via browser-based IDEs
36+
or remote IDE extensions
37+
38+
## Why Coder
39+
40+
The key difference between Coder v2 and other remote IDE platforms is the added
41+
layer of infrastructure control. This additional layer allows admins to:
42+
43+
- Support ARM, Windows, Linux, and macOS workspaces
44+
- Modify pod/container specs (e.g., adding disks, managing network policies,
45+
setting/updating environment variables)
46+
- Use VM/dedicated workspaces, developing with Kernel features (no container
47+
knowledge required)
48+
- Enable persistent workspaces, which are like local machines, but faster and
49+
hosted by a cloud service
50+
51+
Coder includes [production-ready templates](../examples) for use with AWS EC2,
52+
Azure, Google Cloud, Kubernetes, and more.
53+
54+
## What Coder is *not*
55+
56+
- Coder is not an infrastructure as code (IaC) platform. Terraform is the first
57+
IaC *provisioner* in Coder, allowing Coder admins to define Terraform
58+
resources as Coder workspaces.
59+
60+
- Coder is not a DevOps/CI platform. Coder workspaces can follow best practices
61+
for cloud service-based workloads, but Coder is not responsible for how you
62+
define or deploy the software you write.
63+
64+
- Coder is not an online IDE. Instead, Coder supports common editors, such as VS
65+
Code, vim, and JetBrains, over HTTPS or SSH.
66+
67+
- Coder is not a collaboration platform. You can use git and dedicated IDE
68+
extensions for pull requests, code reviews, and pair programming.
69+
70+
- Coder is not a SaaS/fully-managed offering. You must host
71+
Coder on a cloud service (AWS, Azure, GCP) or your private data center.
72+
73+
---
74+
75+
Next: [Templates](./templates.md)
76+
77+
[^1]: alexellis.io: [The Internet is my computer](https://blog.alexellis.io/the-internet-is-my-computer/)
78+
79+
[^2]: slack.engineering: [Development environments at Slack](https://slack.engineering/development-environments-at-slack)

0 commit comments

Comments
 (0)