initial import

This commit is contained in:
James Andariese 2023-04-27 16:43:02 -05:00
parent 98e244df45
commit 6753d2b62c
5 changed files with 118 additions and 0 deletions

49
docker-compose.yaml Normal file
View File

@ -0,0 +1,49 @@
# cloudflared tunnel create ytmd
# cloudflared tunnel route dns ytmd ytmd.strudelline.net
# cp ~/.cloudflared/*.json /Volumes/webdav.strudelline.net/docker-compose-mounts/cloudflared
#
# grab the tunnel-id that's output from the first two commands and open this file again
# add the tunnel-id to TUNNELID below
version: '3'
volumes:
config: {}
services:
main:
image: ghcr.io/jamesandariese/ytmd-api:main
restart: always
environment:
- "HOST=127.0.0.1"
cloudflared-configurator:
image: debian:11
environment:
- TUNNELID=4f3aba1c-c226-4e14-800f-ad4b8d30dc60
- HOST=ytmd.strudelline.net
- SVCPORT=8000
command:
- bash
- -c
- |
cat /cloudflared/$${TUNNELID}.json > /config/tunnel.json
cat << EOF > /config/cloudflared.yaml
tunnel: $${TUNNELID}
credentials-file: /config/tunnel.json
ingress:
- hostname: ytmd.strudelline.net
service: http://localhost:$${SVCPORT}
- service: http_status:404
EOF
volumes:
- /volume1/docker-compose-mounts/cloudflared:/cloudflared
- config:/config
cloudflared:
image: cloudflare/cloudflared:latest
restart: always
depends_on: {"cloudflared-configurator": {"condition": "service_completed_successfully"}}
volumes:
- config:/config
command: tunnel --config /config/cloudflared.yaml run
network_mode: service:main

24
manifests/deployment.yaml Normal file
View File

@ -0,0 +1,24 @@
apiVersion: apps/v1
kind: Deployment
metadata:
namespace: ytmd
name: ytmd
spec:
replicas: 1
selector:
matchLabels:
app: ytmd
strategy:
type: Recreate
template:
metadata:
labels:
app: ytmd
spec:
containers:
- env:
- name: HOST
value: 0.0.0.0
image: ghcr.io/jamesandariese/ytmd-api:main
name: ytmd
restartPolicy: Always

24
manifests/ingress.yaml Normal file
View File

@ -0,0 +1,24 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ytmd
namespace: ytmd
annotations:
haproxy-ingress.github.io/ssl-redirect: "true"
spec:
ingressClassName: haproxy
rules:
- host: ytmd.strudelline.net
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: ytmd
port:
number: 8000
tls:
- hosts:
- ytmd.strudelline.net
secretName: wildcard-tls

4
manifests/ns.yaml Normal file
View File

@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: ytmd

17
manifests/svc.yaml Normal file
View File

@ -0,0 +1,17 @@
apiVersion: v1
kind: Service
metadata:
labels:
app: ytmd
name: ytmd
namespace: ytmd
spec:
selector:
app: ytmd
ports:
- name: http
port: 8000
protocol: TCP
targetPort: 8000
clusterIP: None
type: ClusterIP