zkt26/sk1
2026-05-12 20:37:46 +00:00
..
backend Fixed sk1 upload 2026-05-12 21:49:32 +02:00
frontend Fixed sk1 upload 2026-05-12 21:49:32 +02:00
nginx Fixed sk1 upload 2026-05-12 21:49:32 +02:00
.gitignore Fixed sk1 upload 2026-05-12 21:49:32 +02:00
backup.sh Fixed sk1 upload 2026-05-12 21:49:32 +02:00
docker-compose.yml Fixed sk1 upload 2026-05-12 21:49:32 +02:00
prepare-app.sh Fixed sk1 upload 2026-05-12 21:49:32 +02:00
README.md Update sk1/README.md 2026-05-12 20:37:46 +00:00
remove-app.sh Fixed sk1 upload 2026-05-12 21:49:32 +02:00

Smart Share Hub Secure Cloud File & Note Sharing Platform

Overview

Smart Share Hub is a cloud-based web application deployed using Docker containers on a Linux virtual machine. The application allows users to:

  • Upload and share files
  • Create and share notes
  • Access the application publicly through a web browser
  • Use HTTPS encryption
  • Store persistent data using PostgreSQL and Docker volumes

Developed for the Cloud Technologies assignment.


Features

File Upload System

  • Upload files through the web interface
  • Files stored persistently inside a Docker volume
  • Accessible through the browser

Shared Notes

  • Users can create notes
  • Notes are stored in a PostgreSQL database
  • Notes can be viewed publicly

HTTPS Support

  • Application accessible through HTTPS
  • SSL/TLS certificate configured
  • Secure encrypted communication

Docker-Based Deployment

  • Fully containerized application
  • Easy deployment using Docker Compose
  • Repeatable deployment using scripts

Automatic Restart

  • Containers restart automatically after failure
  • Uses Docker restart policies

Backup Support

  • Backup script included
  • Application data can be archived easily

Persistent Storage

  • PostgreSQL database volume
  • Upload storage volume

Environment Variable Configuration

  • Database secrets stored in .env
  • Sensitive data excluded from Git repository

Logging

  • NGINX access logs available
  • Backend logs accessible through Docker

Technologies Used

Layer Technology
Backend Python, Flask, psycopg2
Database PostgreSQL 15
Frontend HTML, CSS, JavaScript
Reverse Proxy NGINX
Containerization Docker, Docker Compose

System Architecture

The application consists of four containers:

Container Purpose
frontend Serves frontend web files
backend Flask API server
postgres PostgreSQL database
nginx Reverse proxy and HTTPS

Environment Variables

Secrets are stored using environment variables. Create a .env file in the project root:

DB_PASSWORD=xxxxxxxx

The .env file is excluded from Git using .gitignore.


Docker Compose

The main deployment file is docker-compose.yml.

# Start application
docker-compose up -d --build

# Stop application
docker-compose down

# Remove everything including volumes
docker-compose down -v

Database configuration example:

environment:
  POSTGRES_DB: smartshare
  POSTGRES_USER: postgres
  POSTGRES_PASSWORD: ${DB_PASSWORD}

Deployment Instructions

1. Install Docker

sudo apt update
sudo apt install docker.io docker-compose -y

2. Clone Repository

git clone <repository-url>
cd sk1

3. Create Environment File

nano .env

Add the following:

DB_PASSWORD=xxxxxxxx

4. Start Application

docker-compose up -d --build

Public Access

The application is publicly accessible at:

https://your-domain

Example:

https://joblin-share.duckdns.org

HTTPS Configuration

HTTPS is configured using:

  • NGINX reverse proxy
  • SSL/TLS certificates

All traffic is redirected through the secure HTTPS protocol.


Persistent Storage

Volume Purpose
postgres_data PostgreSQL database storage
uploads Uploaded files

Data remains intact after container restarts.


Automatic Restart Policy

All containers are configured with:

restart: always

This ensures automatic recovery after crashes or server reboots.


NGINX Reverse Proxy

NGINX handles:

  • HTTPS termination
  • Reverse proxy routing
  • Static frontend delivery
  • API request forwarding
Route Target
/ Frontend
/api/ Backend API

Security Features

  • HTTPS encryption
  • Environment-based secret management
  • Docker network isolation
  • Reverse proxy protection

Backup System

Run the backup script:

./backup.sh

The script:

  • Creates compressed backups
  • Stores them inside /backups
  • Can be used for recovery

Example backup file:

backup_2026-05-12.tar.gz

Scripts

Script Description Usage
prepare-app.sh Starts the application automatically ./prepare-app.sh
remove-app.sh Stops and removes all containers ./remove-app.sh
backup.sh Creates a compressed application backup ./backup.sh

Logs

# NGINX access logs
docker logs nginx

# Backend application logs
docker logs backend

# PostgreSQL logs
docker logs postgres