prep for full docker setup

master
lza_menace 2 years ago
parent 89d6690e90
commit 170eb52f77

4
.gitignore vendored

@ -1,5 +1,3 @@
monero-lws monero-lws
docker-monero-node docker-monero-node
.env .env
data
node_modules

@ -8,26 +8,22 @@ x-log-config: &log-config
volumes: volumes:
lws: lws:
services: services:
# lws-web: lws-web:
# container_name: lws-web container_name: lws-web
# build: build:
# context: lws-web context: lws-web
# dockerfile: Dockerfile dockerfile: Dockerfile
# restart: unless-stopped restart: unless-stopped
# depends_on: depends_on:
# - monero-lws - monero-lws
# environment: environment:
# NUXT_LWS_API_KEY: ayoo LWS_URL: http://127.0.0.1:8080
# NUXT_LWS_ADMIN_URL: http://127.0.0.1:8080 LWS_ADMIN_URL: http://127.0.0.1:8081
# ports:
# - 127.0.0.1:5000:5000
# <<: *log-config
redis:
image: redis:latest
container_name: monero-lws-cache
restart: always
ports: ports:
- 127.0.0.1:6379:6379 - 127.0.0.1:5000:5000
command:
./.venv/bin/poetry run start
<<: *log-config
monero-lws: monero-lws:
container_name: monero-lws container_name: monero-lws
build: build:

@ -0,0 +1,5 @@
# move me to .env
SECRET_KEY=xxxxxxxxxxxx
DEBUG=0
QUART_ENV=production

@ -1,2 +1,3 @@
.venv .venv
*.db* *.db*
.env

@ -3,7 +3,19 @@ FROM ubuntu:22.04
RUN apt-get update RUN apt-get update
RUN apt-get install -y python3 python3-venv RUN apt-get install -y python3 python3-venv
WORKDIR /srv/lws-web WORKDIR /srv/lws-web
RUN adduser \
--system \
--shell /bin/bash \
--gecos 'lws-web' \
--group \
--disabled-password \
--home /srv/lws-web \
--uid 1000 \
lws-web
COPY . . COPY . .
RUN chown -R lws-web:lws-web .
RUN python3 -m venv .venv RUN python3 -m venv .venv
RUN .venv/bin/pip install poetry RUN .venv/bin/pip install poetry
RUN .venv/bin/poetry install RUN .venv/bin/poetry install
CMD ".venv/bin/poetry run start"

@ -8,9 +8,6 @@ TEMPLATES_AUTO_RELOAD = True
DEBUG = 1 == env.get("DEBUG", 1) DEBUG = 1 == env.get("DEBUG", 1)
QUART_ENV = env.get("QUART_ENV", "development") QUART_ENV = env.get("QUART_ENV", "development")
SECRET_KEY = env.get("SECRET_KEY", token_urlsafe(12)) SECRET_KEY = env.get("SECRET_KEY", token_urlsafe(12))
SESSION_URI = env.get("SESSION_URI", "redis://127.0.0.1:6379")
SESSION_TYPE = "redis"
SESSION_PROTECTION = True
QUART_AUTH_DURATION = 60 * 60 # 1 hour QUART_AUTH_DURATION = 60 * 60 # 1 hour
# LWS # LWS

@ -3,22 +3,17 @@ from quart_auth import (
AuthManager, Unauthorized AuthManager, Unauthorized
) )
from quart_bcrypt import Bcrypt from quart_bcrypt import Bcrypt
from quart_session import Session
from lws import config from lws import config
def create_app(): def create_app():
app = Quart(__name__) app = Quart(__name__)
app.config["TEMPLATES_AUTO_RELOAD"] = config.TEMPLATES_AUTO_RELOAD app.config["SECRET_KEY"] = config.SECRET_KEY
app.config["DEBUG"] = config.DEBUG app.config["DEBUG"] = config.DEBUG
app.config["TEMPLATES_AUTO_RELOAD"] = config.TEMPLATES_AUTO_RELOAD
app.config["QUART_ENV"] = config.QUART_ENV app.config["QUART_ENV"] = config.QUART_ENV
app.config["SECRET_KEY"] = config.SECRET_KEY
app.config["SESSION_URI"] = config.SESSION_URI
app.config["SESSION_TYPE"] = config.SESSION_TYPE
app.config["SESSION_PROTECTION"] = config.SESSION_PROTECTION
app.config["QUART_AUTH_DURATION"] = config.QUART_AUTH_DURATION app.config["QUART_AUTH_DURATION"] = config.QUART_AUTH_DURATION
Session(app)
AuthManager(app) AuthManager(app)
bcrypt = Bcrypt(app) bcrypt = Bcrypt(app)

