From 43e300d147a9554ae4ae5e45610c71edba2e635f Mon Sep 17 00:00:00 2001 From: clarkzjw Date: Sun, 11 Dec 2022 03:23:21 -0800 Subject: infra: change domain to jinwei.me --- jinwei.me/config/roles/wordpress/Dockerfile | 5 ++++ jinwei.me/config/roles/wordpress/tasks/main.yaml | 29 ++++++++++++++++++++++++ jinwei.me/config/roles/wordpress/uploads.ini | 5 ++++ jinwei.me/infra/cloudflare.tf | 4 ++-- 4 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 jinwei.me/config/roles/wordpress/Dockerfile create mode 100644 jinwei.me/config/roles/wordpress/tasks/main.yaml create mode 100644 jinwei.me/config/roles/wordpress/uploads.ini 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 @@ +FROM wordpress:apache + +RUN apt-get update -y && apt-get install -y libgmp-dev && docker-php-ext-install gmp + +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 @@ +- name: Pull wordpress Docker image + community.docker.docker_image: + name: "{{ wordpress_image }}:{{ wordpress_image_tag }}" + source: pull + +- name: Start wordpress container using docker-compose + community.docker.docker_compose: + project_name: wordpress + definition: + version: '3' + services: + cloudflared: + image: cloudflare/cloudflared + container_name: cloudflare-tunnel + restart: always + command: tunnel run + environment: + - TUNNEL_TOKEN={{ cloudflared_tunnel_token }} + wordpress: + image: "{{ wordpress_image }}:{{ wordpress_image_tag }}" + volumes: + - "{{ wordpress_home }}/wp-content:/var/www/html/wp-content" + restart: always + environment: + - WORDPRESS_DB_HOST={{ wordpress_db_host }} + - WORDPRESS_DB_USER={{ wordpress_db_user }} + - WORDPRESS_DB_PASSWORD={{ wordpress_db_password }} + - WORDPRESS_DB_NAME={{ wordpress_db_name }} + 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 @@ +file_uploads = On +post_max_size = 100M +upload_max_filesize = 100M +memory_limit = 512M +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" { resource "cloudflare_record" "tunnel_dns" { zone_id = data.cloudflare_zones.domain.zones[0].id - name = "next.${var.site_domain}" + name = var.site_domain value = "${cloudflare_argo_tunnel.tunnel.id}.cfargotunnel.com" type = "CNAME" proxied = true @@ -41,7 +41,7 @@ resource "cloudflare_tunnel_config" "tunnel_route" { config { ingress_rule { - hostname = "next.jinwei.me" + hostname = "jinwei.me" path = "/" service = "http://wordpress:80" } -- cgit v1.2.3