diff --git a/CHANGELOG.md b/CHANGELOG.md index 29f62e4..907d7ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +## [0.6.0] - 2023-08-11 + +## Added + +- Lets Encrypt option + ## [0.5.0] - 2023-03-23 ## Added diff --git a/docs/reference/deploy-command.rst b/docs/reference/deploy-command.rst index 7d12ac9..e20642d 100644 --- a/docs/reference/deploy-command.rst +++ b/docs/reference/deploy-command.rst @@ -104,3 +104,10 @@ Scale Processes Sets the ps:scale command, to set the number of each different type of process types to run. Pass a string to `--psscale` or set the `DOKKUSD_PS_SCALE` environmental variable. + +Lets Encrypt +~~~~~~~~~~~~ + +Enables Lets Encrypt HTTPS. You must set the email address for the Lets Encrypt account to use this. + +Pass a string to `--letsencryptemail` or set the `DOKKUSD_LETSENCRYPT_EMAIL` environmental variable. diff --git a/dokkusd/cli.py b/dokkusd/cli.py index 3aacbe8..d01f163 100644 --- a/dokkusd/cli.py +++ b/dokkusd/cli.py @@ -68,6 +68,11 @@ def main() -> None: help="Sets values for scale command. eg web=1 worker=2", default=os.getenv("DOKKUSD_PS_SCALE"), ) + deploy_parser.add_argument( + "--letsencryptemail", + help="Set email address for Lets Encrypt. If present, Lets Encrypt will be enabled.", + default=os.getenv("DOKKUSD_LETSENCRYPT_EMAIL"), + ) ### Destroy destroy_parser = subparsers.add_parser("destroy") @@ -123,6 +128,8 @@ def main() -> None: nginx_client_max_body_size=args.nginxclientmaxbodysize, nginx_proxy_read_timeout=args.nginxproxyreadtimeout, ps_scale=args.psscale, + letsencrypt_email=args.letsencryptemail, + letsencrypt_enable=bool(args.letsencryptemail), ) deploy.go() diff --git a/dokkusd/deploy.py b/dokkusd/deploy.py index e8a227f..c2ee276 100644 --- a/dokkusd/deploy.py +++ b/dokkusd/deploy.py @@ -25,6 +25,8 @@ def __init__( nginx_client_max_body_size=None, nginx_proxy_read_timeout=None, ps_scale=None, + letsencrypt_enable=False, + letsencrypt_email=None, ): super().__init__( directory=directory, @@ -40,6 +42,8 @@ def __init__( self._nginx_client_max_body_size = nginx_client_max_body_size self._nginx_proxy_read_timeout = nginx_proxy_read_timeout self._ps_scale = ps_scale + self._letsencrypt_enable = letsencrypt_enable + self._letsencrypt_email = letsencrypt_email def go(self) -> None: @@ -199,3 +203,25 @@ def go(self) -> None: stdout, stderr = process.communicate() print(stdout.decode("utf-8")) print(stderr.decode("utf-8")) + + # --------------------- Deploy + if self._letsencrypt_enable and self._letsencrypt_email: + print("Lets Encrypt ...") + stdout, stderr = self._dokku_command( + [ + "letsencrypt:set", + self.app_name, + "email", + str(self._letsencrypt_email), + ] + ) + print(stdout) + print(stderr) + stdout, stderr = self._dokku_command( + [ + "letsencrypt:enable", + self.app_name, + ] + ) + print(stdout) + print(stderr) diff --git a/setup.py b/setup.py index bacf581..ff129d8 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ setuptools.setup( name="DokkuSD", - version="0.5.0", + version="0.6.0", description="DokkuSD", long_description="DokkuSD", url="https://github.com/OpenDataServices/dokkusd-client",