Account Setup

We've switched to nginx & uwsgi for our python hosting. We've also introduced some conventions to make it easier for us to setup new users and fix problems that can occur. In your user home directory you'll find that we've added a few scripts for controlling your uwsgi instance, as well as creating a virtualenv for your project at /home/user/env, for those of you who already had django projects we went ahead and moved your django projects into your new virtualenv. Your virtualenv already has django 1.2.5, mysql, postgres, sqlite3 packages, as well as distribute. You can use the wonderful pip (highly recommended) or easy_install to install any new packages you require. We recommend putting any packages you manually install from in /home/user/env/src. Uwsgi expects /home/user/env/uwsgi_app1.py to exist. It uses this to find your application. We've already configured a test hello project. If you ever want to change or rename your application, keep this in mind and make sure it points to the right project.

Every app is controlled by it's corresponding uwsgi_app.py file in  ~/env/. 

If you have more than one app you'll have more than one uwsgi_app.py file, one for each app. They will be named in the following order:

uwsgi_app1.py
uwsgi_app2.py
uwsgi_app3.py
uwsgi_app4.py
etc.. 

To reload any of these applications we have created a universal uwsgi exectuable so you can use:
uwsgi domainname reload (from anywhere inside a terminal)
domainname is replaced by the full domain name of the app you want to reload.
e.g. uwsgi servqc.net reload

We're also proud to be using the blazing fast nginx to serve your static content. Nginx will first look in /home/user/public_html for static content, then fall back to /home/user/public_html/fcabinet (for compatibility with older projects). You can cache static pages as index.html, etc, and if nginx finds it, it will serve that directly, obviating any need to hit your application. Take advantage of this to really accelerate your application!

Since we do PHP hosting as well, we also have configured nginx to automatically serve PHP scripts located in ~/public_html. If you are mixing python/php no worries, just make sure your PHP script is in ~/public_html. Nginx checks first for index.html and index.htm before serving index.php files so keep this in mind.

Also a very important note, index files take precedence over anything so if you have index files in public_html they will be served before you can hit uwsgi so please keep this in mind.

Right now we have all users capped to one uwsgi process limited to 64MB of memory. After a bit of testing we've found this to be more than acceptable. If you'd like to upgrade your account to use more uwsgi processes (thus handle more concurrent page requests as well as making it more responsive), or find you need more memory available for your application, don't hesitate to contact us and we can discuss this. We haven't worked out pricing yet, but we will make sure to keep the pricing reasonable. If you have any issues at all don't hesitate to file a support ticket.

uwsgi commands:
uwsgi domainname reload # restart your application

Path conventions:
/home/user/env/ <= your virtualenv
/home/user/env/uwsgi_app1.py <= module loaded by uwsgi (points to first application)
/home/user/uwsgi.sh <= script for controlling uwsgi
/home/user/uwsgi-logs/ <= uwsgi log files/nginx error logs
/home/user/env/application_name/ <=your application
/home/user/env/src/ <-- packages you install manually for your application should go here
/home/user/env/requirements.txt <-- requirements file for pip to use to install dependencies for your application

The last two are optional,  but will help us debugging and for administration. 

We are working on the next-generation of servqc and you can expect us to continue rolling in new features. Let us know if there is any technology you are interested in, or feature you'd like us to make available to you.


Thanks for using servqc!

Regards,

The servqc.net team

  • 5 Utenti hanno trovato utile questa risposta
Hai trovato utile questa risposta?

Articoli Correlati

SSL Nginx Setup

1. Generate SSL request First generate the key, replace "mysite.com" with your site...