Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix default host resolution #628

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Conversation

rmccue
Copy link
Member

@rmccue rmccue commented Sep 2, 2023

Fixes #627

This should never be the hostname, always the docker-compose project
name!
This was a badly named environment variable only added for our host
name, but is not related to docker-compose, so we should avoid using a
prefix that isn't ours.
@rmccue rmccue requested a review from joehoyle September 2, 2023 15:37
@mikelittle
Copy link
Contributor

@rmccue
This isn't working for me. I tried it after composer server destroy and checking out this branch in packages/local-server
I got this message during composer server start

 ⠿ Container product-dev-kibana     Started                                                                                                                                                             14.1s
 ⠿ Container product-dev-cavalcade  Started                                                                                                                                                             14.2s
 ⠿ Container product-dev-nginx      Started                                                                                                                                                             14.7s
Error: Site 'product-dev.altis.dev' not found. Define DOMAIN_CURRENT_SITE in 'wp-config.php' or use `--url=<url>` to override.
WordPress install failed. Exited with error code 1

Running it a second time seems to complete successfully. However, trying to access https://product-dev.altis.dev/ redirects to https://example.com

Running env | sort inside composer server shell results in

$ composer server shell
www-data@8dce7aab6a63:/usr/src/app$ env | sort
ALTIS_ANALYTICS_COGNITO_ENDPOINT=https://cognito-product-dev.altis.dev
ALTIS_ANALYTICS_PINPOINT_ENDPOINT=https://pinpoint-product-dev.altis.dev
ALTIS_DEFAULT_HOST=product-dev.altis.dev
AWS_XRAY_DAEMON_HOST=xray
COLUMNS=206
COMPOSE_PROJECT_NAME=product-dev
DB_HOST=db
DB_NAME=wordpress
DB_PASSWORD=wordpress
DB_READ_REPLICA_HOST=db-read-replica
DB_USER=wordpress
ELASTICSEARCH_HOST=elasticsearch
ELASTICSEARCH_PORT=9200
HM_DEPLOYMENT_REVISION=dev
HM_ENV_ARCHITECTURE=local-server
HOME=/var/www
HOSTNAME=8dce7aab6a63
HOST_PATH=/Users/mikelittle/sandbox/02-Altis-Repos/product-dev
LINES=106
PAGER=more
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PHP_CLI_INI_FILE=/usr/local/etc/php/php-cli.ini
PHP_FPM_CONF_FILE=/usr/local/etc/php-fpm.conf
PHP_FPM_INI_FILE=/usr/local/etc/php/php-fpm-fcgi.ini
PHP_FPM_POOL_CONF_FILE=/usr/local/etc/php-fpm.d/www.conf
PHP_IDE_CONFIG=serverName=product-dev.altis.dev
PHP_INI_FILE=/usr/local/etc/php/conf.d/common.ini
PHP_SENDMAIL_PATH=/bin/false
PWD=/usr/src/app
REDIS_HOST=redis
REDIS_PORT=6379
S3_CONSOLE_URL=https://s3-console-product-dev.altis.dev
S3_UPLOADS_BUCKET=s3-product-dev
S3_UPLOADS_BUCKET_URL=https://s3-product-dev.altis.dev
S3_UPLOADS_ENDPOINT=https://s3-product-dev.altis.dev/s3-product-dev/
S3_UPLOADS_KEY=admin
S3_UPLOADS_REGION=us-east-1
S3_UPLOADS_SECRET=password
SHLVL=0
TACHYON_URL=https://product-dev.altis.dev/tachyon
TERM=xterm
WP_DEBUG=1
WP_DEBUG_DISPLAY=0
XDEBUG_CONFIG=client_host=host.docker.internal
XDEBUG_MODE=off
XDEBUG_SESSION=product-dev.altis.dev
_=/usr/bin/env

Running wp in that shell still gives

www-data@8dce7aab6a63:/usr/src/app$ wp
Error: Site 'product-dev.altis.dev' not found. Define DOMAIN_CURRENT_SITE in 'wp-config.php' or use `--url=<url>` to override.

And now wp is broken from the host

$ composer server cli -- post list
Error: Site 'product-dev.altis.dev' not found. Define DOMAIN_CURRENT_SITE in 'wp-config.php' or use `--url=<url>` to override.

Your changes have worked in the definition of docker-compose, but there must be somewhere else that needs changing.

@rmccue
Copy link
Member Author

rmccue commented Sep 4, 2023

Hmm, this seems like a broken install step, possible that the installer is being run somewhere where things aren't properly defined 🤔

@joehoyle
Copy link
Member

joehoyle commented Sep 4, 2023

Is it possible wp install doesn't take from HTTP_HOST? maybe that's a specific / special use of the flag in wp core install.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

COMPOSE_PROJECT_NAME is set incorrectly in shell
3 participants