Skip to content
This repository has been archived by the owner on Feb 5, 2019. It is now read-only.

Start the docker instance #5

Closed
MuschPusch opened this issue Feb 25, 2015 · 5 comments
Closed

Start the docker instance #5

MuschPusch opened this issue Feb 25, 2015 · 5 comments
Assignees

Comments

@MuschPusch
Copy link
Member

  • start it (wait?)
  • install drupal
  • copySSHKeyToDocker
@MuschPusch
Copy link
Member Author

Hm... i'm not sure how to implement this... I started writing a fabalicious task which checks supervisord if all services are running to realize that we would need to add it to all the fabalicious tasks involved above -> lame

Other options would be exposing the xml-rpc api of supervisord and add the waiting logic to jaMann.
xml-rpc and an exposed API where you can restart services -> lame

Supervisord also has some UI where you could check if all services and supervisord in general are up. The lame thing here that the UI will be up when apache is up and yes then what big miracle all services will be running...

@stmh
Copy link
Member

stmh commented Mar 1, 2015

I think the proper way is to extend the run_script task of fabalicious with a set of custom callbacks. Then you can add a new function to test if ssh is ready easily. then your docker-task-definition might look like this:

run:
  - our_run_command
  - wait_for_ssh()

wait_for_ssh will trigger a function in fabfile.py which can act accordingly.

I am currently working on this topic right now.

@stmh stmh self-assigned this Mar 1, 2015
@stmh
Copy link
Member

stmh commented Mar 1, 2015

Ok, I think I've finished the task. Custom callbacks are not sufficient, as you want to check for supervisor not on the docker-host but on the real host. This is a major nuisance in fabric, as you'll have to use executeto run a task on a different host.

Anyways: It's now dead simple to add "new commands " to the docker-host-configuration, I added three:

  • fail_on_error(1|0)
  • echo(text, color)
  • execute(task)

The last one is the most powerful: With this command you can execute tasks on the current host, e.g. execute(backupDB) or something similar.

I added a new task, called waitForServices and used your snippet you gave me and get it running.

So all you have to do is to add - execute(waitForServices) after the run-command.

Here's the commit: factorial-io/fabalicious@a49e797

Which raises a new bug/concern: We'll need a possibility to require a specific fabalicious-version for a given fabfile.yaml or part of a docker-configuration. As the docker-host-configuration is now separated by the fabfile.yaml it's easy to require new features in these files, qhichm ay be used with an outdated fabalicious-version.

@stmh
Copy link
Member

stmh commented Mar 8, 2015

I had some spare-time and added support for running the docker-instance from yeoman. I refactored the complete command–running-code and introduced the concepts of slots to run some queries in series, instead of parallel execution.

My code is part of the vagrant-feature-branch (I knows, stupid me) Please have a look at the new code.

@MuschPusch
Copy link
Member Author

Looks good to me! Merge back if you want to!

@stmh stmh closed this as completed in 082f275 Mar 9, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants