Skip to content

Commit

Permalink
[#1436] Renamed mariadb to database service.
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexSkrypnyk committed Dec 11, 2024
1 parent b94cc08 commit 0cfee4c
Show file tree
Hide file tree
Showing 24 changed files with 284 additions and 223 deletions.
10 changes: 5 additions & 5 deletions .ahoy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ commands:
usage: Show information about this project.
cmd: |
COMPOSE_PROJECT_NAME=${COMPOSE_PROJECT_NAME:-${PWD##*/}} \
VORTEX_HOST_DB_PORT=$(docker compose port mariadb 3306 2>/dev/null | cut -d : -f 2) \
VORTEX_HOST_DB_PORT=$(docker compose port database 3306 2>/dev/null | cut -d : -f 2) \
VORTEX_HOST_SOLR_PORT=$(docker compose port solr 8983 2>/dev/null | cut -d : -f 2) \
VORTEX_HOST_SELENIUM_VNC_PORT=$(docker compose port chrome 7900 2>/dev/null | cut -d : -f 2) \
VORTEX_HOST_HAS_SEQUELACE=$(uname -a | grep -i -q darwin && mdfind -name 'Sequel Ace' 2>/dev/null | grep -q "Ace" && echo 1 || true) \
Expand All @@ -45,8 +45,8 @@ commands:
usage: Open DB in Sequel Ace.
cmd: |
uname -a | grep -i -q darwin && mdfind -name 'Sequel Ace' 2>/dev/null |grep -q "Ace" \
&& VORTEX_HOST_DB_PORT="$(docker port $(docker compose ps -q mariadb 2>/dev/null) 3306 2>/dev/null | cut -d : -f 2)" \
&& open "mysql://${MARIADB_USERNAME:-drupal}:${MARIADB_PASSWORD:-drupal}@127.0.0.1:${VORTEX_HOST_DB_PORT}/drupal" -a "Sequel Ace" \
&& VORTEX_HOST_DB_PORT="$(docker port $(docker compose ps -q database 2>/dev/null) 3306 2>/dev/null | cut -d : -f 2)" \
&& open "mysql://${DATABASE_USERNAME:-drupal}:${DATABASE_PASSWORD:-drupal}@127.0.0.1:${VORTEX_HOST_DB_PORT}/drupal" -a "Sequel Ace" \
|| echo "Not a supported OS or Sequel Ace is not installed."
# ----------------------------------------------------------------------------
Expand Down Expand Up @@ -135,8 +135,8 @@ commands:
usage: Reload the database container using local database image.
cmd: |
ahoy confirm "Running this command will replace your current database. Are you sure?" &&
docker compose rm --force --stop --volumes mariadb && \
ahoy up -- --build mariadb && \
docker compose rm --force --stop --volumes database && \
ahoy up -- --build database && \
ahoy up wait_dependencies && \
sleep 15 && \
ahoy provision && \
Expand Down
2 changes: 1 addition & 1 deletion .docker/cli.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ ENV DRUPAL_CONFIG_PATH=${DRUPAL_CONFIG_PATH}
ENV WEBROOT=${WEBROOT} \
COMPOSER_ALLOW_SUPERUSER=1 \
COMPOSER_CACHE_DIR=/tmp/.composer/cache \
SIMPLETEST_DB=mysql://drupal:drupal@mariadb/drupal \
SIMPLETEST_DB=mysql://drupal:drupal@database/drupal \
SIMPLETEST_BASE_URL=http://nginx:8080 \
SYMFONY_DEPRECATIONS_HELPER=disabled

Expand Down
2 changes: 1 addition & 1 deletion .docker/mariadb.dockerfile → .docker/database.dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# MariaDB container.
# Database container.
#
# @see https://hub.docker.com/r/uselagoon/mariadb-10.11-drupal/tags
# @see https://github.com/uselagoon/lagoon-images/tree/main/images/mariadb-drupal
Expand Down
1 change: 1 addition & 0 deletions .vortex/docs/.utils/update-docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ sed "${sed_opts[@]}" "s/.vortex\/docs\/.utils\/variables\/extra\/acquia.variable
sed "${sed_opts[@]}" "s/.vortex\/docs\/.utils\/variables\/extra\/lagoon.variables.sh/LAGOON ENVIRONMENT/g" "${OUTPUT_FILE}"
sed "${sed_opts[@]}" "s/.vortex\/docs\/.utils\/variables\/extra\/.env.local.example.variables.sh/.env.local.example/g" "${OUTPUT_FILE}"
sed "${sed_opts[@]}" "s/.vortex\/docs\/.utils\/variables\/extra\/.env.variables.sh/.env/g" "${OUTPUT_FILE}"
sed "${sed_opts[@]}" "s/.vortex\/docs\/.utils\/variables\/extra\/docker-compose.variables.sh/docker-compose.yml/g" "${OUTPUT_FILE}"
sed "${sed_opts[@]}" "s/.vortex\/docs\/.utils\/variables\/extra\/ci.variables.sh/CI config/g" "${OUTPUT_FILE}"

echo "---" >>"${OUTPUT_FILE}"
Expand Down
9 changes: 0 additions & 9 deletions .vortex/docs/.utils/variables/extra/.env.variables.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,3 @@ VORTEX_COMPOSER_VERBOSE=1

# Print output from NPM install.
VORTEX_NPM_VERBOSE=0

# Path to public files.
DRUPAL_PUBLIC_FILES="${DRUPAL_PUBLIC_FILES:-./${VORTEX_WEBROOT}/sites/default/files}"

# Path to private files.
DRUPAL_PRIVATE_FILES="${DRUPAL_PRIVATE_FILES:-${DRUPAL_PUBLIC_FILES}/private}"

# Path to temporary files.
DRUPAL_TEMPORARY_FILES="${DRUPAL_TEMPORARY_FILES:-${DRUPAL_PRIVATE_FILES}/tmp}"
29 changes: 29 additions & 0 deletions .vortex/docs/.utils/variables/extra/docker-compose.variables.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env bash
##
# Additional environment variables used in this project in docker-compose.yml
#
# shellcheck disable=SC2034

# Path to public files.
DRUPAL_PUBLIC_FILES="${DRUPAL_PUBLIC_FILES:-./${VORTEX_WEBROOT}/sites/default/files}"

# Path to private files.
DRUPAL_PRIVATE_FILES="${DRUPAL_PRIVATE_FILES:-${DRUPAL_PUBLIC_FILES}/private}"

# Path to temporary files.
DRUPAL_TEMPORARY_FILES="${DRUPAL_TEMPORARY_FILES:-${DRUPAL_PRIVATE_FILES}/tmp}"

# Local database host.
DATABASE_HOST=database

# Local database name.
DATABASE_NAME=drupal

# Local database user.
DATABASE_USERNAME=drupal

# Local database password.
DATABASE_PASSWORD=drupal

# Local database port.
DATABASE_PORT=3306
4 changes: 2 additions & 2 deletions .vortex/docs/content/tools/docker.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,9 @@ Vortex:
different from the `cli` container in that it does not have certain
development dependencies installed, has a smaller size and is optimised for
scalability.
- `mariadb` - a container that runs a database server. This container is used to
- `database` - a container that runs a database server. This container is used to
store the application data. It can be accessed from the host via a randomly
assigned port - run `docker compose port mariadb 3306` to get the port number.
assigned port - run `docker compose port database 3306` to get the port number.
- `redis` - an optional container that runs a Redis server. This container is
used to store the application cache.
- `solr` - an optional container that runs a Solr server. This container is used
Expand Down
48 changes: 44 additions & 4 deletions .vortex/docs/content/workflows/variables.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,46 @@ Default value: `UNDEFINED`

Defined in: `ENVIRONMENT`

### `DATABASE_HOST`

Local database host.

Default value: `database`

Defined in: `docker-compose.yml`, `scripts/vortex/info.sh`

### `DATABASE_NAME`

Local database name.

Default value: `drupal`

Defined in: `docker-compose.yml`

### `DATABASE_PASSWORD`

Local database password.

Default value: `drupal`

Defined in: `docker-compose.yml`, `scripts/vortex/info.sh`

### `DATABASE_PORT`

Local database port.

Default value: `3306`

Defined in: `docker-compose.yml`, `scripts/vortex/info.sh`

### `DATABASE_USERNAME`

Local database user.

Default value: `drupal`

Defined in: `docker-compose.yml`, `scripts/vortex/info.sh`

### `DRUPAL_ADMIN_EMAIL`

Drupal admin email. May need to be reset if database was sanitized.
Expand Down Expand Up @@ -94,7 +134,7 @@ Path to private files.

Default value: `${DRUPAL_PUBLIC_FILES}/private`

Defined in: `.env`
Defined in: `docker-compose.yml`

### `DRUPAL_PROFILE`

Expand All @@ -110,7 +150,7 @@ Path to public files.

Default value: `./${VORTEX_WEBROOT}/sites/default/files`

Defined in: `.env`
Defined in: `docker-compose.yml`

### `DRUPAL_REDIS_ENABLED`

Expand Down Expand Up @@ -158,7 +198,7 @@ Path to temporary files.

Default value: `${DRUPAL_PRIVATE_FILES}/tmp`

Defined in: `.env`
Defined in: `docker-compose.yml`

### `DRUPAL_THEME`

Expand Down Expand Up @@ -644,7 +684,7 @@ Defined in: `scripts/vortex/export-db-image.sh`

The service name to capture.

Default value: `mariadb`
Default value: `database`

Defined in: `scripts/vortex/export-db-image.sh`

Expand Down
2 changes: 1 addition & 1 deletion .vortex/tests/bats/_helper.bash
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ assert_files_present_vortex() {
pushd "${dir}" >/dev/null || exit 1

assert_file_exists ".docker/cli.dockerfile"
assert_file_exists ".docker/mariadb.dockerfile"
assert_file_exists ".docker/database.dockerfile"
assert_file_exists ".docker/nginx-drupal.dockerfile"
assert_file_exists ".docker/php.dockerfile"
assert_file_exists ".docker/solr.dockerfile"
Expand Down
6 changes: 3 additions & 3 deletions .vortex/tests/bats/_helper.workflow.bash
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ assert_timezone() {
assert_output_contains "AE"
run docker compose exec nginx date
assert_output_contains "AE"
run docker compose exec mariadb date
run docker compose exec database date
assert_output_contains "AE"

# Add variable to the .env file and apply the change to container.
Expand All @@ -254,7 +254,7 @@ assert_timezone() {
assert_output_contains "AWST"
run docker compose exec nginx date
assert_output_contains "AWST"
run docker compose exec mariadb date
run docker compose exec database date
assert_output_contains "AWST"

# Restore file, apply changes and assert that original behaviour has been restored.
Expand Down Expand Up @@ -293,7 +293,7 @@ assert_ahoy_info() {
assert_output_contains "Docker Compose project name : star_wars"
assert_output_contains "Site local URL : http://star_wars.docker.amazee.io"
assert_output_contains "Path to web root : /app/${webroot}"
assert_output_contains "DB host : mariadb"
assert_output_contains "DB host : database"
assert_output_contains "DB username : drupal"
assert_output_contains "DB password : drupal"
assert_output_contains "DB port : 3306"
Expand Down
Loading

1 comment on commit 0cfee4c

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.