Commits

Anonymous committed 1ac3f70

Moved prod->staging

  • Participants
  • Parent commits ea6f40d

Comments (0)

Files changed (4)

conf/staging/nginx.conf

+daemon off;
+#user  nobody;
+worker_processes  1;
+
+#error_log  logs/error.log;
+#error_log  logs/error.log  notice;
+#error_log  logs/error.log  info;
+
+#pid        logs/nginx.pid;
+
+
+events {
+    worker_connections  1024;
+}
+
+
+http {
+    include       mime.types;
+    default_type  application/octet-stream;
+
+    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
+    #                  '$status $body_bytes_sent "$http_referer" '
+    #                  '"$http_user_agent" "$http_x_forwarded_for"';
+
+    #access_log  logs/access.log  main;
+
+    sendfile        on;
+    #tcp_nopush     on;
+
+    #keepalive_timeout  0;
+    keepalive_timeout  65;
+
+    #gzip  on;
+
+    server {
+        listen       11826;
+        server_name  rentalerts.danjac354.webfactional.com;
+
+        #charset koi8-r;
+
+        #access_log  logs/host.access.log  main;
+
+
+        #location /static/ {
+        #    root /home/danjac354/webapps/static;
+        #}
+
+
+        location / {
+            root html;
+            index index.html index.htm;
+            auth_basic "Restricted";
+            auth_basic_user_file /home/danjac354/.htpasswd;
+            proxy_pass_header Server;
+            proxy_set_header Host $http_host;
+            proxy_redirect off;
+            proxy_set_header X-Real-IP $remote_addr;
+            proxy_set_header X-Scheme $scheme;
+            proxy_connect_timeout 10;
+            proxy_read_timeout 10;
+            proxy_pass http://127.0.0.1:53369;
+        }
+
+        #error_page  404              /404.html;
+
+        # redirect server error pages to the static page /50x.html
+        #
+        error_page   500 502 503 504  /50x.html;
+        location = /50x.html {
+        }
+
+        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
+        #
+        #location ~ \.php$ {
+        #    proxy_pass   http://127.0.0.1;
+        #}
+
+        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
+        #
+        #location ~ \.php$ {
+        #    root           html;
+        #    fastcgi_pass   127.0.0.1:9000;
+        #    fastcgi_index  index.php;
+        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
+        #    include        fastcgi_params;
+        #}
+
+        # deny access to .htaccess files, if Apache's document root
+        # concurs with nginx's one
+        #
+        #location ~ /\.ht {
+        #    deny  all;
+        #}
+    }
+
+
+    # another virtual host using mix of IP-, name-, and port-based configuration
+    #
+    #server {
+    #    listen       8000;
+    #    listen       somename:8080;
+    #    server_name  somename  alias  another.alias;
+
+    #    location / {
+    #        root   html;
+    #        index  index.html index.htm;
+    #    }
+    #}
+
+
+    # HTTPS server
+    #
+    #server {
+    #    listen       443;
+    #    server_name  localhost;
+
+    #    ssl                  on;
+    #    ssl_certificate      cert.pem;
+    #    ssl_certificate_key  cert.key;
+
+    #    ssl_session_timeout  5m;
+
+    #    ssl_protocols  SSLv2 SSLv3 TLSv1;
+    #    ssl_ciphers  HIGH:!aNULL:!MD5;
+    #    ssl_prefer_server_ciphers   on;
+
+    #    location / {
+    #        root   html;
+    #        index  index.html index.htm;
+    #    }
+    #}
+
+}

conf/staging/supervisord.conf

