-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Multideploy: Deploy to multiple hooks of the same type #6241
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
base: dev
Are you sure you want to change the base?
Conversation
Deployhook docker
+1 on this kind of capability at least for wildcard certs. I was recently looking at a situation with multiple mikrotik routers where this would have been helpful. |
please update the wiki page first. |
@Neilpang done |
let's remove the
It's not necessary. In the yaml example, please add some other hooks, not just docker hook. because it should work with any hooks. Don't use a hardcoded 'multideploy.yml" file, let's make it a env variable, just like the others:
You can just copy the "$DEPLOY_YAML" file to the domain folder, it will be easier for the user to use. |
The configurations ( Do you agree with this @Neilpang? |
no, this is too complicated.
no, use the env variable to pass value. it's the same way as others. |
@Neilpang, I removed configs and introduced a variable deploy file name. The wiki is now up to date. |
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.
tested and working fine for me
_debug _cfullchain "$_cfullchain" | ||
_debug _cpfx "$_cpfx" | ||
|
||
DOMAIN_DIR=$_cdomain |
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.
why do you need this DOMAIN_DIR ?
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 can be used in the deploy file to specify the path for a cert if you are going to have multiple certs on the same service. This makes it easier to copy the deploy file to another domain dir.
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.
which deploy file uses it ?
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.
have a look at the sample config 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.
which one ?
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.
first comment after pr opening. Both services use DOMAIN_DIR. I use it for all my domains because they are deployed to the same service. If I change something in one deploy file I can just copy the file to all other domains without having to change the path for each domain in my docker container
# $1 - A YAML formatted string containing environment variable key-value pairs. | ||
# Usage: | ||
# _clear_envs "<yaml_string>" | ||
_clear_envs() { |
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.
no need to clear
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.
If a hook has optional envs and you have two services that use the same hook, but one service uses the optional envs and the other doesn't, both services will use the optional envs because they are saved by the first service. Clearing them ensures that multideploy only uses the envs specified in the deploy file
I tested this and I'm looking forward to have this merged. |
@tomo2403 First, thanks so much for putting this together! I grabbed the file and am attempting to use it within a docker container after I added
I then executed the following: But unfortunately, it is returning this:
So it seems like the environment variable isn't being set for some reason, very odd. |
Hello @invario,
acme.sh --deploy -d example.com --deploy-hook multideploy --debug 3 |
At least 5 times.. Even completely wiped the multideploy.yml file and copy and pasted from your example and manually typed it in just in case there were something off.
The above is what the
Debug log as follows:
|
Maybe I can also add something weird I have observed and that I did not mention in my previous comment. I am also getting errors, but not all the time. I am using SSH deploy and Synology deploy. Sometimes the SSH deploy is giving me "DEPLOY_SSH_USER not defined." then "Error deploying for domain: ..." and then "Error encountered while deploying.", but then proceed successfully to the next deploy (Synology). I also see this line most of the time, not sure if this is an error: "./acme.sh: 241: [: unexpected operator". I've assumed there was still some race condition issues that hopefully would get resolved at some point... Perhaps this is a different problem. |
Hang on, here's a new debug log with `--output-insecure` included which might be more helpful:
Which looks like your deploy script is reading the HMM.... |
Interesting, this commit should not be related to the problem with the environment variables. |
@Gerporgl @invario @egarzadev Could you please pull the latest change and test it again? I can't reproduce this error with my setup. |
Pulled, working on my end. Thanks for the quick turnaround. |
I'd like to make a suggestion that if a service fails to deploy properly, a non-zero return code should be returned upon completing deployment of all other services. Perhaps even something simple like increment the return code by 1 for each service that fails. |
dhparams |
This hook allows the user to deploy certificates to multiple services at once. It can store configurations for numerous services, even for the same hook.
Example
You have three Docker containers and a Synology NAS (DSM). However, using the
docker
andsynology_dsm
hooks, you can only deploy to one Docker container with renewals. This problem is solved with Multideploy.Sample config file
The file can be named
multideploy.yml
ormultideploy.yaml
. It is stored in the domain folder.$DOMAIN_DIR
is a variable that allows deploying certificated to a dir named after the certificate's domain to make changes easier.Wiki
Please tell me if you will merge this first before I start writing a wiki entry for this. thx
https://github.com/acmesh-official/acme.sh/wiki/deployhooks#36-deploying-to-multiple-services-with-the-same-hooks