diff --git a/CHANGELOG.md b/CHANGELOG.md index b99a198..3fc6620 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - nginx / client_max_body_size option - set by command line option or environmental variable. - nginx / proxy-read-timeout option - set by command line option or environmental variable. - Dokku app names are cleaned up. Invalid characters are changed to "-". Lower case is enforced. +- ps:sale - set by command line option or environmental variable. ## Changed diff --git a/docs/reference/deploy-command.rst b/docs/reference/deploy-command.rst index 0c9e16f..7d12ac9 100644 --- a/docs/reference/deploy-command.rst +++ b/docs/reference/deploy-command.rst @@ -97,3 +97,10 @@ Sets the Nginx Proxy Read Timeout. Pass a string to `--nginxproxyreadtimeout` or set the `DOKKUSD_NGINX_PROXY_READ_TIMEOUT` environmental variable. Should include units. eg `120s` not `120`. + +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. diff --git a/dokkusd/cli.py b/dokkusd/cli.py index edfe041..3aacbe8 100644 --- a/dokkusd/cli.py +++ b/dokkusd/cli.py @@ -63,6 +63,11 @@ def main() -> None: help="Sets a value for Nginx Proxy Read Timeout. Include units eg 120s", default=os.getenv("DOKKUSD_NGINX_PROXY_READ_TIMEOUT"), ) + deploy_parser.add_argument( + "--psscale", + help="Sets values for scale command. eg web=1 worker=2", + default=os.getenv("DOKKUSD_PS_SCALE"), + ) ### Destroy destroy_parser = subparsers.add_parser("destroy") @@ -117,6 +122,7 @@ def main() -> None: environment_variables=env_vars, nginx_client_max_body_size=args.nginxclientmaxbodysize, nginx_proxy_read_timeout=args.nginxproxyreadtimeout, + ps_scale=args.psscale, ) deploy.go() diff --git a/dokkusd/deploy.py b/dokkusd/deploy.py index 2dbf7b3..e8a227f 100644 --- a/dokkusd/deploy.py +++ b/dokkusd/deploy.py @@ -24,6 +24,7 @@ def __init__( environment_variables: dict = {}, nginx_client_max_body_size=None, nginx_proxy_read_timeout=None, + ps_scale=None, ): super().__init__( directory=directory, @@ -38,6 +39,7 @@ def __init__( self.environment_variables_json_string = environment_variables_json_string 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 def go(self) -> None: @@ -173,6 +175,19 @@ def go(self) -> None: print(stdout) print(stderr) + # --------------------- PS scale + if self._ps_scale: + print("Ps: scale ...") + command = [ + "ps:scale", + self.app_name, + "--skip-deploy", + ] + command.extend([i.strip() for i in self._ps_scale.split(" ") if i.strip()]) + stdout, stderr = self._dokku_command(command) + print(stdout) + print(stderr) + # --------------------- Deploy print("Deploy ...") process = subprocess.Popen(