Skip to content

Commit

Permalink
Merge pull request #14 from OpenDataServices/2023-08-11
Browse files Browse the repository at this point in the history
2023 08 11
  • Loading branch information
odscjames authored Aug 14, 2023
2 parents cac18b8 + 35f9adf commit 77c3e04
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions docs/reference/deploy-command.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
7 changes: 7 additions & 0 deletions dokkusd/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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()

Expand Down
26 changes: 26 additions & 0 deletions dokkusd/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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:

Expand Down Expand Up @@ -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)
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 77c3e04

Please sign in to comment.