Skip to content

Commit 6215ef9

Browse files
committed
remove db/Dockerfile for connecting to db in ansible playbook, previously didn't set up correctly
1 parent 9900171 commit 6215ef9

File tree

3 files changed

+6
-51
lines changed

3 files changed

+6
-51
lines changed

ansible/roles/wordpress/tasks/main.yml

+5-6
Original file line numberDiff line numberDiff line change
@@ -42,23 +42,22 @@
4242
mode: '0755'
4343

4444
- name: check wordpress installed
45-
shell: sudo -u www-data /usr/local/bin/wp/wp-cli.phar --no-color --quiet core is-installed #$> /dev/null is supposed to silence stdout and stderr while keeping the return code, but for some reason this one also gets rid of the return code
46-
ignore_errors: true
45+
shell: sudo -u www-data /usr/local/bin/wp/wp-cli.phar --no-color --quiet core is-installed
4746
args:
4847
chdir: /var/www/dev
4948
register: wp_installed
49+
ignore_errors: yes
5050

51-
# Currently not working because web-dev is running the server with www-data user which cannot connect to the db because www-data does not have access to the environment variables passed from docker. Only root has access to those environment variables. And because it cannot connect to the DB, this step always fails when trying to check if wordpress is installed
52-
- name: Use WP_CLI to install wordpress
53-
shell: sudo -u www-data /usr/local/bin/wp/wp-cli.phar core download --version={{wp_version}}
51+
- name: Use WP_CLI to install WordPress
52+
shell: sudo -E -u www-data /usr/local/bin/wp/wp-cli.phar core download --version={{wp_version}}
5453
when: wp_installed.rc != 0
5554
args:
5655
chdir: /var/www/dev
5756
vars:
5857
wp_version: 6.3.4
5958

6059
# Download wp-config-docker.php for use as wp-config.php
61-
- name: WordPress basic configuration step 1
60+
- name: WordPress basic configuration
6261
get_url:
6362
url: https://raw.githubusercontent.com/docker-library/wordpress/master/latest/php8.2/apache/wp-config-docker.php
6463
dest: /var/www/dev/wp-config.php

db/Dockerfile

-35
This file was deleted.

docker-compose.yml

+1-10
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,8 @@ services:
6666

6767
db-dev:
6868
container_name: db-dev
69-
build:
70-
context: .
71-
dockerfile: db/Dockerfile
69+
image: mariadb
7270
environment:
73-
USER: sysadmin
7471
MYSQL_DATABASE: wordpress
7572
MYSQL_ROOT_PASSWORD: root
7673
MYSQL_USER: root
@@ -79,12 +76,6 @@ services:
7976
restart: on-failure
8077
ports:
8178
- "3306:3306"
82-
- "22003:22"
83-
volumes:
84-
- db-data:/var/lib/mysql
85-
- ./sysadmin-ssh-keys/rsa_sysadmin:/home/sysadmin/.ssh/id_rsa:ro
86-
- ./sysadmin-ssh-keys/rsa_sysadmin.pub:/home/sysadmin/.ssh/id_rsa.pub:ro
87-
- ./sysadmin-ssh-keys/rsa_sysadmin.pub:/home/sysadmin/.ssh/authorized_keys:ro
8879

8980
volumes:
9081
db-data:

0 commit comments

Comments
 (0)