52
lws-web/poetry.lock generated

@ -12,18 +12,6 @@ files = [
{file = "aiofiles-23.1.0.tar.gz", hash = "sha256:edd247df9a19e0db16534d4baaf536d6609a43e1de5401d7a4c1c148753a1635"}, {file = "aiofiles-23.1.0.tar.gz", hash = "sha256:edd247df9a19e0db16534d4baaf536d6609a43e1de5401d7a4c1c148753a1635"},
] ]
[[package]]
name = "async-timeout"
version = "4.0.2"
description = "Timeout context manager for asyncio programs"
category = "main"
optional = false
python-versions = ">=3.6"
files = [
{file = "async-timeout-4.0.2.tar.gz", hash = "sha256:2163e1640ddb52b7a8c80d0a67a08587e5d245cc9c553a74a847056bc2976b15"},
{file = "async_timeout-4.0.2-py3-none-any.whl", hash = "sha256:8ca1e4fcf50d07413d66d1a5e416e42cfdf5851c981d679a09851a6853383b3c"},
]
[[package]] [[package]]
name = "bcrypt" name = "bcrypt"
version = "3.2.2" version = "3.2.2"
@ -668,44 +656,6 @@ files = [
bcrypt = ">=3.2.2,<4.0.0" bcrypt = ">=3.2.2,<4.0.0"
quart = ">=0.18.0,<0.19.0" quart = ">=0.18.0,<0.19.0"
[[package]]
name = "quart-session"
version = "2.0.0"
description = "Adds server-side session support to your Quart application"
category = "main"
optional = false
python-versions = "*"
files = [
{file = "Quart-Session-2.0.0.tar.gz", hash = "sha256:2bbc197855f7307938c4fe451585240fa0cf06afee00c826685a55641ec91f45"},
]
[package.dependencies]
Quart = ">=0.10.0"
[package.extras]
dotenv = ["python-dotenv"]
mongodb = ["motor (>=2.5.1)"]
redis = ["redis (>=4.4.0)"]
[[package]]
name = "redis"
version = "4.5.4"
description = "Python client for Redis database and key-value store"
category = "main"
optional = false
python-versions = ">=3.7"
files = [
{file = "redis-4.5.4-py3-none-any.whl", hash = "sha256:2c19e6767c474f2e85167909061d525ed65bea9301c0770bb151e041b7ac89a2"},
{file = "redis-4.5.4.tar.gz", hash = "sha256:73ec35da4da267d6847e47f68730fdd5f62e2ca69e3ef5885c6a78a9374c3893"},
]
[package.dependencies]
async-timeout = {version = ">=4.0.2", markers = "python_version <= \"3.11.2\""}
[package.extras]
hiredis = ["hiredis (>=1.0.0)"]
ocsp = ["cryptography (>=36.0.1)", "pyopenssl (==20.0.1)", "requests (>=2.26.0)"]
[[package]] [[package]]
name = "requests" name = "requests"
version = "2.30.0" version = "2.30.0"
@ -805,4 +755,4 @@ h11 = ">=0.9.0,<1"
[metadata] [metadata]
lock-version = "2.0" lock-version = "2.0"
python-versions = "^3.10" python-versions = "^3.10"
content-hash = "5465cc294e32dd3f725c0cd72f6d6b404688e7508ac6f95783d0f9d71a8e55dc" content-hash = "5300fb61562523b1601e989618fadac9f121d6531a43208ecf56b6e4dc02a62c"

@ -1,5 +1,5 @@
[tool.poetry] [tool.poetry]
name = "lws" name = "lws-web"
version = "0.1.0" version = "0.1.0"
description = "" description = ""
authors = ["lza_menace <lza_menace@protonmail.com>"] authors = ["lza_menace <lza_menace@protonmail.com>"]
@ -12,9 +12,7 @@ quart = "^0.18.3"
peewee = "^3.15.3" peewee = "^3.15.3"
quart-auth = "^0.8.0" quart-auth = "^0.8.0"
quart-bcrypt = "^0.0.6" quart-bcrypt = "^0.0.6"
quart-session = "^2.0.0"
requests = "^2.29.0" requests = "^2.29.0"
redis = "^4.4.0"
monero = "^1.1.1" monero = "^1.1.1"
python-dotenv = "^1.0.0" python-dotenv = "^1.0.0"

Loading…
Cancel
Save