I am currently using git as my version control for my php written apps. This is fine for source code.
I am also learning phinx for some database version control, initially I was excited about this as I thought it was a full blown database migration tool, that worked similar to git in that I could "pull" or "push" to and from a database repository, but i can see now it is more for use for database schema changes to be migrated from local to production.
I would like a system that allows me to ensure that my local version of the database is up to date, so for example a customer registers an account on the live site. I should in theory be able to have this change reflected fairly quickly on the local version. It would need to be totally framework independent, i.e easy to integrate into opencart/wordpress and my own frameworks.
It would work in a similar way to a version control system, where I could simply push or migrate the latest production database to some repository, and pull this down to the local version.
Are there any tools out there that do this? And if not can someone advise, theoretically how I could go about writing something like this myself?
Related
I am new to software development, working on creating a Moodle LMS project. I have already installed XAMPP and working on Moodle. But I have another 5 team members working on the same Moodle project.
As XAMPP is installed on everyone's computer, we are working separately. But I want to know how all we 6 developers can work in a team to develop a project. How can I go for making the network configurations? Do I need to share the XAMPP folder to all other team members in to work as a team?
As Moodle already uses git for core development, that would certainly be your best bet for coordinating the code between multiple developers. See https://docs.moodle.org/dev/Git_for_developers for more details (although that is a bit more focussed on contributing back patches to Moodle core).
Sharing the data is more difficult, but in my experience it usually works OK for each developer to work with their own Moodle install, with a central install for testing (and make sure each developer uses the xmldb editor to define install.xml + upgrade.php steps, so that the other developers can pull the latest code from them and the database definitions will be upgraded properly).
Use any flavor of source distributed version control system, like git or subversion.
I am an avid webdev hobbyist and freelance, up until now I simply edit the website live (put a maintenance message up while its being made), now all my projects up until now have also been very small.
eg I make a site, show em, take money and go, I've never had to work on a site after it's gone live.
Now my new project is pretty big and I know I will have to edit it after its gone live and maybe have a small team of devs (atm just me)
So how do people professionally handle this? I know I will need a prefix-amp app cos i run an apache server, I've also heared that people use github for versioning, but I'm not really sure because apparently its not svn?
Thanks
ps. I have a windows 7 pc, so no mac apps please
up until now i simply edit the website live
Terrible in my book ;)
so how do people professionally handle this?
First you need to setup a development server (it would be best to keep it as close as possible to the expected live environments). On this server you would install all the software you need.
You may also want to setup a staging server.
i know i will need a prefix-amp app
I hope you are not talking about those one click installers. If you would do it professionally you should install everything yourself that way you can set it up the way you need it.
ive also heared that people use github for versioning, but im not really sure because apparently its not svn?
GitHub is just a website. What you are looking for is git or svn for versioning. You could also setup a git or svn server locally instead of using services like GitHub. Basically what versioning is is that when somebody makes a change to the code he/she would need commit the changes. This way it is easy to keep track of changes in the codebase (like what was changed, when was it changed and by whom).
Local XAMP-stack (LAMP, or WAMP) for development
intranet-system for test and maybe staging
Of course the live system
Versioncontrol, I prefer git. Of course you can use SVN too, but... lets say: It's SVN.
Make changes local, test this changes local
everythings fine: Push it into the "master" vcs-repository
New version ready (or it's "sunday-night-release-time")? Push all that stuff on test/stage
Everythings fine there too: Push it into the live system
Thats very shortened of course, but it should give you an idea.
The tool where you manage your software version is not that important. Use Git, or SVN or whatever, the one you like most. But use _one_.
Equally important is that you run the "page" on two sites, a test and a live system, strictly apart. Both systems have to be very close in their layout, all changes must first be done in the test system, be verified and then done in the same manner in the live system. Do not allow changes only to be made to the live system ('cause it's just a small change'). No exceptions.
Then think about deployment: how will you transfer changed files to the target system ? You need routines for this, that run once started and don't forget a step in between.
Firstly you need some kind of versioning system: either SVN or Git. GitHub is simply an online service that provides managed Git repositories. Secondly you need a development server.
If it were just you doing development, you could host both of these on your local desktop PC, but since other developers are going to be joining, you need a remote server. If you don't want to be running a server out of your home, the best option is a VPS (virtual private server) on which you can install Git, Apache, etc. and anything else you need.
As for development software, take your pick- there are loads of options. A common choice is the NetBeans IDE and TortoiseGit combo. You use NetBeans to develop your code on, automatically uploading to your development server, then you TortoiseGit to commit and sync changes.
Only when you're ready to go live do you copy the code from the dev server to the production server.
We are two in a team working on the same project. i am on MAC and the other one is on PC. i have never used SVN before. googling about the SVN gave me basic understanding about svn. and what i understood is there should be subversion installed in client machine (i do not know which client, i assume there are many like versions and cornerstone for mac, tortoise for windows etc. and i require a repository where i will host the centralized version of the application. the client will get the copy of codes or files where they can commit the changes to repository (main application). which can be undone if required. however what i don't understand is, as our PHP code uses database(mysql in my case) how is it managed by SVN client?
lastly i expect my development environment to be implemented the following way.
i want to set up my mac as development server for SVN at the same
time i would like to work in the same machine making use of SVN.
PC should access the repository from MAC and commit the changes.
all the setup should be done and implemented locally via LAN. please correct me if i am wrong on my understanding about the svn and also do guide me about the requirements and resources i need to install in both the machine for me to get going using SVN for my projects.
thank you..
You can use your Mac both for hosting your SVN repository and also use it as the client to checkout your working copy. Have a look at this link (its slightly old but you'll get the gist).
Once you have the SVN repository setup you can enable HTTP access on it so that your partner can checkout the copy and commit changes to it. Have a look here on how to enable HTTP access for your repository.
Most modern day PHP Frameworks use migrations scripts that help in building and maintaining your database schema, if possible use a framework. Have a look at the migrations script of one of the frameworks for inspiration (i.e if you can't use a framework). Migration scripts under the hood fire create table or alter table commands, and all you do is add the migration files to your SVN repository to version control your database schema.
One caveat with hosting the SVN repository on your Mac is that for some reason if its down, your partner gets stuck as code changes can't be committed and new changes can't be checked out. Have a look at this thread for free online private SVN repositories. In case you want to go the paid route GitHub.com is awesome.
I develop on my own and use a repository hosted on http://www.springloops.com. On here I just export the database to a text file and keep historic changes to the database on there. Clearly this is not suitable for a team working together on a project unless you're well coordinated in recording your database changes.
This question looks useful MySQL Version Control - Subversion though it's specific to mysql subversioning - not quite the answer to your broader question.
Each machine should have the relevant Client software, I recommend Tortoise SVN for Windows - it's pretty popular. There is bound to be a similar alternative SVN Client for OSX that you can get your hands on.
This is the 3rd web project I have been developing and I have been a sole developer in all projects.
Now I need to change my style and don't know how to do it, so I need your suggestions.
My setup is;
Netbeans for PHP development
Github for private repository (As I am developing on Windows I found very hard to integrate Git-Windows-Netbeans so I can change it if needed)
Basecamp for project management (Even if I use GIT, I might change my GIT provider (github) and select a one which can be integrated with Basecamp)
My needs are;
For my current project, I will setup a dev server and test the changes there first. Then I will commit them to the production server. So I should be able to use netbeans while I can easily commit to my repository and apply the changes to the production server. How can I do it easily? Should I first commit to the repository and get the changes from the dev. server via command line? It seems a bit work to do this for every change. Should I directly upload to the dev. server, then commit the final changes to the repository and get the changes from there to the production server?
So, what do you suggest as a repository which can be integrated into the netbeans and how should I manage these changes?
I also would like to use one of these providers (http://basecamphq.com/extras - SOFTWARE DEVELOPMENT TOOLS). So, if you have any suggestions from these companies too, that would be great
Thanks a lot,
Everyone's tastes vary.
There are many IDE/Editors, different version control systems, and even different methods of deploying to a live server.
So really the best way is to just experiment with different methods until you find one that suits you.
I will tell you how i do it, and take from it what you want.
And im sure this will be downvoted by certain people, but its what i found to suit me best.
My editor of choice is vim, but i also like Eclipse with the PDT plugin. Eclipse isn't as "snappy" as netbeans (at least on my computer), but its very nice.
I use SVN for my version control, this is just something that i have been using for years and i am comfortable with.
To deploy the latest code to my live servers i check out the trunk of my svn repo on my live server, for small changes i just commit them directly to trunk, but for larger changes i branch off the code to change, and then merge it back into trunk when its ready.
Then all i need to do is issue a "svn update" on live, and the new code gets checked out of the svn.
To avoid ssh'ing into the machine, this can even be called from a php script, from a protected file somewhere.
<?
$svnuser = username;
$svnpass = pass;
$returnString = exec("svn --username={$svnuser} --password={$svnpass} update 2>&1",$output,$returnVal);
header("Content-Type: text/plain");
print("Return value: {$returnVal}".PHP_EOL);
print("Return String: {$returnString}".PHP_EOL);
foreach($output as $line){
print($line.PHP_EOL);
}
?>
I am in the midst of setting up the development environment (PHP/MySQL) for my start-up. We use three sets of servers:
LIVE - the servers which provide the actual application
TEST - providing a testing version before it is actually released
DEV - the development servers
The development servers run SVN with each developer checking out their local copy. At the end of each day completed fixes are checked in and then we use Hudson to automate our build process and then transfer it over to TEST. We then check the application still functions correctly using a tester and then if everything is fine move it to LIVE. I am happy with this process but I do have two questions:
How would you recommend we do local testing - as each developer adds new pages or changes functionality I want them to be able to test what they are doing. Would you just setup local Apache and a local database and have them test locally on their own machine?
How would you recommend dealing with data layer changes?
Is there anything else you would recommend doing to really make our development process as easy and efficient as possible?
Thanks in advance
+1 to each developer running her own setup, complete with Apache and database.
Keep the database schema under version control.
Possibly you could keep (maybe in a separate repository) a small but representative set of data, in a test database. Each morning you check out the latest copy of this test database, and start hacking. When you change schemas, update your test data repository accordingly.
Anyone doing development SHOULD have their own local environment. I use Mac so I run MAMP so that I can have my own LAMP environment local and independent of any other environment. This will also allow me to know that nobody else is changing / working on the same components I am and removes any possible confusion. If you are a windows user, there are also easy to install local versions of the LAMP stack such as XAMP, etc. If you are running Linux as your desktop, you will most likely already know how to install LAMP for the flavor of Linux you are running.
The database schema version is a great idea. It is what we use as well. In addition to the schema under version control, we add a schema version table to the schema and keep it updated so we can quickly tell what version is in production/qa/dev when we need to compare.
As for the data layer changes there are two things I would recommend.
Always create your migration path, forward and backward. This means that when you have the schema you want to put on production to upgrade an existing schema, you should always make it part of the release. A clear concise process for ALTERing the tables. By the same token, you need to have a working and tested ROLLBACK version as well in case something goes wrong.
What I have found helpful is using a backup of production to load on my local (or QA/DEV) so that I have the most up-to-date data / schema to play with without affecting production. If you are not performing regular backups of production, maybe now is a good time to implement a policy. Then you will kill two birds with one stone. You will have backups for any outage and a useful live schema with data you can load to test with on another machine. This will also lend itself to raising any possible issues with schema changes as the data will be matching production. So if it works locally (and on DEV/QA), it reduces the risk of something going wrong in production.