+; Webfaction supervisor config file.
+ 
+[inet_http_server]                         ; inet (TCP) server setings
+port=127.0.0.1:25863                    ; (ip_address:port specifier, *:port for all iface)
+username=danjac                        ; (default is no username (open server))
+password=m0nk3Y                           ; (default is no password (open server))
+
+[supervisord]
+logfile=/home/danjac354/logs/user/supervisor/supervisord.log       ; (main log file;default $CWD/supervisord.log)
+logfile_maxbytes=50MB                             ; (max main logfile bytes b4 rotation;default 50MB)
+logfile_backups=10                                ; (num of main logfile rotation backups;default 10)
+loglevel=debug                                    ; (log level;default info; others: debug,warn,trace)
+pidfile=/home/danjac354/supervisord.pid                                ; (supervisord pidfile;default supervisord.pid)
+nodaemon=false                                    ; (start in foreground if true;default false)
+minfds=1024                                       ; (min. avail startup file descriptors;default 1024)
+minprocs=200                                      ; (min. avail process descriptors;default 200)
+
+[rpcinterface:supervisor]
+supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
+
+[supervisorctl]
+serverurl=http://127.0.0.1:25863
+username=danjac
+password=m0nk3Y
+
+[program:nginx]
+directory=/home/danjac354/webapps/nginx
+command=sbin/nginx 
+user=danjac354
+autostart=true
+autorestart=true
+logfile=/home/danjac354/logs/user/supervisor/nginx.log
+redirect_stderr=true
+
+[program:rentalerts]
+directory=/home/danjac354/webapps/rentalerts/rentalerts
+command=/home/danjac354/.virtualenvs/rentalerts/bin/python2.7 /home/danjac354/webapps/rentalerts/rentalerts/bin/production run_gunicorn -b 127.0.0.1:53369 -w 4
+user=danjac354
+autostart=true
+autorestart=true
+logfile=/home/danjac354/logs/user/supervisor/rentalerts.log
+redirect_stderr=true
+
 server = Server()
 
 @api.task 
-def prod():
+def stage():
     
     server.dir = "/home/danjac354/webapps/rentalerts/rentalerts"
     server.nginx_dir = "/home/danjac354/webapps/nginx"
-    server.conf_dir = "%s/conf/production" % server.dir
+    server.conf_dir = "%s/conf/staging" % server.dir
     server.python_exec = "/home/danjac354/.virtualenvs/rentalerts/bin/python2.7"
-    server.manager = "%s ./bin/production" % server.python_exec
+    server.manager = "%s ./bin/staging" % server.python_exec
     server.testrunner = "%s ./bin/runtests" % server.python_exec
 
     api.env.hosts = ['danjac354.webfactional.com']
     api.env.password = 'VN4je2Cj'
 
 
+def prod():
+
+    raise NotImplementedError
+
 @api.task
 def nginx_start():
 

rentalerts/settings/staging.py

 from rentalerts.settings.base import *
+
+DEBUG = False
+TEMPLATE_DEBUG = False
+
+ADMINS = MANAGERS = (
+    ("Danny", "danjac354@gmail.com"),
+)
+
+INSTALLED_APPS += ('sentry', 'gunicorn')
+
+# database
+
+DATABASES['default']['NAME'] = 'danjac354_rentalerts'
+DATABASES['default']['USER'] = 'danjac354_rentalerts'
+DATABASES['default']['PASSWORD'] = "e3667de9"
+
+# static media
+
+STATIC_ROOT = os.path.join(
+    os.path.expanduser("~"),
+    "webapps", "static"
+)
+
+STATIC_URL = "http://static.danjac354.webfactional.com/"
+ADMIN_MEDIA_PREFIX = STATIC_URL + "grappelli/"
+
+# email setup
+
+EMAIL_HOST = 'smtp.webfaction.com'
+EMAIL_HOST_USER = 'rentalerts'
+EMAIL_HOST_PASSWORD = 'rentalerts1'
+DEFAULT_FROM_EMAIL = 'admin@rentalerts.danjac354.webfactional.com'
+SERVER_EMAIL = DEFAULT_FROM_EMAIL
+
+# sentry setup
+
+SENTRY_LOG_DIR = os.path.join(PROJECT_DIR, 'logs')
+SENTRY_RUN_DIR= os.path.join(PROJECT_DIR, 'run')
+SENTRY_WEB_HOST = '127.0.0.1'
+SENTRY_WEB_PORT = 9000
+SENTRY_KEY = '%@^tk!eqeaq(bs+nl@(ww6@5cxom!1vcbvqnz^zw26kon7qzdk'
+
+SENTRY_FILTERS = (
+    'sentry.filters.StatusFilter',
+    'sentry.filters.LoggerFilter',
+    'sentry.filters.LevelFilter',
+    'sentry.filters.ServerNameFilter',
+    'sentry.filters.SiteFilter',
+)
+
+SENTRY_VIEWS = (
+    'sentry.views.Exception',
+    'sentry.views.Message',
+    'sentry.views.Query',
+)
+
+
+