diff options
| author | 2026-05-02 15:06:44 +0700 | |
|---|---|---|
| committer | 2026-05-02 15:06:44 +0700 | |
| commit | d3a63ca8a84bf4583bac8f5fd09bd52774bc4158 (patch) | |
| tree | 1a8b8582a75c966dd0a0c2c9d87e6aa1970795e2 | |
| parent | ca1f36376865cb2a20923aa62fdff3ee217abde3 (diff) | |
| download | web-d3a63ca8a84bf4583bac8f5fd09bd52774bc4158.tar.gz web-d3a63ca8a84bf4583bac8f5fd09bd52774bc4158.zip | |
feat: migrate to uz.saya.casa
| -rw-r--r-- | .github/workflows/build-and-deploy-prod.yml | 6 | ||||
| -rw-r--r-- | .github/workflows/build-and-deploy-stage.yml | 6 | ||||
| -rw-r--r-- | Caddyfile | 50 | ||||
| -rw-r--r-- | caddy.Dockerfile | 10 | ||||
| -rw-r--r-- | deploy/inventory.yml | 20 | ||||
| -rw-r--r-- | deploy/playbook.yml | 2 |
6 files changed, 77 insertions, 17 deletions
diff --git a/.github/workflows/build-and-deploy-prod.yml b/.github/workflows/build-and-deploy-prod.yml index 76012c6..d89cc76 100644 --- a/.github/workflows/build-and-deploy-prod.yml +++ b/.github/workflows/build-and-deploy-prod.yml @@ -54,7 +54,7 @@ jobs: - name: Checkout uses: actions/checkout@v6 - - name: Set up SSH connection for pl.saya.today + - name: Set up SSH connection for uz.saya.casa run: | mkdir -p ~/.ssh (cat <<EOF @@ -63,11 +63,11 @@ jobs: ) > ~/.ssh/id_ed25519 chmod 600 ~/.ssh/id_ed25519 sed -i 's/\r$//' ~/.ssh/id_ed25519 - ssh-keyscan -H pl.saya.today >> ~/.ssh/known_hosts + ssh-keyscan -H uz.saya.casa >> ~/.ssh/known_hosts - name: Test SSH connection run: | - ssh -o ConnectTimeout=10 -i ~/.ssh/id_ed25519 svc_github@pl.saya.today "echo 'SSH connection successful'" + ssh -o ConnectTimeout=10 -i ~/.ssh/id_ed25519 svc_github@uz.saya.casa "echo 'SSH connection successful'" - name: Install Ansible shell: bash diff --git a/.github/workflows/build-and-deploy-stage.yml b/.github/workflows/build-and-deploy-stage.yml index 89000d0..e699856 100644 --- a/.github/workflows/build-and-deploy-stage.yml +++ b/.github/workflows/build-and-deploy-stage.yml @@ -56,7 +56,7 @@ jobs: - name: Checkout uses: actions/checkout@v6 - - name: Set up SSH connection for pl.saya.today + - name: Set up SSH connection for uz.saya.casa run: | mkdir -p ~/.ssh (cat <<EOF @@ -65,11 +65,11 @@ jobs: ) > ~/.ssh/id_ed25519 chmod 600 ~/.ssh/id_ed25519 sed -i 's/\r$//' ~/.ssh/id_ed25519 - ssh-keyscan -H pl.saya.today >> ~/.ssh/known_hosts + ssh-keyscan -H uz.saya.casa >> ~/.ssh/known_hosts - name: Test SSH connection run: | - ssh -o ConnectTimeout=10 -i ~/.ssh/id_ed25519 svc_github@pl.saya.today "echo 'SSH connection successful'" + ssh -o ConnectTimeout=10 -i ~/.ssh/id_ed25519 svc_github@uz.saya.casa "echo 'SSH connection successful'" - name: Install Ansible shell: bash diff --git a/Caddyfile b/Caddyfile new file mode 100644 index 0000000..5781d74 --- /dev/null +++ b/Caddyfile @@ -0,0 +1,50 @@ +{ + email saya.andy@posteo.com + + order rate_limit before reverse_proxy + + servers { + timeouts { + read_body 10s + read_header 5s + write 30s + idle 2m + } + } +} + +(saya-web) { + header { + Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" + X-Xss-Protection "1; mode=block" + X-Content-Type-Options "nosniff" + X-Frame-Options "DENY" + Content-Security-Policy "upgrade-insecure-requests" + Referrer-Policy "strict-origin-when-cross-origin" + Cache-Control "public, max-age=15, must-revalidate" + Feature-Policy "accelerometer 'none'; ambient-light-sensor 'none'; autoplay 'self'; camera 'none'; encrypted-media 'none'; fullscreen 'self'; geolocation 'none'; gyroscope 'none'; magnetometer 'none'; microphone 'none'; midi 'none'; payment 'none'; picture-in-picture *; speaker 'none'; sync-xhr 'none'; usb 'none'; vr 'none'" + Server "No." + } + + request_body { + max_size 1MB + } + + rate_limit { + zone per_ip { + key {remote_host} + events 600 + window 1m + } + } +} + +stage.saya.uz { + import saya-web + reverse_proxy sayauz-stage:3000 +} + +saya.uz { + import saya-web + reverse_proxy sayauz-prod:3000 +} diff --git a/caddy.Dockerfile b/caddy.Dockerfile new file mode 100644 index 0000000..9f90d8b --- /dev/null +++ b/caddy.Dockerfile @@ -0,0 +1,10 @@ +FROM docker.io/library/caddy:2.11.2-builder-alpine AS builder + +RUN --mount=type=cache,target=/go/pkg/mod \ + --mount=type=cache,target=/root/.cache/go-build \ + xcaddy build v2.11.2 \ + --with github.com/mholt/caddy-ratelimit + +FROM docker.io/library/caddy:2.11.2-alpine + +COPY --from=builder /usr/bin/caddy /usr/bin/caddy diff --git a/deploy/inventory.yml b/deploy/inventory.yml index a1ecf5d..d3acab8 100644 --- a/deploy/inventory.yml +++ b/deploy/inventory.yml @@ -3,17 +3,17 @@ all: prod: hosts: node_prod: - ansible_host: pl.saya.today - saya_today_web_name: sayana-web - saya_today_web_hostname: sayana-web - saya_today_web_ipv4_address: 172.16.0.18 - saya_today_web_listen_address: saya.today + ansible_host: uz.saya.casa + saya_today_web_name: sayauz-prod + saya_today_web_hostname: sayauz-prod + saya_today_web_ipv4_address: 172.16.0.17 + saya_today_web_listen_address: saya.uz stage: hosts: node_stage: - ansible_host: pl.saya.today - saya_today_web_name: sayana-demo - saya_today_web_hostname: sayana-demo - saya_today_web_ipv4_address: 172.16.0.17 - saya_today_web_listen_address: demo.saya.today + ansible_host: uz.saya.casa + saya_today_web_name: sayauz-stage + saya_today_web_hostname: sayauz-stage + saya_today_web_ipv4_address: 172.16.0.18 + saya_today_web_listen_address: stage.saya.uz diff --git a/deploy/playbook.yml b/deploy/playbook.yml index b0202bd..8fb9088 100644 --- a/deploy/playbook.yml +++ b/deploy/playbook.yml @@ -2,7 +2,7 @@ - name: Deploy saya-today-web Docker Container hosts: all remote_user: svc_github - + tasks: - name: Create a volume community.docker.docker_volume: |