Установка и развёртывание проекта posada на ubuntu 12.04.LTS

From

Revision as of 15:28, 11 October 2013 by Daniel (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

sudo apt-get install sqlite sudo easy_install virtualenv cd /var/www hg clone https://daniel-bavrin@bitbucket.org/bolkhovsky/posada posada cd posada virtualenv /var/www/posada source /var/www/posada/bin/activate pip install django==1.5.2 django-suit south django-debug-toolbar gunicorn git+https://github.com/toastdriven/django-tastypie celery django-celery django-kombu flower mkdir staticfiles mkdir ./logs mkdir ./pids mkdir ./db mkdir ./static_content mkdir ./static_content/media python manage.py collectstatic

sudo nano /etc/nginx/sites-available/posada.conf upstream posada.solab.rshu.ru {

   server localhost:12345 fail_timeout=0;

}

server {

   listen 80;
   server_name  www.posada.solab.rshu.ru;
   rewrite ^/(.*) http://posada.solab.rshu.ru/$1 permanent;

}

server {

   listen 80;
   client_max_body_size 4G;
   server_name posada.solab.rshu.ru;
   access_log  /var/www/posada/logs/posada.access.log;
   error_log  /var/www/posada/logs/posada.error.log;
   keepalive_timeout 5;
   root /var/www/posada/static_content;
   location / {
       location ~ ^/pydap/(?!\.static.*).*$ {
           rewrite ^/pydap(/.*)$ $1 break;
           proxy_pass http://127.0.0.1:3031$1;
           include proxy_params;
       }
       location /pydap/.static/ {
           autoindex    on;
           alias /var/www/pydap/server/data/.static/;
       }
       location /.static/ {
           autoindex    on;
           alias /var/www/pydap/server/data/.static/;
       }
       proxy_pass http://posada.solab.rshu.ru$request_uri;


   }


   error_page 500 502 503 504 /500.html;
   location = /500.html {
       root /var/www/posada/static_content/static/html;
   }
   location ~ ^/(static|media)/ {
       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
       proxy_set_header Host $http_host;
       proxy_redirect off;
       if (!-f $request_filename) {
           proxy_pass http://posada.solab.rshu.ru;
           break;
       }
   }



sudo ln -s /etc/nginx/sites-available/posada.conf /etc/nginx/sites-enabled/ sudo service nginx restart


sudo nano /etc/supervisor/conf.d/posada.conf [program:posada] command=/var/www/posada/bin/python /var/www/posada/manage.py run_gunicorn --bind=localhost:12345 --workers=3 --pid=/var/www/posada/pids/gunicorn.pid --log-file /var/www/posada/logs/gunicorn.log /var/www/posada/logs/gunicorn.log directory=/var/www/posada/posada umask=022 autostart=true autorestart=true startsecs=10 startretries=3 exitcodes=0,2 stopsignal=TERM stopwaitsecs=10 user=user


sudo nano /etc/supervisor/conf.d/celery.conf [program:celery] command=/var/www/posada/bin/python /var/www/posada/manage.py celeryd -B directory=/var/www/posada umask=022 autostart=true autorestart=true startsecs=10 startretries=3 exitcodes=0,2 stopsignal=TERM stopwaitsecs=10 user=user


sudo nano /etc/supervisor/conf.d/flower.conf [program:flower] command=/var/www/posada/bin/python /var/www/posada/manage.py celery flower process_name=%(program_name)s numprocs=1 numprocs_start=0 autostart=false autorestart=true startsecs=1 startretries=3 exitcodes=0,2 stopsignal=TERM stopwaitsecs=10 user=user redirect_stderr=false stdout_logfile=AUTO stdout_logfile_maxbytes=50MB stdout_logfile_backups=10 stdout_capture_maxbytes=0 stdout_events_enabled=false stderr_logfile=AUTO stderr_logfile_maxbytes=50MB stderr_logfile_backups=10 stderr_capture_maxbytes=0 stderr_events_enabled=false directory=/var/www/posada/ serverurl=AUTO


sudo supervisorctl reread sudo supervisorctl update


python manage.py syncdb python manage.py migrate


wget http://www.rabbitmq.com/rabbitmq-signing-key-public.asc sudo apt-key add rabbitmq-signing-key-public.asc sudo apt-get update sudo apt-get upgrade rabbitmq-server sudo rabbitmqctl add_vhost / sudo rabbitmqctl add_user posada posada_password sudo rabbitmqctl set_permissions -p posada / ".*" ".*" ".*" sudo rabbitmq-server restart sudo supervisorctl restart celery

python manage.py createsuperuser >>solab >>bavrin@rshu.ru >>s0l4b1sg00d

Personal tools
MediaWiki Appliance - Powered by TurnKey Linux