This commit is contained in:
2024-02-28 10:33:15 +08:00
commit 492c03bfcf
27 changed files with 813 additions and 0 deletions
BIN
View File
Binary file not shown.
+29
View File
@@ -0,0 +1,29 @@
# base image
FROM python:3.11-slim
#basic build prep
RUN apt-get update && apt-get install -y \
build-essential \
curl \
software-properties-common \
git \
&& rm -rf /var/lib/apt/lists/*
# copy over and install packages
COPY ./src/requirements.txt ./requirements.txt
RUN pip3 install cython
RUN pip3 install -r requirements.txt
# streamlit-specific commands
RUN mkdir -p /root/.streamlit
RUN bash -c 'echo -e "\
[general]\n\
email = \"\"\n\
" > /root/.streamlit/credentials.toml'
# RUN bash -c 'echo -e "\
# [server]\n\
# baseUrlPath = \"/fin\"\n\
# " > /root/.streamlit/config.toml'
# copying everything over
COPY . .
+5
View File
@@ -0,0 +1,5 @@
FROM traefik:v2.11
RUN mkdir -p /etc/traefik/acme \
&& touch /etc/traefik/acme/acme.json \
&& chmod 600 /etc/traefik/acme/acme.json
COPY ./compose/traefik/traefik.yml /etc/traefik
+143
View File
@@ -0,0 +1,143 @@
log:
level: DEBUG
api:
# Dashboard
dashboard: true
# https://docs.traefik.io/master/operations/api/#insecure
# insecure: true
entryPoints:
web:
# http
address: ":80"
http:
# https://docs.traefik.io/routing/entrypoints/#entrypoint
redirections:
entryPoint:
to: web-secure
web-secure:
# https
address: ":443"
# osrm:
# address: ":5000"
certificatesResolvers:
letsencrypt:
# https://docs.traefik.io/master/https/acme/#lets-encrypt
acme:
email: "furyx@hotmail.com"
storage: /etc/traefik/acme/acme.json
# https://docs.traefik.io/master/https/acme/#httpchallenge
httpChallenge:
entryPoint: web
http:
routers:
dashboard:
rule: "Host(`dashboard.furyhawk.lol`) && (PathPrefix(`/api`) || PathPrefix(`/dashboard`))"
service: api@internal
middlewares:
- auth
tls:
# https://docs.traefik.io/master/routing/routers/#certresolver
certResolver: letsencrypt
web-secure-router:
rule: "Host(`furyhawk.lol`, `www.furyhawk.lol`, `bai.furyhawk.lol`) || PathPrefix(`/bai`)"
entryPoints:
- web-secure
middlewares:
- csrf
- add-bai
service: streamlit_bai_app
tls:
# https://docs.traefik.io/master/routing/routers/#certresolver
certResolver: letsencrypt
fin-router:
rule: "Host(`fin.furyhawk.lol`)"
entryPoints:
- web-secure
middlewares:
- csrf
- add-fin
service: streamlit_fin_app
tls:
# https://docs.traefik.io/master/routing/routers/#certresolver
certResolver: letsencrypt
blog-router:
rule: "Host(`blog.furyhawk.lol`)"
entryPoints:
- web-secure
# redirect to external blog
middlewares:
- redirect-blog
service: blog
tls:
# https://docs.traefik.io/master/routing/routers/#certresolver
certResolver: letsencrypt
osrm-router:
rule: "Host(`osrm.furyhawk.lol`)"
entryPoints:
- "web-secure"
# - "osrm"
middlewares:
- csrf
service: osrm_service
tls:
# https://docs.traefik.io/master/routing/routers/#certresolver
certResolver: letsencrypt
middlewares:
auth:
basicAuth:
users:
- "test:$apr1$2E4PEW8M$/wEgFNKX71h.YYMywV7WZ/"
csrf:
# https://doc.traefik.io/traefik/middlewares/http/headers/#hostsproxyheaders
# https://docs.djangoproject.com/en/dev/ref/csrf/#ajax
headers:
hostsProxyHeaders: ["X-CSRFToken"]
add-bai:
addPrefix:
prefix: "/bai"
add-fin:
addPrefix:
prefix: "/fin"
redirect-blog:
# https://docs.traefik.io/master/middlewares/redirectscheme/
redirectregex:
regex: "^https://blog.furyhawk.lol/(.*)"
replacement: "https://furyhawk.github.io/124c41/${1}"
permanent: true
services:
osrm_service:
loadBalancer:
servers:
- url: http://osrm_backend:{{env "OSRM_PORT"}}
streamlit_bai_app:
loadBalancer:
servers:
- url: http://streamlit_bai_app:8502/bai
streamlit_fin_app:
loadBalancer:
servers:
- url: http://streamlit_fin_app:{{env "STREAMLIT_FIN_SERVER_PORT"}}/{{env "FIN_LOCATION"}}
blog:
loadBalancer:
servers:
- url: https://furyhawk.github.io/124c41/
providers:
# https://docs.traefik.io/master/providers/file/
file:
filename: /etc/traefik/traefik.yml
watch: true