1 2 3 4 5 6 7 8 9 10 11 12 |
server { listen 80; server_name example.com; location / { return 301 https://$server_name$request_uri; } location /.well-known/acme-challenge/ { root /var/www/html; } } |
1 2 3 4 5 6 7 8 9 10 11 12 |
server { listen 80; server_name example.com; location / { return 301 https://$server_name$request_uri; } location /.well-known/acme-challenge/ { root /var/www/html; } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
_complete_ssh_hosts () { COMPREPLY=() cur=”${COMP_WORDS[COMP_CWORD]}” comp_ssh_hosts=`cat ~/.ssh/known_hosts | \ cut -f 1 -d ‘ ‘ | \ sed -e s/,.*//g | \ grep -v ^# | \ uniq | \ grep -v “\[” ; cat ~/.ssh/config | \ grep “^Host ” | \ awk ‘{print $2}’ ` COMPREPLY=( $(compgen -W “${comp_ssh_hosts}” — $cur)) return 0 } complete -F _complete_ssh_hosts ssh |
# update packages
1 |
sudo apt-get update |
# install gitolite server
1 |
sudo apt-get install gitolite3 |
# rename (not necessary) user gitolite3 to git
1 |
sudo usermod gitolite3 –login git |
# clone git admin dir to your home account
1 2 |
cd ~ git clone [email protected]:gitolite-admin |
# make changes in gitolite.conf — add new repo
1 2 3 |
“`repo web-app RW+ = admin“` |
# show status
1 |
git status |
# add files to repo
1 |
git add -A . |
# commit your changes
1 |
git commit -m ‘Added new repo’ |
# for use simple git push
1 |
git config –global push.default simple |
# push changes to repo
1 |
git push |
All done, your repo is ready.
Now go to dir with your app.
1 |
cd ~/web-app/ |
# initialize dir for git
1 |
git init |
# add url of «remote» repo
1 |
git remote add origin ssh://[email protected]:8822/web-app |
# check it
1 |
git remote -v |
# commit and push your repo
1 2 3 4 5 6 7 |
git status git add -A . git commit -m ‘Initial commit’ git push –set-upstream origin master |
# clone repo on desktop
1 |
git clone ssh://[email protected]:8822/web-app |
/etc/ssh/sshd_config:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
#Subsystem sftp /usr/lib/openssh/sftp-server Subsystem sftp internal-sftp Match group chrooted ChrootDirectory /www/sites X11Forwarding no AllowTcpForwarding no ForceCommand internal-sftp |
/etc/passwd:
1 |
testuser:x:1002:1002::/www/sites/testuser:/usr/lib/sftp-server |
Live backup of your VM running in KVM under Ubuntu using qcow2 disk images
# First of all disable apparmor to allow access
1 2 3 4 5 |
aa-status aa-complain /usr/sbin/libvirtd aa-complain /etc/apparmor.d/libvirt/libvirt-xxxxxxxxxxxxxxxxxx |
# View disks
1 |
virsh domblklist test-backup |
# Suspend the domain (This is optional. I do this so that the condition of virtual machines remains unchanged during the backup.)
1 |
virsh suspend test-backup |
# Create snapshot
1 2 3 4 5 6 7 |
virsh snapshot-create-as –domain test-backup test-snap1 \ –diskspec vda,file=/home/virtual/test_backup/test-c.img \ –diskspec vdb,file=/home/virtual/test_backup/test-d.img \ –disk-only –atomic |
# or
1 |
virsh snapshot-create-as –domain test-backup test-backup-snap1 –disk-only –atomic |
# View snapshots
1 |
virsh snapshot-list test-backup |
# View disks (it must be running on snapshots)
1 |
virsh domblklist test-backup |
# Copy drives to backup dir
1 2 3 |
rsync -avh –progress drive-c.qcow2 export/drive-c.qcow2-copy rsync -avh –progress drive-d.qcow2 export/drive-d.qcow2-copy |
# Perform active blockcommit by live merging contents
1 2 3 |
virsh blockcommit test-backup vda –active –verbose –pivot virsh blockcommit test-backup vdb –active –verbose –pivot |
# View disks (it must be running on normal drives)
1 |
virsh domblklist test-backup |
# Unsuspend the domain
1 |
virsh resume test-backup |
# View snapshots again
1 |
virsh snapshot-list test-backup |
# Delete snapshots
1 |
virsh snapshot-delete test-backup test-backup-snap1 –metadata |
# View snapshots to check
1 |
virsh snapshot-list test-backup |
# Delete snapshot files
1 2 3 |
rm -f /home/virtual/test_backup/drive-c.test-backup-snap1 rm -f /home/virtual/test_backup/drive-d.test-backup-snap1 |