Compare commits

..
Author SHA1 Message Date
roysc f8f5030976 change imports 2023-10-07 12:22:40 +08:00
roysc b686540512 rename app module, nest cli in app 2023-10-07 12:22:30 +08:00
18 changed files with 52 additions and 55 deletions
+1 -1
View File
@@ -15,8 +15,8 @@
import os
from abc import ABC, abstractmethod
from app.deploy import get_stack_status
from decouple import config
from .deploy import get_stack_status
def get_stack(config, stack):
+3 -3
View File
@@ -27,8 +27,8 @@ import subprocess
import click
import importlib.resources
from pathlib import Path
from app.util import include_exclude_check, get_parsed_stack_config
from app.base import get_npm_registry_url
from .util import include_exclude_check, get_parsed_stack_config
from .base import get_npm_registry_url
# TODO: find a place for this
# epilog="Config provided either in .env or settings.ini or env vars: CERC_REPO_BASE_DIR (defaults to ~/cerc)"
@@ -67,7 +67,7 @@ def command(ctx, include, exclude, force_rebuild, extra_build_args):
print('Dev root directory doesn\'t exist, creating')
# See: https://stackoverflow.com/a/20885799/1701505
from app import data
from . import data
with importlib.resources.open_text(data, "container-image-list.txt") as container_list_file:
all_containers = container_list_file.read().splitlines()
+3 -3
View File
@@ -25,8 +25,8 @@ from decouple import config
import click
import importlib.resources
from python_on_whales import docker, DockerException
from app.base import get_stack
from app.util import include_exclude_check, get_parsed_stack_config
from .base import get_stack
from .util import include_exclude_check, get_parsed_stack_config
builder_js_image_name = "cerc/builder-js:local"
@@ -83,7 +83,7 @@ def command(ctx, include, exclude, force_rebuild, extra_build_args):
os.makedirs(build_root_path)
# See: https://stackoverflow.com/a/20885799/1701505
from app import data
from . import data
with importlib.resources.open_text(data, "npm-package-list.txt") as package_list_file:
all_packages = package_list_file.read().splitlines()
+8 -8
View File
@@ -15,14 +15,14 @@
import click
from app.command_types import CommandOptions
from app import setup_repositories
from app import build_containers
from app import build_npms
from app import deploy
from app import version
from app import deployment
from app import update
from .command_types import CommandOptions
from . import setup_repositories
from . import build_containers
from . import build_npms
from . import deploy
from . import version
from . import deployment
from . import update
CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help'])
@@ -70,7 +70,6 @@ services:
command: "/run-op-geth.sh"
ports:
- "0.0.0.0:8545:8545"
- "0.0.0.0:8546:8546"
healthcheck:
test: ["CMD", "nc", "-vz", "localhost:8545"]
interval: 30s
@@ -13,11 +13,11 @@
# 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/>.
from app.util import get_yaml
from app.deploy_types import DeployCommandContext, LaconicStackSetupCommand, DeploymentContext
from app.stack_state import State
from app.deploy_util import VolumeMapping, run_container_command
from app.command_types import CommandOptions
from laconic_stack_orchestrator.util import get_yaml
from laconic_stack_orchestrator.deploy_types import DeployCommandContext, LaconicStackSetupCommand, DeploymentContext
from laconic_stack_orchestrator.stack_state import State
from laconic_stack_orchestrator.deploy_util import VolumeMapping, run_container_command
from laconic_stack_orchestrator.command_types import CommandOptions
from enum import Enum
from pathlib import Path
from shutil import copyfile, copytree
+4 -4
View File
@@ -2,11 +2,11 @@ version: "1.0"
description: "MobyMask v3 stack"
name: mobymask-v3
repos:
- github.com/cerc-io/ts-nitro@v0.1.13
- github.com/cerc-io/watcher-ts@v0.2.63
- github.com/cerc-io/mobymask-v2-watcher-ts@v0.2.2
- github.com/cerc-io/ts-nitrov0.1.12
- github.com/cerc-io/watcher-ts@v0.2.57
- github.com/cerc-io/mobymask-v2-watcher-ts@v3 # TODO: Update after fixes
- github.com/cerc-io/MobyMask@v0.1.3
- github.com/cerc-io/mobymask-ui@v0.2.1
- github.com/cerc-io/mobymask-ui@v0.2.0
containers:
- cerc/nitro-contracts
- cerc/watcher-ts
+1 -4
View File
@@ -23,7 +23,7 @@ laconic-so --stack mobymask-v3 build-containers --exclude cerc/mobymask-ui
Create and update an env file to be used in the next step ([defaults](../../config/watcher-mobymask-v3/mobymask-params.env)):
```bash
# External ETH RPC endpoint for contract(s) deployment
# External ETH RPC endpoint (L2 Optimism geth)
CERC_ETH_RPC_ENDPOINT=
# External ETH RPC endpoint used for queries in the watcher
@@ -32,9 +32,6 @@ Create and update an env file to be used in the next step ([defaults](../../conf
# External ETH RPC endpoint used for mutations in the watcher
CERC_ETH_RPC_MUTATION_ENDPOINT=
# External ETH endpoint used by watcher's Nitro node
CERC_NITRO_CHAIN_URL=
# Specify the an account PK for contract deployment
CERC_PRIVATE_KEY_DEPLOYER=
+4 -4
View File
@@ -13,10 +13,10 @@
# 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/>.
from app.util import get_yaml
from app.deploy_types import DeployCommandContext
from app.stack_state import State
from app.deploy_util import VolumeMapping, run_container_command
from laconic_stack_orchestrator.util import get_yaml
from laconic_stack_orchestrator.deploy_types import DeployCommandContext
from laconic_stack_orchestrator.stack_state import State
from laconic_stack_orchestrator.deploy_util import VolumeMapping, run_container_command
from pathlib import Path
default_spec_file_content = """config:
+6 -6
View File
@@ -26,11 +26,11 @@ import subprocess
from python_on_whales import DockerClient, DockerException
import click
from pathlib import Path
from app.util import include_exclude_check, get_parsed_stack_config, global_options2
from app.deploy_types import ClusterContext, DeployCommandContext
from app.deployment_create import create as deployment_create
from app.deployment_create import init as deployment_init
from app.deployment_create import setup as deployment_setup
from .util import include_exclude_check, get_parsed_stack_config, global_options2
from .deploy_types import ClusterContext, DeployCommandContext
from .deployment_create import create as deployment_create
from .deployment_create import init as deployment_init
from .deployment_create import setup as deployment_setup
@click.group()
@@ -263,7 +263,7 @@ def _make_cluster_context(ctx, stack, include, exclude, cluster, env_file):
print(f"Using cluster name: {cluster}")
# See: https://stackoverflow.com/a/20885799/1701505
from app import data
from . import data
with resources.open_text(data, "pod-list.txt") as pod_list_file:
all_pods = pod_list_file.read().splitlines()
+1 -1
View File
@@ -17,7 +17,7 @@ from typing import List
from dataclasses import dataclass
from pathlib import Path
from python_on_whales import DockerClient
from app.command_types import CommandOptions
from .command_types import CommandOptions
@dataclass
+2 -2
View File
@@ -15,8 +15,8 @@
import os
from typing import List
from app.deploy_types import DeployCommandContext, VolumeMapping
from app.util import get_parsed_stack_config, get_yaml, get_compose_file_dir
from .deploy_types import DeployCommandContext, VolumeMapping
from .util import get_parsed_stack_config, get_yaml, get_compose_file_dir
def _container_image_from_service(stack: str, service: str):
+2 -2
View File
@@ -17,8 +17,8 @@ import click
from dataclasses import dataclass
from pathlib import Path
import sys
from app.deploy import up_operation, down_operation, ps_operation, port_operation
from app.deploy import exec_operation, logs_operation, create_deploy_context
from .deploy import up_operation, down_operation, ps_operation, port_operation
from .deploy import exec_operation, logs_operation, create_deploy_context
@dataclass
+3 -3
View File
@@ -20,9 +20,9 @@ from pathlib import Path
import random
from shutil import copyfile, copytree
import sys
from app.util import get_stack_file_path, get_parsed_deployment_spec, get_parsed_stack_config, global_options, get_yaml
from app.util import get_compose_file_dir
from app.deploy_types import DeploymentContext, LaconicStackSetupCommand
from .util import get_stack_file_path, get_parsed_deployment_spec, get_parsed_stack_config, global_options, get_yaml
from .util import get_compose_file_dir
from .deploy_types import DeploymentContext, LaconicStackSetupCommand
def _make_default_deployment_dir():
+2 -2
View File
@@ -25,7 +25,7 @@ import click
import importlib.resources
from pathlib import Path
import yaml
from app.util import include_exclude_check
from .util import include_exclude_check
class GitProgress(git.RemoteProgress):
@@ -232,7 +232,7 @@ def command(ctx, include, exclude, git_ssh, check_only, pull, branches, branches
os.makedirs(dev_root_path)
# See: https://stackoverflow.com/a/20885799/1701505
from app import data
from . import data
with importlib.resources.open_text(data, "repository-list.txt") as repository_list_file:
all_repos = repository_list_file.read().splitlines()
+1 -1
View File
@@ -23,7 +23,7 @@ import sys
import stat
import shutil
import validators
from app.util import get_yaml
from .util import get_yaml
def _download_url(url: str, file_path: Path):
+1 -1
View File
@@ -23,7 +23,7 @@ def command(ctx):
'''print tool version'''
# See: https://stackoverflow.com/a/20885799/1701505
from app import data
from . import data
with importlib.resources.open_text(data, "build_tag.txt") as version_file:
# TODO: code better version that skips comment lines
version_string = version_file.read().splitlines()[1]
+5 -4
View File
@@ -1,5 +1,5 @@
# See https://medium.com/nerd-for-tech/how-to-build-and-distribute-a-cli-tool-with-python-537ae41d9d78
from setuptools import setup, find_packages
from setuptools import setup
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
with open("requirements.txt", "r", encoding="utf-8") as fh:
@@ -14,8 +14,9 @@ setup(
long_description=long_description,
long_description_content_type="text/markdown",
url='https://github.com/cerc-io/stack-orchestrator',
py_modules=['cli', 'app'],
packages=find_packages(),
packages=['laconic_stack_orchestrator'],
package_dir={'laconic_stack_orchestrator': 'app'},
py_modules=['laconic_stack_orchestrator', 'laconic_stack_orchestrator.cli'],
install_requires=[requirements],
python_requires='>=3.7',
include_package_data=True,
@@ -25,6 +26,6 @@ setup(
"Operating System :: OS Independent",
],
entry_points={
'console_scripts': ['laconic-so=cli:cli'],
'console_scripts': ['laconic-so=laconic_stack_orchestrator.cli:cli'],
}
)