Questions regarding automating development setup with DevilBox

#1

Hello all,

I am just trying to think how best to go about automating the setup of my development wordpress environment into Devilbox.

My company has MySQL backups on a web accessible share withing our intranet. We also have the composer and grunt files needed to setup an environment on our companies github.

My idea is to construct a bash script that executes on start of a devilbox container that pulls down a MySQL dump for the blog being developed on, take this dump and import it into MySQL. Then have it pull down the files needed to compose and run grunt. I not looking for anyone to solve this issue I just trying to get ideas on how to best tackle this.

The idea is to make it so a new developer can just pull down a docker image and be ready to develop on there first day

#2

Sure, there’s a way to use the built-in autostart provider

This can be achieved on a

  1. per PHP-version level: https://devilbox.readthedocs.io/en/latest/autostart/custom-scripts-per-php-version.html
  2. or PHP version independent: https://devilbox.readthedocs.io/en/latest/autostart/custom-scripts-globally.html

If you seek an example, here’s one to autostart NodeJS application during docker-compose up automatically: https://devilbox.readthedocs.io/en/latest/autostart/autostarting-nodejs-apps.html

#3

Thanks I already found this yesterday I gotten part way with the documentation I found yesterday.

I am still trying to figure out how to add SSH keys and a github auth token for composer.

I was able to get it to download a MySQL dump create the database do the import. Then download the github WordPress repo skelton and create the symbolic link.

I guess if I could get the SSH key part going I be most of the way to my objective. I found this post which talks about what I am attempting to do with devilbox:

I not sure how to implement that.

Thanks

#4

I have already suggested a current work-around (until this feature is fully available):

The above proposed directory structure is going to require some more heavy lifting on PHP-FPM images than initially thought.

But in order to make this possible for you, I have a quick-fix which should satisfy your need until this feature hits the master branch:

Add your ssh key into the bash/ directory and use the auto-start mechanism of the Devilbox to always copy (not move), this key to /home/devilbox/.ssh/. This allows all the magic happen automatically during docker-compose up/

See here for how to add custom autostart scripts: https://devilbox.readthedocs.io/en/latest/autostart/custom-scripts-globally.html