<p>Im using nginx as a reverse proxy to serve an Express.js backend and a Vue.js frontend. The whole application runs in two Docker Compose images, one for development, and one for production. I'd like to be able to test the production image locally with <strong>HTTPS</strong> (especially because Vue's PWA framework depends on HTTPS to properly register service workers).</p>
<p>The issue is that to configure a let's encrypt certificate with certbot, I need to be running on a server associated with my domain through DNS. What is the correct way to set up a CI/CD workflow where I can test HTTPS locally and also push it to my production server? Do I have to buy a certificate from a different CA and update it manually?</p>
<p>I tried using certbot, but it will not work since I am not on the server that is associated with mine through DNS.</p>

<p>With <strong>certbot</strong> there is type of verification method <strong>DNS</strong> and <strong>HTTP</strong></p>
<p><strong>DNS</strong> method verify the <strong>record</strong> in <strong>DNS</strong> while <strong>HTTP</strong> check for <strong>200</strong> response from your <strong>Endpoint</strong>.</p>
<p>In <strong>CI/CD</strong> you can go with the <strong>HTTP</strong> method which checks for the Domain status</p>
<p>Refer repo for more : <a href="https://gitlab.com/gdm85/lets-gitlab/-/blob/master/scripts/letsencrypt/authenticator.sh" rel="nofollow noreferrer">Auth script</a></p>
<pre><code>certbot certonly $CERTBOT_DEBUG --non-interactive --manual --preferred-challenges=http \
    -m &quot;$LETSENCRYPT_CONTACT_EMAIL&quot; \
    --manual-auth-hook authenticator.sh \
    --no-self-upgrade --agree-tos \
    $DOMAIN_OPTS
</code></pre>
<p>Refer gist for <a href="https://gist.github.com/gaoyifan/b72f680df3e2a5d760b2f928d62d2a4f" rel="nofollow noreferrer">DNS verification</a></p>
<p><strong>Another option Manual one</strong></p>
<p>During <strong>CI/CD</strong> or just want set cert in docker, i would suggest downloading/creating a cert first and use multiple time <a href="https://www.sslforfree.com/" rel="nofollow noreferrer">SSL for free</a></p>
<p>You locally create the <strong>cert</strong> first and <strong>re-use</strong> multiple times by injecting it during <strong>CI/CD</strong> process storing it in a <strong>variable</strong> or downloading from <strong>Bucket</strong> if you are using any <strong>cloud</strong>.</p>
