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

Setup local docker-compose install #4

Open
jeffcullis opened this issue Apr 5, 2021 · 4 comments
Open

Setup local docker-compose install #4

jeffcullis opened this issue Apr 5, 2021 · 4 comments

Comments

@jeffcullis
Copy link

Working through the docker-compose setup instructions in the current dockerinstall branch.

@jeffcullis
Copy link
Author

jeffcullis commented Apr 5, 2021

Using Windows install via WSL2 (Ubuntu)

Following steps here:
https://github.com/cioos-siooc/cioos-siooc-wordpress/tree/dockerinstall

Setup .env file as specified.

Ran docker-compose up.

  • PHP admin page and login worked
  • The WP-CLI failed to start.
  • Wordpress had an error stating it couldn't find versions.php.

Connected to WP container and linked in the fixed location of the wp-includes:
ln -s /usr/src/wordpress/wp-includes/ /var/www/html/wp-includes

After this could start WP. However

Added a couple of changes to the docker-compose.yml based on
https://stackoverflow.com/questions/50999848/how-to-run-wp-cli-in-docker-compose-yml

Trying the sample WP CLI command failed stating that a path needed to be specified. However adding the 'command' line specified there still did not start.

Next tried running an updated docker-compose command:

$ docker-compose run --rm wpcli wp core install --path="/var/www/html" --url=http://example.test --title=test --admin_user=<username> --admin_email=<email>
Creating cioos-siooc-wordpress_wpcli_run ... done
Error: Error establishing a database connection. This either means that the username and password information in your `wp-config.php` file is incorrect or we can’t contact the database server at `mysql`. This could mean your host’s database server is down.
ERROR: 1

Noticed that the wp-app/wp-config.php contained a different DB password from my .env, so updated it to match. However after docker-compose down/up it still failed. The wp-config.php also has 'db' as the DB_HOST setting, so not clear why it is trying to connect to 'mysql' instead.

However afterwards going to localhost in browser took me to the WP install menu:
http://127.0.0.1/wp-admin/install.php
After going through the install I see the WP hello world page at localhost.

@jeffcullis
Copy link
Author

Seems I just needed to copy the 'environment' section from the wp section to the wpcli section in the docker-compose.yml, and then the WP CLI commands work as expected.

@joelfriesen
Copy link

I don't know if the version.php is a WordPress error. It doesn't come with that file - was there a plugin in the install?

WPCLI doesn't run normally, because it's not something that turns on, and persists. In that file you linked, they include an install command to make WordPress install on compose-up, which is cool. That would eliminate step 5 in my setup.

There is a lot going on on these docker setups, and I hope it runs smoother for you next time

Thanks for reporting!

@jeffcullis
Copy link
Author

No problem, I figured it could be a bit involved getting it to run in a different environment than you used.

Here's the commands I wound up needing for the composer and npm install of the theme:

(base) jcullis@... $ pwd
/home/jcullis/docker/cioos-siooc-wordpress/wp-app/wp-content/themes/cioos-siooc-wordpress

# Install nvm, node
$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
$ nvm install --lts

$ sudo apt update
$ sudo apt install php7.4-cli
$ sudo apt install php-xmlwriter

# PHP composer install - followed instructions here:
# https://www.jeffgeerling.com/blog/2018/installing-php-7-and-composer-on-windows-10-using-ubuntu-wsl

# Once composer and npm installed, run:
$ composer install
$ npm 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

No branches or pull requests

2 participants