Subversion

    How to start with Subversion in Amazon EC2?

    The Subversion EC2 AMI configures a Subversion repository and Apache server to show it. The default configuration is using "svnserver" but you can use other methods (like SSH) to access your repository.

    Before starting the instance, you should take into account that the default Subversion port is 3690 so it is necessary to open this port in your security group.

    Once the instance is running, you can log in through SSH and configure the repository access. The repository configuration file is /opt/bitnami/repository/svnserve.conf. The variables anon-access  and auth-access can be set to the values none, read, or write. Setting the value to none prohibits both reading and writing; read allows read-only access to the repository, and write allows complete read/write access to the repository. For example, you can uncomment these lines:

    [general]
    anon-access = read
    auth-access = write
    password-db = passwd
    

    You can edit the "passwd" file at the same directory to manage subversion users. For example, if you uncomment these lines you create two subversion users; harry and sally.

    [users]
    harry = harryssecret
    sally = sallyssecret
    

    Then restart the Subversion server to load the changes.

    $ sudo /opt/bitnami/ctlscript.sh restart subversion
    

    Finally you can import a project directory to subversion server from your local machine and show the files in the browser.

    $ svn import /path/to/project/ svn://ec2-xx-yy-zz.compute-1.amazonaws.com/repository/ -m "first import"
    

    How to start the Subversion server: svnserver?

    By default, the "svnserver" is running in the Stacks and you can configure it. The default port is 3690.

    BitNami Cloud Hosting users have to open this port. Please check our BitNami Cloud Hosting FAQ to get more info.

    The repository's svnserve.conf file is the central mechanism for controlling authentication and authorization policies. You can edit this file in /installdir/repository/conf/svnserve.conf. If you want to create a different repository you can create it manually:

    win_platform.png On Windows: Go to BitNami Console console and run the following command:

    > svnadmin create “C:\new_repository_path”

    linux_platform.png

    On Linux andmac_platform.png OS X: 

    Go to a BitNami Console and then run the following command:

    $ svnadmin create /path/to/new/repository


    The variables anon-access  and auth-access can be set to the values none, read, or write. Setting the value to none prohibits both reading and writing; read allows read-only access to the repository, and write allows complete read/write access to the repository. For example, you can uncomment these lines:
     

    [general]
    anon-access = read
    auth-access = write
    password-db = passwd
    

    You can edit passwd file at the same directory to manage subversion users. For example, if you uncomment these lines you create two subversion users; harry and sally.

    [users]
    harry = harryssecret
    sally = sallyssecret
    

    It is necessary to restart "svnserve" to apply the changes. Finally you can import a project directory to subversion.

    $ svn import /path/to/project/ svn://localhost/repository/ -m "first import"
    

    How to configure your Subversion repository though SSH?

    This guide describes how to create a repository in your Virtual Machine or AMI to access remotely through SSH.

    First, connect to your machine via SSH and execute the following commands to create your repositories directory /installdir/repositories and your subversion repository myapp:

    $ sudo mkdir /opt/bitnami/repositories
    $ sudo chown -R bitnami:bitnami /opt/bitnami/repositories
    $ svnadmin create /opt/bitnami/repositories/myapp
    

    Assign your repository to your Redmine project. In Redmine go to your project Settings/Repository section and add the following value in the URL field (login and password are not necessary):

    file:///opt/bitnami/repositories/myapp

    Now you need to check if you have subversion binaries in the PATH even in the non-interactive SSH session. Try to execute the following command:

    ssh -l bitnami -i /path/to/bitnami-hosting.pem mymachine.bitnamiapp.com svn
    

    If you get "command not found" error, then you will need to  update your /home/bitnami/.bashrc, and move all BitNami PATH configuration from the bottom of this file to the top, above the following entry "[ -z "$PS1" ] && return"

    Checkout your repository now, start adding and commiting new files. Your repository is available remotely via the following url (please configure your Subversion client with your login: bitnami and SSH key):

    svn+ssh://mymachine.bitnamiapp.com/opt/bitnami/repositories/myapp

    To add example file to your repository execute the following commands on you local machine (Unix only):

    $ export SVN_SSH="ssh -l bitnami -i /path/to/bitnami-hosting.pem"
    $ svn checkout svn+ssh://mymachine.bitnamiapp.com/opt/bitnami/repositories/myapp
    Checked out revision 0.
    $ cd myapp
    $ echo "This is a simple test" > Readme.txt
    $ svn add Readme.txt
    A         Readme.txt
    $ svn commit -m "Adding simple readme file, closes #1"
    Adding         Readme.txt
    Transmitting file data .
    Committed revision 1.
    

    How to see the Subversion repository from the web browser?

    If you prefer you can add the following configuration to the Apache configuration file /installdir/apache2/conf/httpd.conf

    ...
    LoadModule dav_module modules/mod_dav.so
    LoadModule dav_fs_module modules/mod_dav_fs.so
    ..
    LoadModule dav_svn_module     modules/mod_dav_svn.so                                                 
    LoadModule authz_svn_module   modules/mod_authz_svn.so
    
    ...
    <Location /new_site_name>                                  
      DAV svn                                                                         
      SVNPath "/path/to/subversion/repository"                                         
    </Location>
    

    Then restart Apache:

    $ /installdir/ctlscript.sh restart apache
    

    How to configure the repository URL?

    If you do not set the prefix in the Subversion scripts, you should specify the full path to the repository, for instance svn://YOUR_IP/home/user/repository. If you do not want to specify the full path of the repository, you should add the repository path option in the following scripts:

    win_platform.png On Windows: "installdir/subversion/scripts/serviceinstall.bat"

    -d --listen-port=3690 --root "C:\path\to\repository"
    

    Then run the script to apply the changes: "serviceinstall.bat UNINSTALL" and "serviceinstall.bat INSTALL" from a command prompt as Administrator.

    linux_platform.png On Linux andmac_platform.png OS X: "installdir/subversion/scripts/ctl.sh"

    -d --listen-port=3690 --root=/path/to/repository
    

    Then restart the Subversion server.

    Comments

    You must login to post a comment.

    Attach file

    Attachments