DEV Community

Cover image for 🧰 DevilBox: A containerized PHP dev environment (Part 1)

🧰 DevilBox: A containerized PHP dev environment (Part 1)

Frank Sierra on January 03, 2020

UPDATE (01/15/2020): fixed some typos and started writing part two. This year for me, is a year to share and what better way to start it than with...
Collapse
 
mbougarne profile image
Mourad Bougarne

Why you waiting man?!! Go and write a deep post about it, It makes the PHP development much easier especially if you want to use different versions, as example I like these new features in 7.4: Arrow Function, Spread Operator and Typed Properties. I'll wait the new post about it from you. Thank you!!!

Collapse
 
franksierra profile image
Frank Sierra

Sure I'll do, you can even try PHP 8 with it 😁

Collapse
 
mbougarne profile image
Mourad Bougarne

PHP8?!! What I heard it will be available in 2021?!

Thread Thread
 
franksierra profile image
Frank Sierra

Its in active development, and the image is built nightly from it, github.com/devilbox/docker-php-fpm...
This is from the Repo,

This repository will provide you a fully functional PHP-FPM 8.0 Docker image built from official sources nightly. It provides the base for Devilbox PHP-FPM Docker images.

Collapse
 
bgatwitt profile image
bga

I have almost used this for almost two years, its super awesome. If anyone is also intersted in some scripts that helps to install multiple versions of an application, let me know, i am happy to share.
Anyways, thanks for the post.

Collapse
 
boskoboskovic profile image
Boško

Hi there, I'm getting this error for httpd Cannot start service httpd: driver failed programming external connectivity on endpoint devilbox_httpd_1 (020de2a9f4437690626e391e4d7e1475fa65e324f83d1c5882a5791a37c31e4c): Error starting userland proxy: listen tcp 0.0.0.0:80: bind: address already in use

Collapse
 
franksierra profile image
Frank Sierra

Hey Hi, It seems like you already have something using port 80 on your computer you could run netstat -ant and look for port 80 and then kill it

Collapse
 
boskoboskovic profile image
Boško

Thanks, man. I will try that. I hope it will work after that.

Collapse
 
mehrdad profile image
Mehrdad Shokri

Does it facilitate only local development? I mean I couldn't find any guide on taking it to production

Collapse
 
franksierra profile image
Frank Sierra

In the company I work for, we don't have any dockerized production environments, just bare metal servers so we use devilbox only for development.

But I think it would be possible to use it as such, although there are a lot of things installed on those containers other than the bare minimum we need.

I don't know how big of a burden would it be, but most of the stuff is installed on the php-fpm containers, the best alternative I can think of, would be to replace the devilbox image for php-fpm for a custom one.

Collapse
 
michaelbutler profile image
Michael Butler

Was thinking this as well

Collapse
 
woddell profile image
Chris Weir

One of my colleagues told me about Devilbox but I've never looked as I'm learning more in depth Docker and felt it was better to write from scratch. Would love to see more posts about this though, looks really interesting.

Collapse
 
franksierra profile image
Frank Sierra

I was in that position at the begining, when I started learning about Docker, almost at the same time that I started using DevilBox, it helped me a lot about docker-compose.

Collapse
 
weswedding profile image
Weston Wedding

Devilbox is pretty cool and easy to work with once you've got it running...

Unfortunately you need to learn a lot about Docker if you need Devilbox to run from a non-standard hard drive location. Even more fun if you have an older CPU and get stuck with Docker Toolbox.

I've got an unfinished guide waiting for final touches, but it was pretty frustrating. Not a lot of useful information about the exact series of steps required to get Docker to correctly mount a new folder and telling Devilbox how to use it.

Collapse
 
mwoodpatrick profile image
Mark Wood-Patrick

I'm trying to get PHP debugging to work in devilbox running under vscode but running into an error where its reporting that port 9000 is already in use.

Doing

lsof -n -i -P | grep LISTEN

I get:

node 1726 devilbox 18u IPv6 630515 0t0 TCP *:34357 (LISTEN)

Does anyone have this working with current vscode & docker?

It seems like the devilbox documentation does not reflect current vscode & docker. Does anyone know if someone is working on fixing this?

Collapse
 
mwoodpatrick profile image
Mark Wood-Patrick

I fixed the issue about "port 9000 is already in use", just switched to a new port. Looking at the docker-compose file I do see:

PHP_FPM_SERVER_PORT=9000

I am still very interested in hearing about any efforts to get the documentation updated

Collapse
 
emcewe profile image
emcewe

I love devilbox. Everything's completely awesome. The only thing I can't get to work is: to make the devilbox available through my local network for other devices in this very same network.

To clarify what I mean: let's say my dev machine is a macbook pro. And now I wanted to view the project/site/app I am working on also on my smartphone, tablet, windows laptop etc. What's to be done, if you wanted to access the "project.loc" located on a macbook from your windows laptop which has access to the same local network via wifi?

I'd be very happy, if you could elaborate on this. Also for any pointers.
Thank you very much!

Collapse
 
clawhammer profile image
Julio Vergara

Great article man, please write a deep post about it...!!! Thanks

Collapse
 
nasouhmr profile image
Nasouh Mrstani

Thanks its very useful,fast install !

Collapse
 
biros profile image
Boris Jamot ✊ /

It sounds great, please go on and write a blog post about it !

Collapse
 
franksierra profile image
Frank Sierra

😁 For sure, I'll let you know

Collapse
 
nickopris profile image
Nick Opris

Thanks for the article. I'll check the DevilBox to see how different is from Wodby which I use on all my projects.