Get basic environment creation beginning to work
This commit is contained in:
@@ -1,64 +0,0 @@
|
||||
package environment
|
||||
|
||||
import (
|
||||
"os"
|
||||
)
|
||||
|
||||
// Defines the docker configuration used by the daemon when interacting with
|
||||
// containers and networks on the system.
|
||||
type DockerConfiguration struct {
|
||||
Container struct {
|
||||
User string
|
||||
}
|
||||
|
||||
// Network configuration that should be used when creating a new network
|
||||
// for containers run through the daemon.
|
||||
Network struct {
|
||||
// The interface that should be used to create the network. Must not conflict
|
||||
// with any other interfaces in use by Docker or on the system.
|
||||
Interface string
|
||||
|
||||
// The name of the network to use. If this network already exists it will not
|
||||
// be created. If it is not found, a new network will be created using the interface
|
||||
// defined.
|
||||
Name string
|
||||
}
|
||||
|
||||
// If true, container images will be updated when a server starts if there
|
||||
// is an update available. If false the daemon will not attempt updates and will
|
||||
// defer to the host system to manage image updates.
|
||||
UpdateImages bool `yaml:"update_images"`
|
||||
|
||||
// The location of the Docker socket.
|
||||
Socket string
|
||||
|
||||
// Defines the location of the timezone file on the host system that should
|
||||
// be mounted into the created containers so that they all use the same time.
|
||||
TimezonePath string `yaml:"timezone_path"`
|
||||
}
|
||||
|
||||
type Docker struct {
|
||||
// Defines the configuration for the Docker instance that will allow us to connect
|
||||
// and create and modify containers.
|
||||
Configuration DockerConfiguration
|
||||
}
|
||||
|
||||
// Ensure that the Docker environment is always implementing all of the methods
|
||||
// from the base environment interface.
|
||||
var _ Environment = (*Docker)(nil)
|
||||
|
||||
func (d *Docker) Exists() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func (d *Docker) Start() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (d *Docker) Stop() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (d *Docker) Terminate(signal os.Signal) error {
|
||||
return nil
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
package environment
|
||||
|
||||
import (
|
||||
"os"
|
||||
)
|
||||
|
||||
// Defines the basic interface that all environments need to implement so that
|
||||
// a server can be properly controlled.
|
||||
type Environment interface {
|
||||
// Starts a server instance. If the server instance is not in a state where it
|
||||
// can be started an error should be returned.
|
||||
Start() error
|
||||
|
||||
// Stops a server instance. If the server is already stopped an error should
|
||||
// not be returned.
|
||||
Stop() error
|
||||
|
||||
// Determines if the server instance exists. For example, in a docker environment
|
||||
// this should confirm that the container is created and in a bootable state. In
|
||||
// a basic CLI environment this can probably just return true right away.
|
||||
Exists() bool
|
||||
|
||||
// Terminates a running server instance using the provided signal. If the server
|
||||
// is not running no error should be returned.
|
||||
Terminate(signal os.Signal) error
|
||||
}
|
||||
Reference in New Issue
Block a user