initial commit

This commit is contained in:
D. Scott Boggs 2025-05-27 14:11:33 -04:00
commit c58323c588
9 changed files with 73 additions and 0 deletions

8
.dockerignore Normal file
View file

@ -0,0 +1,8 @@
Dockerfile
.dockerignore
.gitignore
**/*.egg-info
**/__pycache__
.env/
build/
.mypy_cache/

5
.gitignore vendored Normal file
View file

@ -0,0 +1,5 @@
.env
.mypy_cache
build/
**/*.egg-info
**/__pycache__

8
Dockerfile Normal file
View file

@ -0,0 +1,8 @@
FROM python:3.13-alpine
EXPOSE 1312
WORKDIR /app
COPY ./pyproject.toml ./wsgi-conf.py /app/
RUN pip install --no-cache-dir --upgrade .
COPY ./fnb_redirecter/ /app/fnb_redirecter
RUN pip install --no-cache-dir --upgrade .
CMD ["python", "-m", "fnb_redirecter"]

7
docker-compose.yml Normal file
View file

@ -0,0 +1,7 @@
services:
fnb-redirecter:
build: .
labels:
traefik.http.routers.fnb-redirecter.rule: Host(`rocfnb.org`)
traefik.http.routers.fnb-redirecter.tls.certresolver: letsencrypt_standalone
networks: [ public ]

View file

@ -0,0 +1 @@
from fnb_redirecter.server import app

View file

@ -0,0 +1,3 @@
from os import execlp
execlp('gunicorn', 'gunicorn', '--conf', '/app/wsgi-conf.py', '--bind', '0.0.0.0:1312', 'fnb_redirecter:app')

16
fnb_redirecter/server.py Normal file
View file

@ -0,0 +1,16 @@
from flask import Flask, redirect
app = Flask(__name__.split('.')[0])
@app.route('/ig')
def ig_redir():
return redirect('https://instagram.com/RocFNB')
@app.route('/donate')
def donate_redir():
return redirect('https://venmo.com/RocFoodNotBombs')
@app.errorhandler(404)
def redirect_other(_):
return redirect('https://linktr.ee/RocFNB')

16
pyproject.toml Normal file
View file

@ -0,0 +1,16 @@
[build-system]
requires = ["setuptools", "setuptools-scm"]
build-backend = "setuptools.build_meta"
[project]
name = "fnb_redirecter"
authors = [{ name = "D. Scott Boggs", email = "scott@techwork.zone" }]
description = "Temporary placeholder for fnb web site"
readme = "README.md"
requires-python = ">=3.11" # Self type added
license = "AGPL-3.0-only"
dependencies = ["flask", "gunicorn"]
dynamic = ["version"]
[project.scripts]
# Put scripts here

9
wsgi-conf.py Normal file
View file

@ -0,0 +1,9 @@
# Gunicorn config variables
loglevel = "info"
errorlog = "-" # stderr
accesslog = "-" # stdout
worker_tmp_dir = "/dev/shm"
graceful_timeout = 120
timeout = 120
keepalive = 5
threads = 3