How should I use Git/SVN for my projects running on an EC2 server? I am the only person who writes the code
-
Currently I am writing PHP code on an Amazon EC2 server and I am editing the live code everytime I need to make a minor change. Obviously this is not the best way to proceed so I would like some advice on how I can improve this setup with regards to making backups of my code and working in a more 'professional' manner. I would like to continue to edit the code on the EC2 rather than having to edit on my PC and then upload each time I make a minor change. Can I or should I do this with Git? If anyone has any guides they could refer me to that would also be great. Excuse the complete noob-ness of this post, I havent worked with Git before.
-
Answer:
One simple way I use for fast prototyping and quick version control on my VPS (which could resemble the process on EC2) is http://bitbucket.org. This process does not require setting up a git-server or you worrying about ssh configuration for secure repository updates. It's very simple and if you're looking for a temporary solution this might be it. Bitbucket is a free private web-based hosting service for projects that use the Mercurial or Git revision control systems.. It allows you to host an unlimited amount of repositories for free. The process: Follow the Bitbucket instructions on how to setup you first repository (after you sign up they will guide you). One you do that, the next step is simple. Install Git on your EC2 instance ( if Ubuntu you can use: sudo apt-get install git-core ) Then clone the repository from Bitbucket as follows (This is simply an example and you need to adjust it): cd /var/www/ git-clone https://[email protected]/Username/projectimworkingon.git This will clone the repository on Bitbucket to your server. After that, commit your changes from your local machine to Bitbucket and simply execute: cd ./projectimworkingon/ git pull and you will receive the latest commited update from your local machine. Disclaimer: This is a simple temporary solution and it's not the most efficient / robust / secure way of achieving your goal. What has mentioned in his answer is the way to go and investing a little bit of time to learn how to install git-server on your EC2 instance or any other alternative should be the optimal choice. This answer is simply, another option.
Bassem Dghaidy at Quora Visit the source
Other answers
No matter what language you develop and no matter where you deploy your code, you must use a version control system, Git or Subversion. The process should be like Develop, build, test and deploy. There are several ways to deploy your code automatically: You may use Jenkins to all these purposes. It can integrate well with VCs to develop, build and test. You may write a custom script/tool to deploy the changes in the EC2 instance. You may configure jenkins to automatically pull changes from Git, test and create the package. Using the custom scripts you may upload the package to EC2 and extract the package. Alternatively you could use puppet to simply deploy the code. No build. No test. You may install puppet in EC2. Define manifests to download code from Git repository, using vcsrepo puppet module. The puppet could be configured to execute in server-less mode. The agent can run periodically depending on how frequent you want to deploy the code. In this context, you may refer to one of my recent blogs http://livecipher.blogspot.com/2013/01/deploy-code-from-git-using-puppet.html.
Bhuvan Arumugam
This can be done with the help of Subversion with the help of hook-scripts. Details are already given in their FAQ section - http://subversion.apache.org/faq.html#website-auto-update. Hope it helps.
Jeyanthan Inbasekaran
Related Q & A:
- How can I restore Sharepoint web app when the DB is in another server?Best solution by SharePoint
- How do I make a python web program that is on a ubuntu server allow access to the server?Best solution by Yahoo! Answers
- Where do I find my Yahoo briefcase and how do I use it?Best solution by Yahoo! Answers
- How do I use a genetic code table?Best solution by biology.about.com
- How do I use chat when I am in a room?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.