-
Notifications
You must be signed in to change notification settings - Fork 168
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
various improvements and build updates #130
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this update. I did a first pass but most changes look good. I will try it on our install shortly too.
Dockerfile
Outdated
&& mkdir -p /app ~/.wp-cli \ | ||
&& service apache2 restart | ||
|
||
# Install wp-cli, add scripts, create install directory & symlink |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't install wp-cli anymore, it's done above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch.
Dockerfile
Outdated
|
||
# Install base requirements & sensible defaults + required PHP extensions | ||
RUN echo "deb http://ftp.debian.org/debian stretch-backports main" >> /etc/apt/sources.list \ | ||
&& apt-get update \ | ||
# RUN echo "deb http://ftp.debian.org/debian $(sed -n 's/^VERSION=.*(\(.*\)).*/\1/p' /etc/os-release)-backports main" >> /etc/apt/sources.list \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you want to keep this? I don't think commented out code should stay.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, agreed. That's what the first checkbox in the PR was addressing.
Will fix.
Dockerfile
Outdated
&& DEBIAN_FRONTEND=noninteractive apt-get -t stretch-backports install -y \ | ||
python-certbot-apache \ | ||
# && DEBIAN_FRONTEND=noninteractive apt-get -t stretch-backports install -y \ | ||
# python-certbot-apache \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you want to keep this? I don't think commented out code should stay.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above comment. Will Fix.
build.sh
Outdated
for php_version in "${php_versions[@]}"; do | ||
docker build \ | ||
--build-arg PHP_VERSION="$php_version" \ | ||
--build-arg VERSION="$npm_package_version" \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extra space
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops. shfmt might have added that break.
Will fix.
build.sh
Outdated
--build-arg PHP_VERSION="$php_version" \ | ||
--build-arg VERSION="$npm_package_version" \ | ||
-t "visiblevc/wordpress:latest" \ | ||
-t "visiblevc/wordpress:latest-php7.2" \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this won't work, shouldn't it use the $php_version
version? Also we don't want to set latest
for all version, only for 7.2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should work I think unless I'm overlooking something.
The PHP_VERSION
arg is the one that sets the base image in the Dockerfile.
The npm_package_version
arg is only used for setting the version label in the Dockerfile.
I see what you mean Re: your latest
concern. I'll add a fix for that so that only the latest php version image gets tagged with latest
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh hah... Now I'm also noticing that 7.2
is hard-coded in there still.. Fixing that too 😊
soap \ | ||
zip \ | ||
# See https://secure.php.net/manual/en/opcache.installation.php | ||
&& echo 'memory_limit = 512M' > /usr/local/etc/php/php.ini \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we want to port this too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's on line 33 of the new Dockerfile
run.sh
Outdated
fi | ||
configure() { | ||
# Ensures that this only runs on the initial build | ||
[[ -f ~/.wp-cli/config.yml ]] && return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure this take any time so I would run it everytime. It allows that changes to variables are actually passed down to the image. wdyt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see what you mean.
The issue currently is that it would append the ServerName
directive and append the completions line in the bashrc on every restart.
So the end result of that would be a single ServerName
, but a bunch of ServerAlias
es and a bunch of . /etc/bash_completion.d/wp-cli
s.
I can prob adjust the logic there though if you think we should keep the ability to change variable defaults.
PLUGINS="${PLUGINS/%,}," | ||
THEMES="${THEMES/%,}," | ||
|
||
if [[ -f /root/.dockercache ]]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason you removed this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Crap. Good catch.
Forgot that we needed to keep track of those beyond deciphering which of the existing themes/plugins are volumed.
I added the new --skip-content
flag to the wp core download
call on line 95 and I thought that would satisfy our needs.
The good news is that, even though we need to add this back in, it can be greatly simplified with skip-content
enabled.
I'll add that back in.
@karellm should be good now |
@dsifford Would you mind including these:
|
@karellm Do you think we should be adding composer to the image? Seems kind of heavy considering most users won't be using it or needing it. |
@dsifford I don't need it personally but I can see why it is a reasonable request. Can you think of an alternative solution? |
@karellm I probably could if I had an idea of what the common use-case is for it in wordpress projects. Do people just use it to bundle PHP libraries with their themes/plugins? Do they use it to literally manage their themes/plugins? If it's used to bundle libraries, why is it needed on the server? Why not just bundle everything before deploying or volume the composer directory? What's your typical use-case @louisremi? |
@dsifford I'm also fine merging this without it and keep the conversation open. What do you think of the other items? My concern is that this PR will make most PRs non fast-forward. |
Yeah, both of the other ones are totally reasonable and I can definitely add those in |
@karellm What about instead of hard-coding the reverse proxy stuff, we just add a single # [...]
environment:
- EXTRA_PHP: |
if ($something) {
// blah blah
} |
@dsifford I like that. I think the reverse proxy is also a rare use case. We just need to document this properly. |
@karellm Give that a look and let me know what you think. We should be good from here. One little thing to note, I added a "breaking" change to how If the script comes across the old form, a deprecation warning is printed and it fixes itself. So not technically breaking, but still requires a change to the user's compose file to get rid of the warning. |
@karellm updates here? |
I tried to run it and got:
Does it ring a bell? Also the |
Hmmmmmmm... Where did you run this? In the container?
Re: README -- Good catch. |
I checkout the branch, built the image and referenced it in our company website with a new tag. Is there something more you did? |
Which tag did you try? |
Hah... Knew it! The PHP 5.6 image uses bash 4.3, which does not have the Uggggh.... Suggestions? Edit: Nor does the php7.0 image Edit 2: All images except for the PHP 7.2 image do not have |
@karellm Ok should be good now. Not sure why I even added the Let me know if you still have issues. |
Haha, you know the art of making feeling bad for not updating our server's php version ;) I've just tested the build and the Volume mounted themes trigger an error:
Cause:
Plugins don't install, I have two errors:
Let me know if you need more details. I think the errors above are a little poorly formatted, I guess it is truncated in length but it gets in the way of readability imo, I would rely on the terminal truncation. (update: I can see why it makes copy/pasting log to github issues a lot better though) |
@karellm Can you post the snippet to your plugins env variable? Re: theme issue -- You shouldn't post your volumes in Just the things that need to be downloaded at runtime should go in Re: truncation --- if not truncated manually at 70 chars, then it'll just wrap into the |
RE: themes - I forgot about that, we are running an older version
Note that |
Found a typo in the theme check. I think once I fix that it should work as expected. Also, this fix should now tolerate plugins and theme volumes being listed explicitly in the compose file. Let me know. |
Themes are not failing anymore, it didn't download nothing either. 👍 I still get the unpacking error though:
After checking, it looks like a permission issue. Permission are all weird. Does it ring a bell to you? Removing the mounted volumes didn't help much. |
Ahaaaa! Yeah, forgot that volumes will automatically force root-level perms to the volumed directory. Sorry for the trouble! And thanks for your continued patience 😄 I'll fix that in a few. |
Eeek! Sorry for the delay. Totally forgot about this. Should be good now @karellm |
@dsifford I still get the error. Did you test this successfully with local and remote themes/plugins? If not can you please make sure you test all the images? Thanks |
Yes I tested with both |
My bad, the error is different and not an error per say Can you juste make sure to squash when you merge this so we keep a clean history? Thanks for the good work once more! |
Ah, yeah -- we used to filter those out but I figured it would be safer and easier to maintain if we just let all messages from wp-cli through. Re: squash -- yep, no problem will do. I'll merge this a bit later when I have time to build and push to dockerhub. 👍 Thanks for the great feedback, as always. |
Circling back to this now finally @karellm and I think I'm gonna have to add back in the This is because the SSL challenge step of certbot requires connections to port 443, which can't be exposed simultaneously between two running containers. Is that alright? |
@dsifford I reviewed the code and it looks ok though I haven't got a chance to test. If you have, I trust you to merge this. |
Found a bug... Gonna work on a fix shortly. |
This fixes installs in cases where the install source is a url. Previosly, the key was passed, which would result in wp-cli checking wordpress.org for it and it would fail.
Fixed... I'll test again tomorrow |
Our site seems to run fine and the code looks good to me 👍 |
Found one more little sneaky one.. I'll push an update for it shortly Update: Commit below still didn't fix -- working on something better when I get a few extra moments. |
This PR removes several redundancies and introduces several improvements to the overall build process.
Notable changes are as follows:
admin
) with passwordless sudo priviledges, rather than using the root user.run.sh
.run.sh
file automatically withshfmt
.Stuff still left to do after review:
Let me know what you think @karellm