Repository navigation
platform pkg re-org and initial local file plugin - #41
Conversation
|
Need to work out the merge conflicts but i don't plan on adding anything else to this PR...branch is just named wrong t this point. |
|
With the changes I added I'm able to spin up a site successfully, though its a very unintuitive workflow right now:
This would obviously be a fair bit of manual effort every time we add a site, and we don't yet have the working directory-based approach, an init cmd, or anything else to not make this workflow janky in the interim. proposalAn option we could consider with this PR would be to use the existing We would still be dependent on the newmedia archive format temporarily, but I believe this would unblock the removal of the legacy plugin, and allow for the removal of our S3 and Vault go dependencies. This would in turn unblock wrangling of the vendor directory. I do not believe we are talking about much effort to go this route, and I feel like it would allow for some tasks to move in parallel that otherwise would have been blocked on the full local file implementation, workflow changes, etc. |
|
With the commit I just pushed, the workflow becomes the following:
|
rfay
left a comment
There was a problem hiding this comment.
I'm putting "approve" here to not be in the way, but the basic issues are as commented: This must be viewed as a model for all future work, so should be viewed as that instead of as just a first cut of what we're trying to accomplish right now. Long term I'd like to see only one-file-per-plugin-type in the platform directory, other things moved out, and clear comments about what's being accomplished in each interface method.
I'd like to be confident that this is working with a few different tarballs before it goes in. It seems like we (might have) lost a little ground with the switch to tarballs.
| } | ||
|
|
||
| // AddHostsEntry will add the local site URL to the local hostfile. | ||
| func (l *LocalApp) AddHostsEntry() error { |
There was a problem hiding this comment.
This shouldn't be in the plugin unless I'm missing something.
There was a problem hiding this comment.
Agreed. (boring history) I believe this was added before there was an abstraction on platforms, and it made slightly more sense in that context. Probably was the wrong place for it even then, though.
| // HostName returns the hostname of a given application. | ||
| func (l *LocalApp) HostName() string { | ||
| return l.ContainerName() | ||
| } |
There was a problem hiding this comment.
Actually none of this should be in the plugin should it? I assume we have an assumption of how container names map to hostname and such? Or is that not true?
There was a problem hiding this comment.
Could be valid that a URL can be altered by a config file, but even then it probably shouldn't be plugin specific.
| if l.AppType == "wp" { | ||
| fileDir = "content/uploads" | ||
| } else if l.AppType == "drupal" || l.AppType == "drupal8" { | ||
| fileDir = "sites/default/files" |
There was a problem hiding this comment.
I don't mind this for today, but this isn't a valid assumption, and should not live as a literal in the code.
There was a problem hiding this comment.
This is addressed with the dcfg work.
| } else if l.AppType == "drupal" || l.AppType == "drupal8" { | ||
| fileDir = "sites/default/files" | ||
| } | ||
|
|
There was a problem hiding this comment.
Please do add some comments in this file explaining the overall strategy of what is being accomplished.
| out, err = system.RunCommand( | ||
| "chmod", | ||
| []string{"-R", "+rwx", path.Join(basePath, "files")}, | ||
| ) |
There was a problem hiding this comment.
Oh no, please no. If we can't do any better, chmod -R ugo+rw. Total security disasters like making everything 777 can find their way into the future and we don't want that.
There was a problem hiding this comment.
The good news is it's not cross-platform.
There was a problem hiding this comment.
This will go when we remove the archive dependency, so chmod -R ugo+rw is good enough for now.
| ) | ||
| } | ||
|
|
||
| // SetType determines the app type and sets it |
There was a problem hiding this comment.
Just a general comment (and I know this is from old times). Instead of saying something obvious like what you could guess from the function name anyway, say how it determines the app type, what an "app type" is, and things like that. (Does not need to be resolved in this PR)
beeradb
left a comment
There was a problem hiding this comment.
I also approve, with most of the same reservations as Randy. Feels like we need this to move forward, but I do hope we improve it and make it a better example as we go.
|
I took a minute to pull out the git and config related functionality to their own files, as we're likely to want to remove them from the platform package, either by deprecating the functionality or moving to a more sensible package. |
|
I know a lot is in flight, so just noting my results from having a machine with no trace of ddev.
Anyway, it may be user error or things in flight. |
|
On the first bullet, these folders are created the first time you run the start cmd. That's why we do it twice - to create the folders for that site, then manually satisfy the src checkout, and run again. |
This PR re-organizes and renames so that we have a
platformpackage representing the current interface and plugins. This also introduces the start of a local file plugin, temporarily relying on newmedia archives present on the user's system.Related Issues
#27
#12
#26