Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
docs
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
backend
docs
Commits
028a28e2
Commit
028a28e2
authored
9 years ago
by
郑伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
后端服务器
parent
68caf6e0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
99 additions
and
0 deletions
+99
-0
spec.md
spec.md
+99
-0
No files found.
spec.md
0 → 100644
View file @
028a28e2
<table>
<tr>
<th>
Category
</th>
<th>
Directory
</th>
</tr>
<tr>
<td>
project
</td>
<td>
/srv/apps/$PROJECT/
</td>
</tr>
<tr>
<td>
virtualenv
</td>
<td>
/srv/envs/$PROJECT/
</td>
</tr>
<tr>
<td>
http-static-files
</td>
<td>
/srv/static/$PROJECT/
</td>
</tr>
<tr>
<td>
app-log
</td>
<td>
/data/log/$PROJECT/app/
*
.log
</td>
</tr>
<tr>
<td>
nginx-log
</td>
<td>
/data/log/$PROJECT/nginx/
*
.log
</td>
</tr>
<tr>
<td>
supervisor-log
</td>
<td>
/data/log/$PROJECT/supervisor/
*
.log
</td>
</tr>
<tr>
<td>
nginx
</td>
<td>
/etc/nginx/gmapps/$PROJECT.conf
</td>
</tr>
<tr>
<td>
supervisord
</td>
<td>
/etc/supervisor/gmapps/$PROJECT.conf
</td>
</tr>
<tr>
<td>
logrotate
</td>
<td>
/etc/logrotate.d/gmapps/$PROJECT.conf
</td>
</tr>
</table>
PROJECT={prj_name} && mkdir -p /srv/apps/$PROJECT/ /srv/envs/$PROJECT/ /srv/static/$PROJECT/ /data/log/$PROJECT/app/ /data/log/$PROJECT/nginx/ /data/log/$PROJECT/supervisor/
# conf example
## nginx
server {
listen 80;
server_name {{domain}};
root /srv/apps/{{PROJECT}};
location / {
proxy_pass {{GUNICORN BIND}};
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /static/ {
alias /srv/static/{{PROJECT}}/;
expires 864000;
}
access_log /data/log/{{PROJECT}}/nginx/access.log combined;
}
## supervisord
[program:{{PROJECT}}]
command = /srv/envs/{{PROJECT}}/bin/gunicorn {{PROJECT}}.wsgi:application -w=5 -b {{HOST:PORT}}
directory = /srv/apps/{{PROJECT}}
redirect_stderr = true
stdout_logfile = /data/log/{{PROJECT}}/supervisor/supervisor.log
# misc for convenience
## automatically activate virtual env
####### file .gengmei.bash #######
# put into .bashrc.
# if [ -f ~/.gengmei.bash ];then
# source ~/.gengmei.bash
# fi
# usage: cd {project_dir}
APPPATH=/srv/apps
ENVPATH=/srv/envs
function cd(){
builtin cd $1;
fullpath=`pwd`;
dirpath=`dirname $fullpath`;
appname=`basename $fullpath`;
if [ $dirpath = $APPPATH ];then
source $ENVPATH/$appname/bin/activate;
fi
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment