はじめに
自分のサーバーへGLATasksをデプロイする手順。
デプロイ
前提条件
- Docker / Docker Composeがインストールされたサーバー
- HTTPS環境(リバースプロキシ等)
手順
リポジトリをクローン
bashgit clone https://github.com/ak110/GLATasks.git cd GLATasks.envを作成(.env-exampleを参考に)bashcp .env-example .envDATA_DIRにデータ保存先ディレクトリのパスを設定する(COMPOSE_PROFILEはproductionを推奨)起動
bashmake deployHTTPSでアクセスできるようリバースプロキシを設定 (設定例は外部リバースプロキシ設定を参照)
ブラウザでアクセスし、ユーザー登録してログイン
停止
bash
make stop更新
最新版に更新する場合:
bash
git pull
make deploy外部リバースプロキシ設定
Docker Composeの前段にLet's Encrypt証明書でHTTPS終端する外部nginxを配置する場合の設定要点。
mermaid
flowchart LR
Browser["ブラウザ"]
ExtNginx["外部 nginx\n(Let's Encrypt)"]
IntNginx["内部 nginx\n(自己署名 HTTPS, :38180)"]
SK["SvelteKit"]
Browser -- "HTTPS" --> ExtNginx
ExtNginx -- "HTTPS(proxy_ssl_*)" --> IntNginx
IntNginx --> SK設定上の制約:
- 内部nginxは自己署名HTTPSのため、
/api/eventsと/の両方にproxy_ssl_certificate/proxy_ssl_certificate_keyを指定する - SSE用の
/api/eventsにはproxy_buffering offに加えproxy_read_timeout 86400・proxy_http_version 1.1・Connection ''を指定する。 さらにX-Accel-Buffering: noヘッダーでレスポンスバッファも無効化する (SSEがバッファされると配信遅延が発生するため)
最小サンプル(要点のみ):
nginx
location /api/events {
proxy_pass https://app_backend;
proxy_http_version 1.1;
proxy_set_header Connection '';
proxy_ssl_certificate /path/to/glatasks/web/ssl/server.crt;
proxy_ssl_certificate_key /path/to/glatasks/web/ssl/server.key;
proxy_buffering off;
proxy_read_timeout 86400;
add_header X-Accel-Buffering no;
}
location / {
proxy_pass https://app_backend;
proxy_ssl_certificate /path/to/glatasks/web/ssl/server.crt;
proxy_ssl_certificate_key /path/to/glatasks/web/ssl/server.key;
}Host / X-Forwarded-For / X-Forwarded-Proto等の標準ヘッダーは通常通り設定する。