From 872e0e24169208005046ed29547a7343d3d5acd6 Mon Sep 17 00:00:00 2001 From: fram3d Date: Mon, 15 Jan 2024 19:54:18 +0100 Subject: [PATCH] create taskmanager repo --- build-deb/Makefile | 28 +++++++++---------- build-deb/flaskapp/DEBIAN/postinst | 3 -- build-deb/flaskapp/DEBIAN/prerm | 3 -- .../lib/systemd/system/freeriders.service | 12 -------- .../man/{flaskapp.1.md => taskmanger.1.md} | 4 +-- .../{flaskapp => taskmanager}/DEBIAN/control | 4 +-- build-deb/taskmanager/DEBIAN/postinst | 3 ++ build-deb/taskmanager/DEBIAN/prerm | 3 ++ {flaskapp => taskmanager}/__init__.py | 4 +-- {flaskapp => taskmanager}/functions.py | 0 {flaskapp => taskmanager}/models.py | 2 +- {flaskapp => taskmanager}/routes.py | 6 ++-- {flaskapp => taskmanager}/static/style.css | 0 .../templates/index.html | 0 .../templates/submit.html | 0 15 files changed, 30 insertions(+), 42 deletions(-) delete mode 100755 build-deb/flaskapp/DEBIAN/postinst delete mode 100755 build-deb/flaskapp/DEBIAN/prerm delete mode 100644 build-deb/flaskapp/lib/systemd/system/freeriders.service rename build-deb/man/{flaskapp.1.md => taskmanger.1.md} (85%) rename build-deb/{flaskapp => taskmanager}/DEBIAN/control (72%) create mode 100755 build-deb/taskmanager/DEBIAN/postinst create mode 100755 build-deb/taskmanager/DEBIAN/prerm rename {flaskapp => taskmanager}/__init__.py (77%) rename {flaskapp => taskmanager}/functions.py (100%) rename {flaskapp => taskmanager}/models.py (87%) rename {flaskapp => taskmanager}/routes.py (91%) rename {flaskapp => taskmanager}/static/style.css (100%) rename {flaskapp => taskmanager}/templates/index.html (100%) rename {flaskapp => taskmanager}/templates/submit.html (100%) diff --git a/build-deb/Makefile b/build-deb/Makefile index fae7d0a..01389d5 100644 --- a/build-deb/Makefile +++ b/build-deb/Makefile @@ -1,17 +1,17 @@ all: man deb -man: man/flaskapp.1.md - pandoc man/flaskapp.1.md -f markdown+hard_line_breaks -s -t man -o man/flaskapp.1 - cp man/flaskapp.1 flaskapp/usr/share/man/man1/ - gzip -f flaskapp/usr/share/man/man1/flaskapp.1 -deb: man ../requirments.txt ../run.py ../flaskapp ../LICENSE - cp -r ../flaskapp/* flaskapp/var/flaskapp/flaskapp/ - cp ../run.py flaskapp/var/flaskapp/ - cp ../LICENSE flaskapp/var/flaskapp/ - dpkg-deb --build flaskapp +man: man/taskmanager.1.md + pandoc man/taskmanager.1.md -f markdown+hard_line_breaks -s -t man -o man/taskmanager.1 + cp man/taskmanager.1 taskmanager/usr/share/man/man1/ + gzip -f taskmanager/usr/share/man/man1/taskmanager.1 +deb: man ../requirments.txt ../run.py ../taskmanager ../LICENSE + cp -r ../taskmanager/* taskmanager/var/taskmanager/taskmanager/ + cp ../run.py taskmanager/var/taskmanager/ + cp ../LICENSE taskmanager/var/taskmanager/ + dpkg-deb --build taskmanager clean: - rm -f flaskapp.deb - rm -f man/flaskapp.1 - rm -rf flaskapp/var - mkdir -p flaskapp/var/flaskapp/flaskapp - mkdir -p flaskapp/usr/share/man/man1/ + rm -f taskmanager.deb + rm -f man/taskmanager.1 + rm -rf taskmanager/var + mkdir -p taskmanager/var/taskmanager/taskmanager + mkdir -p taskmanager/usr/share/man/man1/ diff --git a/build-deb/flaskapp/DEBIAN/postinst b/build-deb/flaskapp/DEBIAN/postinst deleted file mode 100755 index 6f104c8..0000000 --- a/build-deb/flaskapp/DEBIAN/postinst +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -/usr/bin/systemctl enable flaskapp.service -/sbin/service flaskapp start diff --git a/build-deb/flaskapp/DEBIAN/prerm b/build-deb/flaskapp/DEBIAN/prerm deleted file mode 100755 index ab24d80..0000000 --- a/build-deb/flaskapp/DEBIAN/prerm +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -/sbin/service flaskapp stop -/usr/bin/systemdctl disable flaskapp.service diff --git a/build-deb/flaskapp/lib/systemd/system/freeriders.service b/build-deb/flaskapp/lib/systemd/system/freeriders.service deleted file mode 100644 index 269d62d..0000000 --- a/build-deb/flaskapp/lib/systemd/system/freeriders.service +++ /dev/null @@ -1,12 +0,0 @@ -[Unit] -Description=Gunicorn flaskapp service -Documentation=man:gunicorn(1) -After=network.target nss-lookup.target - -[Service] -WorkingDirectory=/var/flaskapp/ -ExecStart=/usr/bin/gunicorn --workers 3 --bind 127.0.0.1:5000 run:app - -[Install] -WantedBy=multi-user.target - diff --git a/build-deb/man/flaskapp.1.md b/build-deb/man/taskmanger.1.md similarity index 85% rename from build-deb/man/flaskapp.1.md rename to build-deb/man/taskmanger.1.md index d42f136..bb5994c 100644 --- a/build-deb/man/flaskapp.1.md +++ b/build-deb/man/taskmanger.1.md @@ -1,9 +1,9 @@ -% FLASKAPP(1) flaskapp 1.0.0 +% FLASKAPP(1) taskmanager 1.0.0 % Decentrala % Jun 2023 # NAME -flaskapp - Web app +taskmanager - Web app # SYNOPSIS **python3 run.py** diff --git a/build-deb/flaskapp/DEBIAN/control b/build-deb/taskmanager/DEBIAN/control similarity index 72% rename from build-deb/flaskapp/DEBIAN/control rename to build-deb/taskmanager/DEBIAN/control index 80173fb..5b7578b 100644 --- a/build-deb/flaskapp/DEBIAN/control +++ b/build-deb/taskmanager/DEBIAN/control @@ -1,11 +1,11 @@ -Package: flaskapp +Package: taskmanager Section: net Priority: optional Architecture: all Essential: no Installed-Size: 2000 Depends: gunicorn, python3-flask-sqlalchemy -Homepage: https://gitea.dmz.rs/Decentrala/flaskapp +Homepage: https://gitea.dmz.rs/Decentrala/taskmanager Maintainer: Decentrala Description: Web app Version: 1.0.0 diff --git a/build-deb/taskmanager/DEBIAN/postinst b/build-deb/taskmanager/DEBIAN/postinst new file mode 100755 index 0000000..581544d --- /dev/null +++ b/build-deb/taskmanager/DEBIAN/postinst @@ -0,0 +1,3 @@ +#!/bin/sh +/usr/bin/systemctl enable taskmanager.service +/sbin/service taskmanager start diff --git a/build-deb/taskmanager/DEBIAN/prerm b/build-deb/taskmanager/DEBIAN/prerm new file mode 100755 index 0000000..e735257 --- /dev/null +++ b/build-deb/taskmanager/DEBIAN/prerm @@ -0,0 +1,3 @@ +#!/bin/sh +/sbin/service taskmanager stop +/usr/bin/systemdctl disable taskmanager.service diff --git a/flaskapp/__init__.py b/taskmanager/__init__.py similarity index 77% rename from flaskapp/__init__.py rename to taskmanager/__init__.py index d528518..03c6033 100644 --- a/flaskapp/__init__.py +++ b/taskmanager/__init__.py @@ -5,7 +5,7 @@ import os # if you wanna have db credenitalas in os.environ app = Flask(__name__) # SQLAlchemy setup -app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///flaskapp.db' +app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///taskmanager.db' #MySql setup #app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql://user:pass@localhost/dbname' @@ -13,4 +13,4 @@ app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///flaskapp.db' app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False db = SQLAlchemy(app) -from flaskapp import routes +from taskmanager import routes diff --git a/flaskapp/functions.py b/taskmanager/functions.py similarity index 100% rename from flaskapp/functions.py rename to taskmanager/functions.py diff --git a/flaskapp/models.py b/taskmanager/models.py similarity index 87% rename from flaskapp/models.py rename to taskmanager/models.py index 3dd8b41..e4ab563 100644 --- a/flaskapp/models.py +++ b/taskmanager/models.py @@ -1,4 +1,4 @@ -from flaskapp import db +from taskmanager import db class Table(db.Model): id = db.Column(db.Integer, primary_key=True) diff --git a/flaskapp/routes.py b/taskmanager/routes.py similarity index 91% rename from flaskapp/routes.py rename to taskmanager/routes.py index 30eefb5..4df4be4 100644 --- a/flaskapp/routes.py +++ b/taskmanager/routes.py @@ -1,7 +1,7 @@ from flask import render_template, request, redirect -from flaskapp import app, db -from flaskapp.functions import * -from flaskapp.models import * +from taskmanager import app, db +from taskmanager.functions import * +from taskmanager.models import * @app.route('/', methods=['GET']) def index(): diff --git a/flaskapp/static/style.css b/taskmanager/static/style.css similarity index 100% rename from flaskapp/static/style.css rename to taskmanager/static/style.css diff --git a/flaskapp/templates/index.html b/taskmanager/templates/index.html similarity index 100% rename from flaskapp/templates/index.html rename to taskmanager/templates/index.html diff --git a/flaskapp/templates/submit.html b/taskmanager/templates/submit.html similarity index 100% rename from flaskapp/templates/submit.html rename to taskmanager/templates/submit.html