I work on eclipse IDE mainly for php and java. I own a PC and a laptop both of which I need to use for coding. Now how do i sync code ad resources between two instances of eclipse between these two I think SVN and git are overkill for this. I own a portable USB drive. Is there some nice way to sync these two seamlessly?
Btw I dont need a dynamic sync. I wont be working on both simultaneously. Ill probably work on my comp. Them sync it with laptop and continue working there when im out and then sync with pc when im back..
Actually, source control might be a pretty good solution here.
In particular, using a distributed source control like git or Mercurial could be a pretty good route, because they both don't require setting up a Subversion server (one can create a repo right from Eclipse! -- see below regarding plugins), and merging between repositories are very easy.
To make matters easier, that there are plugins available for Eclipse which integrates with git (e.g. EGit) and Mercurial (e.g. MercurialEclipse). Both are easily installable using the Eclipse Marketplace feature in Eclipse Helios (3.6).
If you're not using source control, might as well make this an opportunity to start using one! :)
If you really don't want to use source control (which is useful, I use mercurial), try DropBox, or Windows Live Mesh. Both can sync over LAN without an internet connection, AFAIK. (Definitely DropBox, anyway)
Both are free.
(P.S. if you're interested in checking out DropBox, use this link, and we'll both get extra free storage space https://www.dropbox.com/referrals/NTkxNzM4MjU5?src=global0)
I dont think that using SVN in your case is an overkill. You can setup either laptop or desktop as SVN server and both instances of eclipse as SVN clients. Besides sync you will get added benefits of having change log, ability to roll back and all other bells and whistles of a source code repository.
Related
I have a PHP/Mysql Desktop server. I also installed PHP/Mysql to my laptop and one of my friends for developing a project. Is there anyway that we can synchronise all the changes (i.e. to the php files as well as database changes whether structural or data wise) we do on our laptops to desktop PC ?
For sure you want to start using Git, possibly with a free private repository on somewhere like www.bitbucket.org. Within your versioning, you can backup a version of your SQL inside of the phpMySQL admin tool, and clone the entire repository every time you want to move it.
There are a few choices
https://github.com/axkibe/lsyncd#readme
will sync real time and uses inotify
and if you want to go real nerd
http://www.drbd.org/
High availability clustering
The best way would to be purchase a VPS from a company like Digital Ocean for $5.00 a month. You can then setup a MySQL database that you can both easily connect to. In addition, you will be able to use it to test and deploy (smaller) projects to the server.
Forgot to address the other part of your question. You will be able to setup git/SVN/CVS on this server as well. There are good tutorials online for this. You can both access and commit your changes to this repository. You could also use a website like GitHub for this version control.
Probably the easiest way (if you just want the files synced as is on each change) would be to use something like Google Drive or a similar service. Though if you want revision history and more advanced tools, you'd probably need some sort of version control repository (git, svn, etc.).
However, I definitely recommend version control if that works for you. And if you go with git, I highly recommend bitbucket as they have free closed source hosting for projects of up to 10 (last time I checked) people.
Along with a version control system (such as SVN, Git, or Mercurial) you can't go wrong with using a tool such as FreeFileSync (free as in freeware) for a quick and easy way to push the changes you make to a project to a centralized location. With your project included in a VCS repository the VCS you choose to use will give you control over how you want your project to be synchronized.
This has helped me a lot over the years and has even made the process faster.
Good day to you all,
I am currently developing a project on Laravel. So far I have always developed online, directly editing my files on the webserver throuh FTP (using PSPad or similar simple editing tools).
What I want to do now (and what i believe most people actually do) is setup a (W)LAMP stack on my local machine and program locally. However it is a little bit unclear to me how to keep my local code (including databases) in sync with the live website. How do you folks do that? I know there's probably lots of ways and tools to do that, but what would be your advice for a best practice? Any advice would be very welcome :)
What many companies do is build offline, then push their edits up to a server using git.
Im no expert on the software so ill describe what you do in a basic form:
My advice would be to create an online repo (repository) to store your project while you edit/update.
There are several git project management systems such as github or bitbucket. I personally use bitbucket
What git does, is when you have built or added what you need offline on local (w)lamp, you then git push them up to your repo or server. The changed files then get merged with the existing on the repo or the server. If you'd like the most recent version of your project you'd simply just git pull them down.
Read the full documentation here to see the wide range of options available when using git
We have a settings array within our platform available as $res::Config.
At runtime, a variable is changed from 'dev' to 'live' after checking the HTTP Host, obviously depending on the IP address.
Within our framework bootstrapping, depending on the value of $res::Config->$env, or the environment set previously as either dev or live, the settings for the database connection are set. You store these settings in the Config array as db_live or db_dev.
However you do it, use an environmental variable to figure out whether you want live or dev, and set up and array of settings accordingly.
We also have sandbox and staging for intermittent development stages.
As for version control, use git or subversion.
Edit: It's also possible that within our vhost file, we setup an environmental variable as either live or dev, and our application reads from this accordingly. I'd suggest this approach :)
There are a number of ways of doing this. But this is a deceptively HUGE question you've asked.
Here is some good practice advice - go and research these items, then have a look at my approach.
Typically you use a precess called version control which allows you to create "versions" or snapshots of your system.
The commonly used "SVN" software is good, but the new (not really any more) kid on the block is GIT, and I personally recommend that.
You can use this system to push the codebase live in a controlled fashion. While the files/upload feature is essentially similar to FTP, it allows you to dump a specific version of your site live.
In environments where there are multiple developers, this is ideal - you can compare/test and work around each other, and version control tends to stop errors between devs.
So - advice part 1: Look up and understand version control, then use it to release CODE to the live environment.
Part 2: I use database dumps and farm them back to my machine to work with.
If the live database needs updating, I can work locally and simply export, then re-import on the live system.
For example: on a recent Moodle project I worked on, to refresh the whole database took seconds... I could push a patch and database update in a few minutes.
However: you should think about maintenance and scheduling... if the site is live and has ongoing data changes then you need to be careful with this. Consider adding a maintenance page.
Advice 2: go research SQL dump/export and importing.
I personally use phpmyadmin to dump and re-import, as it's very convenient.
Advice 3: Working locally then pushing live is MUCH BETTER PRACTICE. You're starting down a much safer and better road than you're on!
Hope that helps... but bear in mind - this is a big subject, so you'll need to research a fair bit.
I use Git to track local changes in my PHP web applications, and I was wondering if it would be a good idea to use Git on the server as well, so that I could just use git push to deploy my changes. Would there be any pitfalls with this approach?
This seems like a nice way to do things. If you're tagging and branching properly it will enable you to quickly switch back to working versions of your site too in the event that something breaks.
I think this is a fine way to do it. I handle things in a similar manner, where live sites are just a checkout from the repository, and i update them as necessary.
Git is fine but you can do a lot better then just using git pull. Take a look at railess deploy for capistrano.
Capistrano basically does a combination of rsync and git pull to deploy copies of your website. It supports roleback, staging and distributed deployments.
And online hotfixes can be pushed back to development.
Being able to do a git status on a live system can be a live saver.
Go for it!
Caveats
Make sure the the ".git" folder isn't accessible from the web.
With PHP the source code is usually present on the webserver, so that doesn't add additional risk in case the server is hacked.
I would be in favor of using a technique like this if only because you can be sure anything on your deployed site is also being tracked in git. That is, it encourages a best practice and discourages ad hoc changes that aren't under source control.
For another alternative, check out this article about how Twitter uses BitTorrent to manage deployment: http://torrentfreak.com/twitter-uses-bittorrent-for-server-deployment-100210/
It's probably most useful when you need to deploy quickly across a large collection of servers.
I think its a great solution. I have been using it to deploy my website for a long time... Its nice because you can almost instantly push your changes into production just by updating the folder. I have encountered no security issues or anything with it.
Enjoy!
Im thinking of updating my practices, and looking for a little help and advice!
I do a lot of work on sites that run joomla, oscommerce, drupal etc and so I have created a lot of custom components/plugins and hacks etc. Currently each site has its own folder on my xampp setup. What I would like to do is have a default setup of (for example) a Joomla setup and when I make changes updates, I can do something which updates all the other folders that contain joomla, almost like an auto update?
Im also looking at using Aptana IDE more and SVN service such as unfuddle to share my work with others, but I have not used SVN before and not sure if its possible to do the above using SVN?
It would be great to be able to work on a main/core item and send the updates to both local updates and to actual servers, without having to maintain lots of different individual sites.
Suggestions?
Yes, SVN would be a great tool for this purpose. Store your code (eg: a custom Joomla component) in source control. Wherever you want to use that component, just do a checkout or export of that particular folder into your live site. Here's one way you could structure your repository:
unfuddle.com/myRepo/trunk/com_myComponent
unfuddle.com/myRepo/trunk/com_anotherComponent
Log in to your live server via SSH and run this command:
> cd path/to/joomla/components
> svn co http://unfuddle.com/myRepo/trunk/com_myComponent
Any time you change your code, commit the changes and then log back into the server and run:
> cd path/to/joomla/components
> svn up com_myComponent
A real benefit of this is that should you do an update and break something, you can always roll it back to the last known "good" version.
As for automating this process, you might be out of luck if it's on different servers. For multiple deployments on the same server, you could quite easily write a shell script to run the above commands for each site/component. If you needed this to be fully automated, you could even set up a cron job to run this script every day at 2am or something - personally I'd stick with the manual approach, but it's still an option.
For working locally with your SVN repositories, I'd recommend looking at TortoiseSVN (if you're on Windows): it's the simplest and easiest way to work with SVN.
For automating things, you could use SVN hooks for this. There is a post-commit hook, so every time you do a commit, your hook script could tell the other machines to do an SVN update to get the latest code.
For more info, see Version Control with Subversion - Implementing Repository Hooks.
I don't have a good answer for your situation, but I don't think Subversion by itself is the answer.
This Question addresses some of the concerns about Subversion's mechanisms for sharing across 'projects'.
Subversion can certainly handle the source code management part of this puzzle. The automated distribution, well I'd use another tool.
Look into Capistrano. I've used it a couple of times and once you figure it out, it's pretty good. Aimed at rails but should work for anything where you need to get code from a repository and deploy it on different servers.
There are so many options when it comes to PHP development environments and you have to piece it all together yourself.
I'm wondering if someone has come up with what they think is the ideal setup that gets out of your way and lets you develop.
Right now I use vim and svn from the command-line. I write scripts to manage builds but I'm thinking about looking into Phing.
I love vim but I'm seriously thinking of trying Eclipse with the PHP plugin because I imagine it makes common SVN options a bit easier (moving files around in a project).
Something to support continuous integration on the database would be a major plus!
UPDATE: Just wanted to stress that previous line up there. I realize some frameworks will help with this, but I don't use a framework. Is there some simple module out there (included in the IDE or not) that will let me easily tie my database schemas/data to a subversion revision, letting me rollback and forward, tag, branch, etc?
Any comments on things beyond the editor? For example: Builds, managing staging/production/development environments, automated testing and building upon SVN commit, etc. Ideally we can make this post a "Go to Whoah" for setting up a professional PHP team development environment.
I recommend to use a complete featured IDE like the PDT (the eclipse PHP project), it gives you:
debugging (using Xdebug or ZendDebugger)
SVN/CVS very convinient integration
DB integration (the DTP plugin)
and much more, based on features of the PDT and eclipse plugins
if you have some money to spent, I think the Zend Studio For eclipse worth it.
It gives you better debugging, PHPUnit integration, ZendFramewrok support, Refactoring and remote system support (ftp, ssh etc.)
I'm giving Netbeans 6.5 PHP bundle a try and liking it very much. I find debugging in it is less clunky than in Eclipse PDT.
I too love vim and used to develop using the same environment as you. These days though I find Eclipse PDT, with Subclipse for SVN integration, to be invaluable. XDebug is great too - no more var_dump();exit; for debugging.
One of the best plugins for a vim fan moving to Eclipse: viPlugin. Well worth the token licence fee to have vi key bindings in Eclipse.
If you are working from the command line, using Git's SVN module eases most of the SVN pain - it handles deletes and moves automagically.
The GUI front ends (kgit or qgit) provide a very intuitive history browser.
I personally like the way that AptanaStudio has pre-packaged all the great Eclipse modules you need to have a very smooth PHP development environment