forked from cerc-io/stack-orchestrator
Thomas E Lackey
fa21ff2627
This adds two new commands: `publish-webapp-deployer` and `request-webapp-deployment`. `publish-webapp-deployer` creates a `WebappDeployer` record, which provides information to requestors like the API URL, minimum required payment, payment address, and public key to use for encrypting config. ``` $ laconic-so publish-deployer-to-registry \ --laconic-config ~/.laconic/laconic.yml \ --api-url https://webapp-deployer-api.dev.vaasl.io \ --public-key-file webapp-deployer-api.dev.vaasl.io.pgp.pub \ --lrn lrn://laconic/deployers/webapp-deployer-api.dev.vaasl.io \ --min-required-payment 100000 ``` `request-webapp-deployment` simplifies publishing a `WebappDeploymentRequest` and can also handle automatic payment, and encryption and upload of configuration. ``` $ laconic-so request-webapp-deployment \ --laconic-config ~/.laconic/laconic.yml \ --deployer lrn://laconic/deployers/webapp-deployer-api.dev.vaasl.io \ --app lrn://cerc-io/applications/webapp-hello-world@0.1.3 \ --env-file ~/yaml/hello.env \ --make-payment auto ``` Related changes are included for the deploy/undeploy commands for decrypting and using config, using the payment address from the WebappDeployer record, etc. Reviewed-on: cerc-io/stack-orchestrator#938
73 lines
3.5 KiB
Python
73 lines
3.5 KiB
Python
# Copyright © 2022, 2023 Vulcanize
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
# it under the terms of the GNU Affero General Public License as published by
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU Affero General Public License for more details.
|
|
|
|
# You should have received a copy of the GNU Affero General Public License
|
|
# along with this program. If not, see <http:#www.gnu.org/licenses/>.
|
|
|
|
import click
|
|
|
|
from stack_orchestrator.command_types import CommandOptions
|
|
from stack_orchestrator.repos import setup_repositories
|
|
from stack_orchestrator.repos import fetch_stack
|
|
from stack_orchestrator.build import build_containers, fetch_containers
|
|
from stack_orchestrator.build import build_npms
|
|
from stack_orchestrator.build import build_webapp
|
|
from stack_orchestrator.deploy.webapp import (run_webapp,
|
|
deploy_webapp,
|
|
deploy_webapp_from_registry,
|
|
undeploy_webapp_from_registry,
|
|
publish_webapp_deployer,
|
|
request_webapp_deployment)
|
|
from stack_orchestrator.deploy import deploy
|
|
from stack_orchestrator import version
|
|
from stack_orchestrator.deploy import deployment
|
|
from stack_orchestrator import opts
|
|
from stack_orchestrator import update
|
|
|
|
CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help'])
|
|
|
|
|
|
@click.group(context_settings=CONTEXT_SETTINGS)
|
|
@click.option('--stack', help="specify a stack to build/deploy")
|
|
@click.option('--quiet', is_flag=True, default=False)
|
|
@click.option('--verbose', is_flag=True, default=False)
|
|
@click.option('--dry-run', is_flag=True, default=False)
|
|
@click.option('--local-stack', is_flag=True, default=False)
|
|
@click.option('--debug', is_flag=True, default=False)
|
|
@click.option('--continue-on-error', is_flag=True, default=False)
|
|
# See: https://click.palletsprojects.com/en/8.1.x/complex/#building-a-git-clone
|
|
@click.pass_context
|
|
def cli(ctx, stack, quiet, verbose, dry_run, local_stack, debug, continue_on_error):
|
|
"""Laconic Stack Orchestrator"""
|
|
command_options = CommandOptions(stack, quiet, verbose, dry_run, local_stack, debug, continue_on_error)
|
|
opts.opts.o = command_options
|
|
ctx.obj = command_options
|
|
|
|
|
|
cli.add_command(fetch_stack.command, "fetch-stack")
|
|
cli.add_command(setup_repositories.command, "setup-repositories")
|
|
cli.add_command(build_containers.command, "build-containers")
|
|
cli.add_command(fetch_containers.command, "fetch-containers")
|
|
cli.add_command(build_npms.command, "build-npms")
|
|
cli.add_command(build_webapp.command, "build-webapp")
|
|
cli.add_command(run_webapp.command, "run-webapp")
|
|
cli.add_command(deploy_webapp.command, "deploy-webapp")
|
|
cli.add_command(deploy_webapp_from_registry.command, "deploy-webapp-from-registry")
|
|
cli.add_command(undeploy_webapp_from_registry.command, "undeploy-webapp-from-registry")
|
|
cli.add_command(publish_webapp_deployer.command, "publish-deployer-to-registry")
|
|
cli.add_command(request_webapp_deployment.command, "request-webapp-deployment")
|
|
cli.add_command(deploy.command, "deploy") # deploy is an alias for deploy-system
|
|
cli.add_command(deploy.command, "deploy-system")
|
|
cli.add_command(deployment.command, "deployment")
|
|
cli.add_command(version.command, "version")
|
|
cli.add_command(update.command, "update")
|