Expressionengine 2 and git (version control) - php

I’m looking to move over to using git to make my EE development a lot easier and more manageable. I’m already aware of the guides posted on devotee and a few othersites but after scanning over them they seem a little old and seem to be specifically for ee 1.x, I was wondering if anyone had been successful with ee 2. I’ve only recently made the transition from svn to git, previously I found that using ee via svn was a ballache, so many confit conflicts, wrong urls, and all versions of the site were using the same database. I’m basically looking for the best or should I say the ideal way to setup both git and ee to work in harmony together. I’d like to also learn how to branch other sites I develop with ee from this too, if anyone has experience with this that’d be great!
Also if it’s any use I’m hosted by dreamhost, As far as I understand they support git, I’ve looked over their knowledge base on how best to set things up, would anyone reccomend their way of doing things? And has anyone had a successful experience whilst doing so? 
I look forward to hearing your responses!
Thanks
Sent from my iPhone, whilst falling asleep so excuse the possible typos!a

Check out Gititon
My flow is as follows.
I've installed git on my local machine. (via macports)
Git Server: for me
that's Beanstalk (http://www.beanstalkapp.com),
In the presentation from the above link,
you'll see that Github (http://www.github.com) is in between
the local git and Beanstalk. But for
me, that's kinda an overhead,
because I'm the only developer for
the moment, maybe I'll add it later.
Advantage: with beanstalk you can deploy via (s)ftp to a staging or production server. You don't need to install git on your hosting solution.
Hope it helps!

Related

Work from different pc's on a project located in localhost using phpStorm

We are a team of 4 web developers working at the same time on a project located in localhost [each one of us has a copy of the project]. So what we are doing is using a really primitive technique to upgrade it, we work on our copy and once per week we gather everyone's work, which is a HUGE HEADACHE. So I would like to configure phpStorm to connect to the team leader local server and work directly from there, so the project will always be updated.
I recommend downloading git gui tool(or sourcetree). Create a repo on one of your servers or host it on github. Git GUI tool should be able to guide you through the whole process. If Git GUI is a little confusing, try SourceTree which is a little bit more user-friendly.
It would be easier for all of you to create a Git Repository and collaborate your work.

provide updates to a webapp via a bitbucket repo

I have created a simple web-application using PHP, JS etc.. My next step is to deploy it to eg. liveserver.com. I am sure that I will be providing a lot of additional features in the future and so I would like to know how this is generally done. I am pretty sure its a noob question so I tried to google it but nothing helpful came up.
Here is a rough idea on how I may do it. I would keep a local copy in WAMP and keep developing it and sync / push it to bitbucket. The question is : How do I connect the updated bitbucket version to my liveserver.com. I am keen to know how web-developers generally provide updates to their app users. Is there a general update mechanism they follow ? Is my idea of using a version control application wrong for this purpose ? How would you do it for a simple app like this ?
A concise answer would suffice. It would be great if anyone could provide me helpful links or point me to right direction, further information etc. TIA.
You're really asking two questions here:
How do I connect the updated bitbucket version to my liveserver.com?
I would like to know how this (syncing code between test environment and production environment) is generally done, best practices and stuff.
The first question is answered here. The latter, broader question is touched on here but I'd like to offer my personal thoughts as well.
You've mentioned you're using WAMP, whereas I'm coming from a LAMP environment. Regardless, I'm hoping you will find some additional usefulness in my answer as it may help lead you to a Windows-based equivalent solution.
At home/work:
I also use bitbucket and prefer it to github. I have Git installed for source control which allows me to push or pull any code between bitbucket and my local machine.
On the go:
I have AWD IDE installed on my tablet which allows me FTP access to a production environment, and the non-free version also has Git integration. Another great IDE is Cloud 9; completely web-based and convenient if I don't have my tablet with me and need to use a public computer or laptop. Cloud 9 also supports Git.
Syncing:
Rather than push code from Bitbucket to my production server, I prefer to keep a mirror of my production server locally. I use a tool called rsync for this. I have a bash file setup on a cron job that looks something like this:
#!/bin/sh
RSYNC=/usr/bin/rsync
SSH=/usr/bin/ssh
RUSER=remoteUser
RHOST=remoteHost
RPATH=/remote/path/
LPATH=/local/path/mirror/
$RSYNC -av --no-p --delete -O -e $SSH $RUSER#$RHOST:$RPATH $LPATH
So basically, my primary workstation (which is where I do most of my work) is always in sync with the live server. Both the live server and Bitbucket can be updated away from home. Thanks to Git, I can see exactly what has been modified. It's also comforting to know my code exists in three different places for redundancy.
This is what I have found to be most convenient for me, but I would love to know how others do it.

