Merge internal/stack => component
This commit is contained in:
parent
7b2f79bea1
commit
91a088a56a
16 changed files with 40 additions and 72 deletions
26
env/component.go
vendored
26
env/component.go
vendored
|
|
@ -12,8 +12,6 @@ import (
|
|||
"github.com/FAU-CDI/wisski-distillery/component/ssh"
|
||||
"github.com/FAU-CDI/wisski-distillery/component/triplestore"
|
||||
"github.com/FAU-CDI/wisski-distillery/component/web"
|
||||
"github.com/FAU-CDI/wisski-distillery/embed"
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/stack"
|
||||
)
|
||||
|
||||
// TODO: Remove me when migration is complete
|
||||
|
|
@ -92,28 +90,6 @@ func (dis *Distillery) Triplestore() (ts triplestore.Triplestore) {
|
|||
|
||||
// makeComponent updates the baseComponent belonging to component
|
||||
func (dis *Distillery) makeComponent(component component.Component, base *component.ComponentBase) {
|
||||
base.Dir = dis.getComponentPath(component)
|
||||
base.Config = dis.Config
|
||||
}
|
||||
|
||||
// asCoreStack treats the provided stack as a core component of this distillery.
|
||||
// TODO: this should no longer be used
|
||||
func (dis *Distillery) makeComponentStack(component Component, stack stack.Installable) stack.Installable {
|
||||
stack.Dir = dis.getComponentPath(component)
|
||||
|
||||
name := component.Name()
|
||||
|
||||
// TODO: This writes out resources.
|
||||
// Should migrate this directly!
|
||||
if stack.Resources == nil {
|
||||
stack.Resources = embed.ResourceEmbed
|
||||
stack.ContextPath = filepath.Join("resources", "compose", name)
|
||||
stack.EnvPath = filepath.Join("resources", "templates", "docker-env", name)
|
||||
}
|
||||
|
||||
return stack
|
||||
}
|
||||
|
||||
func (dis *Distillery) getComponentPath(component Component) string {
|
||||
return filepath.Join(dis.Config.DeployRoot, "core", component.Name())
|
||||
base.Dir = filepath.Join(dis.Config.DeployRoot, "core", component.Name())
|
||||
}
|
||||
|
|
|
|||
2
env/distillery.go
vendored
2
env/distillery.go
vendored
|
|
@ -12,7 +12,7 @@ import (
|
|||
// Distillery represents a running instance for the distillery
|
||||
type Distillery struct {
|
||||
Config *config.Config
|
||||
Upstream Upstream
|
||||
Upstream Upstream // TODO: not sure this belongs here
|
||||
}
|
||||
|
||||
// Upstream are the upstream urls connecting to the various external components.
|
||||
|
|
|
|||
16
env/instances.go
vendored
16
env/instances.go
vendored
|
|
@ -11,10 +11,10 @@ import (
|
|||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/FAU-CDI/wisski-distillery/component"
|
||||
"github.com/FAU-CDI/wisski-distillery/embed"
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/bookkeeping"
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/fsx"
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/stack"
|
||||
"github.com/alessio/shellescape"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/tkw1536/goprogram/exit"
|
||||
|
|
@ -229,9 +229,9 @@ func (instance Instance) URL() *url.URL {
|
|||
}
|
||||
|
||||
// Stack represents a stack representing this instance
|
||||
func (instance Instance) Stack() stack.Installable {
|
||||
return stack.Installable{
|
||||
Stack: stack.Stack{
|
||||
func (instance Instance) Stack() component.Installable {
|
||||
return component.Installable{
|
||||
Stack: component.Stack{
|
||||
Dir: instance.FilesystemBase,
|
||||
},
|
||||
Resources: embed.ResourceEmbed, // TODO: Move this over
|
||||
|
|
@ -260,9 +260,9 @@ func (instance Instance) Stack() stack.Installable {
|
|||
}
|
||||
}
|
||||
|
||||
func (instance Instance) ReserveStack() stack.Installable {
|
||||
return stack.Installable{
|
||||
Stack: stack.Stack{
|
||||
func (instance Instance) ReserveStack() component.Installable {
|
||||
return component.Installable{
|
||||
Stack: component.Stack{
|
||||
Dir: instance.FilesystemBase,
|
||||
},
|
||||
ContextPath: filepath.Join("resources", "compose", "reserve"),
|
||||
|
|
@ -282,7 +282,7 @@ func (instance Instance) Provision(io stream.IOStream) error {
|
|||
|
||||
// create the basic st!
|
||||
st := instance.Stack()
|
||||
if err := st.Install(io, stack.InstallationContext{}); err != nil {
|
||||
if err := st.Install(io, component.InstallationContext{}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue