diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8d4e3c9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,20 @@ +# Docker container instance data directories +/data/ + +# Python virtual environment directory +.venv/ + +# Python cache files and directories +*.pyc +__pycache__/ + +# Flask app-spefific directories +instance/ +dist/ +build/ +*.egg-info/ + +# Test framework cache directories +.pytest_cache/ +.coverage +htmlcov/ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..6c3a3cd --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +# syntax=docker/dockerfile:1 + +# This Dockerfile builds a docker image containing all dependecies to run +# a development version of the lumi application. + +FROM python:3 + +# Install dependencies +WORKDIR /app +COPY requirements.txt /app/ +RUN pip install -r requirements.txt diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..faf3221 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,48 @@ +--- + +version: "3" + +services: + lumi2: + build: . + container_name: lumi2 + command: flask --app /app/lumi2 --debug run --host 0.0.0.0 --port 80 + volumes: + - ./lumi2/__init__.py:/app/lumi2/__init__.py:ro + - ./lumi2/usermanager.py:/app/lumi2/usermanager.py:ro + - ./lumi2/static/:/app/lumi2/static/:ro + - ./lumi2/templates/:/app/lumi2/templates/:ro + ports: + - "8000:80" + depends_on: + - lumi2-openldap + lumi2-openldap: + container_name: lumi2-openldap + image: osixia/openldap + restart: unless-stopped + volumes: + - ./data/openldap/data:/var/lib/ldap + - ./data/openldap/config:/etc/ldap/slapd.d + hostname: openldap + expose: + - 389 + environment: + LDAP_ORGANISATION: "Example Inc." + LDAP_DOMAIN: "example.com" + LDAP_ADMIN_PASSWORD: "admin" + LDAP_CONFIG_PASSWORD: "admin" + LDAP_TLS_VERIFY_CLIENT: "allow" + lumi2-phpldapadmin: + container_name: lumi2-phpldapadmin + image: osixia/phpldapadmin + restart: unless-stopped + depends_on: + - lumi2-openldap + ports: + - "8001:80" + environment: + PHPLDAPADMIN_LDAP_HOSTS: "openldap" + PHPLDAPADMIN_HTTPS: "false" + PHPLDAPADMIN_SERVER_ADMIN: "admin" + +... diff --git a/lumi2/__init__.py b/lumi2/__init__.py new file mode 100644 index 0000000..b30ea09 --- /dev/null +++ b/lumi2/__init__.py @@ -0,0 +1,38 @@ +import os + +from flask import Flask + + +def create_app(test_config=None): + """ Application factory function. + + Creates and configures the flask app. + """ + + app = Flask(__name__, instance_relative_config=True) + app.config.from_mapping( + SECRET_KEY='ChangeMeInProduction', + SITE_URL='https://www.example.com/', + SITE_TITLE='LUMI 2', + SITE_AUTHOR='LUMI 2 Development Team', + SITE_DESCRIPTION='A simple frontend for LDAP account management.', + ) + + if test_config is None: + # Load the instance config, if it exists, when not testing + app.config.from_pyfile('config.py', silent=True) + else: + # Load the test config if passed in + app.config.from_mapping(test_config) + + # Ensure the instance folder exists + try: + os.makedirs(app.instance_path) + except OSError: + pass + + from . import usermanager + app.register_blueprint(usermanager.bp) + app.add_url_rule('/', endpoint='index') + + return app diff --git a/lumi2/static/css/style.css b/lumi2/static/css/style.css new file mode 100644 index 0000000..072fe8c --- /dev/null +++ b/lumi2/static/css/style.css @@ -0,0 +1,4 @@ +body { + background-color: #222222; + color: #CCCCCC; +} diff --git a/lumi2/static/images/apple-touch-icon.png b/lumi2/static/images/apple-touch-icon.png new file mode 100644 index 0000000..03a2a8b Binary files /dev/null and b/lumi2/static/images/apple-touch-icon.png differ diff --git a/lumi2/static/images/favicon.ico b/lumi2/static/images/favicon.ico new file mode 100644 index 0000000..2cfbdb0 Binary files /dev/null and b/lumi2/static/images/favicon.ico differ diff --git a/lumi2/static/images/favicon.svg b/lumi2/static/images/favicon.svg new file mode 100644 index 0000000..c545a99 --- /dev/null +++ b/lumi2/static/images/favicon.svg @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + diff --git a/lumi2/static/images/og.png b/lumi2/static/images/og.png new file mode 100644 index 0000000..f176efc Binary files /dev/null and b/lumi2/static/images/og.png differ diff --git a/lumi2/static/images/og.svg b/lumi2/static/images/og.svg new file mode 100644 index 0000000..c5ab532 --- /dev/null +++ b/lumi2/static/images/og.svg @@ -0,0 +1,110 @@ + + + + + + + + + + + + + + + + + LUMI 2 + + diff --git a/lumi2/templates/base.html b/lumi2/templates/base.html new file mode 100644 index 0000000..b7382b2 --- /dev/null +++ b/lumi2/templates/base.html @@ -0,0 +1,29 @@ + + + + + + + + {{ config.SITE_TITLE }} + + + + + + + + + + + + + + + + + + {% block content %} + {% endblock content %} + + diff --git a/lumi2/templates/usermanager/index.html b/lumi2/templates/usermanager/index.html new file mode 100644 index 0000000..887618f --- /dev/null +++ b/lumi2/templates/usermanager/index.html @@ -0,0 +1,6 @@ +{% extends 'base.html' %} + +{% block content %} +

Welcome to LUMI 2

+

This site is still under construction.

+{% endblock content %} diff --git a/lumi2/usermanager.py b/lumi2/usermanager.py new file mode 100644 index 0000000..b81101a --- /dev/null +++ b/lumi2/usermanager.py @@ -0,0 +1,14 @@ +"""Views for lumi2.""" + +from flask import ( + Blueprint, render_template +) + + +bp = Blueprint('usermanager', __name__) + +@bp.route('/') +def index(): + """Home page view.""" + + return render_template('usermanager/index.html') diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..c9edc1a --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +Flask==2.2.2