0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Kamal 2でwordpressをVPSにデプロイ

Last updated at Posted at 2025-03-12

VPSにKamalでWordpressをデプロイしました。
その設定ファイルです。
ヘルスチェックを解決しないといけないので、Dockerfileでヘルスチェック用のPHPをアップしています。

Dockerfile
FROM wordpress:latest
COPY up.php /var/www/html/up.php
EXPOSE 80
deploy.yml
service: xxxxxx_com_wp
 
image: xxxxxx/xxxxxx_com_wp
registry:
  username: xxxxxx
  password:
    - KAMAL_REGISTRY_PASSWORD
servers:
  web:
    hosts:
      - {IP}
proxy:
  ssl: true
  app_port: 80
  host: {ホスト}
  healthcheck:
    path: /up.php

builder:
  arch: amd64    
env:
  clear:
    WORDPRESS_DB_HOST: xxxxxx_com_wp-db # サービス名-アクセサリ名
    WORDPRESS_DB_NAME: wordpress
    WORDPRESS_DB_USER: example
    WORDPRESS_DB_PASSWORD: examplepassword
# volumes:
#   - "wordpress:/var/www/html"
accessories:
  db:
    image: mysql:8.4
    host: {IP}
    env:
      MYSQL_DATABASE: wordpress
      MYSQL_USER: example
      MYSQL_PASSWORD: examplepassword
      MYSQL_RANDOM_ROOT_PASSWORD: '1'
    directories:
      - data:/var/lib/mysql
up.php
<?php
header('Content-Type: application/json');
http_response_code(200);
echo json_encode(['healthy' => true]);
exit;

ハマったのはさくらVPSだとなぜかdbに接続できない…設定の問題なんだろうけれど…

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?