Repository navigation
Splits "add" command into "start" and "import" commands - #52
Conversation
I would argue for 3 basic functions (in this realm here, replacing "add")
|
|
Can't ddev import please please take the name of the tarball instead of expecting it to be magically named? If that needs to be later it's ok with me. |
|
What caught me about this is that you have to have the source checked out (or gotten another way) in the src directory first. If you just have the tarball it can't detect the type of the site. Probably the site type should be a required argument for an init-type command? I'm not sure we're doing the right thing by auto-detecting anyway. Probably also I don't understand the long-term intent here, and when I do it will go down better. |
rfay
left a comment
There was a problem hiding this comment.
Import fails on a d7 import - do we still have to push and specify a new mysql container?
Getting Resources.
time="2017-03-09T07:44:52-07:00" level=info msg="Running Command" Command="tar -xzvf /Users/rfay/.drud/local/production-drud-d7.tar.gz -C /Users/rfay/.drud/local/drud-d7-production/files --exclude=sites/default/settings.php --exclude=docroot/wp-config.php"
time="2017-03-09T07:44:52-07:00" level=info msg="Running Command" Command="rsync -avz --recursive /Users/rfay/.drud/local/drud-d7-production/files/docroot/sites/default/files/ /Users/rfay/.drud/local/drud-d7-production/src/docroot/sites/default/files"
time="2017-03-09T07:44:52-07:00" level=info msg="Running Command" Command="chmod -R ugo+rw /Users/rfay/.drud/local/drud-d7-production/files"
time="2017-03-09T07:44:55-07:00" level=info msg="Drupal site. Creating settings.php file."
rpc error: code = 2 desc = oci runtime error: exec failed: container_linux.go:247: starting container process caused "exec: \"./import.sh\": stat ./import.sh: no such file or directory"
2017-03-09 07:45:06.472888 I | exit status 126
Could not execute command.
rfay
left a comment
There was a problem hiding this comment.
Most of my comments are about longstanding issues, but we need to improve error output and overall code quality as we go. Thanks for the good work on this.
| if scaffold != true { | ||
| exec.Command("open", tmpFilePath).Run() | ||
| } | ||
| exec.Command("open", tmpFilePath).Run() |
There was a problem hiding this comment.
Please check this for error and emit appropriate debugging information. I know this was pre-existing code, but we just have to fix things like this as we go.
| err = dockerutil.DockerCompose(cmdArgs...) | ||
| if err != nil { | ||
| log.Println(err) | ||
| Failed("Could not execute command.") |
There was a problem hiding this comment.
Please include the command that was trying to be executed in the Failed(). (or in the log.Println() above). It makes sorting these things out so much easier.
There was a problem hiding this comment.
IMHO the answer here is to make sure the DockerCompose function outputs when DRUD_DEBUG is enabled, and not make it the responsibility of the caller. In that case, we probably do need something better than "could not execute command" as output, though.
| Failed("Site never became ready") | ||
| } | ||
|
|
||
| color.Cyan("Successfully imported %s-%s", activeApp, activeDeploy) |
There was a problem hiding this comment.
Just a note for action as we go forward: We should be creating status functions that are named for their type rather than their color. For example, something like statusOutput(SUCCESS, "Successfully imported..."), which would then be implemented with Cyan.
There was a problem hiding this comment.
We actually have those, https://github.com/drud/ddev/blob/master/cmd/ddev/cmd/utils.go#L148
Could be that we want to move them out of a generic utils and into somewhere more visible.
| if err != nil { | ||
| log.Println(err) | ||
| Failed("Failed to start application.") | ||
| } |
There was a problem hiding this comment.
I'd like to see these two error messages concatenated rather than using separate output techniques. Also, please add the name of the "application" for context.
| WebTag ?= 0.2.0 | ||
| DBImg ?= drud/mysql-docker-local-57 | ||
| DBTag ?= 0.1.0 | ||
| DBTag ?= 0.2.0 |
There was a problem hiding this comment.
Good stuff. Could you edit https://github.com/drud/mysql-docker-local/releases/tag/v0.2.0 to remind us in the future what this was about? Just a trivial explanation with a link. Kind of an experimental technique for documenting tags, but might have some value.
There was a problem hiding this comment.
|
I tested - start and import work great. I approve |
| if err != nil { | ||
| log.Println(err) | ||
| Failed("Could not execute command.") | ||
| Failed("Could not execute command: %s", err) |
There was a problem hiding this comment.
I'd be happier if this said the command it was trying to execute, but a good step forward, thanks.
|
Approved, thanks. Only reservations: 1) Get @rickmanelius go-ahead from the semantic point of view (OK with me if it's not perfect) and 2) Pass tests of course. |
The Problem:
To satisfy our 0.1 target, we must be able to initialize an environment for a site without requiring an existing site's assets to import. Currently our "add" command does both.
The Fix:
This introduces a new "start" command (nevermind there was one i didn't know about somehow) and a new "import" command.
The "start" command only handles the configuration and initialization of the docker containers, returning the URL the site will be accessible at.
The "import" command handles the collection and import of assets for an existing site. It will also write the app configuration and check for 200 status.
These commands should work with both the legacy and local plugins.
The Test:
These notes are all using the drud-d7 staging site - once you are successful w/ this site feel free to test others, the process should generally be the same.
start
You should be able to reach the drupal install page following these steps:
This should return successfully with the URL of the site, which should then lead you to the install page.
import
Ensure that you have the latest archive saved to
~/.drud/local/staging-drud-d7.tar.gzThis should complete the placement of files and import the database, resulting in an imported site.
Automation Overview:
We discussed and reached the concensus that we will not introduce new tests for this change, as we expect major upcoming changes would largely invalidate any tests written at this stage.
Related Issue Link(s):
#48 - parent issue
drud/mysql-docker-local#8 - removes db import from mysql container start.
Release/Deployment notes:
Does this affect anything else, or are there ramifications for other code? Does anything have to be done on deployment?
drud/mysql-docker-local#8 will need review and merge, with a new version tag to be pushed after.