Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Any reason NOT to use subdomain for development?

Tags:

subdomain

I was originally planning on using a local machine on our network as the development server.

Then I had the idea of using a subdomain.

So if the site was at www.example.com then the development could be done at dev.example.com.

If I did this, I would know that the entire software stack was configured exactly the same for development and production. Also development could use the same database as production removing the hassle of syncing the data. I could even use the same media (images, videos, etc.)

I have never heard of anyone else doing this, and with all these pros I am wondering why not?

What are the cons to this approach?


Update

OK, so its seems the major no no of this approach is using the same DB for dev and production. If you take that out of the equation, is it still a terrible idea?

like image 461
JD Isaacks Avatar asked Jan 18 '11 14:01

JD Isaacks


2 Answers

The obvious pro is what you mentioned: no need to duplicate files, databases, or even software stacks. The obvious con is slightly bigger: you're using the exact same files, databases, or even software stacks. Needless to say: if your development isn't working correctly (infinite loops, and whatnot), production will be pulled down right alongside with it. Obviously, there are possibilities to jail both environments within the OS, but in that case you're back to square one.

My suggestion: use a dedicated development machine, not the production server, for development. You want to split it for stability.

PS: Obviously, if the development environment missed a "WHERE id = ?", all information in the production database is removed. That sounds like a huge problem, doesn't it? :)

like image 117
Berry Langerak Avatar answered Sep 20 '22 06:09

Berry Langerak


People do do this.

However, it is a bad idea to run development against a production database.
What happens if your dev code accidentally overwrites a field?

like image 30
SLaks Avatar answered Sep 21 '22 06:09

SLaks