Skip to content

Containerised URL shortener written in Python, using the Flask/Gunicorn web engine and Turso as a database. The aim of this project is to eventually have it hosted publicly as a public ally available web service. This repository is also being used to test 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 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 & Web App Hosting
  • Python Development
  • DevSecOps Automation

Testing locally

  • Sign up for a free Turso account, and create database with a table called 'links' in it.

  • Create a file in the /src directory called .env, with the following contents, setting the appropriate values with your own substitutions:

ENDPOINT="<your-turso-url>"
TOKEN="<your-turso-token>"
TLD=localhost

! 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 the root directory of this repository, run:

docker-compose up -d --build
[+] Running (2/2)
 ✔ Network linkshort_ls-net   Created
 ✔ Container linkshort-app-1  Started

If succesful, app will be running at http://localhost, it will connect to your Turso database over the internet.

You can re-run this command whenever you make changes to rebuild the container.

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
  • Demonstration application set up and deployed on hosting provider

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, using the Flask/Gunicorn web engine and Turso as a database. The aim of this project is to eventually have it hosted publicly as a public ally available web service. This repository is also being used to test DevSecOps tooling.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks