This commit is contained in:
Simple_Not 2023-07-01 20:29:27 +10:00
parent 7645d83c51
commit dce21d4ad0
10 changed files with 7306 additions and 0 deletions

0
.drone.yml Normal file
View File

View File

@ -0,0 +1,90 @@
# Table of Contents
1. [Логика доступа к контенту ](#Логика-доступа-к-контенту)
1. [Логика деплоя в куб по коммиту ](#Логика-деплоя-в-куб-по-коммиту)
Вообще суть такова:
Мы берём фласк, кидаем в контейнер, далее контейнер педалим в кубернетес в деплоймент соответствующий ветке (мастер/дев) с 2-3 подами на деплоймент, всё это должен уметь делать CI/CD
----
## Логика доступа к контенту
```mermaid
stateDiagram-v2
state USER
state inet <<join>>
state Nginx
user --> inet : internet
inet --> Nginx : router
state Kube {
NginxIngress
lbServiceMaster
lbServiceDev
state DeploymentMaster {
state "pod" as p1
state "pod" as p2
}
state DeploymentDev {
state "pod" as p1d
state "pod" as p2d
}
}
Nginx --> NginxIngress : *.board.vdk2ch.ru, www.vdk2ch.ru
NginxIngress --> lbServiceMaster : master.board.vdk2ch.ru
NginxIngress --> lbServiceDev : dev.board.vdk2ch.ru
lbServiceMaster --> DeploymentMaster
lbServiceMaster --> DeploymentMaster
lbServiceDev --> DeploymentDev
lbServiceDev --> DeploymentDev
state Minio
state Postgresql
state all_join <<join>>
p1 --> all_join
p2 --> all_join
p1d --> all_join
p2d --> all_join
p1 --> all_join
all_join --> Postgres : данные с БД
all_join --> Minio : статика
```
----
## Логика деплоя в куб по коммиту
TBA
```mermaid
stateDiagram-v2
Git
committer
Docker
Kube
Drone
```

27
app.py Normal file
View File

@ -0,0 +1,27 @@
from flask import Flask, render_template, request
from flask_assets import Bundle, Environment
app = Flask(__name__)
assets = Environment(app)
#css = Bundle("src/main.css", output="dist/main.css")
# https://unpkg.com/htmx.org
js = Bundle("src/*.js", output="dist/main.js")
#assets.register("css", css)
assets.register("js", js)
#css.build()
js.build()
@app.route("/")
def homepage():
return render_template("page1.html")
if __name__ == "__main__":
app.run(debug=True)

2
reqs.txt Normal file
View File

@ -0,0 +1,2 @@
flask
flask-assets

3566
static/dist/main.js vendored Normal file

File diff suppressed because it is too large Load Diff

3566
static/src/htmx.js Normal file

File diff suppressed because it is too large Load Diff

23
templates/base.html Normal file
View File

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!--
{% assets 'css' %}
<link rel="stylesheet" href="{{ ASSET_URL }}">
{% endassets %} -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/purecss@3.0.0/build/pure-min.css" integrity="sha384-X38yfunGUhNzHpBaEBsWLO+A0HDYOQi8ufWDkZ0k9e0eXz/tH3II7uKZ9msv++Ls" crossorigin="anonymous">
{% assets 'js' %}
<script type="text/javascript" src="{{ ASSET_URL }}"></script>
{% endassets %}
<title>Flask + htmx</title>
</head>
<body class="bg-blue-100">
{% block content %}
{% endblock content %}
</body>
</html>

32
templates/page1.html Normal file
View File

@ -0,0 +1,32 @@
{% extends "base.html" %}
{% block content %}
<div class="w-small w-2/3 mx-auto py-10 text-gray-600">
<input
type="text"
name="search"
hx-post="/search"
hx-trigger="keyup changed delay:250ms"
hx-indicator=".htmx-indicator"
hx-target="#todo-results"
placeholder="Search"
class="bg-white h-10 px-5 pr-10 rounded-full text-2xl focus:outline-none"
>
<span class="htmx-indicator">Searching...</span>
</div>
suppss
<table class="border-collapse w-small w-2/3 mx-auto">
<thead>
<tr>
<th class="p-3 font-bold uppercase bg-gray-200 text-gray-600 border border-gray-300 hidden lg:table-cell">#</th>
<th class="p-3 font-bold uppercase bg-gray-200 text-gray-600 border border-gray-300 hidden lg:table-cell">Title</th>
<th class="p-3 font-bold uppercase bg-gray-200 text-gray-600 border border-gray-300 hidden lg:table-cell">Completed</th>
</tr>
</thead>
<tbody id="todo-results">
</tbody>
</table>
{% endblock content %}