Skip to main content

A plugin for django-simple-deploy, supporting deployments to VPS providers.

Project description

dsd-vps

A plugin for deploying Django projects to any VPS provider, using django-simple-deploy.

Quick Start

To deploy your project to a VPS, you'll need to ...

Prerequisites

Deployment to a VPS requires the following:

  • You must be using Git to track your project.
  • You need to be tracking your dependencies with a requirements.txt file, or be using Poetry or Pipenv.
  • You'll need...

Configuration-only deployment (NOT SUPPORTED YET)

First, install dsd-vps and add django_simple_deploy to INSTALLED_APPS in settings.py:

$ pip install dsd-vps
# Add "django_simple_deploy" to INSTALLED_APPS in settings.py.
$ git commit -am "Added django_simple_deploy to INSTALLED_APPS."

When you install dsd-vps, it will install django-simple-deploy as a dependency.

Now run the deploy command:

$ python manage.py deploy

This is the deploy command from django-simple-deploy, which makes all the changes you need to run your project on a VPS.

Automated deployment

This is experimental, and you should review the codebase before running this early version on your system. It will modify local files outside of your project, such as ~/.ssh/config and ~/.ssh/id_rsa_git.

  • Create a new VPS instance.
    • I'm Using Ubuntu 24.04 on Digital Ocean for development work; any debian-based OS on any VPS provider should work.
    • Choose SSH username/password login approach, not SSH key (for now).
  • Set two local env vars:
    • $ export DSD_HOST_IPADDR=<instance-ip-address>
    • $ export DSD_HOST_PW=<instance-pw>
  • Install dsd-vps. (If you cloned this repo, you probably want to make a local editable install of dsd-vps.)
  • Add django_simple_deploy to INSTALLED_APPS.
  • Run python manage.py deploy --automate-all.
    • This command takes a while. If you think it might be hanging, look at your VPS instance dashboard. High CPU means it's probably still updating.
    • For development work, it might be reasonable to use a higher spec instance, that will be destroyed in under an hour.
    • The deployment will ask you to confirm a fingerprint before connecting. It will also require the root password for the instance.

The deploy command will add a new user named django_user to the instance, with the same password you originally chose. It will update and configure the server, configure Git on the server, configure the project to be served from the droplet, commit changes, push the project, and open the remote project in a new browser tab.

It will add a local ssh key pair for Git, modifying ~/.ssh/config. The key will be stored at ~/.ssh/id_rsa_git.

The project will be served over http, which means the browser will almost certainly flag it as insecure.

Automated deployment - using SSH keys

This is experimental, and you should review the codebase before running this early version on your system. It will modify local files outside of your project, such as ~/.ssh/config and ~/.ssh/id_rsa_git.

The current version of dsd-vps only supports ssh-key-based deployment to Digital Ocean, because it only knows how to create resources on that platform. Support for other platforms will be added as the behavior stabilizes.

  • Install dsd-vps. (If you cloned this repo, you probably want to make a local editable install of dsd-vps.)
  • Add django_simple_deploy to INSTALLED_APPS.
  • Run python manage.py deploy --platform digital_ocean --automate-all --ssh-key <path_to_ssh_key>.
    • This command takes a while. If you think it might be hanging, look at your VPS instance dashboard. High CPU means it's probably still updating.
    • For development work, it might be reasonable to use a higher spec instance, that will be destroyed in under an hour.
    • The deployment will ask you to confirm a fingerprint before connecting.

The deploy command will add a new user named django_user to the instance. It will update and configure the server, configure Git on the server, configure the project to be served from the droplet, commit changes, push the project, and open the remote project in a new browser tab.

It will add a local ssh key pair for Git, modifying ~/.ssh/config. The key will be stored at ~/.ssh/id_rsa_git.

The project will be served over http, which means the browser will almost certainly flag it as insecure.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dsd_vps-0.1.1.tar.gz (18.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dsd_vps-0.1.1-py3-none-any.whl (20.3 kB view details)

Uploaded Python 3

File details

Details for the file dsd_vps-0.1.1.tar.gz.

File metadata

  • Download URL: dsd_vps-0.1.1.tar.gz
  • Upload date:
  • Size: 18.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for dsd_vps-0.1.1.tar.gz
Algorithm Hash digest
SHA256 018227791626350e6e385bbe318e34465f2cfaff58a2b0d606d93571f935fe81
MD5 876db0c08ac2200a63015498bd00a40c
BLAKE2b-256 eaa467dfad6d2a0883500448e6a3902a848341df12a5d222f7ec8caeec3441fb

See more details on using hashes here.

File details

Details for the file dsd_vps-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: dsd_vps-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 20.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for dsd_vps-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9164ca837bcad9905a2ee691e81713bd6d02c279bd1497d656a631d3115ff006
MD5 184e7a9530a21305429f7baed4028a6f
BLAKE2b-256 65656bbdf8d7922b450380adc72f50d871b923a3cde1686aa05e2464f00c0036

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page