Closed Thread
Page 2 of 3 FirstFirst 1 2 3 LastLast
Results 11 to 20 of 23

Thread: Setting up Subversion on Bluehost

  1. #11
    Join Date
    Jul 2008
    Posts
    2

    Post Setting up Subversion from START to FINISH and all the steps in between

    As many of you are quickly finding out, merely installing subversion is not the end of the story to creating a robust, sharable, source-controlled experience on BlueHost. I have scoured through the internet and found numerous extremely good resources that can help you get things running smoothly from start to finish.

    First of all, here's an overview of what we hope to accomplish and why:
    1. Install Subversion on BlueHost via SSH access -- This will allow us to both use svn commands from within the BlueHost shell and allow us to serve our repository to the outside world.
    2. Setup and svn+ssh tunnel to our Subversion server -- Since BlueHost doesn't natively support serving subversion repositories to the outside world through Apache, we are going to have to access our repositories through an ssh tunnel
    3. Import existing projects into repository -- We will take our existing projects and import them into subversion so that they can be source controlled.
    4. Setup synchronization between our repository and live site -- Since subversion places its source-controlled files in its own special directories, we need a way to push changes to the directory to the live site (the one in public_html) automatically. We do this through Subversion's post-commit hook.
    5. (In a following post) Setup commit emails to notify users when commits happen to the repository -- We all want to know when our source changes. By using subversion's mailer.py, we can email ourselves commit logs.

    By the time we are done, you will be able to checkout your BlueHost repository to your local computer, edit your files locally, check them in, and see your changes instantly on the internet; all with the wonderful magic of Subversion source control!

    Okay, enough long-winded introduction. Here we go.

    1. Install Subversion on BlueHost

    This is the part that this post (and others on bluehostforums) have answered very very well.

    Bottom line, GO HERE (However, you should install subversion 1.5 instead of 1.4): http://www.tabruyn.com/site/life/55-...n-and-bluehost
    This guy is AMAZING! He gets you all the way to checkout and adding files from BlueHost through Subversion.

    NOTE: You should get subversion 1.5 instead of 1.4.6. You should also read Tom's comment at the bottom of the page if things aren't working properly.


    2. Get Connected to Your BlueHost Subversion Repository

    Once again, tabruyn.com has all the answers for this one!
    http://www.tabruyn.com/site/life/55-...n-and-bluehost


    3. Import Existing Projects Into Repository

    This, unfortunately is where tabruyn.com is of no more help.

    I am assuming that you will have existing projects that you wish to put under source control. Luckily, subversion makes this very easy via the import command. Just run the following command in a terminal on your BlueHost account.

    If you want to import a specific project, subdomain, or addon domain into the repository, you can do something like this:
    Code:
    svn import /home/USER/public_html/MYWEBSITE file:///home/USER/svn/MYREPOSITORY/MYWEBSITE --message="Importing mywebsite"
    You could also source control your entire public_html folder. If you wanted to do that, you could type in something like this:
    Code:
    svn import /home/USER/public_html/ file:///home/USER/svn/MYREPOSITORY/ --message="Importing mywebsite"

    4. Synchronize Repository and Live Site

    Now we have a problem where we want to update our live site automatically whenever we commit to our repository. (Remember the actual repository files will not be in your public_html directory) To do this, we will utilize Subversion's hooks; specifically the post-commit hooks. To read more about hooks, see the links at the bottom of this sub-section.

    Here is how I got the hooks working properly on BlueHost:
    BACKUP YOUR ENTIRE SITE BEFORE YOU DO ATTEMPT THIS SECTION.

    What we will do now is go into our public_html folder and delete anything that has already been imported into subversion. We will then checkout all of that stuff. That way, public_html will be a subversion controlled image of our actual repository. We can then update public_html through a hook script whenever we commit to the repository.

    Make sure that your website folder is imported into subversion (see previous sub section). For this tutorial, let's assume that I put ~/public_html/MYWEBSITE into subversion. When, I did this, I told subversion to place the contents of MYWEBSITE in an svn project located at /home/USER/svn/MYREPOSITORY/MYWEBSITE

    Delete anything in public_html that I added to subversion:

    Code:
    cd ~/public_html
    rm -rf MYWEBSITE
    Now run svn checkout:

    Code:
    svn checkout file:///home/USER/svn/MYREPOSITORY/MYWEBSITE /home/USER/public_html/MYWEBSITE
    If you put your entire public_html folder under source control, you can execute pretty much the same thing, except you don't specifiy MYWEBSITE.

    To test to see if this is working, navigate into your public_html/MYWEBSITE folder and run
    Code:
    svn info
    Okay, now that we have that configured, we need a way to essentially run svn update from within your public_html folder everytime someone commits something. To do this, we will use a commit hook.

    navigate to the hooks directory of your svn repository:

    Code:
    cd ~/svn/MYREPOSITORY/hooks
    In here you will find template files for various types of hooks you can enable. We are interested in post-commit.tmpl. The .tmpl files are just templates, they are not the actual hooks. To make the actual hook, simply do the following:

    Code:
    cp post-commit.tmpl post-commit
    Now we need to edit post-commit. Open it up in some shell text editor. You can use something like vi, vim, or nano.

    Scroll down to the bottom and comment in (add a '#' character) the commit-email.pl and the log-commit.py lines. The entire file should be completely commented in.

    Now we are going to add the line that updates our source-controlled live site. Since the hooks REMOVE ALL ENVIRONMENT VARIABLES, we need to give an absolute path to the svn command (which should be installed in a bin directory within your /home/USER folder) and the absolute path to your live site that you wish to update. The following is an example line that assumes I am updating a single project folder on my live site.
    Code:
    /home/USER/bin/svn update /home/USER/public_html/MYWEBSITE
    Save the file. Be sure it is executable. If it is not, you can type:
    Code:
    chmod a+x post-commit
    .

    To test it, manually execute the script and pass it some arguments:
    Code:
    ./post-commit /home/USER/svn/MYREPOSITORY 1
    You should also change something in your repository by updating something from your local machine and committing it. If it automatically updated your live site as well, then your hook is working properly.

    Here are a bunch of resources on SVN hooks, that really helped me out:
    http://subversion.tigris.org/faq.htm...te-auto-update
    http://svnbook.red-bean.com/nightly/...n.create.hooks

    In a post immediately following this, I will explain how to setup a commit email. I couldn't fit it in this post because I exceeded the 10,000 character limit


    Final Thoughts:

    PLEASE POST UPDATES TO THIS POST IF SOMETHING IS INCORRECT.

    I hope this helps everyone out there on BlueHost get subversion up and running. It is a significantly better and more robust way to code and I think you'll find it will make your life better.

    As a side note, I also recommend setting up a local testing server to try out your new stuff before committing. In this setup, commits go directly to your live website. If your a bit crazy (like me) then you can manually install and configure PHP, Apache, and MySQL on your local machine. Otherwise if you're running windows you can just use XAMPP

    You can also modify this setup to have the automatic commit hook update a dev site. You can then manually trigger an update on your live site when dev looks good. If you want a well documented alternative to how subversion is done on shared hosting plans, look here:
    http://wiki.dreamhost.com/Subversion

  2. #12
    Join Date
    Jul 2008
    Posts
    2

    Post Subversion Automatic Commit Emails

    In my post titled "Setting up Subversion from START to FINISH and all the steps in between", I promised explaining how to send automatic commit emails. Well here it is. PLEASE REPLY TO THE POST IF ANYTHING IS INCORRECT.


    5. Automatically Send Commit Emails

    One final cool thing you can do with the post-commit hook is send yourself or other collaborators emails whenever a commit happens to the repository. The way you used to do this was with the commit-email.pl script, but this has been deprecated and replaced by mailer.py.

    You need to get these scripts and place them somewhere in your home directory. I put them into a folder in my home directory called hook-scripts:

    Code:
    mkdir ~/hook-scripts
    cd ~/hook-scripts
    wget http://svn.collab.net/repos/svn/trunk/tools/hook-scripts/mailer/mailer.py
    wget http://svn.collab.net/repos/svn/trunk/tools/hook-scripts/mailer/mailer.conf.example
    Copy the mailer.conf.example and modify it:
    Code:
    cp mailer.conf.example mailer.conf
    Open up mailer.conf and do the following things:
    • uncomment (remove '#') the line that says: mail_command = /user/sbin/sendmail
    • modify the from_addr field
    • modify the to_addr field
    Close and save the file when you're done

    Test the mailer.py file by running the script like this:
    Code:
    python mailer.py commit /home/USER/svn/MYREPOSITORY 1 mailer.conf
    If it works, awesome! Skip to the bottom of the section where we edit the post-commit file again.

    When I tried to run it, I got an error message that said "You need version 1.5.0 or better of the Subversion Python bindings."

    To fix this Python bindings problem, I navigated to where I unzipped subversion (in my case it was ~/src/subversion-1.5.0) and ran the following commands:

    Code:
    make swig-py
    make check-swig-py
    make install-swig-py
    The output of this installation told me that it dumped a bunch of python source in /home/USER/lib/svn-python. In order for python to properly load those files, we need to set our PYTHONPATH environment variable. I did this with the following line (be sure to include the standard library in the path):

    Code:
    export PYTHONPATH=/usr/lib64/python2.3:/home/USER/lib/svn-python
    Now test the mailer.py again. It should not spit out errors and you should get an email in your email that you set in the mailer.conf file.

    Okay, last step. Now we need to add this to our post-commit file.

    Navigate to your post-commit file again
    Code:
    cd ~/svn/MYREPOSITORY/hooks
    Edit it and add the following lines to the bottom of the file:

    Code:
    export PYTHONPATH=/usr/lib64/python2.3:/home/USER/lib/svn-python
    /bin/python /home/USER/SCRIPTDIR/mailer.py commit "$REPOS" "$REV" /home/USER/SCRIPTDIR/mailer.conf
    Remember that post-commit clears all environment variables before it runs.

    Okay, change some stuff on your repository, commit it, check to see whether your live-site updated and check to see whether you have an email.

    If you did everything correctly it all (knock on wood) should work!

  3. #13
    Join Date
    Sep 2008
    Posts
    141

    Default

    Emorikawa,
    Thank you so much! I was about to go stir crazy.

  4. #14

    Default

    Hello,
    I tried your code on my bluehost account but i get the following error when it gets to the last commands
    cd ~/src/subversion-1.4.6
    ./configure --prefix=$HOME --without-berkeley-db --with-zlib --with-ssl LDFLAGS="-L/lib64"
    make
    make install
    I get this error
    [usportsp@box457 ~]$ cd ~/src/apr-util-1.2.12
    [usportsp@box457 apr-util-1.2.12]$ ./configure --prefix=$HOME --with-apr=$HOME LDFLAGS="-L/lib64"
    checking build system type... x86_64-unknown-linux-gnu
    checking host system type... x86_64-unknown-linux-gnu
    checking target system type... x86_64-unknown-linux-gnu
    checking for a BSD-compatible install... /usr/bin/install -c
    checking for working mkdir -p... yes
    APR-util Version: 1.2.12
    checking for chosen layout... apr-util
    checking for gcc... gcc
    checking for C compiler default output file name... a.out
    checking whether the C compiler works... yes
    checking whether we are cross compiling... no
    checking for suffix of executables...
    checking for suffix of object files... o
    checking whether we are using the GNU C compiler... yes
    checking whether gcc accepts -g... yes
    checking for gcc option to accept ISO C89... none needed
    Applying apr-util hints file rules for x86_64-unknown-linux-gnu
    checking for APR... yes
    setting CPP to "gcc -E"
    adding "-pthread" to CFLAGS
    setting CPPFLAGS to " -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE"
    checking how to run the C preprocessor... gcc -E
    checking for grep that handles long lines and -e... /ramdisk/bin/grep
    checking for egrep... /ramdisk/bin/grep -E
    checking for ANSI C header files... yes
    checking for sys/types.h... yes
    checking for sys/stat.h... yes
    checking for stdlib.h... yes
    checking for string.h... yes
    checking for memory.h... yes
    checking for strings.h... yes
    checking for inttypes.h... yes
    checking for stdint.h... yes
    checking for unistd.h... yes
    checking for ldap support...
    checking for default DBM... sdbm (default)
    checking libpq-fe.h usability... yes
    checking libpq-fe.h presence... yes
    checking for libpq-fe.h... yes
    checking for PQsendQueryPrepared in -lpq... yes
    setting APRUTIL_EXPORT_LIBS to "-lpq"
    setting APRUTIL_LIBS to "-lpq"
    checking sqlite3.h usability... yes
    checking sqlite3.h presence... yes
    checking for sqlite3.h... yes
    checking for sqlite3_open in -lsqlite3... yes
    adding "-lsqlite3" to APRUTIL_EXPORT_LIBS
    adding "-lsqlite3" to APRUTIL_LIBS
    checking sqlite.h usability... no
    checking sqlite.h presence... no
    checking for sqlite.h... no
    checking Expat 1.95.x... yes
    adding "-lexpat" to APRUTIL_EXPORT_LIBS
    adding "-lexpat" to APRUTIL_LIBS
    checking iconv.h usability... yes
    checking iconv.h presence... yes
    checking for iconv.h... yes
    checking for type of inbuf parameter to iconv... char **
    checking for iconv.h... (cached) yes
    checking langinfo.h usability... yes
    checking langinfo.h presence... yes
    checking for langinfo.h... yes
    checking for nl_langinfo... yes
    checking for CODESET in langinfo.h... yes
    checking for library containing crypt... -lcrypt
    checking if system crypt() function is threadsafe... no
    checking for crypt_r... yes
    checking style of crypt_r... struct_crypt_data
    adding "/home1/usportsp/lib/libapr-1.la" to APRUTIL_LIBS
    adding "-luuid" to APRUTIL_LIBS
    adding "-lrt" to APRUTIL_LIBS
    adding "-lcrypt" to APRUTIL_LIBS
    adding "-lpthread" to APRUTIL_LIBS
    adding "-ldl" to APRUTIL_LIBS
    configure: creating ./config.status
    config.status: creating Makefile
    config.status: creating export_vars.sh
    config.status: creating build/pkg/pkginfo
    config.status: creating apr-util.pc
    config.status: creating apu-1-config
    config.status: creating include/private/apu_select_dbm.h
    config.status: creating include/apr_ldap.h
    config.status: creating include/apu.h
    config.status: creating include/apu_want.h
    config.status: creating test/Makefile
    config.status: creating include/private/apu_config.h
    config.status: include/private/apu_config.h is unchanged
    config.status: executing default commands
    [usportsp@box457 apr-util-1.2.12]$ make
    make[1]: Entering directory `/home1/usportsp/src/apr-util-1.2.12'
    /bin/sh /home1/usportsp/build-1/libtool --silent --mode=link gcc -g -O2 -pthread -DHAVE_CONFIG_H -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -I/home1/usportsp/src/apr-util-1.2.12/include -I/home1/usportsp/src/apr-util-1.2.12/include/private -I/home1/usportsp/include/apr-1 -version-info 2:12:2 -L/lib64 -o libaprutil-1.la -rpath /home1/usportsp/lib buckets/apr_buckets_pipe.lo buckets/apr_buckets_flush.lo buckets/apr_buckets_alloc.lo buckets/apr_buckets_pool.lo buckets/apr_buckets_socket.lo buckets/apr_buckets_heap.lo buckets/apr_buckets_simple.lo buckets/apr_buckets_file.lo buckets/apr_buckets.lo buckets/apr_buckets_mmap.lo buckets/apr_buckets_eos.lo buckets/apr_brigade.lo buckets/apr_buckets_refcount.lo crypto/apr_sha1.lo crypto/uuid.lo crypto/getuuid.lo crypto/apr_md5.lo crypto/apr_md4.lo dbm/apr_dbm.lo dbm/apr_dbm_berkeleydb.lo dbm/apr_dbm_gdbm.lo dbm/apr_dbm_ndbm.lo dbm/apr_dbm_sdbm.lo dbm/sdbm/sdbm_pair.lo dbm/sdbm/sdbm.lo dbm/sdbm/sdbm_hash.lo dbm/sdbm/sdbm_lock.lo encoding/apr_base64.lo hooks/apr_hooks.lo ldap/apr_ldap_url.lo ldap/apr_ldap_option.lo ldap/apr_ldap_init.lo misc/apr_reslist.lo misc/apu_version.lo misc/apr_date.lo misc/apr_rmm.lo misc/apr_queue.lo uri/apr_uri.lo xml/apr_xml.lo strmatch/apr_strmatch.lo xlate/xlate.lo dbd/apr_dbd.lo dbd/apr_dbd_mysql.lo dbd/apr_dbd_sqlite2.lo dbd/apr_dbd_sqlite3.lo dbd/apr_dbd_pgsql.lo -luuid -lrt -lcrypt -lpthread -ldl -lpq -lsqlite3 -lexpat /home1/usportsp/lib/libapr-1.la -luuid -lrt -lcrypt -lpthread -ldl
    /usr/lib/libexpat.so: could not read symbols: File in wrong format
    collect2: ld returned 1 exit status
    make[1]: *** [libaprutil-1.la] Error 1
    make[1]: Leaving directory `/home1/usportsp/src/apr-util-1.2.12'
    make: *** [all-recursive] Error 1

    [usportsp@box457 apr-util-1.2.12]$ cd ~/src/subversion-1.4.6
    [usportsp@box457 subversion-1.4.6]$ ./configure --prefix=$HOME --without-berkeley-db --with-zlib --with-ssl LDFLAGS="-L/lib64"
    configure: Configuring Subversion 1.4.6
    configure: creating config.nice
    checking for gcc... gcc
    checking for C compiler default output file name... a.out
    checking whether the C compiler works... yes
    checking whether we are cross compiling... no
    checking for suffix of executables...
    checking for suffix of object files... o
    checking whether we are using the GNU C compiler... yes
    checking whether gcc accepts -g... yes
    checking for gcc option to accept ANSI C... none needed
    checking how to run the C preprocessor... gcc -E
    checking build system type... x86_64-unknown-linux-gnu
    checking host system type... x86_64-unknown-linux-gnu
    checking target system type... x86_64-unknown-linux-gnu
    checking for egrep... grep -E
    checking whether ln -s works... yes
    checking for a BSD-compatible install... /usr/bin/install -c
    checking for static Apache module support... no
    checking for Apache module support via DSO through APXS... found at /usr/local/apache/bin/apxs
    checking httpd version... recent enough
    configure: Apache Portable Runtime (APR) library configuration
    checking for APR... yes
    checking APR version... 1.2.12
    configure: Apache Portable Runtime Utility (APRUTIL) library configuration
    checking for APR-util... no
    configure: WARNING: APRUTIL not found
    The Apache Portable Runtime Utility (APRUTIL) library cannot be found.
    Either install APRUTIL on this system and supply the appropriate
    --with-apr-util option

    or

    get it with SVN and put it in a subdirectory of this source:

    svn co \
    http://svn.apache.org/repos/asf/apr/...branches/0.9.x \
    apr-util

    Run that right here in the top level of the Subversion tree,
    then run autogen.sh again.

    configure: error: no suitable APRUTIL found
    What should I do at this point??
    Thanks

  5. #15
    Join Date
    Sep 2008
    Posts
    1

    Default Error while installing SVN

    I'm also getting the error "/usr/lib/libexpat.so: could not read symbols: File in wrong format" while attempting to install SVN.

    I ran the exact code given in the first post of this thread. In the final step, when I run make install, I get the error message.

    Any help is appreciated.

  6. #16

    Default expat.so error fix

    I came to a solution for this:

    append

    Code:
    --with-expat=builtin
    EDIT: The above will only work up until Subversion. I am still working at that but I think the answer is going to be compiling expat src.

    Code:
    cd $HOME
    wget http://downloads.sourceforge.net/expat/expat-2.0.1.tar.gz?modtime=1181083143&big_mirror=0
    tar xzf expat-2.0.1.tar.gz
    cd expat-2.0.1
    ./configure --prefix=$HOME LDFLAGS="-L/lib64"
    make; make install
    Although I prefer to use ~/usr/local. Keeps the home directory cleaner, and makes things a bit more natural.

    Still trying to figure out how to get Subversion to compile using these expat libraries as there is no --with-expat argument.

    I'll post if I resolve this! Jeez all this and all I want is client functionality! Maybe I should just make an rsync script

    EDIT: Ok kiddos here it is!

    Do everything I said above with expat, then go back into subversion-1.4.6

    Code:
    ./configure --prefix=${HOME}
    cp libtool libtool.backup
    sed 's/sys_lib_search_path_spec=" /sys_lib_search_path_spec=" ${HOME}/lib /1' libtool.backup > libtool
    make; make install
    If you get errors about apache or apxs at the end and you do not need to integrate subversion with apache then try this:

    Code:
    ./configure --prefix=${HOME} --without-apache --without-apxs --disable-mod-activation
    Then don't forget to rerun that sed command!

    Because I'm a vi addict I also did --with-editor=vim

    If you are like me and didn't throw all this to your home directory, then just replace each ${HOME} with the directory name you are using like ~/usr/local(but expand the path). Just make sure you preserve the spaces in the sed script. Like this:

    Code:
    sed 's/sys_lib_search_path_spec=" /sys_lib_search_path_spec=" /home1/username/usr/local/lib /1'
    I'll be glad to answer and questions but I can't be responsible for anyone that doesn't read thoroughly or only knows how to copy paste.

    BadReligion
    Last edited by badreligion; 10-09-2008 at 01:53 AM. Reason: Ok I have the solution for real this time!

  7. #17
    Join Date
    Oct 2008
    Posts
    2

    Default

    Does anyone have one big script for all these commands. It is always easier to upload and just run.

  8. #18
    Join Date
    Oct 2008
    Posts
    17

    Default

    Quote Originally Posted by birdsnare View Post

    Remember to hit enter after the last 'make install" is pasted.
    I was almost pulling my hair out until I remembered this^^. Thanks!

  9. #19
    Join Date
    Oct 2008
    Posts
    2

    Default

    Thanks a lot for tutorial.
    I installed svn and was able to create repository. It works with keys and TortoiseSVN. I have the following question:
    I want several developers to be able to use my repository. But I don't want to give them access to all of my my hosting account via ssh. Is it possible?

  10. #20
    Join Date
    Oct 2008
    Location
    ideamesh.com
    Posts
    2

    Cool

    Just some notes as I am working my way through getting SVN working on my account. I followed the tutorial located here

    Here is my edited code which installs the most updated version of SVN
    Code:
    cd ~
    mkdir src
    cd ~/src
    wget http://www.gtlib.gatech.edu/pub/apache/apr/apr-util-1.2.12.tar.gz
    wget http://www.gtlib.gatech.edu/pub/apache/apr/apr-1.2.12.tar.gz
    wget http://subversion.tigris.org/downloads/subversion-1.5.4.tar.gz
    wget http://www.webdav.org/neon/neon-0.28.0.tar.gz
    tar -xzf apr-util-1.2.12.tar.gz
    tar -xzf apr-1.2.12.tar.gz
    tar -xzf subversion-1.5.4.tar.gz
    tar -xzf neon-0.28.0.tar.gz
    cd ~/src/apr-1.2.12
    ./configure --prefix=$HOME LDFLAGS="-L/lib64"
    make
    make install
    cd ~/src/apr-util-1.2.12
    ./configure --prefix=$HOME --with-apr=$HOME LDFLAGS="-L/lib64"
    make
    make install
    cd ~/src/neon-0.28.0
    ./configure --enable-shared --prefix=$HOME LDFLAGS="-L/lib64"
    make
    make install
    cd ~/src/subversion-1.5.4
    ./configure --prefix=$HOME --without-berkeley-db  --with-ssl LDFLAGS="-L/lib64"
    make
    make install
    I also removed the "--with-zlib" option because it was causing an error on my box.

    The command I used to create my repository
    Code:
    svnadmin create $HOME/svn/myrepositoryname
    The command I used to check my repository (The verbose flag will actually list something even though your repository is empty at this point)
    Code:
    svn list --verbose svn+ssh://username@domain.com/home/homedir/svn/myrepositoryname
    Instead of needing to install WinSCP, you can also use Filezilla as your SSH/FTP client to download the keys.

    I have been using SuperVersion because it was easy to learn and install on a Windows machine, but now I want to learn a real CVS. Anyway, here is a cheatsheet I found for SVN commands

    PS Thanks emorikawa for the help on how to import existing code into the repository!
    Last edited by WebWorker; 10-26-2008 at 12:25 AM.

Closed Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts