-->

Best/Better/Optimal way to setup a Staging/Develop

2019-03-30 00:10发布

问题:

I recently launched a service, meaning I can no longer work directly on the site, or I do so at a risk.

I haven't been able to find any "standard" or "best" way to make a development server. The two things I have seen are

a) Using a GIT or SVN to host the data (this doesn't quite solve my problem, I need to be able to develop somewhere, preferably not my home computer)

b) Capistrano (for Rails, is there something for PHP?)


The current solution I'm looking at is putting a complete copy of the server on "development.domain.com", which would then allow me to work on everything, and I can simply copy the files over to the main section.

Is this a workable solution? What's the optimal solution? (Separate server, special tools, etc.)


EDIT This system be developed by a number of developers. The server settings have been tweaked considerably to allow for the full functionality and security of the system. Having the development on my own computer is not a workable solution, nor on an intranet type of system as none of our programmers are in the same location.

I'm looking for an on-a-server solution.

回答1:

Three suggestions:

1) You are on the right track with making sure that your source code is in some form of source control (git and svn are both excellent choices). This should be priority #1.

2) Have EVERYTHING that has deviated from a standard configuration be in some form of source control. This means your apache configs, your php.ini, database configs, etc. Then when you setup your staging and dev servers you can be (relatively) assured that everything is the same across all of your servers, otherwise you are just guessing.

3) Look into some sort of build scripts, either ant, phing, or anything that you can use to reliable build your environment from scratch on any machine.

There are tons of other things you can do, but if you implement these three you'll be well on your way to having the ability to easily setup a dev/staging server. This will also give you the added benefit of ensuring that all of your developers have a similar environment when doing their development as well.



回答2:

http://www.wampserver.com/ for windows

or

www.mamp.info for mac

or

load up a VM

Personally, I do my programming on a mac, running VMWare with suse or redhat for the server test environment. I've used mamp in the past and it works well; but sometimes I like to work in a real operating system.

That, or setup a physical test server. PHP / (choice of DB) now adays runs on anything (mac, windows, linux)

Depending on what how you want to do it, you could install VMWare right on the production server and dev in there; that is, if you run the server yourself. If your collocated or on shared hosting, you probably can't do that.

-Mario



回答3:

Your development, staging, and production environments should be exactly the same otherwise you risk the change of something bombing as you move between environments. Obviously your development environment will have development settings (e.g. PHP's display_errors on, possibly a remote debugger, etc) but otherwise they should be as identical as possible.

As everyone else has mentioned if you aren't using version control you as asking for trouble. Not only is this a good practice for development but also eases deployment between your different environments. This is especially true when there are multiple developers working on a project.



回答4:

I started to use a git repository as starting point. Main development is done on my local mac. At a certain point I push the changes and pull them on a development server where further testing is done. If everything is fine, I pull things on the development server. This is more or less the way, capistrano works, I think. I wrote a central script for these tasks, so I can update development or production servers with a single comand.