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
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 v

249 Jan 06, 2023
Flask Apps - Open-Source And Paid | AppSeed

Flask Apps Open-Source web apps built with automation tools, HTML parsing and boilerplated code in Flask - - Provided by AppSeed App Generator. What i

App Generator 120 Oct 04, 2022
A Python, Flask login system

Python Login System This is a basic login + authenticason system for flask using Flask_Login and Flask_SQLAlchemy Get started on your own To use this

MrShoe 0 Feb 02, 2022
Flask RESTful Web services using API to communicate between client and server.

Welcome! Open up two terminals, one for client and for server each Terminal 1 Terminal 2 Now navigate to the CW2_code directory in both like so $ cd C

Sehra Elahi 1 Nov 23, 2021
Neo4j Movies Example application with Flask backend using the neo4j-python-driver

Neo4j Movies Application: Quick Start This example application demonstrates how easy it is to get started with Neo4j in Python. It is a very simple we

Neo4j Examples 309 Dec 24, 2022
This is a API/Website to see the attendance recorded in your college website along with how many days you can take days off OR to attend class!!

Bunker-Website This is a GUI version of the Bunker-API along with some visualization charts to see your attendance progress. Website Link Check out th

Mathana Mathav 11 Dec 27, 2022
Regex Converter for Flask URL Routes

Flask-Reggie Enable Regex Routes within Flask Installation pip install flask-reggie Configuration To enable regex routes within your application from

Rhys Elsmore 48 Mar 07, 2022
Paid roles for discord using Stripe, Python, Flask & Docker

Welcome to Paycord Paid roles for discord using Stripe, Python, Flask & Docker. Setup Production On stripe dashboard, go Developers ➡️ Webhooks ➡️ Add

Ward 12 Dec 28, 2022
A web application that consists of a collection of board games

PyBoardGame About This website contains a collection of board games for users to enjoy, as well as various guides for the games. The web app is built

Larry Shi 0 Aug 11, 2021
A flask template with Bootstrap 4, asset bundling+minification with webpack, starter templates, and registration/authentication.

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 Jan 06, 2023
Geometry Dash Song Bypass with Python Flask Server

Geometry Dash Song Bypass with Python Flask Server

pixelsuft‮ 1 Nov 16, 2021
Example Flask application illustrating some of my common practices

Overholt Overholt is an example Flask application illustrating some of my common practices Development Environment At the bare minimum you'll need the

Matt Wright 1.6k Dec 15, 2022
RestApi_flask_sql.alchemy - Product REST API With Flask & SQL Alchemy

REST API With Flask & SQL Alchemy Products API using Python Flask, SQL Alchemy and Marshmallow Quick Start Using Pipenv # Activate venv $ pipenv shell

amirwahla 1 Jan 01, 2022
A live chat built with python(flask + gevent + apscheduler) + redis

a live chat room built with python(flask / gevent / apscheduler) + redis Basic Architecture Screenshot Install cd /path/to/source python bootstrap.py

Limboy 309 Nov 13, 2022
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 web application made with Flask that works with a weather service API to get the current weather from all over the world.

Weather App A web application made with Flask that works with a weather service API to get the current weather from all over the world. Uses data from

Christian Jairo Sarmiento 19 Dec 02, 2022
Flask-redmail - Email sending for Flask

Flask Red Mail: Email Sending for Flask Flask extension for Red Mail What is it?

Mikael Koli 11 Sep 23, 2022
i18n and l10n support for Flask based on Babel and pytz

Flask Babel Implements i18n and l10n support for Flask. This is based on the Python babel module as well as pytz both of which are installed automatic

397 Dec 15, 2022
Rate Limiting extension for Flask

Flask-Limiter Flask-Limiter provides rate limiting features to flask routes. It has support for a configurable backend for storage with current implem

Ali-Akber Saifee 922 Jan 08, 2023
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