How should i sort out versioning and offline testing on a website

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.

Setup SVN/LAMP/Test Server/ on linux, where to start?

I have a ubuntu machine I have setup. I installed apache2 and php5 on it. I can access the web server from other machines on the network via http://linux-server. I have subversion installed on it. I also have vsftpd installed on it so I can ftp to it from another computer on the network.
Myself and other users currently use dreamweaver to checkin-checkout files directly from our live site to make changes.
I want the connect to the linux server from pc. make the changes on the test server until ready and then pushed to the live site. I want to use subversion also into this workflow as well. but not sure what the best workflow is or how to set this up.
I have no experience with linux, svn, or even using a test server, the checkin/out we are currently doing is the way I have always done it.
I have hit many snags already just getting what I have setup because of my lack of knowledge in the area. Dreamweaver 5 has integration with subversion but I can't figure out how to get it to work.
I want to setup and create the best workflow possible.
I dont expect anyone to be able to give me an answer that will enlighten me enough to know everthing I need to know to do what I want to do (altough if possible that would be great) instead I am looking for maybe a knowledge path like answer. Like a general outline of what I need to do accompanied with links to learn how to do it. like read this book to learn linux, then read this article to learn svn, etc., then you should know what to do. I would be happy just getting it all setup, but I would like to know what I am actually doing while setting it up too.
I'm sure you've solved your issue by now, but for future reference to other users, here's the steps I would suggest to get started:
Create a repository for your project (in Ubuntu)
Host the SVN repo using Apache
I'd read up on the subversion book to look at some strategies for development with SVN.
To connect to your SVN machine, you'll need to use it's IP or hostname instead of your svn live site you mentioned. With proper forwarding, it's easy to access it from anywhere.

PHP Deployment to Live Server

I am new to this, I just reading about how I should not edit code on the live production server. I don't know anything about source control or SVN.
I would like to start coding on a test server then once everything is confirmed working, I want to send all the files over to the production server.
How should I go about this? I am on mac os x and was looking into apps like http://versionsapp.com/ but I am not sure if this is the right solution.
What do you suggest?
If you are new to web development, I wouldn't suggest jumping into Subversion right away. You should have a firm grasp on Subversion before actually using it in any production environment, as its surprisingly easy to screw things up. Don't let that scare you off, though, as version management (whether through SVN or another avenue) is highly useful.
And if the project in question is small enough, I don't see anything wrong with the old "develop locally then ftp it to the server" approach. Sometimes a full-blown version management tool just isn't necessary.
Whether or not a SVN deployment strategy is appropriate depends on factors such as the size of the site, your familiarity with using the command line, and whether you are working as part of a team.
It is worth noting that in most shared hosting environments you won't have the option to install SVN on the server, which narrows your options somewhat!
I don't think there is anything inherently bad about using good old fashioned FTP to get files up to a server, especially for smaller sites where you are the only person working on the site.
Even then, SVN can still be very useful. I keep all my sites under version control even if they are going to be deployed by FTP.
Just go with SVN as it is the basics. After you get a taste of it you can explore the alternatives like GIT or whatever.
You should learn to do the basic SVN stuff through the console, there is no other way especially if you are going to work on a live server. Your live server should have SVN installed and some SSH access so you can execute your SVN command there.
You can also get TortoiseSVN which is a nice visual client for SVN.
The basic SVN you are going to use is those 3 commands:
$ svn co # Checkout
$ svn ci # Commit
$ svn up # Update
There are tons of tutorials of how to do stuff, here is the first one from google:
http://paulstamatiou.com/how-to-subversion-basics
After you feel comfortable with that stuff and when you start working with team and contribute to public repositories you might start exploring the advanced stuff like branches, tags and all other terms that make some people feel important when they mention them.
This versionwhatever.com I would hold for now and explore the popular choices, before specializing, especially that SVN works on UNIX and you can put it on Linux which runs most of the web hosting out there.
Cheers!
If you're just starting out I recommend you avoid SVN. Try git, there are numerous mac tools, such as GitX for Mac. There's also github and others to host your projects for easy pulling and revisions within a group of people.

Categories