Skip to content

Deploying This Week in Past

Introduction

This Week in Past is a self-hosted application that brings back memories by showing you photos from the same week in previous years. Similar to the “On This Day” features in commercial photo services, This Week in Past lets you maintain complete control over your photo library while still enjoying the nostalgia of rediscovering old moments.

Key features of This Week in Past include:

  • Daily Memory Surfacing: See photos from the current week in previous years
  • Self-Hosted Privacy: Keep your photos under your control
  • Web Interface: Browse memories from any device
  • EXIF Date Support: Uses photo metadata to determine when photos were taken
  • Simple Setup: Minimal configuration required
  • Lightweight: Efficient resource usage for personal deployments

This guide walks you through deploying This Week in Past on Klutch.sh, configuring your photo library, and setting up daily memory notifications.

Why Deploy This Week in Past on Klutch.sh

Deploying This Week in Past on Klutch.sh offers several advantages:

Always Available: Access your memories from anywhere at any time without running a local server.

Privacy-Focused: Unlike cloud photo services, your photos stay on your own infrastructure.

Simplified Deployment: Klutch.sh handles container orchestration and HTTPS automatically.

Persistent Storage: Your photos and metadata persist across container restarts.

Secure Access: HTTPS by default ensures secure access to your personal photos.

Prerequisites

Before deploying This Week in Past on Klutch.sh, ensure you have:

  • A Klutch.sh account
  • A GitHub account with a repository for your configuration
  • A collection of photos with EXIF date metadata
  • Basic familiarity with Docker

Preparing Your Repository

Create a GitHub repository with the following structure:

this-week-in-past/
├── Dockerfile
└── .dockerignore

Creating the Dockerfile

FROM python:3.11-slim
# Install system dependencies
RUN apt-get update && apt-get install -y \
libexif-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Create app directory
WORKDIR /app
# Install Python dependencies
RUN pip install --no-cache-dir \
flask \
pillow \
exifread
# Create directories
RUN mkdir -p /photos /app/cache
# Copy application code
COPY app.py /app/
# Set environment variables
ENV FLASK_ENV=production
ENV PHOTOS_DIR=/photos
EXPOSE 5000
CMD ["python", "app.py"]

Simple Application

Create a basic app.py:

from flask import Flask, render_template_string, send_from_directory
from datetime import datetime, timedelta
import os
import exifread
app = Flask(__name__)
PHOTOS_DIR = os.environ.get('PHOTOS_DIR', '/photos')
def get_photo_date(filepath):
with open(filepath, 'rb') as f:
tags = exifread.process_file(f, stop_tag='DateTimeOriginal')
if 'EXIF DateTimeOriginal' in tags:
date_str = str(tags['EXIF DateTimeOriginal'])
return datetime.strptime(date_str, '%Y:%m:%d %H:%M:%S')
return None
def get_this_week_photos():
today = datetime.now()
week_start = today - timedelta(days=today.weekday())
photos = []
for root, dirs, files in os.walk(PHOTOS_DIR):
for file in files:
if file.lower().endswith(('.jpg', '.jpeg', '.png')):
filepath = os.path.join(root, file)
photo_date = get_photo_date(filepath)
if photo_date:
if (photo_date.month == week_start.month and
week_start.day <= photo_date.day <= week_start.day + 6 and
photo_date.year < today.year):
photos.append({
'path': filepath,
'date': photo_date,
'years_ago': today.year - photo_date.year
})
return sorted(photos, key=lambda x: x['date'], reverse=True)
@app.route('/')
def index():
photos = get_this_week_photos()
return render_template_string('''
<html>
<head><title>This Week in Past</title></head>
<body>
<h1>This Week in Past</h1>
{% for photo in photos %}
<div>
<img src="/photo/{{ photo.path }}" width="300">
<p>{{ photo.years_ago }} years ago</p>
</div>
{% endfor %}
</body>
</html>
''', photos=photos)
if __name__ == '__main__':
app.run(host='0.0.0.0', port=5000)

Environment Variables Reference

VariableRequiredDefaultDescription
PHOTOS_DIRNo/photosDirectory containing your photo library
FLASK_ENVNoproductionFlask environment mode

Deploying on Klutch.sh

    Push Your Repository to GitHub

    Commit and push your Dockerfile and application code.

    Create a New Project on Klutch.sh

    Navigate to the Klutch.sh dashboard and create a new project named “this-week-in-past” or “memories”.

    Create the App

    Within your project, create a new app and connect your GitHub repository.

    Configure HTTP Traffic

    Set the traffic type to HTTP with the internal port set to 5000.

    Attach Persistent Volumes

    Add persistent storage for your photos:

    Mount PathSizePurpose
    /photos100 GBYour photo library (adjust based on collection size)
    /app/cache1 GBThumbnail cache

    Deploy Your Application

    Click Deploy to build and launch This Week in Past.

    Upload Your Photos

    Transfer your photos to the persistent volume for the application to scan.

Uploading Photos

Transferring Your Photo Library

Options for uploading photos to your persistent storage:

  1. File Manager: Deploy a companion file manager app
  2. rsync/SCP: Direct transfer if you have storage access
  3. Cloud Sync: Use rclone to sync from cloud storage
  4. Pre-populated Volume: Prepare the volume with photos before mounting

Photo Organization

For best results:

  • Keep photos organized in folders (by date or event)
  • Ensure photos have EXIF date metadata
  • Use consistent file naming conventions
  • Remove duplicates to avoid repeated memories

Configuration Options

Customizing the Display

Adjust how memories are presented:

  • Change the date range (week, month, specific days)
  • Configure the number of photos displayed
  • Customize the web interface styling
  • Add filtering options

Notification Integration

Set up daily memory notifications:

  • Email notifications with photo attachments
  • Mobile push notifications via services like Pushover
  • Calendar integration for memory reminders
  • Webhook triggers for custom integrations

Production Best Practices

Security Recommendations

  • Authentication: Add password protection for personal photos
  • HTTPS Only: Use Klutch.sh’s automatic SSL
  • Access Control: Limit access to authorized users
  • Privacy: Don’t expose photo paths in URLs

Performance Optimization

  • Thumbnail Caching: Pre-generate thumbnails for faster loading
  • Database Index: Use SQLite to index photo metadata
  • Lazy Loading: Load images progressively
  • CDN: Consider a CDN for large photo libraries

Backup Strategy

Protect your memories:

  1. Regular backups of the photo volume
  2. Maintain original copies in multiple locations
  3. Back up metadata database
  4. Test restoration procedures

Troubleshooting

Photos Not Appearing

  • Verify photos have EXIF date metadata
  • Check file permissions on the photos directory
  • Ensure supported file formats (.jpg, .jpeg, .png)
  • Review application logs for errors

Incorrect Dates

  • Some photos may have incorrect EXIF data
  • Check file modification dates as fallback
  • Use photo editing software to fix EXIF dates
  • Exclude problematic photos

Slow Loading

  • Enable thumbnail caching
  • Optimize image sizes
  • Use pagination for large collections
  • Check server resource allocation

Additional Resources

Conclusion

Deploying This Week in Past on Klutch.sh provides a private, self-hosted way to relive your photo memories. With automatic HTTPS, persistent storage for your photo library, and always-on availability, you can enjoy daily nostalgia without relying on commercial cloud services. Your memories stay under your control while remaining accessible from anywhere.