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

Large refactor + improvements #97

Merged
merged 6 commits into from May 23, 2017
Merged

Large refactor + improvements #97

merged 6 commits into from May 23, 2017

Conversation

dsifford
Copy link
Collaborator

@dsifford dsifford commented Apr 23, 2017

@karellm This PR addresses a bunch of the nagging issues that have been around for a while now. There's a lot of changes, all good I think, so, in an effort to reduce verbosity, I'll copy the changelog verbatim below...


0.15.0 - latest

Deprecations

Note: Both deprecations will still work as usual until the next release cycle.

[local]plugin-name & [local]theme-name syntax

The build process is now aware of locally-volumed plugins and themes automatically.

Additionally, listing locally-volumed plugins and themes in your docker-compose.yml file is optional; you may list them if you'd like to keep your compose file declarative, or you may skip listing them completely. The build will complete the same either way.

SEARCH_REPLACE has been renamed to URL_REPLACE

We chose to rename this because, although you may search and replace strings that are not URLs, the build process requires them to be.

This name reflects that requirement better and will lead to less confusion down the road.

VERBOSE environment variable

Logging has been changed to show necessary information by default.

Improvements

  • Widespread efficiency improvements to build process.
  • Reduce the number of Dockerfile layers.
  • If SERVER_NAME is specified (eg. example.com), create a ServerAlias in the apache configs for www.example.com.

Fixes


Final Note: run.sh was pretty much rewritten again because it was sort of a disaster, which is my fault. A lot of the complexity from the last version came from just making the logging pretty. I changed a bunch of that, which I'm sure you'll see. I was able to slim down the file a good bit and keep it readable.

Let me know your thoughts! Glad to discuss anything that you aren't sure of or think can be done better.

@dsifford dsifford requested a review from karellm April 23, 2017 21:25
@dsifford
Copy link
Collaborator Author

Have you had a chance to look through this @karellm? Any questions?

@dsifford
Copy link
Collaborator Author

@karellm Merging this monday if I don't hear back. Need the fixes on my sites.

@karellm
Copy link
Collaborator

karellm commented Apr 30, 2017

@dsifford I disagree about merging code that wasn't reviewed. I will take the time tomorrow to look at it (past few weeks have been quite busy for me).

@dsifford
Copy link
Collaborator Author

dsifford commented May 1, 2017

@karellm No problem. Take all the time you need. I just didn't hear back with even an acknowledgment of the PR so that's why I was opting to merge if I didn't hear back. I didn't know what your particular circumstances were or if you'd be able to review in a semi-timely fashion.

Copy link
Collaborator

@karellm karellm left a comment

Choose a reason for hiding this comment

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

Great work, the project is a lot cleaner now. I added couple minor comments. I will also test it with a website tomorrow.


# start the website at localhost:8080
docker-compose up
docker-compose up -d && docker-compose logs -f wordpress
Copy link
Collaborator

Choose a reason for hiding this comment

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

What is the motivation behind this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That's how I start it. It allows you to watch build logs and know when exactly the build is finished, rather than just trying localhost:8080 a bunch of times until it works.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I haven't run a wordpress site in a while but I think docker-compose up did output the logs for me. It is arguably more verbose though since it logs all services and not just wordpress.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, the benefit to doing my way is that you get only the wordpress logs, as you stated, and also you can just ctrl-c after it's done building without it tearing down the application.

You can detach from a forground process by hitting ctrl-p followed by ctrl-q as well (I think), but that's too difficult to remember.

