Compare commits
37 Commits
5f3f571a94
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7bf65691c7 | ||
|
|
14da8dd465 | ||
|
|
918359a802 | ||
|
|
6031e14793 | ||
| cd6e59a5b6 | |||
| e6230e3975 | |||
| 8735c410bd | |||
|
|
05e0072548 | ||
|
|
a05ae55c37 | ||
|
|
b6f3708aad | ||
|
|
eb3116778a | ||
|
|
684f88b56d | ||
|
|
036b27d4bc | ||
|
|
c2295e2442 | ||
|
|
89a10061c5 | ||
|
|
374244ba66 | ||
|
|
4a78885c66 | ||
|
|
85cba202d4 | ||
|
|
c3354c0cec | ||
|
|
f9ae17cdd4 | ||
|
|
4f74b317f4 | ||
|
|
329c27a6a2 | ||
|
|
d5760660f3 | ||
|
|
f891a75063 | ||
|
|
0c856a9f84 | ||
|
|
56d5fa8d32 | ||
|
|
10bbab3460 | ||
|
|
056f14dbe1 | ||
|
|
ea1c124e1d | ||
|
|
1ac1d57465 | ||
|
|
084afba83d | ||
|
|
d4480c4d2b | ||
|
|
48a696b176 | ||
|
|
acb7ccdf77 | ||
|
|
7d2228d75a | ||
|
|
c7dc1115a6 | ||
|
|
b85d91e2b2 |
@@ -15,6 +15,7 @@
|
|||||||
(common_auth) {
|
(common_auth) {
|
||||||
basicauth {
|
basicauth {
|
||||||
Standa $2a$14$Qt8qzPSymY09baSwfhTVw./vsB4debh4UcS5Ty/2yg44vXrGnxTz.
|
Standa $2a$14$Qt8qzPSymY09baSwfhTVw./vsB4debh4UcS5Ty/2yg44vXrGnxTz.
|
||||||
|
eit $2a$14$PGERi8FOypvxFoy3vVGPAOgMbP1XZtwe9/4uQVDQeUGOSBqO0SAOO
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
26
scripts/deploy_from_git.sh
Normal file → Executable file
26
scripts/deploy_from_git.sh
Normal file → Executable file
@@ -2,26 +2,20 @@
|
|||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
REPO_DIR="/opt/homelab"
|
REPO_DIR="/opt/homelab"
|
||||||
BRANCH="main"
|
|
||||||
|
|
||||||
echo "[1/4] Switching to repo..."
|
echo "[1/5] Switching to repo..."
|
||||||
cd "$REPO_DIR"
|
cd "$REPO_DIR"
|
||||||
|
|
||||||
echo "[2/4] Fetching changes..."
|
echo "[2/5] Fetching changes..."
|
||||||
git fetch origin "$BRANCH"
|
git fetch origin
|
||||||
|
|
||||||
LOCAL="$(git rev-parse HEAD)"
|
echo "[3/5] Resetting to origin/main..."
|
||||||
REMOTE="$(git rev-parse origin/$BRANCH)"
|
git reset --hard origin/main
|
||||||
|
|
||||||
if [[ "$LOCAL" == "$REMOTE" ]]; then
|
echo "[4/5] Cleaning untracked files..."
|
||||||
echo "[3/4] No changes to deploy."
|
git clean -fd
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "[3/4] Pulling latest changes..."
|
echo "[5/5] Running deploy..."
|
||||||
git pull --ff-only origin "$BRANCH"
|
./scripts/deploy_caddy.sh
|
||||||
|
|
||||||
echo "[4/4] Running Caddy deployment..."
|
echo "[Done]"
|
||||||
"$REPO_DIR/scripts/deploy_caddy.sh"
|
|
||||||
|
|
||||||
echo "[Done] Git-based deployment completed."
|
|
||||||
@@ -24,7 +24,8 @@ def validate_service(data: dict, source: Path) -> None:
|
|||||||
raise ValueError(f"{source.name}: missing required key '{key}'")
|
raise ValueError(f"{source.name}: missing required key '{key}'")
|
||||||
|
|
||||||
svc_type = data["type"]
|
svc_type = data["type"]
|
||||||
if svc_type not in {"static", "proxy"}:
|
|
||||||
|
if svc_type not in {"static", "proxy", "redirect"}:
|
||||||
raise ValueError(f"{source.name}: unsupported type '{svc_type}'")
|
raise ValueError(f"{source.name}: unsupported type '{svc_type}'")
|
||||||
|
|
||||||
if svc_type == "static" and "root" not in data:
|
if svc_type == "static" and "root" not in data:
|
||||||
@@ -33,6 +34,9 @@ def validate_service(data: dict, source: Path) -> None:
|
|||||||
if svc_type == "proxy" and "backend" not in data:
|
if svc_type == "proxy" and "backend" not in data:
|
||||||
raise ValueError(f"{source.name}: proxy service requires 'backend'")
|
raise ValueError(f"{source.name}: proxy service requires 'backend'")
|
||||||
|
|
||||||
|
if svc_type == "redirect" and "target" not in data:
|
||||||
|
raise ValueError(f"{source.name}: redirect service requires 'target'")
|
||||||
|
|
||||||
|
|
||||||
def render_service(env: Environment, data: dict) -> str:
|
def render_service(env: Environment, data: dict) -> str:
|
||||||
svc_type = data["type"]
|
svc_type = data["type"]
|
||||||
@@ -43,6 +47,13 @@ def render_service(env: Environment, data: dict) -> str:
|
|||||||
"real_ip": False,
|
"real_ip": False,
|
||||||
"health_uri": None,
|
"health_uri": None,
|
||||||
"health_interval": None,
|
"health_interval": None,
|
||||||
|
"internal": False,
|
||||||
|
"internal_ranges": [
|
||||||
|
"10.0.0.0/8",
|
||||||
|
"172.16.0.0/12",
|
||||||
|
"192.168.0.0/16",
|
||||||
|
],
|
||||||
|
"redirect_code": 301,
|
||||||
}
|
}
|
||||||
|
|
||||||
merged = {**defaults, **data}
|
merged = {**defaults, **data}
|
||||||
@@ -51,6 +62,10 @@ def render_service(env: Environment, data: dict) -> str:
|
|||||||
template = env.get_template("static.caddy.j2")
|
template = env.get_template("static.caddy.j2")
|
||||||
return template.render(**merged).strip() + "\n"
|
return template.render(**merged).strip() + "\n"
|
||||||
|
|
||||||
|
if svc_type == "redirect":
|
||||||
|
template = env.get_template("redirect.caddy.j2")
|
||||||
|
return template.render(**merged).strip() + "\n"
|
||||||
|
|
||||||
reverse_proxy_block = any(
|
reverse_proxy_block = any(
|
||||||
[
|
[
|
||||||
merged.get("real_ip"),
|
merged.get("real_ip"),
|
||||||
@@ -91,6 +106,5 @@ def main() -> int:
|
|||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
sys.exit(main())
|
sys.exit(main())
|
||||||
6
services/bistrousky-dev.yml
Normal file
6
services/bistrousky-dev.yml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
name: bistrousky-dev
|
||||||
|
type: proxy
|
||||||
|
domain: bistrousky-dev.hubacek.cloud
|
||||||
|
headers: true
|
||||||
|
auth: false
|
||||||
|
backend: 192.168.50.109:80
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
name: bistrousky
|
name: bistrousky
|
||||||
type: static
|
type: proxy
|
||||||
domain: bistrousky.hubacek.cloud
|
domain: bistrousky.cz, www.bistrousky.cz
|
||||||
headers: true
|
headers: true
|
||||||
root: /var/www/html
|
auth: false
|
||||||
|
backend: 192.168.50.107:80
|
||||||
5
services/bystrousky.yml
Normal file
5
services/bystrousky.yml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
name: bystrousky
|
||||||
|
type: redirect
|
||||||
|
domain: www.bystrousky.cz, bystrousky.cz
|
||||||
|
target: https://bistrousky.cz{uri}
|
||||||
|
code: 301
|
||||||
9
services/catalog-generator.yml
Normal file
9
services/catalog-generator.yml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
name: Catalogue Generator
|
||||||
|
type: proxy
|
||||||
|
domain: catalogue-generator.hubacek.cloud
|
||||||
|
headers: true
|
||||||
|
auth: false
|
||||||
|
internal: true
|
||||||
|
internal_ranges:
|
||||||
|
- 192.168.50.0/24
|
||||||
|
backend: 192.168.50.112:8080
|
||||||
6
services/dalik.yml
Normal file
6
services/dalik.yml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
name: dalik
|
||||||
|
type: proxy
|
||||||
|
domain: daliborturza.hubacek.cloud
|
||||||
|
headers: true
|
||||||
|
auth: false
|
||||||
|
backend: 192.168.50.105:80
|
||||||
6
services/eshop-bistrousky.yml
Normal file
6
services/eshop-bistrousky.yml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
name: eshop.bistrousky
|
||||||
|
type: proxy
|
||||||
|
domain: eshop-bistrousky.hubacek.cloud
|
||||||
|
headers: true
|
||||||
|
auth: false
|
||||||
|
backend: 192.168.50.113:80
|
||||||
6
services/fakturace.yml
Normal file
6
services/fakturace.yml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
name: fakturace
|
||||||
|
type: proxy
|
||||||
|
domain: fakturace.hubacek.cloud
|
||||||
|
headers: true
|
||||||
|
auth: false
|
||||||
|
backend: 192.168.50.118:80
|
||||||
@@ -2,5 +2,5 @@ name: gitea
|
|||||||
type: proxy
|
type: proxy
|
||||||
domain: git.hubacek.cloud
|
domain: git.hubacek.cloud
|
||||||
headers: true
|
headers: true
|
||||||
auth: true
|
auth: false
|
||||||
backend: 192.168.50.110:3000
|
backend: 192.168.50.110:3000
|
||||||
9
services/homarr.yml
Normal file
9
services/homarr.yml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
name: homarr
|
||||||
|
type: proxy
|
||||||
|
domain: homarr.hubacek.cloud
|
||||||
|
headers: true
|
||||||
|
auth: false
|
||||||
|
internal: true
|
||||||
|
internal_ranges:
|
||||||
|
- 192.168.50.0/24
|
||||||
|
backend: 192.168.50.236:7575
|
||||||
9
services/homepage.yml
Normal file
9
services/homepage.yml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
name: homepage
|
||||||
|
type: proxy
|
||||||
|
domain: home.hubacek.cloud
|
||||||
|
headers: true
|
||||||
|
auth: true
|
||||||
|
internal: true
|
||||||
|
internal_ranges:
|
||||||
|
- 192.168.50.0/24
|
||||||
|
backend: 192.168.50.245:3000
|
||||||
6
services/immich.yml
Normal file
6
services/immich.yml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
name: immich-app
|
||||||
|
type: proxy
|
||||||
|
domain: immich.hubacek.cloud
|
||||||
|
headers: true
|
||||||
|
auth: false
|
||||||
|
backend: 192.168.50.10:2283
|
||||||
9
services/ipplan.yml
Normal file
9
services/ipplan.yml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
name: IPplan
|
||||||
|
type: proxy
|
||||||
|
domain: ipplan.hubacek.cloud
|
||||||
|
headers: true
|
||||||
|
auth: true
|
||||||
|
internal: true
|
||||||
|
internal_ranges:
|
||||||
|
- 192.168.50.0/24
|
||||||
|
backend: 192.168.50.237:5000
|
||||||
6
services/portal.yml
Normal file
6
services/portal.yml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
name: portal
|
||||||
|
type: proxy
|
||||||
|
domain: portal.hubacek.cloud
|
||||||
|
headers: true
|
||||||
|
auth: false
|
||||||
|
backend: 192.168.50.111:8000
|
||||||
9
services/provisioner.yml
Normal file
9
services/provisioner.yml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
name: provisioner
|
||||||
|
type: proxy
|
||||||
|
domain: provisioner.hubacek.cloud
|
||||||
|
headers: true
|
||||||
|
auth: false
|
||||||
|
internal: true
|
||||||
|
internal_ranges:
|
||||||
|
- 192.168.50.0/24
|
||||||
|
backend: 192.168.50.103:8000
|
||||||
6
services/smsgw.yml
Normal file
6
services/smsgw.yml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
name: smsgw
|
||||||
|
type: proxy
|
||||||
|
domain: smsgw.hubacek.cloud
|
||||||
|
headers: true
|
||||||
|
auth: true
|
||||||
|
backend: 192.168.50.116:80
|
||||||
6
services/spravcetajemstvi.yml
Normal file
6
services/spravcetajemstvi.yml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
name: spravcetajemstvi
|
||||||
|
type: proxy
|
||||||
|
domain: spravcetajemstvi.cz, www.spravcetajemstvi.cz
|
||||||
|
headers: true
|
||||||
|
auth: false
|
||||||
|
backend: 192.168.50.115:3000
|
||||||
@@ -5,6 +5,12 @@
|
|||||||
{% if auth %}
|
{% if auth %}
|
||||||
import common_auth
|
import common_auth
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{% if internal %}
|
||||||
|
@internal {
|
||||||
|
remote_ip {{ internal_ranges | join(' ') }}
|
||||||
|
}
|
||||||
|
handle @internal {
|
||||||
{% if reverse_proxy_block %}
|
{% if reverse_proxy_block %}
|
||||||
reverse_proxy {{ backend }} {
|
reverse_proxy {{ backend }} {
|
||||||
{% if real_ip %}
|
{% if real_ip %}
|
||||||
@@ -19,5 +25,29 @@
|
|||||||
}
|
}
|
||||||
{% else %}
|
{% else %}
|
||||||
reverse_proxy {{ backend }}
|
reverse_proxy {{ backend }}
|
||||||
|
{% endif %}
|
||||||
|
}
|
||||||
|
handle {
|
||||||
|
respond "Forbidden" 403
|
||||||
|
}
|
||||||
|
|
||||||
|
{% else %}
|
||||||
|
|
||||||
|
{% if reverse_proxy_block %}
|
||||||
|
reverse_proxy {{ backend }} {
|
||||||
|
{% if real_ip %}
|
||||||
|
header_up X-Real-IP {remote_host}
|
||||||
|
{% endif %}
|
||||||
|
{% if health_uri %}
|
||||||
|
health_uri {{ health_uri }}
|
||||||
|
{% endif %}
|
||||||
|
{% if health_interval %}
|
||||||
|
health_interval {{ health_interval }}
|
||||||
|
{% endif %}
|
||||||
|
}
|
||||||
|
{% else %}
|
||||||
|
reverse_proxy {{ backend }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
}
|
}
|
||||||
3
templates/redirect.caddy.j2
Normal file
3
templates/redirect.caddy.j2
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
{{ domain }} {
|
||||||
|
redir {{ target }} {{ code | default(redirect_code) }}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user