Python webapp deployment system - vpsdeploy

Wondering if anybody else struggled to get their projects deployed to remote servers.

Wanted to share a python web app deployment strategy called vpsdeploy.

This is lightly documented fabric 2 package. The basic usage is setup your python web app on your development system. Install the vpsdeploy package. Hack the version of invoke that fabric uses. Generate the fabric configuration file. Then use fabric tasks supplied by vpsdeploy to push and configure your web app.

Configuring your ubuntu linode host for security and and systems like uwsgi, nginx etc is up to you.

This strategy uses git to synchronize your project on the remote machine. A repo is produced on the remote server. The project files are cloned from there.

A linux user is configured to allow the application to run under security constraints. The user is granted application rights in the uwsgi configuration.

The uwsgi instance runs with socket activation provided by systemd. The socket activates a systemd service which in turn commands the uwsgi instance. This activation chain is documented by uwsgi.

Nginx uses this socket to serve requests to your web app. Vpsdeploy also creates nginx configuration files for your web app. Static locations are generated per configuration entries.

I use makefiles to establish the systemd service application setups. A the systemd template service files are saved to the remote server home directory. Instances of the app are enabled under the project name.

1 Reply

Hey @slippers - thanks for putting this guide together! I've added a couple tags to increase visibility. :)

I also wanted to include a link to the uWSGI documentation you mention, as well as links to some guides on configuring NGINX, uWSGI, and server security.

From the Linode guides and docs:

How to Secure Your Server

How to Configure NGINX

From uWSGI:

Configuring uWSGI

Things to know (best practices and “issues”)

Socket activation via systemd

Also of note: We have a freelance technical writing program called Write for Linode that I'd recommend looking into if you're interested!

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct