feat: add base files

This commit is contained in:
Julian Lobbes 2022-11-07 22:17:05 +01:00
parent 29fb33c03a
commit f25bf10206
14 changed files with 367 additions and 0 deletions

20
.gitignore vendored Normal file
View File

@ -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/

11
Dockerfile Normal file
View File

@ -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

48
docker-compose.yml Normal file
View File

@ -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"
...

38
lumi2/__init__.py Normal file
View File

@ -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

View File

@ -0,0 +1,4 @@
body {
background-color: #222222;
color: #CCCCCC;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 157 KiB

View File

@ -0,0 +1,86 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="512"
height="512"
viewBox="0 0 512 512"
version="1.1"
id="svg5"
sodipodi:docname="favicon.svg"
inkscape:version="1.2.1 (9c6d41e410, 2022-07-14, custom)"
inkscape:export-filename="apple-touch-icon.png"
inkscape:export-xdpi="18"
inkscape:export-ydpi="18"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview7"
pagecolor="#505050"
bordercolor="#eeeeee"
borderopacity="1"
inkscape:showpageshadow="0"
inkscape:pageopacity="0"
inkscape:pagecheckerboard="false"
inkscape:deskcolor="#505050"
inkscape:document-units="px"
showgrid="false"
inkscape:zoom="2.0172186"
inkscape:cx="1.7350623"
inkscape:cy="302.64444"
inkscape:window-width="2536"
inkscape:window-height="1360"
inkscape:window-x="2570"
inkscape:window-y="38"
inkscape:window-maximized="1"
inkscape:current-layer="layer1" />
<defs
id="defs2" />
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<circle
style="fill:#d8af24;fill-opacity:1;stroke:none;stroke-width:0.511802"
id="path111"
cx="256"
cy="91.079361"
r="84.022392" />
<path
style="fill:#c9c033;fill-opacity:1;stroke:none;stroke-width:0.997777"
id="path927"
sodipodi:type="arc"
sodipodi:cx="-256"
sodipodi:cy="-330.88705"
sodipodi:rx="136.01785"
sodipodi:ry="138.84554"
sodipodi:start="0"
sodipodi:end="3.1415927"
sodipodi:open="true"
sodipodi:arc-type="arc"
d="m -119.98215,-330.88705 a 136.01785,138.84554 0 0 1 -68.00893,120.24376 136.01785,138.84554 0 0 1 -136.01785,-1e-5 136.01785,138.84554 0 0 1 -68.00892,-120.24375"
transform="scale(-1)" />
<path
id="rect1005"
d="m 119.98215,328.05939 h 272.0357 v 18.33321 c 0,17.28211 -272.0357,17.98233 -272.0357,0 z"
sodipodi:nodetypes="ccssc"
style="fill:#c9c033;fill-opacity:1;stroke-width:0.344016" />
<path
id="rect1005-3-6-7"
d="m 119.98215,367.81723 c 0,14.53527 272.0357,12.84369 272.0357,0 v 31.14067 c 0,12.78284 -272.0357,10.59969 -272.0357,0 z"
sodipodi:nodetypes="sssss"
style="fill:#f8c655;fill-opacity:1;stroke-width:0.448357" />
<path
id="rect1005-3-6-7-1"
d="m 119.98215,415.94454 c 0,14.53527 272.0357,12.84369 272.0357,0 v 31.14067 c 0,12.78284 -272.0357,10.59969 -272.0357,0 z"
sodipodi:nodetypes="sssss"
style="fill:#b1ac4b;fill-opacity:1;stroke-width:0.448357" />
<path
id="rect1005-3-6-7-27"
d="m 119.98215,464.07185 c 0,14.53527 272.0357,12.84369 272.0357,0 v 31.14067 c 0,12.78284 -272.0357,10.59969 -272.0357,0 z"
sodipodi:nodetypes="sssss"
style="fill:#518664;fill-opacity:1;stroke-width:0.448357" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.1 KiB

BIN
lumi2/static/images/og.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

110
lumi2/static/images/og.svg Normal file
View File

@ -0,0 +1,110 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="1200"
height="630"
viewBox="0 0 1200 630"
version="1.1"
id="svg5"
sodipodi:docname="og.svg"
inkscape:version="1.2.1 (9c6d41e410, 2022-07-14, custom)"
inkscape:export-filename="og.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview7"
pagecolor="#505050"
bordercolor="#eeeeee"
borderopacity="1"
inkscape:showpageshadow="0"
inkscape:pageopacity="0"
inkscape:pagecheckerboard="false"
inkscape:deskcolor="#505050"
inkscape:document-units="px"
showgrid="false"
inkscape:zoom="2.0172186"
inkscape:cx="58.248521"
inkscape:cy="316.52494"
inkscape:window-width="2536"
inkscape:window-height="1360"
inkscape:window-x="10"
inkscape:window-y="38"
inkscape:window-maximized="1"
inkscape:current-layer="layer1" />
<defs
id="defs2">
<rect
x="443.72474"
y="78.23549"
width="662.99755"
height="255.29392"
id="rect1106" />
</defs>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<rect
style="fill:#06192c;fill-opacity:0.69833165"
id="rect379"
width="1200"
height="630"
x="0"
y="0" />
<circle
style="fill:#d8af24;fill-opacity:1;stroke:none;stroke-width:0.511802"
id="path111"
cx="274.30383"
cy="150.55087"
r="84.022392" />
<path
style="fill:#c9c033;fill-opacity:1;stroke:none;stroke-width:0.994968"
id="path927"
sodipodi:type="arc"
sodipodi:cx="-274.30383"
sodipodi:cy="-389.57779"
sodipodi:rx="136.01785"
sodipodi:ry="138.06476"
sodipodi:start="0"
sodipodi:end="3.1415927"
sodipodi:open="true"
sodipodi:arc-type="arc"
d="m -138.28598,-389.57779 a 136.01785,138.06476 0 0 1 -68.00893,119.56759 136.01785,138.06476 0 0 1 -136.01785,0 136.01785,138.06476 0 0 1 -68.00893,-119.56759"
transform="scale(-1)" />
<path
id="rect1005"
d="m 138.28599,387.53091 h 272.0357 v 18.33321 c 0,17.28211 -272.0357,17.98233 -272.0357,0 z"
sodipodi:nodetypes="ccssc"
style="fill:#c9c033;fill-opacity:1;stroke-width:0.344016" />
<path
id="rect1005-3-6-7"
d="m 138.28599,427.28875 c 0,14.53527 272.0357,12.84369 272.0357,0 v 31.14067 c 0,12.78284 -272.0357,10.59969 -272.0357,0 z"
sodipodi:nodetypes="sssss"
style="fill:#f8c655;fill-opacity:1;stroke-width:0.448357" />
<path
id="rect1005-3-6-7-1"
d="m 138.28599,475.41606 c 0,14.53527 272.0357,12.84369 272.0357,0 v 31.14067 c 0,12.78284 -272.0357,10.59969 -272.0357,0 z"
sodipodi:nodetypes="sssss"
style="fill:#b1ac4b;fill-opacity:1;stroke-width:0.448357" />
<path
id="rect1005-3-6-7-27"
d="m 138.28599,523.54337 c 0,14.53527 272.0357,12.84369 272.0357,0 v 31.14067 c 0,12.78284 -272.0357,10.59969 -272.0357,0 z"
sodipodi:nodetypes="sssss"
style="fill:#518664;fill-opacity:1;stroke-width:0.448357" />
<text
xml:space="preserve"
id="text1104"
style="white-space:pre;shape-inside:url(#rect1106);display:inline;fill:#c9c033;fill-opacity:1"
transform="translate(37.270219,131.27051)"><tspan
x="443.72461"
y="262.55603"
id="tspan1393"><tspan
style="font-weight:600;font-size:213.333px;font-family:'URW Gothic';-inkscape-font-specification:'URW Gothic, Semi-Bold'"
id="tspan1391">LUMI 2</tspan></tspan></text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.8 KiB

29
lumi2/templates/base.html Normal file
View File

@ -0,0 +1,29 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{{ config.SITE_TITLE }}</title>
<meta name="description" content="{{ config.SITE_DESCRIPTION }}">
<meta name="author" content="{{ config.SITE_AUTHOR }}">
<meta property="og:title" content="{{ config.SITE_TITLE }}">
<meta property="og:type" content="website">
<meta property="og:url" content="{{ config.SITE_URL }}">
<meta property="og:description" content="{{ config.SITE_DESCRIPTION }}">
<meta property="og:image" content="{{ url_for('static', filename='images/og.png') }}">
<link rel="icon" href="{{ url_for('static', filename='images/favicon.ico') }}">
<link rel="icon" href="{{ url_for('static', filename='images/favicon.svg') }}" type="image/svg+xml">
<link rel="apple-touch-icon" href="{{ url_for('static', filename='images/apple-touch-icon.png') }}">
<link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
</head>
<body>
{% block content %}
{% endblock content %}
</body>
</html>

View File

@ -0,0 +1,6 @@
{% extends 'base.html' %}
{% block content %}
<h1>Welcome to LUMI 2</h1>
<p>This site is still under construction.</p>
{% endblock content %}

14
lumi2/usermanager.py Normal file
View File

@ -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')

1
requirements.txt Normal file
View File

@ -0,0 +1 @@
Flask==2.2.2