diff options
-rw-r--r-- | jinwei.me/config/roles/wordpress/Dockerfile | 5 | ||||
-rw-r--r-- | jinwei.me/config/roles/wordpress/tasks/main.yaml | 29 | ||||
-rw-r--r-- | jinwei.me/config/roles/wordpress/uploads.ini | 5 | ||||
-rw-r--r-- | jinwei.me/infra/cloudflare.tf | 4 |
4 files changed, 41 insertions, 2 deletions
diff --git a/jinwei.me/config/roles/wordpress/Dockerfile b/jinwei.me/config/roles/wordpress/Dockerfile new file mode 100644 index 0000000..34704c0 --- /dev/null +++ b/jinwei.me/config/roles/wordpress/Dockerfile | |||
@@ -0,0 +1,5 @@ | |||
1 | FROM wordpress:apache | ||
2 | |||
3 | RUN apt-get update -y && apt-get install -y libgmp-dev && docker-php-ext-install gmp | ||
4 | |||
5 | ADD uploads.ini /usr/local/etc/php/conf.d/uploads.ini | ||
diff --git a/jinwei.me/config/roles/wordpress/tasks/main.yaml b/jinwei.me/config/roles/wordpress/tasks/main.yaml new file mode 100644 index 0000000..51e1a2b --- /dev/null +++ b/jinwei.me/config/roles/wordpress/tasks/main.yaml | |||
@@ -0,0 +1,29 @@ | |||
1 | - name: Pull wordpress Docker image | ||
2 | community.docker.docker_image: | ||
3 | name: "{{ wordpress_image }}:{{ wordpress_image_tag }}" | ||
4 | source: pull | ||
5 | |||
6 | - name: Start wordpress container using docker-compose | ||
7 | community.docker.docker_compose: | ||
8 | project_name: wordpress | ||
9 | definition: | ||
10 | version: '3' | ||
11 | services: | ||
12 | cloudflared: | ||
13 | image: cloudflare/cloudflared | ||
14 | container_name: cloudflare-tunnel | ||
15 | restart: always | ||
16 | command: tunnel run | ||
17 | environment: | ||
18 | - TUNNEL_TOKEN={{ cloudflared_tunnel_token }} | ||
19 | wordpress: | ||
20 | image: "{{ wordpress_image }}:{{ wordpress_image_tag }}" | ||
21 | volumes: | ||
22 | - "{{ wordpress_home }}/wp-content:/var/www/html/wp-content" | ||
23 | restart: always | ||
24 | environment: | ||
25 | - WORDPRESS_DB_HOST={{ wordpress_db_host }} | ||
26 | - WORDPRESS_DB_USER={{ wordpress_db_user }} | ||
27 | - WORDPRESS_DB_PASSWORD={{ wordpress_db_password }} | ||
28 | - WORDPRESS_DB_NAME={{ wordpress_db_name }} | ||
29 | register: output | ||
diff --git a/jinwei.me/config/roles/wordpress/uploads.ini b/jinwei.me/config/roles/wordpress/uploads.ini new file mode 100644 index 0000000..cd6e86c --- /dev/null +++ b/jinwei.me/config/roles/wordpress/uploads.ini | |||
@@ -0,0 +1,5 @@ | |||
1 | file_uploads = On | ||
2 | post_max_size = 100M | ||
3 | upload_max_filesize = 100M | ||
4 | memory_limit = 512M | ||
5 | max_execution_time = 600 | ||
diff --git a/jinwei.me/infra/cloudflare.tf b/jinwei.me/infra/cloudflare.tf index 1d8ebdc..6e9660e 100644 --- a/jinwei.me/infra/cloudflare.tf +++ b/jinwei.me/infra/cloudflare.tf | |||
@@ -29,7 +29,7 @@ resource "cloudflare_argo_tunnel" "tunnel" { | |||
29 | 29 | ||
30 | resource "cloudflare_record" "tunnel_dns" { | 30 | resource "cloudflare_record" "tunnel_dns" { |
31 | zone_id = data.cloudflare_zones.domain.zones[0].id | 31 | zone_id = data.cloudflare_zones.domain.zones[0].id |
32 | name = "next.${var.site_domain}" | 32 | name = var.site_domain |
33 | value = "${cloudflare_argo_tunnel.tunnel.id}.cfargotunnel.com" | 33 | value = "${cloudflare_argo_tunnel.tunnel.id}.cfargotunnel.com" |
34 | type = "CNAME" | 34 | type = "CNAME" |
35 | proxied = true | 35 | proxied = true |
@@ -41,7 +41,7 @@ resource "cloudflare_tunnel_config" "tunnel_route" { | |||
41 | 41 | ||
42 | config { | 42 | config { |
43 | ingress_rule { | 43 | ingress_rule { |
44 | hostname = "next.jinwei.me" | 44 | hostname = "jinwei.me" |
45 | path = "/" | 45 | path = "/" |
46 | service = "http://wordpress:80" | 46 | service = "http://wordpress:80" |
47 | } | 47 | } |