Step 1: Prepare the Web Directory
Before starting, make sure that you have created myVesta user called "svn" and clear the contents of the public_html directory for the target domain.
Code: Select all
rm -rf /home/svn/web/domain.com/public_html/*
mkdir -p /home/svn/logs
chown svn:svn /home/svn/logs
Code: Select all
mcedit /srv/svn/repos/myapp/hooks/post-commit
Code: Select all
#!/bin/sh
export LC_ALL=en_US.UTF-8
chown -R svn:svn /home/svn/web/domain.com/public_html/
/usr/bin/svn update /home/svn/web/domain.com/public_html
--username svnadmin
--password testpass123
--non-interactive
--accept theirs-full
--force
>> /home/svn/logs/subversion_log 2>&1
chown -R svn:svn /home/svn/web/domain.com/public_html/
chmod -R 775 /home/svn/web/domain.com/public_html/
Code: Select all
chown svn:svn /srv/svn/repos/myapp/hooks/post-commit
chmod +x /srv/svn/repos/myapp/hooks/post-commit
This command initializes the web directory with the repository’s content:
Code: Select all
svn checkout svn://domain.com/myapp
/home/svn/web/domain.com/public_html
--username svnadmin
--password testpass123
--non-interactive
On your local machine (for example, from a Debian system):
Code: Select all
mkdir ~/myapp-import
echo "<p>This is a test file for SVN import</p>" > ~/myapp-import/test.html
svn import ~/myapp-import svn://domain.com/myapp
--username testuser
--password testuserpass
-m "Initial import of test file"
Open your website (https://domain.com) and check if test.html is present in the public_html directory.
Confirm that the post-commit hook is working as expected.
Final Notes:
- Replace testpass123 and testuserpass with your actual credentials.
- The post-commit script ensures that changes from the SVN repository are automatically updated in the website directory after each commit.
- Monitor the /home/svn/logs/subversion_log for any update errors.