-
Hey all! Really liking the images! I've been testing out the Unit variation with PHP7.4 using my own local certificates generated using Minica. So that's the background. Here is my question... I'm new to contributing to open source projects. So what do I do with my change? Am I able to simply create a new branch and upload my change and open a PR? Or do I need to do it in a fork? Hoping to become an active contributor to the unit variation as I think I've noticed a couple of other bugs too, so looking forward to helping out. Thanks in advance, Jon |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
Thanks for your willingness to help! If you could jot down your notes on this thread on what needs to be fixed, I will circle back when I am ready for a PR. I have a big PR that I am about to merge (#311) and it's going to require a lot of changes. I'd love to improve that This is what I looked like when I was putting it together 🤣 |
Beta Was this translation helpful? Give feedback.
-
Hey Jay, no problem at all, happy to help out on this. I'm looking to use this base image for our app initially in local envs, but also in productions environments in the near future, so it's worth my while spending some of my work hours on this project to ensure everything is running well :) Currently, I've just looked into the SSL side of things. We're using minica to create our certs, as this enables us to trust the root ca locally and use a custom domain, so this means I need to provide our own cert bundle to the docker image. Here is an extract from my docker-compose: environment:
PHP_POST_MAX_SIZE: "500M"
PHP_UPLOAD_MAX_FILE_SIZE: "500M"
SSL_MODE: "full"
UNIT_CERTIFICATE_NAME: "bundle"
volumes:
- ./laravel:/var/www/html:cached
- ./certs:/etc/ssl/private And here is the diff with my changes: diff --git a/src/variations/unit/etc/entrypoint.d/10-init-unit.sh b/src/variations/unit/etc/entrypoint.d/10-init-unit.sh
index 361ba2e..744885e 100644
--- a/src/variations/unit/etc/entrypoint.d/10-init-unit.sh
+++ b/src/variations/unit/etc/entrypoint.d/10-init-unit.sh
@@ -104,13 +104,13 @@ configure_unit() {
# this curl call will get a reply once unit is fully launched
/usr/bin/curl -s -X GET --unix-socket "$UNIT_SOCKET_LOCATION" http://localhost/
- echo "$script_name: Looking for certificate bundles in $UNIT_CONFIG_DIRECTORY..."
- for f in $(/usr/bin/find "$UNIT_CONFIG_DIRECTORY" -type f -name "*.pem"); do
+ echo "$script_name: Looking for certificate bundles in /etc/ssl/private..."
+ for f in $(/usr/bin/find "/etc/ssl/private" -type f -name "$UNIT_CERTIFICATE_NAME.pem"); do
echo "$script_name: Uploading certificates bundle: $f"
curl_put "--data-binary" "$f" "certificates/$(basename $f .pem)"
done
- set_debug_output "/usr/bin/find $UNIT_CONFIG_DIRECTORY -type f -name \"*.pem\""
+ set_debug_output "/usr/bin/find /etc/ssl/private -type f -name \"$UNIT_CERTIFICATE_NAME.pem\""
echo "$script_name: Looking for JavaScript modules in $UNIT_CONFIG_DIRECTORY..."
for f in $(/usr/bin/find $UNIT_CONFIG_DIRECTORY -type f -name "*.js"); do
@@ -154,7 +154,7 @@ configure_unit() {
}
validate_ssl(){
- available_ssl_bundles=$(/usr/bin/find "$UNIT_CONFIG_DIRECTORY" -type f -name "*.pem")
+ available_ssl_bundles=$(/usr/bin/find "/etc/ssl/private" -type f -name "$UNIT_CERTIFICATE_NAME.pem") The main points here is that we need to look inside Thoughts? Jon |
Beta Was this translation helpful? Give feedback.
-
To use a custom certificate, do you need to run this or is there another way? this is the only way it worked for me The ssl-off.json.template template does not have the listener for 8443 curl -X PUT --data-binary '{"pass": "routes", "tls": {"certificate": "bundle"}}' --unix-socket /var/run/unit/control.unit.sock 'http://localhost:8080/config/listeners/*:8443' volumes: |
Beta Was this translation helpful? Give feedback.
Ok, I think this is where the main issue is. Actually what is happening, is that if I provide my own certs in the manner described, you still generate a self signed and use that, overwriting the certificates provided. Essentially , you're first checking if the certificate has been provided in the config directory (which isn't possible) then generating a self signed.
Thanks for the contributing links. Using these, I've created a PR from my fork for you to take a look at here: #321
Let me know what you think!
BTW: I'm on UK time, so may not always reply later in the …