- [Part 3: Optimize your wordpress theme assets and deploy to S3](https://visible.vc/engineering/optimize-wordpress-theme-assets-and-deploy-to-s3-cloudfront/)
- Part 4: Auto deploy your site on your server (coming)

### Example
Copy link
Collaborator

Choose a reason for hiding this comment

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

The Example section was removed altogether. Why is that?

Copy link
Collaborator Author

@dsifford dsifford May 2, 2017

Choose a reason for hiding this comment

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

I moved it to its own ./example directory to contain all of it there for those who need a complete example to look at.

Copy link
Collaborator

Choose a reason for hiding this comment

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

My question wasn't clear. I think that there is value in the documentation. You might want to use this without relying on the example at all no?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

What about moving the example details to a separate README.md file in the example directory? That way the info is still there for those who need it, but it clears up some of the noise from the main readme.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm fine with that

package.json Outdated
"accessKeyId": "",
"secretAccessKey": ""
}
"update-version": "for file in './php7.0/Dockerfile' './php5.6/Dockerfile'; do sed -Ei \"s/(version=\\\")(.*)(-)/\\1$npm_package_version\\3/g\" \"$file\"; done && sed -Ei \"s/(wordpress:)(.*)(-)/\\1$npm_package_version\\3/g\" ./example/docker-compose.yml"
Copy link
Collaborator

Choose a reason for hiding this comment

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

🎉 I think you missed 7.1 though

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yep, good catch. Adding 7.1 was an afterthought. I'll fix later this afternoon.

# Set recommended PHP.ini settings (see https://secure.php.net/manual/en/opcache.installation.php)
RUN echo "memory_limit = 512M" > /usr/local/etc/php/php.ini \
zip \
# See https://secure.php.net/manual/en/opcache.installation.php)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Trailing ) not needed

# Set recommended PHP.ini settings (see https://secure.php.net/manual/en/opcache.installation.php)
RUN echo "memory_limit = 512M" > /usr/local/etc/php/php.ini \
zip \
# See https://secure.php.net/manual/en/opcache.installation.php)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same

opcache \
soap \
zip \
# See https://secure.php.net/manual/en/opcache.installation.php)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same

h1 "WordPress Configuration Complete!"
while read -r -d, i; do
[[ ! "$i" ]] && continue
i="${i# }" # Trim leading whitespace
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could maybe be a function?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I suppose it could. No preference. I can change later this afternoon.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Actually, I take that back. It would end up being more code than just keeping as is because bash functions can't return values. So there'd have to be a minimum of 2 side effects each time it's called, which I'm not super fond of.

I can still change it if you're firm on this, but I wouldn't recommend it.

Copy link
Collaborator

Choose a reason for hiding this comment

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

That's fine as is!

@dsifford
Copy link
Collaborator Author

dsifford commented May 2, 2017

@karellm I addressed everything you mentioned in the last commit, less the part about converting the string replacements into a function. Gonna wait to hear back on that before I travel that road.

Let me know what else you need.

@karellm
Copy link
Collaborator

karellm commented May 3, 2017

I still need to run it but looks good. I will do that later today

@dsifford
Copy link
Collaborator Author

dsifford commented May 6, 2017

You get a chance to run this yet? Any issues?

@dsifford
Copy link
Collaborator Author

@karellm status?

@dsifford
Copy link
Collaborator Author

@karellm Can you please let me know if I can merge this? I really need the update.

Thanks in advance.

@karellm
Copy link
Collaborator

karellm commented May 23, 2017

@dsifford I apologize for the delay. I was offline for a while (a much needed break).

I just ran everything and it went smoothly. Also did another pass of the code and didn't see anything bugging me. So let's merge this. Thanks again for the great work!

@dsifford
Copy link
Collaborator Author

No problem. Everyone needs a good disconnect every now and again! Glad to hear yours went well. 😄

Gonna merge and let my automatic builds run. If you'd like to also update your dockerhub builds, can you take care of those?

Thanks!

@dsifford dsifford merged commit 76150f8 into master May 23, 2017
@dsifford dsifford deleted the dsifford-refactor-fixes branch May 23, 2017 16:06
@karellm
Copy link
Collaborator

karellm commented May 23, 2017

@dsifford I looked and the Hub still require us to grant full access to all private repos, which I don't want to do. That said, I simplified the way to deploy a bit: https://github.com/visiblevc/wordpress-starter/wiki/Development

@dsifford
Copy link
Collaborator Author

@karellm I have automated builds pulling from this repo here: https://hub.docker.com/r/dsifford/wordpress/builds/

On a different note: found a couple issues with the run.sh file.. Patch coming shortly

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.

None yet

2 participants