-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Includes * pyramid application * tailwind, htmx, hyperscript * a very basic metal template and a single pseudo dashboard view I'm switching from hatch to poetry as hatch doesn't have proper locking for application-style packages. Fixes ARAMAKI-10
- Loading branch information
Showing
20 changed files
with
1,969 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[run] | ||
source = aramaki |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
include *.txt *.ini *.cfg *.rst | ||
recursive-include menage2 *.ico *.png *.css *.gif *.jpg *.pt *.txt *.mak *.mako *.js *.html *.xml *.jinja2 | ||
recursive-include tests * | ||
recursive-exclude * __pycache__ | ||
recursive-exclude * *.py[co] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
### | ||
# app configuration | ||
# https://docs.pylonsproject.org/projects/pyramid/en/latest/narr/environment.html | ||
### | ||
|
||
[app:main] | ||
use = egg:aramaki | ||
|
||
pyramid.reload_templates = true | ||
pyramid.debug_authorization = false | ||
pyramid.debug_notfound = false | ||
pyramid.debug_routematch = false | ||
pyramid.default_locale_name = de | ||
pyramid.includes = | ||
pyramid_debugtoolbar | ||
|
||
sqlalchemy.url = aramaki:///%(here)s/aramaki.sqlite | ||
|
||
retry.attempts = 3 | ||
|
||
# By default, the toolbar only appears for clients from IP addresses | ||
# '127.0.0.1' and '::1'. | ||
# debugtoolbar.hosts = 127.0.0.1 ::1 | ||
|
||
[pshell] | ||
setup = aramaki.pshell.setup | ||
|
||
### | ||
# wsgi server configuration | ||
### | ||
|
||
[alembic] | ||
# path to migration scripts | ||
script_location = src/aramaki/server/alembic | ||
file_template = %%(year)d%%(month).2d%%(day).2d_%%(rev)s | ||
# file_template = %%(rev)s_%%(slug)s | ||
|
||
[server:main] | ||
use = egg:waitress#main | ||
listen = 0.0.0.0:6543 | ||
|
||
### | ||
# logging configuration | ||
# https://docs.pylonsproject.org/projects/pyramid/en/latest/narr/logging.html | ||
### | ||
|
||
[loggers] | ||
keys = root, aramaki, sqlalchemy, alembic | ||
|
||
[handlers] | ||
keys = console | ||
|
||
[formatters] | ||
keys = generic | ||
|
||
[logger_root] | ||
level = INFO | ||
handlers = console | ||
|
||
[logger_aramaki] | ||
level = DEBUG | ||
handlers = | ||
qualname = aramaki | ||
|
||
[logger_sqlalchemy] | ||
level = WARN | ||
handlers = | ||
qualname = sqlalchemy.engine | ||
# "level = INFO" logs SQL queries. | ||
# "level = DEBUG" logs SQL queries and results. | ||
# "level = WARN" logs neither. (Recommended for production systems.) | ||
|
||
[logger_alembic] | ||
level = INFO | ||
handlers = | ||
qualname = alembic | ||
|
||
[handler_console] | ||
class = StreamHandler | ||
args = (sys.stderr,) | ||
level = NOTSET | ||
formatter = generic | ||
|
||
[formatter_generic] | ||
format = %(asctime)s %(levelname)-5.5s [%(name)s:%(lineno)s][%(threadName)s] %(message)s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
### | ||
# app configuration | ||
# https://docs.pylonsproject.org/projects/pyramid/en/latest/narr/environment.html | ||
### | ||
|
||
[app:main] | ||
use = egg:aramaki | ||
|
||
pyramid.reload_templates = false | ||
pyramid.debug_authorization = false | ||
pyramid.debug_notfound = false | ||
pyramid.debug_routematch = false | ||
pyramid.default_locale_name = en | ||
sqlalchemy.url = postgres:///%(here)s/aramaki.sqlite | ||
|
||
retry.attempts = 3 | ||
|
||
[pshell] | ||
setup = aramaki.pshell.setup | ||
|
||
### | ||
# wsgi server configuration | ||
### | ||
|
||
[alembic] | ||
# path to migration scripts | ||
script_location = src/aramaki/server/alembic | ||
file_template = %%(year)d%%(month).2d%%(day).2d_%%(rev)s | ||
# file_template = %%(rev)s_%%(slug)s | ||
|
||
[server:main] | ||
use = egg:waitress#main | ||
listen = *:6543 | ||
url_scheme = https | ||
|
||
### | ||
# logging configuration | ||
# https://docs.pylonsproject.org/projects/pyramid/en/latest/narr/logging.html | ||
### | ||
|
||
[loggers] | ||
keys = root, aramaki, sqlalchemy, alembic | ||
|
||
[handlers] | ||
keys = console | ||
|
||
[formatters] | ||
keys = generic | ||
|
||
[logger_root] | ||
level = WARN | ||
handlers = console | ||
|
||
[logger_aramaki] | ||
level = WARN | ||
handlers = | ||
qualname = aramaki | ||
|
||
[logger_sqlalchemy] | ||
level = WARN | ||
handlers = | ||
qualname = sqlalchemy.engine | ||
# "level = INFO" logs SQL queries. | ||
# "level = DEBUG" logs SQL queries and results. | ||
# "level = WARN" logs neither. (Recommended for production systems.) | ||
|
||
[logger_alembic] | ||
level = WARN | ||
handlers = | ||
qualname = alembic | ||
|
||
[handler_console] | ||
class = StreamHandler | ||
args = (sys.stderr,) | ||
level = NOTSET | ||
formatter = generic | ||
|
||
[formatter_generic] | ||
format = %(asctime)s %(levelname)-5.5s [%(name)s:%(lineno)s][%(threadName)s] %(message)s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,62 @@ | ||
[build-system] | ||
requires = ["hatchling"] | ||
build-backend = "hatchling.build" | ||
requires = ["poetry-core"] | ||
build-backend = "poetry.core.masonry.api" | ||
|
||
|
||
[project] | ||
[tool.poetry] | ||
name = "aramaki" | ||
version = "0.0.1" | ||
authors = [ | ||
{ name="Christian Theune", email="[email protected]" }, | ||
] | ||
description = "A federated DevOps control-plane." | ||
authors = ["Christian Theune <[email protected]>"] | ||
license = "AGPLv3" | ||
readme = "README.md" | ||
requires-python = ">=3.11" | ||
classifiers = [ | ||
"Programming Language :: Python :: 3", | ||
"License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)", | ||
"Operating System :: OS Independent", | ||
] | ||
dependencies = [ | ||
"psycopg2", | ||
"websockets", | ||
"pyramid" | ||
] | ||
|
||
[project.urls] | ||
Homepage = "https://github.com/flyingcircusio/aramaki" | ||
Issues = "https://github.com/flyingcircusio/aramaki/issues" | ||
|
||
[project.scripts] | ||
[tool.poetry.dependencies] | ||
python = "^3.11" | ||
pyramid = "^2.0.1" | ||
pyramid-chameleon = "^0.3" | ||
pyramid-debugtoolbar = "^4.10" | ||
waitress = "^2.1.2" | ||
plaster-pastedeploy = "^1.0.1" | ||
alembic = "^1.11.1" | ||
pyramid-retry = "^2.1.1" | ||
pyramid-tm = "^2.5" | ||
sqlalchemy = "^2.0.19" | ||
transaction = "^3.1.0" | ||
zope-sqlalchemy = "^3.0" | ||
babel = "^2.12.1" | ||
pytz = "^2023.3" | ||
# peppercorn = "^0.6" | ||
peppercorn = { git = "https://github.com/ctheune/peppercorn.git", branch = "htmx-workaround-1686-wrong-form-dataset-construction" } | ||
rtmapi = "^0.7.2" | ||
# implicit dependency that rtmapi did not specify!?! | ||
httplib2 = "^0.22.0" | ||
psycopg2-binary = "^2.9.9" | ||
cachecontrol = "^0.13.1" | ||
arrow = "^1.3.0" | ||
filelock = "^3.13.1" | ||
websockets = "^12" | ||
|
||
[tool.poetry.group.dev.dependencies] | ||
webtest = "^3.0.0" | ||
pytest = "^7.4.0" | ||
pytest-cov = "^4.1.0" | ||
|
||
[tool.poetry.plugins."paste.app_factory"] | ||
main = "aramaki.server.ui.main:main" | ||
|
||
[tool.poetry.plugins."console_scripts"] | ||
aramaki-initialize-db = "aramaki.scripts.initialize_db:main" | ||
aramaki-server = "aramaki.server.main:main" | ||
aramaki-agent = "aramaki.agent.main:main" | ||
|
||
[tool.hatch.build.targets.wheel] | ||
packages = ["src/aramaki"] | ||
|
||
[project.urls] | ||
Homepage = "https://github.com/flyingcircusio/aramaki" | ||
Issues = "https://github.com/flyingcircusio/aramaki/issues" | ||
|
||
[tool.black] | ||
line-length = 79 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,20 @@ | ||
from wsgiref.simple_server import make_server | ||
import logging | ||
|
||
from pyramid.config import Configurator | ||
from pyramid.response import Response | ||
|
||
|
||
def hello_world(request): | ||
return Response("Hello World!") | ||
def main(global_config, **settings): | ||
"""This function returns a Pyramid WSGI application.""" | ||
|
||
logging.basicConfig() # you need to initialize logging, otherwise you will not see anything from requests | ||
logging.getLogger().setLevel(logging.DEBUG) | ||
requests_log = logging.getLogger("urllib3") | ||
requests_log.setLevel(logging.DEBUG) | ||
requests_log.propagate = True | ||
|
||
def main(): | ||
with Configurator() as config: | ||
config.add_route("hello", "/") | ||
config.add_view(hello_world, route_name="hello") | ||
app = config.make_wsgi_app() | ||
server = make_server("0.0.0.0", 6543, app) | ||
server.serve_forever() | ||
with Configurator(settings=settings) as config: | ||
config.include("pyramid_chameleon") | ||
config.include(".routes") | ||
config.scan() | ||
|
||
return config.make_wsgi_app() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import time | ||
|
||
from pyramid.static import QueryStringConstantCacheBuster | ||
|
||
|
||
def includeme(config): | ||
config.add_static_view("static", "static", cache_max_age=3600) | ||
config.add_cache_buster( | ||
"static", QueryStringConstantCacheBuster(str(int(time.time()))) | ||
) | ||
|
||
config.add_route("dashboard", "/") |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.