Extracted frontend from webservice to new directory

Updated directory structure
Updated .gitignore
This commit is contained in:
Administrator 2022-03-17 17:11:00 +01:00
parent 0140fe4b7c
commit ecc532b752
80 changed files with 338 additions and 204 deletions

View File

@ -13,7 +13,7 @@ steps:
- echo -n "${DRONE_BRANCH//\//-}-${DRONE_COMMIT_SHA:0:8}, latest" > .tags
- name: publish_webservice
- name: publish_api
image: plugins/docker
settings:
username:
@ -23,8 +23,21 @@ steps:
registry:
from_secret: registry
repo:
from_secret: repo_webservice
dockerfile: webservice/Dockerfile
from_secret: repo_api
dockerfile: api/Dockerfile
- name: publish_frontend
image: plugins/docker
settings:
username:
from_secret: username
password:
from_secret: password
registry:
from_secret: registry
repo:
from_secret: repo_frontend
dockerfile: frontend/Dockerfile
- name: publish_bot
image: plugins/docker

192
.gitignore vendored
View File

@ -5,4 +5,194 @@ env
Lib
Include
*/*/__pycache__/*
*/__pycache__/*
*/__pycache__/*
# Created by .ignore support plugin (hsz.mobi)
### Python template
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
.hypothesis/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
target/
# IPython Notebook
.ipynb_checkpoints
# pyenv
.python-version
# celery beat schedule file
celerybeat-schedule
# virtualenv
venv/
ENV/
# Spyder project settings
.spyderproject
# Rope project settings
.ropeproject
### VirtualEnv template
# Virtualenv
# http://iamzed.com/2009/05/07/a-primer-on-virtualenv/
[Bb]in
[Ii]nclude
[Ll]ib
[Ll]ib64
[Ll]ocal
[Ss]cripts
pyvenv.cfg
.venv
pip-selfcheck.json
### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff:
.idea/workspace.xml
.idea/tasks.xml
.idea/dictionaries
.idea/vcs.xml
.idea/jsLibraryMappings.xml
# Sensitive or high-churn files:
.idea/dataSources.ids
.idea/dataSources.xml
.idea/dataSources.local.xml
.idea/sqlDataSources.xml
.idea/dynamic.xml
.idea/uiDesigner.xml
# Gradle:
.idea/gradle.xml
.idea/libraries
# Mongo Explorer plugin:
.idea/mongoSettings.xml
.idea/
## File-based project format:
*.iws
## Plugin-specific files:
# IntelliJ
/out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
# See http://help.github.com/ignore-files/ for more about ignoring files.
# compiled output
/dist
/tmp
/out-tsc
# dependencies
/node_modules
# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace
# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
# misc
/.sass-cache
/connect.lock
/coverage
/libpeerconnection.log
npm-debug.log
testem.log
/typings
# e2e
/e2e/*.js
/e2e/*.map
# System Files
.DS_Store
Thumbs.db

View File

@ -3,12 +3,12 @@ FROM python:3.10-alpine
WORKDIR /srv/flask_app
RUN apk add nginx build-base libffi-dev curl uwsgi
COPY webservice/requirements.txt /srv/flask_app/
COPY api/requirements.txt /srv/flask_app/
RUN pip install -r requirements.txt --src /usr/local/src --no-warn-script-location
COPY webservice /srv/flask_app
COPY webservice/deploy/nginx.conf /etc/nginx
COPY api /srv/flask_app
COPY api/deploy/nginx.conf /etc/nginx
RUN chmod +x ./deploy/start.sh
RUN chmod +x ./deploy/healthcheck.sh

View File

@ -4,7 +4,6 @@ from dotenv import load_dotenv
from flask_cors import CORS
from models import *
from blueprint_interface import interface_blueprint
from api_blueprint_keyword import keyword_blueprint
from api_blueprint_shares import shares_blueprint
from api_blueprint_user import users_blueprint
@ -35,17 +34,6 @@ def create_app():
application.register_blueprint(portfolio_blueprint)
application.register_blueprint(users_blueprint)
# interface blueprint
application.register_blueprint(interface_blueprint)
# CORS: Allow * for developing
@application.after_request # blueprint can also be app~~
def after_request(response):
header = response.headers
header['Access-Control-Allow-Headers'] = 'Content-Type'
header['Access-Control-Allow-Origin'] = '*'
return response
return application

View File

@ -1,105 +1,105 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<diagram program="umlet" version="14.3.0">
<zoom_level>10</zoom_level>
<element>
<id>UMLClass</id>
<coordinates>
<x>580</x>
<y>320</y>
<w>210</w>
<h>80</h>
</coordinates>
<panel_attributes>Stichwort
--
PK: s_id
FK: username
Stichwort</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>580</x>
<y>100</y>
<w>210</w>
<h>130</h>
</coordinates>
<panel_attributes>User
--
PK: username
password
user_id
telegramname
Rolle
</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>930</x>
<y>80</y>
<w>210</w>
<h>90</h>
</coordinates>
<panel_attributes>Aktie
--
PK: a_id
FK: username
Aktiensymbol
</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>200</x>
<y>320</y>
<w>210</w>
<h>130</h>
</coordinates>
<panel_attributes>Transaktion
--
PK: t_id
FK: username
FK: Aktiensymbol
Zeitpunkt
Anzahl(+/-)
Preis(+/-)
</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>780</x>
<y>120</y>
<w>170</w>
<h>30</h>
</coordinates>
<panel_attributes>lt=&lt;-</panel_attributes>
<additional_attributes>150.0;10.0;10.0;10.0</additional_attributes>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>400</x>
<y>120</y>
<w>200</w>
<h>260</h>
</coordinates>
<panel_attributes>lt=&lt;-</panel_attributes>
<additional_attributes>10.0;240.0;180.0;10.0</additional_attributes>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>510</x>
<y>200</y>
<w>90</w>
<h>190</h>
</coordinates>
<panel_attributes>lt=&lt;-</panel_attributes>
<additional_attributes>70.0;170.0;10.0;10.0</additional_attributes>
</element>
</diagram>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<diagram program="umlet" version="14.3.0">
<zoom_level>10</zoom_level>
<element>
<id>UMLClass</id>
<coordinates>
<x>580</x>
<y>320</y>
<w>210</w>
<h>80</h>
</coordinates>
<panel_attributes>Stichwort
--
PK: s_id
FK: username
Stichwort</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>580</x>
<y>100</y>
<w>210</w>
<h>130</h>
</coordinates>
<panel_attributes>User
--
PK: username
password
user_id
telegramname
Rolle
</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>930</x>
<y>80</y>
<w>210</w>
<h>90</h>
</coordinates>
<panel_attributes>Aktie
--
PK: a_id
FK: username
Aktiensymbol
</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>200</x>
<y>320</y>
<w>210</w>
<h>130</h>
</coordinates>
<panel_attributes>Transaktion
--
PK: t_id
FK: username
FK: Aktiensymbol
Zeitpunkt
Anzahl(+/-)
Preis(+/-)
</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>780</x>
<y>120</y>
<w>170</w>
<h>30</h>
</coordinates>
<panel_attributes>lt=&lt;-</panel_attributes>
<additional_attributes>150.0;10.0;10.0;10.0</additional_attributes>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>400</x>
<y>120</y>
<w>200</w>
<h>260</h>
</coordinates>
<panel_attributes>lt=&lt;-</panel_attributes>
<additional_attributes>10.0;240.0;180.0;10.0</additional_attributes>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>510</x>
<y>200</y>
<w>90</w>
<h>190</h>
</coordinates>
<panel_attributes>lt=&lt;-</panel_attributes>
<additional_attributes>70.0;170.0;10.0;10.0</additional_attributes>
</element>
</diagram>

View File

@ -21,7 +21,7 @@ yarn-error.log
*.sublime-workspace
# Visual Studio Code
.vscode/*
.vscode/tasks.json
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json

19
frontend/Dockerfile Normal file
View File

@ -0,0 +1,19 @@
FROM node:latest as build
WORKDIR /usr/local/app
COPY frontend /usr/local/app/
RUN npm install
RUN npm run build
RUN ls /usr/local/app/dist
FROM nginx:latest
COPY --from=build /usr/local/app/dist/aktienbot /usr/share/nginx/html
HEALTHCHECK --interval=15s --timeout=2s CMD ["./deploy/healthcheck.sh"]
EXPOSE 80

View File

@ -0,0 +1,2 @@
#!/usr/bin/env sh
curl -s http://localhost:80/ -o /dev/null || exit 1

View File

Before

Width:  |  Height:  |  Size: 948 B

After

Width:  |  Height:  |  Size: 948 B

View File

@ -5,7 +5,7 @@
<title>Aktienbot</title>
<base href="/" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" type="image/x-icon" href="favicon.ico" />
<link rel="icon" type="image/x-icon" href="frontend/Aktienbot/src/favicon.ico" />
<link rel="preconnect" href="https://fonts.gstatic.com" />
<link
href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap"

View File

@ -1,4 +0,0 @@
{
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=827846
"recommendations": ["angular.ng-template"]
}

View File

@ -1,20 +0,0 @@
{
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "ng serve",
"type": "pwa-chrome",
"request": "launch",
"preLaunchTask": "npm: start",
"url": "http://localhost:4200/"
},
{
"name": "ng test",
"type": "chrome",
"request": "launch",
"preLaunchTask": "npm: test",
"url": "http://localhost:9876/debug.html"
}
]
}

View File

@ -1,42 +0,0 @@
{
// For more information, visit: https://go.microsoft.com/fwlink/?LinkId=733558
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "start",
"isBackground": true,
"problemMatcher": {
"owner": "typescript",
"pattern": "$tsc",
"background": {
"activeOnStart": true,
"beginsPattern": {
"regexp": "(.*?)"
},
"endsPattern": {
"regexp": "bundle generation complete"
}
}
}
},
{
"type": "npm",
"script": "test",
"isBackground": true,
"problemMatcher": {
"owner": "typescript",
"pattern": "$tsc",
"background": {
"activeOnStart": true,
"beginsPattern": {
"regexp": "(.*?)"
},
"endsPattern": {
"regexp": "bundle generation complete"
}
}
}
}
]
}

View File

@ -1,12 +0,0 @@
import os
from flask import Blueprint, render_template
interface_blueprint = Blueprint('interface', __name__, url_prefix='/')
__location__ = os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(__file__)))
# Return all tags
@interface_blueprint.route('/', methods=['GET'])
def get_html():
return render_template("index.html")