feat: Add systemd service and production deployment (#545)

* feat: Add systemd service and production deployment

This modifies CI to use a dpkg produced from release to update and
run Coder on a tiny VM in GCP.

It's intentionally kept simple, because customers should
be able to get this same easy install experience.

* Update globalSetup.ts

* Update globalSetup.ts

* Update globalSetup.ts

* Update coder.yaml

* Use pinned version of Go
This commit is contained in:
Kyle Carberry
2022-03-24 15:07:33 +00:00
committed by GitHub
parent 99ece25bb3
commit ddd86ab547
16 changed files with 369 additions and 172 deletions
+10 -3
View File
@@ -16,6 +16,7 @@ import (
type JobOptions struct {
Title string
Output bool
Fetch func() (codersdk.ProvisionerJob, error)
Cancel func() error
Logs func() (<-chan codersdk.ProvisionerJobLog, error)
@@ -40,7 +41,7 @@ func Job(cmd *cobra.Command, opts JobOptions) (codersdk.ProvisionerJob, error) {
var err error
job, err = opts.Fetch()
if err != nil {
// If a single fetch fails, it could be a one-off.
_, _ = fmt.Fprintln(cmd.OutOrStdout(), defaultStyles.Error.Render(err.Error()))
return
}
@@ -94,12 +95,15 @@ func Job(cmd *cobra.Command, opts JobOptions) (codersdk.ProvisionerJob, error) {
return
}
}
signal.Stop(stopChan)
spin.Stop()
_, _ = fmt.Fprintf(cmd.OutOrStdout(), Styles.FocusedPrompt.String()+"Gracefully canceling... wait for exit or data loss may occur!\n")
spin.Start()
err := opts.Cancel()
if err != nil {
_, _ = fmt.Fprintf(cmd.OutOrStdout(), "Failed to cancel %s...\n", err)
spin.Stop()
_, _ = fmt.Fprintln(cmd.OutOrStdout(), defaultStyles.Error.Render(err.Error()))
return
}
refresh()
}()
@@ -123,12 +127,15 @@ func Job(cmd *cobra.Command, opts JobOptions) (codersdk.ProvisionerJob, error) {
case log, ok := <-logs:
if !ok {
refresh()
continue
return job, nil
}
if !firstLog {
refresh()
firstLog = true
}
if !opts.Output {
continue
}
spin.Stop()
var style lipgloss.Style
switch log.Level {