pets

package
v0.0.0-...-fb34658 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 10, 2018 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DownCmd = &cobra.Command{
	Use:   "down",
	Short: "Kill all processes started by pets",
	Run: func(cms *cobra.Command, args []string) {
		analyticsService.Incr("cmd.down", nil)
		defer analyticsService.Flush(time.Second)

		procfs, err := proc.NewProcFS()
		if err != nil {
			fatal(err)
		}

		procs, err := procfs.ProcsFromFS()
		if err != nil {
			fatal(err)
		}

		if len(procs) == 0 {
			fmt.Println("No pets running")
			return
		}

		for _, p := range procs {
			if p.ServiceName != "" {
				fmt.Printf("Stopping %s\n", p.ServiceKey())
			} else {
				fmt.Printf("Stopping pid %d\n", p.Pid)
			}

			pgid := -p.Pid
			syscall.Kill(pgid, syscall.SIGINT)
		}

		procfs.RemoveAllProcs()
	},
}
View Source
var ListCmd = &cobra.Command{
	Use:   "list",
	Short: "List all processes started by pets",
	Run: func(cms *cobra.Command, args []string) {
		procfs, err := proc.NewProcFS()
		if err != nil {
			fatal(err)
		}

		procs, err := procfs.ProcsFromFS()
		if err != nil {
			fatal(err)
		}

		if len(procs) == 0 {
			fmt.Println("No pets running")
			return
		}

		fmt.Printf("%-25s%-15s%-15s%-15s\n", "Name", "Age", "Host", "Port")
		for _, p := range procs {
			el := timeDur(p.TimeSince().Truncate(time.Second))
			fmt.Printf("%-25s%-15s%-15s%-15d\n", p.DisplayName, el, p.Hostname, p.Port)
		}
	},
}
View Source
var LogsCmd = &cobra.Command{
	Use:   "logs",
	Short: "Get logs for running servers",
	Example: `pets logs
pets logs frontend`,
}
View Source
var RootCmd = &cobra.Command{
	Use:   "pets [arguments]",
	Short: "PETS makes it easy to manage lots of servers running on your machine that you want to keep a close eye on for local development.",
	Long: `A PETS file is like a Makefile for running servers and connecting them
to other servers. With PETS, we can switch back and forth quickly
between servers running locally and servers running in the cloud.`,
	Run: pets,
}
View Source
var UpCmd = &cobra.Command{
	Use:   "up",
	Short: "Start servers specified in the Petsfile",
	Long: `Start servers specified in the Petsfile.

To start all servers with tier "local", run: 'pets up'

To start all servers on a different provider tier (for example, k8s), run: 'pets up --tier=k8s'

To start a single server and all its dependencies, run: 'pets up my-server'.
`,
	Example: `pets up
pets up frontend
pets up frontend --tier=k8s`,
}

Functions

func Execute

func Execute() error

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL