aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorclarkzjw <[email protected]>2023-01-01 21:08:22 -0800
committerclarkzjw <[email protected]>2023-01-01 21:08:22 -0800
commite13d4b448efd7174b1b4c8723cbc8be845470c60 (patch)
treec797ae22f1b2261b40c084e22c1e52dab39a6f2e /photo.jinwei.me/config/roles/wordpress
parente330106e9e6524fc76c407aa608a60ccef83bbe4 (diff)
downloadjinwei.me-e13d4b448efd7174b1b4c8723cbc8be845470c60.tar.gz
Diffstat (limited to 'photo.jinwei.me/config/roles/wordpress')
-rw-r--r--photo.jinwei.me/config/roles/wordpress/Dockerfile5
-rwxr-xr-xphoto.jinwei.me/config/roles/wordpress/build.sh5
-rw-r--r--photo.jinwei.me/config/roles/wordpress/defaults/main.yaml4
-rw-r--r--photo.jinwei.me/config/roles/wordpress/tasks/main.yaml16
-rw-r--r--photo.jinwei.me/config/roles/wordpress/templates/docker-compose.yaml.j222
-rw-r--r--photo.jinwei.me/config/roles/wordpress/uploads.ini5
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 @@
1FROM wordpress:apache
2
3RUN apt-get update -y && apt-get install -y libgmp-dev && docker-php-ext-install gmp
4
5ADD 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 @@
1docker_repo=docker.io/clarkzjw
2docker_image=wordpress
3docker_image_tag=$(date -u +%Y%m%d)
4sudo docker build -t $docker_repo/$docker_image:"$docker_image_tag" .
5sudo 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 @@
1wordpress_image: clarkzjw/wordpress
2wordpress_image_tag: 20221211
3wordpress_port: 30080
4wordpress_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 @@
1version: '3'
2services:
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 @@
1file_uploads = On
2post_max_size = 100M
3upload_max_filesize = 100M
4memory_limit = 512M
5max_execution_time = 600
Powered by cgit v1.2.3 (git 2.41.0)