diff options
Diffstat (limited to 'photo.jinwei.me/config/roles/wordpress')
6 files changed, 57 insertions, 0 deletions
diff --git a/photo.jinwei.me/config/roles/wordpress/Dockerfile b/photo.jinwei.me/config/roles/wordpress/Dockerfile new file mode 100644 index 0000000..34704c0 --- /dev/null +++ b/photo.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/photo.jinwei.me/config/roles/wordpress/build.sh b/photo.jinwei.me/config/roles/wordpress/build.sh new file mode 100755 index 0000000..55d7c0e --- /dev/null +++ b/photo.jinwei.me/config/roles/wordpress/build.sh | |||
@@ -0,0 +1,5 @@ | |||
1 | docker_repo=docker.io/clarkzjw | ||
2 | docker_image=wordpress | ||
3 | docker_image_tag=$(date -u +%Y%m%d) | ||
4 | sudo docker build -t $docker_repo/$docker_image:"$docker_image_tag" . | ||
5 | sudo docker push $docker_repo/$docker_image:"$docker_image_tag" | ||
diff --git a/photo.jinwei.me/config/roles/wordpress/defaults/main.yaml b/photo.jinwei.me/config/roles/wordpress/defaults/main.yaml new file mode 100644 index 0000000..250e0a5 --- /dev/null +++ b/photo.jinwei.me/config/roles/wordpress/defaults/main.yaml | |||
@@ -0,0 +1,4 @@ | |||
1 | wordpress_image: clarkzjw/wordpress | ||
2 | wordpress_image_tag: 20221211 | ||
3 | wordpress_port: 30080 | ||
4 | wordpress_home: /opt/wordpress | ||
diff --git a/photo.jinwei.me/config/roles/wordpress/tasks/main.yaml b/photo.jinwei.me/config/roles/wordpress/tasks/main.yaml new file mode 100644 index 0000000..3835145 --- /dev/null +++ b/photo.jinwei.me/config/roles/wordpress/tasks/main.yaml | |||
@@ -0,0 +1,16 @@ | |||
1 | - name: Pull wordpress Docker image | ||
2 | community.docker.docker_image: | ||
3 | name: "{{ wordpress_image }}:{{ wordpress_image_tag }}" | ||
4 | source: pull | ||
5 | |||
6 | - name: render config file | ||
7 | template: | ||
8 | src: docker-compose.yaml.j2 | ||
9 | dest: "{{ wordpress_home }}/docker-compose.yaml" | ||
10 | mode: 0644 | ||
11 | |||
12 | - name: Start wordpress container using docker-compose | ||
13 | community.docker.docker_compose: | ||
14 | project_name: wordpress | ||
15 | project_src: "{{ wordpress_home }}" | ||
16 | register: output | ||
diff --git a/photo.jinwei.me/config/roles/wordpress/templates/docker-compose.yaml.j2 b/photo.jinwei.me/config/roles/wordpress/templates/docker-compose.yaml.j2 new file mode 100644 index 0000000..447b80b --- /dev/null +++ b/photo.jinwei.me/config/roles/wordpress/templates/docker-compose.yaml.j2 | |||
@@ -0,0 +1,22 @@ | |||
1 | version: '3' | ||
2 | services: | ||
3 | cloudflared: | ||
4 | image: cloudflare/cloudflared | ||
5 | container_name: cloudflare-tunnel | ||
6 | network_mode: host | ||
7 | restart: always | ||
8 | command: tunnel run | ||
9 | environment: | ||
10 | - TUNNEL_TOKEN={{ lookup('aws_ssm', '/jinwei-me/cloudflare/tunnel_token') }} | ||
11 | wordpress: | ||
12 | image: "{{ wordpress_image }}:{{ wordpress_image_tag }}" | ||
13 | volumes: | ||
14 | - "{{ wordpress_home }}/wp-content:/var/www/html/wp-content" | ||
15 | restart: always | ||
16 | ports: | ||
17 | - 30081:80 | ||
18 | environment: | ||
19 | - WORDPRESS_DB_HOST={{ lookup('aws_ssm', '/jinwei-me/mysql/host') }}:{{ lookup('aws_ssm', '/jinwei-me/mysql/port') }} | ||
20 | - WORDPRESS_DB_USER={{ lookup('aws_ssm', '/jinwei-me/mysql/username') }} | ||
21 | - WORDPRESS_DB_PASSWORD={{ lookup('aws_ssm', '/jinwei-me/mysql/password') }} | ||
22 | - WORDPRESS_DB_NAME={{ lookup('aws_ssm', '/jinwei-me/mysql/name') }} | ||
diff --git a/photo.jinwei.me/config/roles/wordpress/uploads.ini b/photo.jinwei.me/config/roles/wordpress/uploads.ini new file mode 100644 index 0000000..cd6e86c --- /dev/null +++ b/photo.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 | ||