base

package
v0.0.0-...-3b153a2 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2021 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Image       string   `usage:"Specify the image of service"`
	Dir         string   `usage:"Specify the main data directory of service"`
	ExposePorts []string `usage:"Expose service ports to your host machine"`
	Disabled    bool     `usage:"Enable/Disable service"`
}

type Service

type Service struct {
	Name    string
	Context types.Context

	Hostname    string
	Image       string
	Command     []string
	Environment map[string]string
	Ports       []string
	Volumes     []string
	Disabled    bool
	DataDir     string

	Logger *logrus.Entry
	// contains filtered or unexported fields
}

func New

func New(ctx types.Context, name string) (*Service, error)

func (*Service) Apply

func (t *Service) Apply(cfg interface{}) error

func (*Service) Create

func (t *Service) Create(ctx context.Context) error

func (*Service) Exec

func (t *Service) Exec(ctx context.Context, name string, args ...string) (string, error)

func (*Service) FollowLogs

func (t *Service) FollowLogs(ctx context.Context, since string, tail string) (<-chan string, func(), error)

func (*Service) GetBranchImage

func (t *Service) GetBranchImage(name string) string

func (*Service) GetCommand

func (t *Service) GetCommand() []string

func (*Service) GetContainerName

func (t *Service) GetContainerName(ctx context.Context) string

GetContainerName parses the container name from "docker-compose ps" command

Example 1. docker-compose ps opendexd

Name                    Command        State                              Ports

---------------------------------------------------------------------------------------------------------------------- 5efa0e55c882_testnet_opendexd_1 /entrypoint.sh Exit 255 0.0.0.0:55002->18885/tcp, 18887/tcp, 28887/tcp, 8887/tcp

Example 2. docker-compose ps opendexd1 ERROR: No such service: opendexd1

Example 3. docker-compose ps boltz Name Command State Ports ------------------------------

func (*Service) GetDataDir

func (t *Service) GetDataDir() string

func (*Service) GetDefaultConfig

func (t *Service) GetDefaultConfig() interface{}

func (*Service) GetEnvironment

func (t *Service) GetEnvironment() map[string]string

func (*Service) GetHostname

func (t *Service) GetHostname() string

func (*Service) GetImage

func (t *Service) GetImage() string

func (*Service) GetLogs

func (t *Service) GetLogs(ctx context.Context, since string, tail string) ([]string, error)

func (*Service) GetMode

func (t *Service) GetMode() string

func (*Service) GetName

func (t *Service) GetName() string

func (*Service) GetPorts

func (t *Service) GetPorts() []string

func (*Service) GetRpcParams

func (t *Service) GetRpcParams() (interface{}, error)

func (*Service) GetStartedAt

func (t *Service) GetStartedAt(ctx context.Context) (string, error)

func (*Service) GetStatus

func (t *Service) GetStatus(ctx context.Context) (string, error)

func (*Service) GetVolumes

func (t *Service) GetVolumes() []string

func (*Service) IsDisabled

func (t *Service) IsDisabled() bool

func (*Service) IsRunning

func (t *Service) IsRunning() bool

func (*Service) Remove

func (t *Service) Remove(ctx context.Context) error

func (*Service) RemoveData

func (t *Service) RemoveData(ctx context.Context) error

func (*Service) Rescue

func (t *Service) Rescue(ctx context.Context) bool

func (*Service) Restart

func (t *Service) Restart(ctx context.Context) error

func (*Service) Start

func (t *Service) Start(ctx context.Context) error

func (*Service) Stop

func (t *Service) Stop(ctx context.Context) error

func (*Service) Up

func (t *Service) Up(ctx context.Context) error

Jump to

Keyboard shortcuts

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