Skip to content

Commit effbde7

Browse files
committed
Merge remote-tracking branch 'origin/main' into stevenmasley/template_update_params
2 parents aceca62 + 75205f5 commit effbde7

File tree

123 files changed

+3818
-2267
lines changed

Some content is hidden

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

123 files changed

+3818
-2267
lines changed

.goreleaser.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ nfpms:
9393
type: "config|noreplace"
9494
- src: coder.service
9595
dst: /usr/lib/systemd/system/coder.service
96+
scripts:
97+
preinstall: preinstall.sh
9698

9799
# Image templates are empty on snapshots to avoid lengthy builds for development.
98100
dockers:

README.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Coder creates remote development machines so your team can develop from anywhere
3333
> **Note**:
3434
> Coder is in an alpha state. [Report issues here](https://github.com/coder/coder/issues/new).
3535
36-
There are a few ways to install Coder: [install script](./docs/install.md#installsh) (macOS, Linux), [docker-compose](./docs/install.md#docker-compose), or [manually](./docs/install.md#manual) via the latest release (macOS, Windows, and Linux).
36+
There are a few ways to install Coder: [install script](https://coder.com/docs/coder-oss/latest/install#installsh) (macOS, Linux), [docker-compose](https://coder.com/docs/coder-oss/latest/install#docker-compose), or [manually](https://coder.com/docs/coder-oss/latest/install#manual) via the latest release (macOS, Windows, and Linux).
3737

3838
If you use the install script, you can preview what occurs during the install process:
3939

@@ -47,21 +47,25 @@ To install, run:
4747
curl -fsSL https://coder.com/install.sh | sh
4848
```
4949

50-
Once installed, you can run a temporary deployment in dev mode (all data is in-memory and destroyed on exit):
50+
Once installed, you can start a production deployment with a single command:
5151

5252
```sh
53-
coder server --dev
53+
# Automatically sets up an external access URL on *.try.coder.app
54+
coder server --tunnel
55+
56+
# Requires a PostgreSQL instance and external access URL
57+
coder server --postgres-url <url> --access-url <url>
5458
```
5559

56-
Use `coder --help` to get a complete list of flags and environment variables. Use our [quickstart guide](./docs/quickstart.md) for a full walkthrough.
60+
Use `coder --help` to get a complete list of flags and environment variables. Use our [quickstart guide](https://coder.com/docs/coder-oss/latest/quickstart) for a full walkthrough.
5761

5862
## Documentation
5963

60-
Visit our docs [here](./docs/index.md).
64+
Visit our docs [here](https://coder.com/docs/coder-oss).
6165

6266
## Comparison
6367

64-
Please file [an issue](https://github.com/coder/coder/issues/new) if any information is out of date. Also refer to: [What Coder is not](./docs/about.md#what-coder-is-not).
68+
Please file [an issue](https://github.com/coder/coder/issues/new) if any information is out of date. Also refer to: [What Coder is not](https://coder.com/docs/coder-oss/latest/about#what-coder-is-not).
6569

6670
| Tool | Type | Delivery Model | Cost | Environments |
6771
| :---------------------------------------------------------- | :------- | :----------------- | :---------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------- |
@@ -82,6 +86,6 @@ Join our community on [Discord](https://discord.gg/coder) and [Twitter](https://
8286

8387
## Contributing
8488

85-
Read the [contributing docs](./docs/CONTRIBUTING.md).
89+
Read the [contributing docs](https://coder.com/docs/coder-oss/latest/CONTRIBUTING).
8690

8791
Find our list of contributors [here](./docs/CONTRIBUTORS.md).

cli/autostart_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ func TestAutostart(t *testing.T) {
107107
clitest.SetupConfig(t, client, root)
108108

109109
err := cmd.Execute()
110-
require.ErrorContains(t, err, "status code 403: Forbidden", "unexpected error")
110+
require.ErrorContains(t, err, "status code 404", "unexpected error")
111111
})
112112

113113
t.Run("unset_NotFound", func(t *testing.T) {
@@ -124,7 +124,7 @@ func TestAutostart(t *testing.T) {
124124
clitest.SetupConfig(t, client, root)
125125

126126
err := cmd.Execute()
127-
require.ErrorContains(t, err, "status code 403: Forbidden", "unexpected error")
127+
require.ErrorContains(t, err, "status code 404:", "unexpected error")
128128
})
129129
}
130130

cli/bump.go

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,26 @@ import (
88
"github.com/spf13/cobra"
99
"golang.org/x/xerrors"
1010

11+
"github.com/coder/coder/coderd/util/tz"
1112
"github.com/coder/coder/codersdk"
1213
)
1314

1415
const (
15-
bumpDescriptionLong = `To extend the autostop deadline for a workspace.`
16+
bumpDescriptionShort = `Shut your workspace down after a given duration has passed.`
17+
bumpDescriptionLong = `Modify the time at which your workspace will shut down automatically.
18+
* Provide a duration from now (for example, 1h30m).
19+
* The minimum duration is 30 minutes.
20+
* If the workspace template restricts the maximum runtime of a workspace, this will be enforced here.
21+
* If the workspace does not already have a shutdown scheduled, this does nothing.
22+
`
1623
)
1724

1825
func bump() *cobra.Command {
1926
bumpCmd := &cobra.Command{
2027
Args: cobra.RangeArgs(1, 2),
2128
Annotations: workspaceCommand,
22-
Use: "bump <workspace-name> <duration>",
23-
Short: "Extend the autostop deadline for a workspace.",
29+
Use: "bump <workspace-name> <duration from now>",
30+
Short: bumpDescriptionShort,
2431
Long: bumpDescriptionLong,
2532
Example: "coder bump my-workspace 90m",
2633
RunE: func(cmd *cobra.Command, args []string) error {
@@ -39,17 +46,20 @@ func bump() *cobra.Command {
3946
return xerrors.Errorf("get workspace: %w", err)
4047
}
4148

42-
newDeadline := time.Now().Add(bumpDuration)
49+
loc, err := tz.TimezoneIANA()
50+
if err != nil {
51+
loc = time.UTC // best effort
52+
}
4353

44-
if newDeadline.Before(workspace.LatestBuild.Deadline) {
54+
if bumpDuration < 29*time.Minute {
4555
_, _ = fmt.Fprintf(
4656
cmd.OutOrStdout(),
47-
"The proposed deadline is %s before the current deadline.\n",
48-
workspace.LatestBuild.Deadline.Sub(newDeadline).Round(time.Minute),
57+
"Please specify a duration of at least 30 minutes.\n",
4958
)
5059
return nil
5160
}
5261

62+
newDeadline := time.Now().In(loc).Add(bumpDuration)
5363
if err := client.PutExtendWorkspace(cmd.Context(), workspace.ID, codersdk.PutExtendWorkspaceRequest{
5464
Deadline: newDeadline,
5565
}); err != nil {
@@ -58,10 +68,10 @@ func bump() *cobra.Command {
5868

5969
_, _ = fmt.Fprintf(
6070
cmd.OutOrStdout(),
61-
"Workspace %q will now stop at %s\n", workspace.Name,
62-
newDeadline.Format(time.RFC822),
71+
"Workspace %q will now stop at %s on %s\n", workspace.Name,
72+
newDeadline.Format(timeFormat),
73+
newDeadline.Format(dateFormat),
6374
)
64-
6575
return nil
6676
},
6777
}

cli/bump_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@ func TestBump(t *testing.T) {
124124
workspace, err = client.Workspace(ctx, workspace.ID)
125125
require.NoError(t, err)
126126

127-
// TODO(cian): need to stop and start the workspace as we do not update the deadline yet
128-
// see: https://github.com/coder/coder/issues/1783
127+
// NOTE(cian): need to stop and start the workspace as we do not update the deadline
128+
// see: https://github.com/coder/coder/issues/2224
129129
coderdtest.MustTransitionWorkspace(t, client, workspace.ID, database.WorkspaceTransitionStart, database.WorkspaceTransitionStop)
130130
coderdtest.MustTransitionWorkspace(t, client, workspace.ID, database.WorkspaceTransitionStop, database.WorkspaceTransitionStart)
131131

cli/config/file.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,18 @@ func (r Root) DotfilesURL() File {
2525
return File(filepath.Join(string(r), "dotfilesurl"))
2626
}
2727

28+
func (r Root) PostgresPath() string {
29+
return filepath.Join(string(r), "postgres")
30+
}
31+
32+
func (r Root) PostgresPassword() File {
33+
return File(filepath.Join(r.PostgresPath(), "password"))
34+
}
35+
36+
func (r Root) PostgresPort() File {
37+
return File(filepath.Join(r.PostgresPath(), "port"))
38+
}
39+
2840
// File provides convenience methods for interacting with *os.File.
2941
type File string
3042

0 commit comments

Comments
 (0)