Flask app for deploying DigitalOcean droplet using Pulumi.

Overview

Droplet Deployer

Simple Flask app which deploys a droplet onto Digital ocean.

Behind the scenes there's Pulumi being used.

Background

I have been Terraform user for a while and it is a industry-wide recognized standard tool for deployment of IaC.

Pulumi is written to overcome the hurdle of learning a custom language, allowing developers and DevOps to use standard programming languages such as Python, Go, JavaScript, TypeScript, and C#, to deploy their stacks. I can see merits of using Pulumi where a new team is completely unfamiliar with Terraform but has existing software development skills. This is not to say that HCL is a difficult language to learn. People with existing software engineering and development skills can quickly pickup Terraform and they will also be well supported by communities as it is an extremely popular tool, if not the tool of choice.

If you are interested in learning more around how Pulumi differs from Terraform, there's a comparision on Pulumi's website.

I wanted to write this app to be able to understand Pulumi better so I'm ready for when oppurtunity arise for the use of Pulumi :).

Getting started

There are a few steps to get stack setup.

Export a config passphrase for encrypting your secrets.

export PULUMI_CONFIG_PASSPHRASE=password

Export your Digitalocean Token.

export DIGITALOCEAN_TOKEN="<YOUR_DO_TOKEN>"

Install pulumi engine using curl. For more info, see here.

curl -fsSL https://get.pulumi.com | sh

Create a local state backend. Only good for testing or development use.

pulumi login --local

Install pulumi digitalocean plugin.

pulumi plugin install resource digitalocean v4.8.0

Setup your venv.

python3 -m venv venv

Install requirements under your venv.

venv/bin/python3 -m pip install -r requirements.txt

And final step is to run the flask application using flask run command.

FLASK_RUN_PORT=1337 FLASK_ENV=development FLASK_APP=app venv/bin/flask run

Listing Droplets

Hitting the root of the webserver or /list would list all the pulumi stacks containing droplets managed by the tool.

curl 127.0.0.1:1337

# or

curl 127.0.0.1:1337/list

Creating Droplet

Provide the name of droplet you want to create. This will also be set as Pulumi stack name.

Using curl hit /add endpoint.

curl -H 'Content-Type: application/json' -d '{"name": "test"}' 127.0.0.1:1337/add

Delete a single Droplet

Provide the name of droplet you want to delete. This also deletes Pulumi stack.

Using curl hit /delete endpoint with HTTP method DELETE providing instance name as below.

curl -X DELETE -H 'Content-Type: application/json' -d '{"name": "test"}' 127.0.0.1:1337/delete

Delete ALL Droplets

The tool also provides ability to delete all droplets and the complete stack managed via this Pulumi setup.

curl -X DELETE 127.0.0.1:1337/deleteAll

Acknowledgement

Inspired by similar, feature rich and much better project https://github.com/komalali/self-service-platyform/.

Owner
Ahmed Sajid
Self diagnosed Flow addict! Living the :keyboard: life.
Ahmed Sajid
5 Flask Projects To Get Started

5 Flask Projects Projects Made By Using Flask Projects List Rock Paper Scissor Game - A Simple Game Weather App - A OpenWeatherMap Scraper Task List -

Root_Arch 59 Dec 18, 2022
A caching extension for Flask

Flask-Caching Adds easy cache support to Flask. This is a fork of the Flask-Cache extension. Flask-Caching also includes the cache module from werkzeu

Peter Justin 774 Jan 02, 2023
YAML-formatted plain-text file based models for Flask backed by Flask-SQLAlchemy

Flask-FileAlchemy Flask-FileAlchemy is a Flask extension that lets you use Markdown or YAML formatted plain-text files as the main data store for your

Siddhant Goel 20 Dec 14, 2022
Intranet de la Rez Flask web app

IntraRez Application Flask de l'Intranet de la Rez. Exigences Python : Probablement = 3.10 à terme, pour l'instant = 3.8 suffit ; Autres packages Li

3 Jul 03, 2022
A Flask web application that manages student entries in a SQL database

Student Database App This is a Flask web application that manages student entries in a SQL database. Users can upload a CSV into the SQL database, mak

rebecca 1 Oct 20, 2021
Quick and simple security for Flask applications

Note This project is non maintained anymore. Consider the Flask-Security-Too project as an alternative. Flask-Security It quickly adds security featur

Matt Wright 1.6k Dec 19, 2022
A nice anonymous messaging api (Uses Flask's restful api)

anonymous-message-api A nice anonymous message api (Uses Flask's restful api) How it works: 1. The user send a put request to your api server: Require

6 Nov 07, 2021
A flask template with Bootstrap 4, asset bundling+minification with webpack, starter templates, and registration/authentication. For use with cookiecutter.

cookiecutter-flask A Flask template for cookiecutter. (Supports Python ≥ 3.6) See this repo for an example project generated from the most recent vers

4.3k Dec 29, 2022
Implement Instagram with flask

Blue club The place where manly men live and breathe. Move to Notion Move to Fig

3 Apr 07, 2022
flask extension for integration with the awesome pydantic package

Flask-Pydantic Flask extension for integration of the awesome pydantic package with Flask. Installation python3 -m pip install Flask-Pydantic Basics U

248 Dec 26, 2022
Flask webassets integration.

Integrates the webassets library with Flask, adding support for merging, minifying and compiling CSS and Javascript files. Documentation: https://flas

Michael Elsdörfer 433 Dec 29, 2022
A gRpc server like Flask (像Flask一样的gRpc服务)

Mask A gRpc server just like Flask. Install Mask support pypi packages, you can simply install by: pip install mask Document Mask manual could be fou

吴东 16 Jun 14, 2022
A simple way to demo Flask apps from your machine.

flask-ngrok A simple way to demo Flask apps from your machine. Makes your Flask apps running on localhost available over the internet via the excellen

117 Dec 27, 2022
Pagination support for flask

flask-paginate Pagination support for flask framework (study from will_paginate). It supports several css frameworks. It requires Python2.6+ as string

Lix Xu 264 Nov 07, 2022
API to get the details of the characters in the Money heist TV show.

Project Heist Description: Project Heist is a RESTful API made using Python and Flask. This API is inspired by the popular Spanish TV show Money Heist

Rahul V 5 Dec 19, 2022
Freezes a Flask application into a set of static files.

Frozen-Flask Freezes a Flask application into a set of static files. The result can be hosted without any server-side software other than a traditiona

Frozen Flask 737 Dec 19, 2022
REST API with mongoDB and Flask.

Flask REST API with mongoDB py 3.10 First, to install all dependencies: python -m pip install -r requirements.txt Second, into the ./src/ folder, cop

Luis Quiñones Requelme 3 Mar 05, 2022
Easy file uploads for Flask.

Library that works with Flask & SqlAlchemy to store files on your server & in your database Read the docs: Documentation Installation Please install t

Joe Gasewicz 145 Jan 06, 2023
Boilerplate template formwork for a Python Flask application with Mysql,Build dynamic websites rapidly.

Overview English | 简体中文 How to Build dynamic web rapidly? We choose Formwork-Flask. Formwork is a highly packaged Flask Demo. It's intergrates various

aswallz 81 May 16, 2022
A simple barcode and QR code generator built in Python with Flask.

✨ Komi - Barcode & QR Generator ✨ A simple barcode and QR code generator built in Python with Flask. 📑 Table of Contents Usage Installation Contribut

Bonnie Fave 2 Nov 04, 2021