{"id":431,"date":"2012-01-04T19:54:31","date_gmt":"2012-01-04T19:54:31","guid":{"rendered":"https:\/\/noi3.org\/site\/?p=431"},"modified":"2012-01-04T19:54:31","modified_gmt":"2012-01-04T19:54:31","slug":"configure-subversion-for-this-site","status":"publish","type":"post","link":"https:\/\/site.noi3.org\/?p=431","title":{"rendered":"Configure Subversion for this site"},"content":{"rendered":"<p>We will bring your website (www.<span style=\"color: red;\">domain.com<\/span>) under version control. This step will create the repositories and set their permissions to allow the web user access.<\/p>\n<p>It\u2019s unlikely that you\u2019ll want anyone to be able to access your files so we can generate a password file for SVN access:<\/p>\n<pre>sudo htpasswd -c \/svn-repositories\/passwd <span style=\"color: red;\">svn-username<\/span>  <\/pre>\n<p>We can then create a folder, a repository within the folder and import our files:<\/p>\n<pre>sudo mkdir \/svn-repositories\/www.<span style=\"color: red;\">domain.com<\/span>  sudo svnadmin create \/svn-repositories\/www.<span style=\"color: red;\">domain.com<\/span>  sudo svn import \/var\/www\/www.<span style=\"color: red;\">domain.com<\/span> file:\/\/\/\/svn-repositories\/www.<span style=\"color: red;\">domain.com<\/span>  <\/pre>\n<p>This repository needs to be owned by the web user and be granted certain permissions:<\/p>\n<pre>sudo chown -R www-data:www-data \/svn-repositories\/www.<span style=\"color: red;\">domain.com<\/span>  sudo chmod -R g+rws \/svn-repositories\/www.<span style=\"color: red;\">domain.com<\/span>  <\/pre>\n<p>We can then remove our existing site directory and recreate it from our repository:<\/p>\n<pre>cd \/var\/www  sudo rm -rf \/var\/www\/www.<span style=\"color: red;\">domain.com<\/span>\/  sudo svn co file:\/\/\/svn-repositories\/www.<span style=\"color: red;\">domain.com<\/span>  sudo chown -R www-data:www-data \/var\/www\/www.<span style=\"color: red;\">domain.com<\/span>\/  <\/pre>\n<p>We can also create a trigger so that every time you commit a change  it goes live. This probably wants some modification for production use,  i.e. Local -> Staging -> Production with the later step conducted  manually.<\/p>\n<pre>sudo <span style=\"color: green;\">nano<\/span> \/svn-repositories\/www.<span style=\"color: red;\">domain.com<\/span>\/hooks\/post-commit  <\/pre>\n<pre>#!\/bin\/bash  cd \/var\/www\/www.<span style=\"color: red;\">domain.com<\/span> \/usr\/bin\/svn update <\/pre>\n<p>This also needs the correct permissions to run:<\/p>\n<pre>sudo chown www-data:www-data \/svn-repositories\/www.<span style=\"color: red;\">domain.com<\/span>\/hooks\/post-commit  sudo chmod +x \/svn-repositories\/www.<span style=\"color: red;\">domain.com<\/span>\/hooks\/post-commit  <\/pre>\n<p>We also need to add this repository to a vhost file so that you can  check it out. I would suggest a new one for this purpose. Multiple  locations can be added, but for now we just have one.<\/p>\n<pre>sudo <span style=\"color: green;\">nano<\/span> \/etc\/apache2\/vhosts\/svn.<span style=\"color: red;\">domain.com<\/span>.conf  <\/pre>\n<pre><pre><VirtualHost *:80=\"*:80\">         ServerAdmin webmaster@<span style=\"color: red;\">domain.com<\/span>         DocumentRoot \/var\/www\/default\/         ServerName svn.<span style=\"color: red;\">domain.com<\/span>         <Directory \"\/var\/www\/default\/\"=\"\"\/var\/www\/default\/\"\">                 Options -Indexes FollowSymLinks                 AllowOverride FileInfo                 Order allow,deny                 Allow from all         <\/Directory>         <Location \/svn\/www.<span style=\"color: red;\">domain.com<\/span>>         \tDAV svn         \tSVNPath \/svn-repositories\/www.<span style=\"color: red;\">domain.com<\/span>         \tAuthType Basic         \tAuthName \"www.<span style=\"color: red;\">domain.com<\/span> subversion repository\"         \tAuthUserFile \/svn-repositories\/passwd         \tRequire valid-user         <\/Location> <\/VirtualHost><\/pre>\n<p>Before this can be tested Apache needs to be reloaded:<\/p>\n<pre>sudo service apache2 graceful  <\/pre>\n<p>You can now check out the repository from \u201chttp:\/\/svn.<span style=\"color: red;\">domain.com<\/span>\/svn\/www.<span style=\"color: red;\">domain.com<\/span>\u201d  using the command line or client (Linux \/ OSX) or a client such as  Tortoise SVN on Windows. You will need to validate using the username \/  password that you created in this step. If you would rather use the  .htpasswd file used for the database and mail admin just update the  vhost file with that location.<\/p>\n<p>\u00a0<\/p>\n<p>Articolul original: <a href=\"http:\/\/www.paul-norman.co.uk\/2011\/02\/software-configuration\/\">aici<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>We will bring your website (www.domain.com) under version control. This step will create the repositories and set their permissions to allow the web user access.&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[30],"tags":[232,231],"class_list":["post-431","post","type-post","status-publish","format-standard","hentry","category-informatica","tag-site","tag-subversion"],"_links":{"self":[{"href":"https:\/\/site.noi3.org\/index.php?rest_route=\/wp\/v2\/posts\/431","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/site.noi3.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/site.noi3.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/site.noi3.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/site.noi3.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=431"}],"version-history":[{"count":0,"href":"https:\/\/site.noi3.org\/index.php?rest_route=\/wp\/v2\/posts\/431\/revisions"}],"wp:attachment":[{"href":"https:\/\/site.noi3.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=431"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/site.noi3.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=431"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/site.noi3.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=431"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}