DigitalOcean Blueprints are pre-configured infrastructure stacks with ready-to-use applications and they’re deployed with only a few clicks. With DigitalOcean Blueprints you’ll be able to skip complicated deployment configurations and infrastructure setups. You’ll be able to deploy easily and begin using your applications right away!
DigitalOcean Blueprints are designed to be the starting point for your production-ready infrastructure. They aim to make deployment as seamless as possible so you can access the value of the application quickly. Each Blueprint has its own infrastructure configuration, cost, and software deployments. Please refer to the documentation for more details on each of these components.
The Django Blueprint will deploy 3 Django Droplet 1-Clicks, 1 load balancer, and 1 PostgreSQL database.
Each Droplet deployed contains:
The database is a 30GB PostgreSQL 12 with 2 GB RAM and 1 vCPU.
The load balancer is a single-node with up to 10000 simultaneous connections.
The approximate cost of this deployment is $186 monthly.
Head to the Terraform install page and follow the instructions for your platform.
You can validate your local Terraform installation by running:
$ terraform -v
Terraform v1.5.7
...
Head to the Applications & API page and create a new personal access token (PAT) by clicking the Generate New Token button. Make sure to check the Write scope for the token, as Terraform needs it to create new resources. After creating the token, make sure to save it as it disappears forever if you close the page. If you lost the token, delete it and create a new one.
Clone this repository to the machine where Terraform is installed:
$ git clone https://github.com/digitalocean/marketplace-blueprints.git
Head to the blueprint you are interested in, for this example we will use Django:
$ cd blueprints/django/
Edit variables.tf
file and specify your API token like this:
variable “do_token” {
default = “dop_v1_your_beautiful_token_here”
}
Optionally, if you want to initialize Django Droplets with your Django application, you can specify the link to your project:
variable "project_url" {
default = "https://github.com/your_amazing_django_project"
}
Also optionally, if you want to connect to your Django Droplets using SSH, use doctl to retrieve your SSH key IDs:
$ doctl compute ssh-key list
Paste the keys IDs from the doctl in variable.tf
:
variable "ssh_key_ids" {
default = [123, 112233] // <--- HERE
type = list(number)
}
We are almost there, now initialize the Terraform project by running:
$ terraform init
Finally, after the project is initialized, run the Terraform apply to spin the blueprint:
$ terraform apply
It can take a few minutes to spin the droplets and some blueprints require extra time after the creation to finish the configuration.
Package | Version | License |
---|---|---|
Django | 5 | Custom |
Nginx | 1.18.0 | Custom |
Certbot | 0.40.0 | Apache 2 |
Gunicorn | 20.0.4 | MIT |
Postgres | 12 | Postgres SQL |
Postfix | 3.4.10 | IBM Public |
Click the Deploy to DigitalOcean button to deploy this offering. If you aren’t logged in, this link will prompt you to log in with your DigitalOcean account.
After the stack is deployed, give it 5-6 minutes to finish the configuration.
After this, you can access your via load balancer IP: http://<load-balancer-ip>
.
Keep in mind that unless specified in the variables.tf
, Django Blueprint will not contain a sample project and requests may time out.
After making any change inside Django Droplet 1-Click, don’t forget to reload Gunicorn:
$ systemctl daemon-reload
$ systemctl restart gunicorn
systemctl status gunicorn
./home/django/django_project
.