Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

publishing a website using svn export

I currently ftp all my files to my website when i do an update (over a slowish adsl connection)

And I want to make things easier, so I just recently started using a hosted svn service, and i thought i could speed things up a bit by doing an svn export of my website directly onto my webserver

i have tried that a few times and it seems to work ok, however it does fetch the entire site everytime which is a bit slow for a 1 file update

so my questions are

is it possible to do an export and only get the changes since the last export (how will this handle deleted files ?)

OR will it be easier to do an svn checkout and svn update it all the time instead of svn export and just hide the .svn folders using apache htaccess

is this a good idea, or is there a better way to publish my website i am trying to achieve the 1 click deploy type ideal

maybe there are some gotcha's i haven't thought of that someone else has run into

debian/apache/php

like image 615
bumperbox Avatar asked Jul 21 '09 10:07

bumperbox


3 Answers

I would do an svn checkout, and have done so successfully on a live site for a number of years. You should add mod_rewrite rules to 404 the .svn directories (and files) though.

like image 187
Draemon Avatar answered Sep 27 '22 18:09

Draemon


This is what I'm doing on my host:

For every project I have a structure that looks more less like this:

~/projects/myproj
~/public_html/myproj

First dir is a checkout from SVN, while second one is just svn export.

I have a small bash script

#!/bin/bash
SOURCE="$HOME/projects/"
TARGET="$HOME/public_html/"
for x in `ls $SOURCE`
do
    if [ -d $SOURCE$x ]; then
        svn update $SOURCE$x
        svn export --force $SOURCE$x $TARGET$x
    fi
done

Export is done from working copy so it's very fast.

like image 23
RaYell Avatar answered Sep 27 '22 17:09

RaYell


It might not be exactly the answer you are looking for, but, if you have an SSH access to your webserver (it depends on your hosting service ; some "low cost" don't give such kind of access), you can use rsync to "synchronise" the remote site with what you have on your disk.

In the past, I was using something like the idea you are describing (fetching the svn log between last revision pushed to production and HEAD, analysing every lines, and in the end calculating what to send to the server) ; but it was not really a great process ; I now use rsync, and like it way better.

(Here too, you will have to exclude .svn directories, btw)

like image 23
Pascal MARTIN Avatar answered Sep 27 '22 17:09

Pascal MARTIN