summaryrefslogtreecommitdiffci
diff refs
from: back
to: back
| flip
diff options
context:
space:
mode:
-rw-r--r--config/config.prod.yaml5
-rw-r--r--config/config.stage.yaml5
-rw-r--r--deploy/inventory.yml2
-rw-r--r--deploy/playbook.yml23
-rw-r--r--internal/router/router.go7
5 files changed, 13 insertions, 29 deletions
diff --git a/config/config.prod.yaml b/config/config.prod.yaml
index 2daa3ff..0b45e1a 100644
--- a/config/config.prod.yaml
+++ b/config/config.prod.yaml
@@ -1,9 +1,8 @@
logLevel: info
endpoint:
- type: unix
+ type: http
config:
- path: "/etc/sayauz/prod.socket"
- chmod: '0666'
+ listenOn: ":3000"
blogPages:
storage:
type: b2
diff --git a/config/config.stage.yaml b/config/config.stage.yaml
index 151bb4a..23b76aa 100644
--- a/config/config.stage.yaml
+++ b/config/config.stage.yaml
@@ -1,9 +1,8 @@
logLevel: debug
endpoint:
- type: unix
+ type: http
config:
- path: "/etc/sayauz/stage.socket"
- chmod: '0666'
+ listenOn: ":3000"
blogPages:
storage:
type: b2
diff --git a/deploy/inventory.yml b/deploy/inventory.yml
index 6b8a384..d3acab8 100644
--- a/deploy/inventory.yml
+++ b/deploy/inventory.yml
@@ -8,7 +8,6 @@ all:
saya_today_web_hostname: sayauz-prod
saya_today_web_ipv4_address: 172.16.0.17
saya_today_web_listen_address: saya.uz
- saya_today_web_unix_sockets_mount: '/etc/sayauz'
stage:
hosts:
@@ -18,4 +17,3 @@ all:
saya_today_web_hostname: sayauz-stage
saya_today_web_ipv4_address: 172.16.0.18
saya_today_web_listen_address: stage.saya.uz
- saya_today_web_unix_sockets_mount: '/etc/sayauz'
diff --git a/deploy/playbook.yml b/deploy/playbook.yml
index 9719ed9..8fb9088 100644
--- a/deploy/playbook.yml
+++ b/deploy/playbook.yml
@@ -2,27 +2,9 @@
- name: Deploy saya-today-web Docker Container
hosts: all
remote_user: svc_github
-
- vars:
- docker_volumes:
- - "{{ saya_today_web_name }}-volume:/data:rw"
tasks:
- - name: Initialize Unix socket volume
- when: >-
- saya_today_web_unix_sockets_path is defined and
- saya_today_web_unix_sockets_path is string and
- saya_today_web_unix_sockets_path | length > 0
- block:
- - name: Ensure Unix socket volume exists
- community.docker.docker_volume:
- name: "sayana_sockets"
- - name: Include Unix socket volume in docker volumes list
- ansible.builtin.set_fact:
- docker_volumes: >-
- {{ docker_volumes + ["sayana_sockets:" ~ saya_today_web_unix_sockets_path ~ ":rw"] }}
-
- - name: Create a data volume
+ - name: Create a volume
community.docker.docker_volume:
name: "{{ saya_today_web_name }}-volume"
@@ -47,7 +29,8 @@
networks:
- name: caddy
ipv4_address: "{{ saya_today_web_ipv4_address }}"
- volumes: "{{ docker_volumes }}"
+ volumes:
+ - "{{ saya_today_web_name }}-volume:/data:rw"
restart_policy: unless-stopped
no_log: true
...
diff --git a/internal/router/router.go b/internal/router/router.go
index 14973ad..2b45761 100644
--- a/internal/router/router.go
+++ b/internal/router/router.go
@@ -433,7 +433,12 @@ func (r *Router) Close() (err error) {
}
slog.Debug("closing page cache")
r.supplements.PageCache.Close()
-
+ if r.endpoint.Type == "unix" {
+ slog.Debug("closing unix socket")
+ if err = os.Remove(r.endpoint.Config.(*config.UnixConfig).Path); err != nil {
+ allErrors = append(allErrors, fmt.Errorf("fail to close unix socket: %w", err))
+ }
+ }
return errors.Join(allErrors...)
}