Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Fri Oct 12, 2012 10:00 am 
Offline
Senior Newbie

Joined: Mon May 10, 2010 11:29 pm
Posts: 15
Hi,

What are some good ways of streamlining updates to a website? For example, say I have a software project in version control and I want to release a new version. My current process is:

1. Build an archive containing the new software. (software-1.1.zip)
2. SCP this file to my server.
3. SSH into my server.
4. Use sudo to copy the file into the correct location (Since the website is running as the apache user and my user doesn't have permission to write to that location).
5. Use sudo to update a symlink which always points to the latest version of the software (i.e. Remove 'software.zip' which points to software-1.0.zip and then create a link to software-1.1.zip)
6. Use sudo to change the ownership of the new files to the correct owner (apache).
7. Update the web page with the information about the newest version.

This is fairly tedious and I'l like to automate at least some of it. The most annoying part is the permissions on the web directory. What are the recommended options? Here are some of my ideas:

1. Permit remote access using SSH keys as the apache user. Then I can copy the file into the correct location immediately. Then update the link easily. Or I could allow my user to run as apache using sudo.
2. Have some sort of git post-receive hook:

http://stackoverflow.com/questions/3838 ... te-staging

3. Change the group ownership on /var/www/......... to a group which has both my user and apache as members.
4. Have a cronjob running as apache which looks for files in a directory owned by my user.

Anyone have any good suggestions? Ideally, I'd like to get to the situation where I can run one deploy script on my workstation and it'll deploy the new software release.

Any suggestions/recommendations?

Thanks,

Dan

_________________
https://danieljamesscott.org


Top
   
PostPosted: Fri Oct 12, 2012 1:46 pm 
Offline
Senior Member

Joined: Sun Mar 07, 2010 7:47 pm
Posts: 1970
Website: http://www.rwky.net
Location: Earth
Here's one of my favourite methods.

1) Have a bare git repo on the server storing the entire code base
2) Push your local changes to this repo
3) Have the web directory pull from this repo

Then to update you simply run git push locally and git pull on the remote to update the web directory, it also makes reverting changes easy since you just run git checkout on the web directory.

As for permissions, run the git pull command as root :)

You can also add a git post commit hook to automatically run git pull each time you push, but I prefere to do this manually.

_________________
Paid support
How to ask for help
1. Give details of your problem
2. Post any errors
3. Post relevant logs.
4. Don't hide details i.e. your domain, it just makes things harder
5. Be polite or you'll be eaten by a grue


Top
   
PostPosted: Fri Oct 12, 2012 3:30 pm 
Offline
Senior Newbie

Joined: Mon May 10, 2010 11:29 pm
Posts: 15
This is pretty much what I was thinking of, but has the disadvantage that I have to store my packaged software in git - not ideal...

Anyone know how this is solved in companies or big software projects?

_________________
https://danieljamesscott.org


Top
   
PostPosted: Fri Oct 12, 2012 3:39 pm 
Offline
Senior Newbie

Joined: Tue Aug 07, 2012 2:55 pm
Posts: 11
We use Fabric for deployments. There's literally tons of tutorial for rapid web deployment using Fabric if you google a little.


Top
   
PostPosted: Fri Oct 12, 2012 4:23 pm 
Offline
Senior Newbie

Joined: Mon May 10, 2010 11:29 pm
Posts: 15
Excellent, I hadn't found that tool before. Thanks.

_________________
https://danieljamesscott.org


Top
   
PostPosted: Fri Oct 12, 2012 4:39 pm 
Offline
Senior Newbie

Joined: Thu May 26, 2011 8:24 pm
Posts: 11
I use a combination of mcollective and puppi for actual deployment, and use jenkins to manage dev->stage->prod workflow and testing


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group