Skip to content
This repository has been archived by the owner on Mar 26, 2024. It is now read-only.

Commit

Permalink
Test update
Browse files Browse the repository at this point in the history
  • Loading branch information
wpdevenv authored Aug 4, 2023
1 parent 1fef6b0 commit 0215661
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 16 deletions.
4 changes: 3 additions & 1 deletion src/wp-mysql/.devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ ARG WP_PATH
# Create the user
RUN groupadd --gid $USER_GID vscode \
&& useradd -s /bin/bash --uid $USER_UID --gid $USER_GID -m vscode \
&& usermod -a -G www-data vscode
&& usermod -a -G www-data vscode \
&& usermod -a -G sudo vscode \
&& echo "vscode ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/vscode

RUN ln -s /workspace/release $WP_PATH

Expand Down
17 changes: 4 additions & 13 deletions src/wp-mysql/NOTES.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,15 @@
This template references an image that was [pre-built](https://containers.dev/implementors/reference/#prebuilding) to automatically include needed devcontainer.json metadata.
This template references an image that was [pre-built](https://containers.dev/implementors/reference/#prebuilding) to automatically include needed devcontainer.json metadata

* **Image**: mcr.microsoft.com/devcontainers/php ([source](https://github.com/devcontainers/images/tree/main/src/php))
* **Applies devcontainer.json contents from image**: Yes ([source](https://github.com/devcontainers/images/blob/main/src/php/.devcontainer/devcontainer.json))

## Using this template

This template creates two containers, one for PHP and one for MariaDB. You will be connected to the PHP container, and from within that container the MariabDB container will be available on **`localhost`** port 3305. The MariaDB database has a default password of `mariadb` and you can update MariaDB parameters by updating the `.devcontainer/docker-compose.yml` file.
This template creates two containers, one for PHP and one for MySQL. You will be connected to the PHP container. The MySQL database has a default password of `wordpress` and you can update MySQL parameters by updating the `.devcontainer/docker-compose.yml` file.

While the template itself works unmodified, it uses the `mcr.microsoft.com/devcontainers/php` image which includes `git`, a non-root `vscode` user with `sudo` access, and a set of common dependencies and Python tools for development.
The template uses the `wpdevenv/php` image which includes `git`. This template add a non-root `vscode` user with `sudo` access.

You can connect to MariaDB from an external tool when connected to the Dev Container from a local tool by updating `.devcontainer/devcontainer.json` as follows:

```json
"forwardPorts": [ "3306" ]
```

Once the MariaDB container has port forwarding enabled, it will be accessible from the Host machine at `localhost:3306`. The [MariaDB Documentation](https://mariadb.com/docs/) has:

1. [An Installation Guide for MySQL](https://mariadb.com/kb/en/mysql-client/), a CLI tool to work with a MariaDB database.
2. [Tips on populating data](https://mariadb.com/kb/en/how-to-quickly-insert-data-into-mariadb/) in the database.
You can connect to MySQL from an external tool, it will be accessible from the Host machine at `localhost:9030`

### Adding another service

Expand Down
3 changes: 1 addition & 2 deletions test/wp-mysql/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ cd $(dirname "$0")
source test-utils.sh

# Template specific tests
check "distro" lsb_release -c
check "wp" "cat /var/www/html/wp-config.php | grep SCRIPT_DEBUG"
check "wp" grep -wq "SCRIPT_DEBUG" /var/www/html/wp-config.php

# Report result
reportResults

0 comments on commit 0215661

Please sign in to comment.