Add stuff for docker + captain deployer

This commit is contained in:
Michal Kunc 2021-11-17 21:56:11 +01:00
parent 37cd6ddfda
commit 28f3d7e6cb
Signed by: michal
GPG Key ID: 4CA5FB6559E0BDF8
7 changed files with 166 additions and 1 deletions

2
.dockerignore Normal file
View File

@ -0,0 +1,2 @@
.git/
db-importer/

144
.gitignore vendored Normal file
View File

@ -0,0 +1,144 @@
#### joe made this: http://goel.io/joe
#### python ####
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# 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/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
.pybuilder/
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version
# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/
# Celery stuff
celerybeat-schedule
celerybeat.pid
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
# pytype static type analyzer
.pytype/
# Cython debug symbols
cython_debug/
# poetry
poetry.lock

View File

@ -0,0 +1,4 @@
{
"schemaVersion": 2,
"dockerfilePath": "./db_explorer/Dockerfile"
}

14
db_explorer/Dockerfile Normal file
View File

@ -0,0 +1,14 @@
FROM python:3
RUN python3 -m pip install poetry
EXPOSE 5000
WORKDIR /app
COPY db_explorer/ /app/
RUN poetry update
RUN poetry run pip install setuptools
ENTRYPOINT [ "poetry", "run" ]
CMD [ "gunicorn", "-b=0.0.0.0:5000", "db_explorer:app" ]

View File

@ -0,0 +1 @@
from db_explorer.app import app

View File

@ -37,7 +37,6 @@ def list_actions():
@app.route("/action/<name>") @app.route("/action/<name>")
def show_action(name): def show_action(name):
item = mongo.db.action.find_one_or_404({"name": name}) item = mongo.db.action.find_one_or_404({"name": name})
print(item)
if item["data"]["actions"]["value"] == None: if item["data"]["actions"]["value"] == None:
if item["data"]["actionType"]["value"] == 'passive': if item["data"]["actionType"]["value"] == 'passive':
item['_action_icon'] = None item['_action_icon'] = None

View File

@ -10,6 +10,7 @@ packages = [{include = "db_explorer"}]
python = "^3.8" python = "^3.8"
Flask = "^2.0.2" Flask = "^2.0.2"
Flask-PyMongo = "^2.3.0" Flask-PyMongo = "^2.3.0"
gunicorn = "^20.1.0"
[build-system] [build-system]