Skip to content

Containerised URL shortener written in Python with Flask and Redis. Repo is also being used to try out DevSecOps tooling.

License

Notifications You must be signed in to change notification settings

jackseceng/LinkShort

Repository files navigation

LinkShort - Containerised URL shortener

This is the Python code and Docker/Kubernetes configuration for a link shortening web app

This is not a functional application yet, I will make a full release when it is in a secure, production ready state

I am using this to learn:

  • Docker & Kubernetes
  • Python web app development
  • DevSecOps automation

Testing locally

  • Create a file in the root directory called .env, with the following contents, customising the values between <> with your own substitutions:
REDISUSER=default
REDISMASTER=<a-super-strong-password>
REDISREPLICA=<a-different-super-strong-password>

! WARNING !

Please make sure your local environment variables in your terminal do not share names with the ones in this .env file.

If you change the names of the variables in this file, make sure to change their references in the docker-compose.yaml file as well.

Docker compose

From root directory of the repository, run this command:

docker-compose up --detach --scale redis-master=1 --scale redis-replica=3
[+] Running (6/6)
 ✔ Container linkshort-app-1
 ✔ Container linkshort-redis-replica-2
 ✔ Container linkshort-redis-replica-3
 ✔ Container linkshort-redis-replica-1
 ✔ Container linkshort-redis-master-1
 ✔ Network linkshort_ls-net

If succesful, app will be running at http://localhost:5000, with a redis master database with 3 replica nodes.

To shut down the service, run this command:

docker-compose down

Application Features

  • Simple URL shortening capabilities for URLs
  • Sanitises input from user for both URLs and extensions on requests
  • Checks user input for URLs that begin with HTTPS only
  • Checks submitted URLs for internet reputation before generating them, reject poor reputation URLs
  • Frontend with good looking CSS and HTML animations and colours
  • Handles errors gracefully, with 404 and 500 error pages rendered to the users
  • Containerised with docker compose using secrets management for credentials
  • Kubernetes deployment configuration with database in stateful sets
  • Demonstration application set up and deployed on cloud provider

(Current features have a checkmark, planned ones do not)

DevSecOps Automation

(Current automations have a checkmark, planned ones do not)

Developed by Jack

Alt Text

My site

About

Containerised URL shortener written in Python with Flask and Redis. Repo is also being used to try out DevSecOps tooling.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •