-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Conversation
|
+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. |
zeocax
left a comment
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
|
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 |
- Prefer using a pipe to `while read` - But use a temp file when the loop needs to modify variables that need to be used outside the loop, as the pipe creates a subshell and modifications do not survive after the loop exits.
The config file checks were returning okay even when there were errors. The yq tool returns "null" when it cannot find what's queried, but exists with a 0 rc still.
Before this, checker issues were only logged. This stops the deployment if any configuration is incorrect.
acme.sh takes care of that
Because it causes a mysterious crash and it's honestly not worth it.
Before this, the eval call would try to run some commands (if they were compound commands) in the yaml file on the machine running acme.sh Eval might not be worth it for the little benefit it brings.
Before this, some deployment scripts would interact with STDIN and that would cause this loop to skip some elements. By using descriptor 3 we avoid clashing with the very common stdin and stdout.
kislyuk yq (used by Debian packages) does not accept `yq e` and also returns strings with double quotes. mikefarah's yq-go (used by Alpine) accepts `yq e` and `yq`. replace `yq e` with `yq` and also use `-r` switch to remove double quoting to ensure uniform return values from both yq versions. Signed-off-by: invario <[email protected]>
6cf5aab to
11cae37
Compare
|
please create a new issue for bug reporting for this hook. |
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
dockerandsynology_dsmhooks, 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.ymlormultideploy.yaml. It is stored in the domain folder.$DOMAIN_DIRis 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