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
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
Seamlessly serve your static assets of your Flask app from Amazon S3

flask-s3 Seamlessly serve the static assets of your Flask app from Amazon S3. Maintainers Flask-S3 is maintained by @e-dard, @eriktaubeneck and @SunDw

Edd Robinson 188 Aug 24, 2022
Flask Sitemapper is a small Python 3 package that generates XML sitemaps for Flask applications.

Flask Sitemapper Flask Sitemapper is a small Python 3 package that generates XML sitemaps for Flask applications. This allows you to create a nice and

6 Jan 06, 2023
REST API with Flask and SQLAlchemy. I would rather not use it anymore.

Flask REST API Python 3.9.7 The Flask experience, without data persistence :D First, to install all dependencies: python -m pip install -r requirement

Luis Quiñones Requelme 1 Dec 15, 2021
a flask zipkin extension based on py_zipkin.

flask-zipkin a flask zipkin extension based on py_zipkin. Installation pip install flask_zipkin usage you can simply use it as other flask extensions.

39 Jul 03, 2022
An flask app for fake image detector

fake_img_detector This is a ml based project: frameworks used:- Flask Google collab #Description: Here you can Upload two different looking image with

shivam kumar 7 Jun 29, 2022
Alexa Skills Kit for Python

Program the Amazon Echo with Python Flask-Ask is a Flask extension that makes building Alexa skills for the Amazon Echo easier and much more fun. Flas

John Wheeler 1.9k Dec 30, 2022
A simple FastAPI web service + Vue.js based UI over a rclip-style clip embedding database.

Explore CLIP Embeddings in a rclip database A simple FastAPI web service + Vue.js based UI over a rclip-style clip embedding database. A live demo of

18 Oct 15, 2022
Full Stack Web Development with Flask.

Discover Flask Full Stack Web Development with Flask. http://discoverflask.com Flask is a micro web framework powered by Python. Its API is fairly sma

Real Python 4.4k Jan 06, 2023
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
A tool for the game Politics And War. Saving players hours if searching for targets they can engage with.

A tool for the game Politics And War. Saving players hours if searching for targets they can engage with.

1 Dec 19, 2021
Flask 文档中文翻译

Flask 中文文档 这里是 Flask 文档中文翻译项目,欢迎参与! 在开始翻译之前,请务必阅读下面的 Contributing Guide 了解贡献流程,然后阅读这个 Issue 了解翻译要求,在这个 Discussion 投票选出你认为合适的翻译词汇,在这个 Discussion 投票选出你喜

Grey Li 93 Nov 28, 2022
A Flask extension that enables or disables features based on configuration.

Flask FeatureFlags This is a Flask extension that adds feature flagging to your applications. This lets you turn parts of your site on or off based on

Rachel Greenfield 131 Sep 26, 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
Sample Dockerized flask app deployed on Kubernetes on Azure using AKS

Sample Dockerized flask app deployed on Kubernetes on Azure using AKS

Ahmed khémiri 22 Sep 08, 2021
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
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-Rebar combines flask, marshmallow, and swagger for robust REST services.

Flask-Rebar Flask-Rebar combines flask, marshmallow, and swagger for robust REST services. Features Request and Response Validation - Flask-Rebar reli

PlanGrid 223 Dec 19, 2022
SeaSurf is a Flask extension for preventing cross-site request forgery (CSRF).

Flask-SeaSurf SeaSurf is a Flask extension for preventing cross-site request forgery (CSRF). CSRF vulnerabilities have been found in large and popular

Max Countryman 183 Dec 28, 2022