You are viewing revision #1 of this wiki article.
This version may not be up to date with the latest version.
You may want to view the differences to the latest version.
- [on server] - install git, nothing fancy just basic
- [on local] - prepare git repository
- [on server] - secure your data on server
- [on server] - git hook (top secret)
- [on local] - prepare for git push
- [on local] - ta-ta, push to publish
I did not invent this instruction, I read it somewhere and re-organize it in my way as I was trying and it works for me;
Assuming server is Ubuntu Linux;
If you have dynamic files uploaded by user, PLEASE donwload them first before you git push to publish, if you lose them by using this instruction, don't come back to blame on me!
I am not an expert on git nor in server security, use the instruction at your own risk;
[on server] - install git, nothing fancy just basic ¶
sudo apt-get install git-core
[on local] - prepare git repository ¶
git init / add / commit
+--app-root | +--.git | +--private | | + +--.htaccess | | + +--resource (whatever used at design time) | +--public | +--yii-app (pure & clean)
[on server] - secure your data on server ¶
never point your web route to your private content!!
so in apache conf file
under "/var/www/app-root/private" create file .htaccess (double secure in case accident happends)
order deny, allow deny from all
[on server] - git hook (top secret) ¶
modify /var/www/app-root/.git/hooks/post-receive and give it execute permission
#!/bin/sh cd .. GIT_DIR='.git' umask 002 && git reset --hard ## you don't need those two lines if you are not using sqlite chmod -R 777 public/protected/data chmod -R 777 public/protected/data/*
give it execute permission
chmod +x hooks/post-receive
[on local] - prepare for git push ¶
modify or add the follwoing content to /app-root/.git/config
[remote "production"] fetch = +refs/heads/*:refs/remotes/production/* url = ssh://root@yourwebserver~/var/www/app-root/ [branch "master"] remote = production merge = refs/heads/master
[on local] - ta-ta, push to publish ¶
under /app-root/ folder:
git push proudction master