opsmith-cli 0.2.0b0__tar.gz → 0.3.0b0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/.gitignore +4 -1
- opsmith_cli-0.3.0b0/PKG-INFO +275 -0
- opsmith_cli-0.3.0b0/README.md +236 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/agent.py +6 -1
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/deployment_strategies/base.py +4 -4
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/deployment_strategies/monolithic.py +9 -12
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/git_repo.py +32 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/infra_provisioners/base_provisioner.py +1 -3
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/main.py +17 -8
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/models.py +3 -2
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/prompts.py +2 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/repo_map.py +4 -3
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/service_detector.py +46 -23
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/settings.py +1 -1
- opsmith_cli-0.3.0b0/opsmith/templates/dockerfiles/python_backend_api +79 -0
- opsmith_cli-0.3.0b0/opsmith/templates/dockerfiles/python_backend_worker +77 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/pyproject.toml +5 -1
- opsmith_cli-0.3.0b0/resources/deploy_demo.svg +1 -0
- opsmith_cli-0.3.0b0/resources/setup_demo.gif +0 -0
- opsmith_cli-0.3.0b0/resources/setup_demo.svg +1 -0
- opsmith_cli-0.2.0b0/PKG-INFO +0 -37
- opsmith_cli-0.2.0b0/README.md +0 -1
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/.flake8 +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/.github/workflows/python-publish.yml +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/.pre-commit-config.yaml +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/CONVENTIONS.md +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/LICENSE.txt +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/__init__.py +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/cloud_providers/__init__.py +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/cloud_providers/aws.py +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/cloud_providers/base.py +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/cloud_providers/gcp.py +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/constants.py +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/deployment_strategies/__init__.py +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/exceptions.py +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/infra_provisioners/__init__.py +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/infra_provisioners/ansible_provisioner.py +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/infra_provisioners/terraform_provisioner.py +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/queries/tree-sitter-languages/README.md +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/queries/tree-sitter-languages/arduino-tags.scm +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/queries/tree-sitter-languages/c-tags.scm +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/queries/tree-sitter-languages/c_sharp-tags.scm +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/queries/tree-sitter-languages/chatito-tags.scm +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/queries/tree-sitter-languages/commonlisp-tags.scm +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/queries/tree-sitter-languages/cpp-tags.scm +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/queries/tree-sitter-languages/csharp-tags.scm +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/queries/tree-sitter-languages/d-tags.scm +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/queries/tree-sitter-languages/dart-tags.scm +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/queries/tree-sitter-languages/elisp-tags.scm +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/queries/tree-sitter-languages/elixir-tags.scm +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/queries/tree-sitter-languages/elm-tags.scm +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/queries/tree-sitter-languages/gleam-tags.scm +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/queries/tree-sitter-languages/go-tags.scm +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/queries/tree-sitter-languages/hcl-tags.scm +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/queries/tree-sitter-languages/java-tags.scm +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/queries/tree-sitter-languages/javascript-tags.scm +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/queries/tree-sitter-languages/kotlin-tags.scm +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/queries/tree-sitter-languages/lua-tags.scm +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/queries/tree-sitter-languages/ocaml-tags.scm +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/queries/tree-sitter-languages/ocaml_interface-tags.scm +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/queries/tree-sitter-languages/php-tags.scm +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/queries/tree-sitter-languages/pony-tags.scm +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/queries/tree-sitter-languages/properties-tags.scm +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/queries/tree-sitter-languages/python-tags.scm +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/queries/tree-sitter-languages/ql-tags.scm +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/queries/tree-sitter-languages/r-tags.scm +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/queries/tree-sitter-languages/racket-tags.scm +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/queries/tree-sitter-languages/ruby-tags.scm +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/queries/tree-sitter-languages/rust-tags.scm +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/queries/tree-sitter-languages/scala-tags.scm +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/queries/tree-sitter-languages/solidity-tags.scm +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/queries/tree-sitter-languages/swift-tags.scm +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/queries/tree-sitter-languages/typescript-tags.scm +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/queries/tree-sitter-languages/udev-tags.scm +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/templates/cloud_storage_cleanup/aws/main.yml +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/templates/cloud_storage_cleanup/gcp/main.yml +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/templates/container_registry/aws/main.tf +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/templates/container_registry/aws/outputs.tf +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/templates/container_registry/aws/variables.tf +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/templates/container_registry/gcp/main.tf +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/templates/container_registry/gcp/outputs.tf +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/templates/container_registry/gcp/variables.tf +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/templates/docker_build_push/aws/main.yml +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/templates/docker_build_push/gcp/main.yml +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/templates/docker_compose_deploy/aws/main.yml +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/templates/docker_compose_deploy/gcp/main.yml +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/templates/docker_compose_run/common/main.yml +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/templates/docker_compose_snippets/base.yml +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/templates/docker_compose_snippets/elasticsearch.yml +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/templates/docker_compose_snippets/kafka.yml +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/templates/docker_compose_snippets/mongodb.yml +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/templates/docker_compose_snippets/mysql.yml +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/templates/docker_compose_snippets/postgresql.yml +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/templates/docker_compose_snippets/rabbitmq.yml +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/templates/docker_compose_snippets/redis.yml +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/templates/docker_compose_snippets/services/backend_api.yml +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/templates/docker_compose_snippets/services/backend_worker.yml +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/templates/docker_compose_snippets/services/full_stack.yml +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/templates/docker_compose_snippets/traefik.yml +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/templates/docker_compose_snippets/weaviate.yml +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/templates/docker_setup/aws/main.yml +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/templates/docker_setup/gcp/main.yml +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/templates/fetch_remote_files/common/main.yml +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/templates/frontend_bucket_cert/aws/main.tf +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/templates/frontend_bucket_cert/aws/outputs.tf +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/templates/frontend_bucket_cert/aws/variables.tf +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/templates/frontend_bucket_cert/gcp/main.tf +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/templates/frontend_bucket_cert/gcp/outputs.tf +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/templates/frontend_bucket_cert/gcp/variables.tf +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/templates/frontend_cdn/aws/main.tf +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/templates/frontend_cdn/aws/outputs.tf +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/templates/frontend_cdn/aws/variables.tf +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/templates/frontend_cdn/gcp/main.tf +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/templates/frontend_cdn/gcp/outputs.tf +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/templates/frontend_cdn/gcp/variables.tf +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/templates/frontend_deploy/aws/main.yml +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/templates/frontend_deploy/gcp/main.yml +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/templates/virtual_machine/aws/main.tf +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/templates/virtual_machine/aws/outputs.tf +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/templates/virtual_machine/aws/variables.tf +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/templates/virtual_machine/gcp/main.tf +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/templates/virtual_machine/gcp/outputs.tf +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/templates/virtual_machine/gcp/variables.tf +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/types.py +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/opsmith/utils.py +0 -0
- {opsmith_cli-0.2.0b0 → opsmith_cli-0.3.0b0}/uv.lock +0 -0
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: opsmith-cli
|
|
3
|
+
Version: 0.3.0b0
|
|
4
|
+
Summary: Opsmith is an AI devops engineer in your terminal
|
|
5
|
+
License-Expression: GPL-3.0-only
|
|
6
|
+
License-File: LICENSE.txt
|
|
7
|
+
Classifier: Development Status :: 4 - Beta
|
|
8
|
+
Classifier: Environment :: Console
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: Programming Language :: Python
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Classifier: Topic :: Software Development
|
|
17
|
+
Requires-Python: >=3.10
|
|
18
|
+
Requires-Dist: ansible>=10.7.0
|
|
19
|
+
Requires-Dist: black>=25.1.0
|
|
20
|
+
Requires-Dist: boto3-stubs==1.38.36
|
|
21
|
+
Requires-Dist: gitpython>=3.1.44
|
|
22
|
+
Requires-Dist: google-api-python-client>=2.175.0
|
|
23
|
+
Requires-Dist: google-cloud-compute>=1.31.0
|
|
24
|
+
Requires-Dist: google-cloud-resource-manager>=1.14.2
|
|
25
|
+
Requires-Dist: google-cloud-storage>=3.2.0
|
|
26
|
+
Requires-Dist: grep-ast>=0.9.0
|
|
27
|
+
Requires-Dist: inquirer>=3.4.0
|
|
28
|
+
Requires-Dist: jinja2>=3.1.6
|
|
29
|
+
Requires-Dist: networkx>=3.4.2
|
|
30
|
+
Requires-Dist: pick>=2.4.0
|
|
31
|
+
Requires-Dist: pydantic-ai[logfire]==0.4.2
|
|
32
|
+
Requires-Dist: pydantic>=2.11.5
|
|
33
|
+
Requires-Dist: python-dotenv>=1.1.0
|
|
34
|
+
Requires-Dist: pyyaml>=6.0.2
|
|
35
|
+
Requires-Dist: tqdm>=4.67.1
|
|
36
|
+
Requires-Dist: tree-sitter-language-pack>=0.7.3
|
|
37
|
+
Requires-Dist: typer>=0.16.0
|
|
38
|
+
Description-Content-Type: text/markdown
|
|
39
|
+
|
|
40
|
+
# Opsmith: An AI devops engineer in your terminal
|
|
41
|
+
|
|
42
|
+
Opsmith is a command-line tool that acts as an AI-powered DevOps assistant. It's designed to streamline the process of deploying your applications to the cloud, from analyzing your codebase to provisioning infrastructure and deploying your services.
|
|
43
|
+
|
|
44
|
+
Opsmith helps you with the following tasks:
|
|
45
|
+
|
|
46
|
+
- **Codebase Analysis**: It scans your repository to automatically detect services, programming languages, frameworks, and infrastructure dependencies (like databases or caches).
|
|
47
|
+
- **Configuration Generation**: Based on its analysis, Opsmith generates necessary deployment artifacts.
|
|
48
|
+
- **Infrastructure Provisioning**: It uses tools like Terraform and Ansible to provision and configure required cloud resources on supported providers (e.g., AWS, GCP).
|
|
49
|
+
- **Deployment**: It handles the deployment of your application using various strategies, such as a monolithic deployment on a single virtual machine for hobby projects.
|
|
50
|
+
|
|
51
|
+
The primary goal of Opsmith is to make cloud deployments accessible to all developers, regardless of their DevOps expertise. It achieves this by automating complex tasks through an interactive setup process, allowing you to focus on writing code. Opsmith is also designed to prevent cloud provider lock-in, which helps control long-term costs. The generated configurations are standard and maintainable, making it easy to hand over the deployment to an in-house DevOps team.
|
|
52
|
+
|
|
53
|
+
## Table of Contents
|
|
54
|
+
|
|
55
|
+
- [Getting Started](#getting-started)
|
|
56
|
+
- [Installation](#installation)
|
|
57
|
+
- [Deployment Workflow](#deployment-workflow)
|
|
58
|
+
- [User Guide](#user-guide)
|
|
59
|
+
- [LLMs](#llms)
|
|
60
|
+
- [Supported Models](#supported-models)
|
|
61
|
+
- [Cloud Providers](#cloud-providers)
|
|
62
|
+
- [AWS](#aws-amazon-web-services)
|
|
63
|
+
- [GCP](#gcp-google-cloud-platform)
|
|
64
|
+
- [Deployment Strategies](#deployment-strategies)
|
|
65
|
+
- [Monolithic](#monolithic)
|
|
66
|
+
- [Deployments Directory](#deployments-directory)
|
|
67
|
+
- [Extending Opsmith](#extending-opsmith)
|
|
68
|
+
- [Adding a Cloud Provider](#adding-a-cloud-provider)
|
|
69
|
+
- [Adding a Deployment Strategy](#adding-a-deployment-strategy)
|
|
70
|
+
- [Contributing](#contributing)
|
|
71
|
+
|
|
72
|
+
## Getting Started
|
|
73
|
+
|
|
74
|
+
### Installation
|
|
75
|
+
|
|
76
|
+
1. **Prerequisites**: Opsmith requires `Docker` and `Terraform` to be installed and available in your system's `PATH`.
|
|
77
|
+
|
|
78
|
+
- **macOS (with [Homebrew](https://brew.sh/))**:
|
|
79
|
+
```shell
|
|
80
|
+
brew install --cask docker
|
|
81
|
+
brew install terraform
|
|
82
|
+
```
|
|
83
|
+
After installation, make sure you start Docker Desktop.
|
|
84
|
+
|
|
85
|
+
- **Windows (with [Chocolatey](https://chocolatey.org/))**:
|
|
86
|
+
```shell
|
|
87
|
+
choco install docker-desktop terraform
|
|
88
|
+
```
|
|
89
|
+
After installation, make sure you start Docker Desktop.
|
|
90
|
+
|
|
91
|
+
- **Linux (Debian/Ubuntu)**:
|
|
92
|
+
Please follow the official installation guides for [Docker](https://docs.docker.com/engine/install/ubuntu/) and [Terraform](https://developer.hashicorp.com/terraform/install).
|
|
93
|
+
|
|
94
|
+
2. **Install Opsmith**:
|
|
95
|
+
Once the prerequisites are installed, you can install Opsmith using `pip`:
|
|
96
|
+
```shell
|
|
97
|
+
pip install opsmith-cli
|
|
98
|
+
```
|
|
99
|
+
On macOS, you might need to use `pip3` if `pip` doesn't work.
|
|
100
|
+
|
|
101
|
+
### Deployment Workflow
|
|
102
|
+
|
|
103
|
+
Deploying your application with Opsmith follows a straightforward workflow:
|
|
104
|
+
|
|
105
|
+
1. **Setup Your Project**
|
|
106
|
+
|
|
107
|
+
Navigate to your project's root directory, which should be a Git repository, and run the `setup` command. This command initializes your deployment configuration by analyzing your codebase to detect services and infrastructure requirements.
|
|
108
|
+
|
|
109
|
+
```shell
|
|
110
|
+
opsmith --model <your-llm-provider:model-name> --api-key <your-api-key> setup
|
|
111
|
+
```
|
|
112
|
+
<p >
|
|
113
|
+
<img width="600" src="https://raw.githubusercontent.com/abhishek-ram/opsmith-cli/main/resources/setup_demo.svg" alt="Opsmith Setup">
|
|
114
|
+
</p>
|
|
115
|
+
|
|
116
|
+
2. **Deploy Your Application**
|
|
117
|
+
|
|
118
|
+
After setting up the configuration, deploy your application using the `deploy` command:
|
|
119
|
+
|
|
120
|
+
```shell
|
|
121
|
+
opsmith --model <your-llm-provider:model-name> --api-key <your-api-key> deploy
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
<p >
|
|
125
|
+
<img width="600" src="https://raw.githubusercontent.com/abhishek-ram/opsmith-cli/main/resources/deploy_demo.svg" alt="Opsmith Setup">
|
|
126
|
+
</p>
|
|
127
|
+
|
|
128
|
+
3. **Manage Your Deployments**
|
|
129
|
+
|
|
130
|
+
To manage an existing environment, run the `deploy` command again. You can select an environment and perform the following actions:
|
|
131
|
+
- `release`: Deploy a new version of your application.
|
|
132
|
+
- `run`: Execute a command on a specific service within your environment (e.g., run database migrations).
|
|
133
|
+
- `delete`: Tear down all the infrastructure and delete the environment.
|
|
134
|
+
|
|
135
|
+
## User Guide
|
|
136
|
+
|
|
137
|
+
### LLMs
|
|
138
|
+
|
|
139
|
+
Opsmith leverages Large Language Models (LLMs) to analyze your codebase, generate configurations, and make decisions about your infrastructure. To use Opsmith, you must provide an LLM model and a corresponding API key from the model's provider.
|
|
140
|
+
|
|
141
|
+
#### Supported Models
|
|
142
|
+
|
|
143
|
+
Opsmith supports a variety of models from different providers. Here is a list of the currently supported models:
|
|
144
|
+
|
|
145
|
+
- **Google** (Recommended):
|
|
146
|
+
- `google-gla:gemini-2.5-pro`
|
|
147
|
+
- **OpenAI**:
|
|
148
|
+
- `openai:gpt-4.1`
|
|
149
|
+
- `openai:gpt-o3`
|
|
150
|
+
- **Anthropic**:
|
|
151
|
+
- `anthropic:claude-3-7-sonnet-20250219`
|
|
152
|
+
- `anthropic:claude-sonnet-4-20250514`
|
|
153
|
+
|
|
154
|
+
#### Usage
|
|
155
|
+
|
|
156
|
+
To specify which model to use, pass the `--model` option with the full model name, and provide your API key with the `--api-key` option.
|
|
157
|
+
|
|
158
|
+
**Example with OpenAI:**
|
|
159
|
+
```shell
|
|
160
|
+
opsmith --model openai:gpt-4.1 --api-key YOUR_OPENAI_API_KEY COMMAND
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
**Example with Anthropic:**
|
|
164
|
+
```shell
|
|
165
|
+
opsmith --model anthropic:claude-3-7-sonnet-20250219 --api-key YOUR_ANTHROPIC_API_KEY COMMAND
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
**Example with Google:**
|
|
169
|
+
```shell
|
|
170
|
+
opsmith --model google-gla:gemini-2.5-pro --api-key YOUR_GEMINI_API_KEY COMMAND
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### Cloud Providers
|
|
174
|
+
|
|
175
|
+
Opsmith uses your cloud provider's command-line tools to authenticate and manage resources. Before using Opsmith, you need to configure the credentials for your chosen cloud provider.
|
|
176
|
+
|
|
177
|
+
#### AWS (Amazon Web Services)
|
|
178
|
+
|
|
179
|
+
Opsmith uses the official AWS CLI to interact with your account.
|
|
180
|
+
|
|
181
|
+
1. **Install the AWS CLI**: Follow the [official installation guide](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html) for your operating system.
|
|
182
|
+
|
|
183
|
+
2. **Configure Credentials**: Once installed, configure the CLI with your AWS credentials by running:
|
|
184
|
+
```shell
|
|
185
|
+
aws configure
|
|
186
|
+
```
|
|
187
|
+
You will be prompted to enter your `AWS Access Key ID`, `AWS Secret Access Key`, default region, and default output format. This will store your credentials in the `~/.aws/credentials` file, which Opsmith will use automatically.
|
|
188
|
+
|
|
189
|
+
#### GCP (Google Cloud Platform)
|
|
190
|
+
|
|
191
|
+
Opsmith uses the Google Cloud CLI to authenticate.
|
|
192
|
+
|
|
193
|
+
1. **Install the gcloud CLI**: Follow the [official installation guide](https://cloud.google.com/sdk/docs/install) for your operating system.
|
|
194
|
+
|
|
195
|
+
2. **Authenticate with Application Default Credentials (ADC)**: Run the following command to log in and create your ADC file:
|
|
196
|
+
```shell
|
|
197
|
+
gcloud auth application-default login
|
|
198
|
+
```
|
|
199
|
+
This command will open a browser window for you to log in to your Google account and authorize access. Once completed, your credentials will be stored locally, and Opsmith will use them to authenticate.
|
|
200
|
+
|
|
201
|
+
### Deployment Strategies
|
|
202
|
+
|
|
203
|
+
Deployment strategies in Opsmith define the architecture and approach for deploying your application. When you create a new environment, you will be prompted to select a strategy that best fits your project's needs. Each strategy automates the provisioning of specific infrastructure and handles the deployment process accordingly.
|
|
204
|
+
|
|
205
|
+
#### Monolithic
|
|
206
|
+
|
|
207
|
+
The **Monolithic** strategy is designed for simplicity and is ideal for hobby projects, experiments, or small-scale applications. It deploys your entire application to a single virtual machine (VM).
|
|
208
|
+
|
|
209
|
+
Key features of the Monolithic strategy include:
|
|
210
|
+
|
|
211
|
+
- **Single Virtual Machine**: Provisions one VM to host all backend services and infrastructure dependencies.
|
|
212
|
+
- **Containerization**: Backend and full-stack services are containerized using Docker and managed with `docker-compose`. This isolates services and simplifies dependency management.
|
|
213
|
+
- **Frontend Deployment**: Frontend services are built and deployed to a cloud storage bucket (like AWS S3 or GCS) and served through a Content Delivery Network (CDN) for optimal performance.
|
|
214
|
+
|
|
215
|
+
This strategy is a great starting point for getting your application running in the cloud quickly with minimal complexity.
|
|
216
|
+
|
|
217
|
+
### Deployments Directory
|
|
218
|
+
|
|
219
|
+
When you run `opsmith`, it creates a `.opsmith` directory in the root of your project. This directory stores all the configurations, generated artifacts, and state files required to manage your deployments. This directory is intended to be committed to your git repository so that your deployment configurations are versioned. Sensitive files like Terraform state are automatically ignored.
|
|
220
|
+
|
|
221
|
+
Here is an overview of what you can find inside the `.opsmith` directory:
|
|
222
|
+
|
|
223
|
+
- `deployments.yml`: The main configuration file for your application. It contains the list of services, infrastructure dependencies, cloud provider details, and environment configurations.
|
|
224
|
+
- `docker/`: Contains the generated `Dockerfile`s for each of your services, organized into subdirectories by service name.
|
|
225
|
+
- `environments/`: This directory holds the state and configuration for each of your deployment environments (e.g., `dev`, `staging`).
|
|
226
|
+
- `<environment-name>/`: A directory for each environment, containing Terraform state for provisioned infrastructure and other environment-specific files.
|
|
227
|
+
- `global/`: Contains configurations that are shared across environments within a specific region, such as container registries.
|
|
228
|
+
|
|
229
|
+
### Extending Opsmith
|
|
230
|
+
|
|
231
|
+
Opsmith has been designed with extensibility in mind, allowing you to add your own cloud providers and deployment strategies. This is achieved through Python's entry points mechanism, which enables other packages to plug into Opsmith seamlessly.
|
|
232
|
+
|
|
233
|
+
#### Adding a Cloud Provider
|
|
234
|
+
|
|
235
|
+
To add a new cloud provider, you need to:
|
|
236
|
+
|
|
237
|
+
1. Create a Python class that inherits from `opsmith.cloud_providers.base.BaseCloudProvider` and implements all its abstract methods (`name`, `description`, `get_detail_model`, `get_account_details`, `get_instance_types`, `get_regions`).
|
|
238
|
+
2. Package your new provider class.
|
|
239
|
+
3. In your package's `pyproject.toml`, add an entry point under the `[project.entry-points."opsmith.cloud_providers"]` group.
|
|
240
|
+
|
|
241
|
+
Example `pyproject.toml` entry:
|
|
242
|
+
|
|
243
|
+
```toml
|
|
244
|
+
[project.entry-points."opsmith.cloud_providers"]
|
|
245
|
+
my-provider = "my_opsmith_plugin.providers:MyCloudProvider"
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
Once your package is installed in the same environment as `opsmith-cli`, Opsmith will automatically discover and register your new provider.
|
|
249
|
+
|
|
250
|
+
#### Adding a Deployment Strategy
|
|
251
|
+
|
|
252
|
+
Similarly, you can add a new deployment strategy by:
|
|
253
|
+
|
|
254
|
+
1. Creating a Python class that inherits from `opsmith.deployment_strategies.base.BaseDeploymentStrategy` and implements its abstract methods (`name`, `description`, `deploy`, `release`, `destroy`, `run`).
|
|
255
|
+
2. Packaging your new strategy class.
|
|
256
|
+
3. In your package's `pyproject.toml`, add an entry point under the `[project.entry-points."opsmith.deployment_strategies"]` group.
|
|
257
|
+
|
|
258
|
+
Example `pyproject.toml` entry:
|
|
259
|
+
|
|
260
|
+
```toml
|
|
261
|
+
[project.entry-points."opsmith.deployment_strategies"]
|
|
262
|
+
my-strategy = "my_opsmith_plugin.strategies:MyStrategy"
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
After installation, your custom deployment strategy will be available for selection when creating a new environment.
|
|
266
|
+
|
|
267
|
+
## Contributing
|
|
268
|
+
|
|
269
|
+
We welcome contributions to Opsmith! If you're interested in helping improve the tool, here are a few ways to get started:
|
|
270
|
+
|
|
271
|
+
- **Reporting Bugs**: If you encounter a bug, please open an issue on our GitHub repository. Include as much detail as possible, such as your operating system, the command you ran, and the full error message.
|
|
272
|
+
- **Suggesting Enhancements**: Have an idea for a new feature or an improvement to an existing one? We'd love to hear it. Open an issue to start a discussion.
|
|
273
|
+
- **Submitting Pull Requests**: If you'd like to contribute code, please fork the repository and submit a pull request. For major changes, it's best to discuss your idea in an issue first.
|
|
274
|
+
|
|
275
|
+
When contributing, please follow our [engineering conventions](./CONVENTIONS.md) and ensure your code is formatted with `black`.
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
# Opsmith: An AI devops engineer in your terminal
|
|
2
|
+
|
|
3
|
+
Opsmith is a command-line tool that acts as an AI-powered DevOps assistant. It's designed to streamline the process of deploying your applications to the cloud, from analyzing your codebase to provisioning infrastructure and deploying your services.
|
|
4
|
+
|
|
5
|
+
Opsmith helps you with the following tasks:
|
|
6
|
+
|
|
7
|
+
- **Codebase Analysis**: It scans your repository to automatically detect services, programming languages, frameworks, and infrastructure dependencies (like databases or caches).
|
|
8
|
+
- **Configuration Generation**: Based on its analysis, Opsmith generates necessary deployment artifacts.
|
|
9
|
+
- **Infrastructure Provisioning**: It uses tools like Terraform and Ansible to provision and configure required cloud resources on supported providers (e.g., AWS, GCP).
|
|
10
|
+
- **Deployment**: It handles the deployment of your application using various strategies, such as a monolithic deployment on a single virtual machine for hobby projects.
|
|
11
|
+
|
|
12
|
+
The primary goal of Opsmith is to make cloud deployments accessible to all developers, regardless of their DevOps expertise. It achieves this by automating complex tasks through an interactive setup process, allowing you to focus on writing code. Opsmith is also designed to prevent cloud provider lock-in, which helps control long-term costs. The generated configurations are standard and maintainable, making it easy to hand over the deployment to an in-house DevOps team.
|
|
13
|
+
|
|
14
|
+
## Table of Contents
|
|
15
|
+
|
|
16
|
+
- [Getting Started](#getting-started)
|
|
17
|
+
- [Installation](#installation)
|
|
18
|
+
- [Deployment Workflow](#deployment-workflow)
|
|
19
|
+
- [User Guide](#user-guide)
|
|
20
|
+
- [LLMs](#llms)
|
|
21
|
+
- [Supported Models](#supported-models)
|
|
22
|
+
- [Cloud Providers](#cloud-providers)
|
|
23
|
+
- [AWS](#aws-amazon-web-services)
|
|
24
|
+
- [GCP](#gcp-google-cloud-platform)
|
|
25
|
+
- [Deployment Strategies](#deployment-strategies)
|
|
26
|
+
- [Monolithic](#monolithic)
|
|
27
|
+
- [Deployments Directory](#deployments-directory)
|
|
28
|
+
- [Extending Opsmith](#extending-opsmith)
|
|
29
|
+
- [Adding a Cloud Provider](#adding-a-cloud-provider)
|
|
30
|
+
- [Adding a Deployment Strategy](#adding-a-deployment-strategy)
|
|
31
|
+
- [Contributing](#contributing)
|
|
32
|
+
|
|
33
|
+
## Getting Started
|
|
34
|
+
|
|
35
|
+
### Installation
|
|
36
|
+
|
|
37
|
+
1. **Prerequisites**: Opsmith requires `Docker` and `Terraform` to be installed and available in your system's `PATH`.
|
|
38
|
+
|
|
39
|
+
- **macOS (with [Homebrew](https://brew.sh/))**:
|
|
40
|
+
```shell
|
|
41
|
+
brew install --cask docker
|
|
42
|
+
brew install terraform
|
|
43
|
+
```
|
|
44
|
+
After installation, make sure you start Docker Desktop.
|
|
45
|
+
|
|
46
|
+
- **Windows (with [Chocolatey](https://chocolatey.org/))**:
|
|
47
|
+
```shell
|
|
48
|
+
choco install docker-desktop terraform
|
|
49
|
+
```
|
|
50
|
+
After installation, make sure you start Docker Desktop.
|
|
51
|
+
|
|
52
|
+
- **Linux (Debian/Ubuntu)**:
|
|
53
|
+
Please follow the official installation guides for [Docker](https://docs.docker.com/engine/install/ubuntu/) and [Terraform](https://developer.hashicorp.com/terraform/install).
|
|
54
|
+
|
|
55
|
+
2. **Install Opsmith**:
|
|
56
|
+
Once the prerequisites are installed, you can install Opsmith using `pip`:
|
|
57
|
+
```shell
|
|
58
|
+
pip install opsmith-cli
|
|
59
|
+
```
|
|
60
|
+
On macOS, you might need to use `pip3` if `pip` doesn't work.
|
|
61
|
+
|
|
62
|
+
### Deployment Workflow
|
|
63
|
+
|
|
64
|
+
Deploying your application with Opsmith follows a straightforward workflow:
|
|
65
|
+
|
|
66
|
+
1. **Setup Your Project**
|
|
67
|
+
|
|
68
|
+
Navigate to your project's root directory, which should be a Git repository, and run the `setup` command. This command initializes your deployment configuration by analyzing your codebase to detect services and infrastructure requirements.
|
|
69
|
+
|
|
70
|
+
```shell
|
|
71
|
+
opsmith --model <your-llm-provider:model-name> --api-key <your-api-key> setup
|
|
72
|
+
```
|
|
73
|
+
<p >
|
|
74
|
+
<img width="600" src="https://raw.githubusercontent.com/abhishek-ram/opsmith-cli/main/resources/setup_demo.svg" alt="Opsmith Setup">
|
|
75
|
+
</p>
|
|
76
|
+
|
|
77
|
+
2. **Deploy Your Application**
|
|
78
|
+
|
|
79
|
+
After setting up the configuration, deploy your application using the `deploy` command:
|
|
80
|
+
|
|
81
|
+
```shell
|
|
82
|
+
opsmith --model <your-llm-provider:model-name> --api-key <your-api-key> deploy
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
<p >
|
|
86
|
+
<img width="600" src="https://raw.githubusercontent.com/abhishek-ram/opsmith-cli/main/resources/deploy_demo.svg" alt="Opsmith Setup">
|
|
87
|
+
</p>
|
|
88
|
+
|
|
89
|
+
3. **Manage Your Deployments**
|
|
90
|
+
|
|
91
|
+
To manage an existing environment, run the `deploy` command again. You can select an environment and perform the following actions:
|
|
92
|
+
- `release`: Deploy a new version of your application.
|
|
93
|
+
- `run`: Execute a command on a specific service within your environment (e.g., run database migrations).
|
|
94
|
+
- `delete`: Tear down all the infrastructure and delete the environment.
|
|
95
|
+
|
|
96
|
+
## User Guide
|
|
97
|
+
|
|
98
|
+
### LLMs
|
|
99
|
+
|
|
100
|
+
Opsmith leverages Large Language Models (LLMs) to analyze your codebase, generate configurations, and make decisions about your infrastructure. To use Opsmith, you must provide an LLM model and a corresponding API key from the model's provider.
|
|
101
|
+
|
|
102
|
+
#### Supported Models
|
|
103
|
+
|
|
104
|
+
Opsmith supports a variety of models from different providers. Here is a list of the currently supported models:
|
|
105
|
+
|
|
106
|
+
- **Google** (Recommended):
|
|
107
|
+
- `google-gla:gemini-2.5-pro`
|
|
108
|
+
- **OpenAI**:
|
|
109
|
+
- `openai:gpt-4.1`
|
|
110
|
+
- `openai:gpt-o3`
|
|
111
|
+
- **Anthropic**:
|
|
112
|
+
- `anthropic:claude-3-7-sonnet-20250219`
|
|
113
|
+
- `anthropic:claude-sonnet-4-20250514`
|
|
114
|
+
|
|
115
|
+
#### Usage
|
|
116
|
+
|
|
117
|
+
To specify which model to use, pass the `--model` option with the full model name, and provide your API key with the `--api-key` option.
|
|
118
|
+
|
|
119
|
+
**Example with OpenAI:**
|
|
120
|
+
```shell
|
|
121
|
+
opsmith --model openai:gpt-4.1 --api-key YOUR_OPENAI_API_KEY COMMAND
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
**Example with Anthropic:**
|
|
125
|
+
```shell
|
|
126
|
+
opsmith --model anthropic:claude-3-7-sonnet-20250219 --api-key YOUR_ANTHROPIC_API_KEY COMMAND
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
**Example with Google:**
|
|
130
|
+
```shell
|
|
131
|
+
opsmith --model google-gla:gemini-2.5-pro --api-key YOUR_GEMINI_API_KEY COMMAND
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### Cloud Providers
|
|
135
|
+
|
|
136
|
+
Opsmith uses your cloud provider's command-line tools to authenticate and manage resources. Before using Opsmith, you need to configure the credentials for your chosen cloud provider.
|
|
137
|
+
|
|
138
|
+
#### AWS (Amazon Web Services)
|
|
139
|
+
|
|
140
|
+
Opsmith uses the official AWS CLI to interact with your account.
|
|
141
|
+
|
|
142
|
+
1. **Install the AWS CLI**: Follow the [official installation guide](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html) for your operating system.
|
|
143
|
+
|
|
144
|
+
2. **Configure Credentials**: Once installed, configure the CLI with your AWS credentials by running:
|
|
145
|
+
```shell
|
|
146
|
+
aws configure
|
|
147
|
+
```
|
|
148
|
+
You will be prompted to enter your `AWS Access Key ID`, `AWS Secret Access Key`, default region, and default output format. This will store your credentials in the `~/.aws/credentials` file, which Opsmith will use automatically.
|
|
149
|
+
|
|
150
|
+
#### GCP (Google Cloud Platform)
|
|
151
|
+
|
|
152
|
+
Opsmith uses the Google Cloud CLI to authenticate.
|
|
153
|
+
|
|
154
|
+
1. **Install the gcloud CLI**: Follow the [official installation guide](https://cloud.google.com/sdk/docs/install) for your operating system.
|
|
155
|
+
|
|
156
|
+
2. **Authenticate with Application Default Credentials (ADC)**: Run the following command to log in and create your ADC file:
|
|
157
|
+
```shell
|
|
158
|
+
gcloud auth application-default login
|
|
159
|
+
```
|
|
160
|
+
This command will open a browser window for you to log in to your Google account and authorize access. Once completed, your credentials will be stored locally, and Opsmith will use them to authenticate.
|
|
161
|
+
|
|
162
|
+
### Deployment Strategies
|
|
163
|
+
|
|
164
|
+
Deployment strategies in Opsmith define the architecture and approach for deploying your application. When you create a new environment, you will be prompted to select a strategy that best fits your project's needs. Each strategy automates the provisioning of specific infrastructure and handles the deployment process accordingly.
|
|
165
|
+
|
|
166
|
+
#### Monolithic
|
|
167
|
+
|
|
168
|
+
The **Monolithic** strategy is designed for simplicity and is ideal for hobby projects, experiments, or small-scale applications. It deploys your entire application to a single virtual machine (VM).
|
|
169
|
+
|
|
170
|
+
Key features of the Monolithic strategy include:
|
|
171
|
+
|
|
172
|
+
- **Single Virtual Machine**: Provisions one VM to host all backend services and infrastructure dependencies.
|
|
173
|
+
- **Containerization**: Backend and full-stack services are containerized using Docker and managed with `docker-compose`. This isolates services and simplifies dependency management.
|
|
174
|
+
- **Frontend Deployment**: Frontend services are built and deployed to a cloud storage bucket (like AWS S3 or GCS) and served through a Content Delivery Network (CDN) for optimal performance.
|
|
175
|
+
|
|
176
|
+
This strategy is a great starting point for getting your application running in the cloud quickly with minimal complexity.
|
|
177
|
+
|
|
178
|
+
### Deployments Directory
|
|
179
|
+
|
|
180
|
+
When you run `opsmith`, it creates a `.opsmith` directory in the root of your project. This directory stores all the configurations, generated artifacts, and state files required to manage your deployments. This directory is intended to be committed to your git repository so that your deployment configurations are versioned. Sensitive files like Terraform state are automatically ignored.
|
|
181
|
+
|
|
182
|
+
Here is an overview of what you can find inside the `.opsmith` directory:
|
|
183
|
+
|
|
184
|
+
- `deployments.yml`: The main configuration file for your application. It contains the list of services, infrastructure dependencies, cloud provider details, and environment configurations.
|
|
185
|
+
- `docker/`: Contains the generated `Dockerfile`s for each of your services, organized into subdirectories by service name.
|
|
186
|
+
- `environments/`: This directory holds the state and configuration for each of your deployment environments (e.g., `dev`, `staging`).
|
|
187
|
+
- `<environment-name>/`: A directory for each environment, containing Terraform state for provisioned infrastructure and other environment-specific files.
|
|
188
|
+
- `global/`: Contains configurations that are shared across environments within a specific region, such as container registries.
|
|
189
|
+
|
|
190
|
+
### Extending Opsmith
|
|
191
|
+
|
|
192
|
+
Opsmith has been designed with extensibility in mind, allowing you to add your own cloud providers and deployment strategies. This is achieved through Python's entry points mechanism, which enables other packages to plug into Opsmith seamlessly.
|
|
193
|
+
|
|
194
|
+
#### Adding a Cloud Provider
|
|
195
|
+
|
|
196
|
+
To add a new cloud provider, you need to:
|
|
197
|
+
|
|
198
|
+
1. Create a Python class that inherits from `opsmith.cloud_providers.base.BaseCloudProvider` and implements all its abstract methods (`name`, `description`, `get_detail_model`, `get_account_details`, `get_instance_types`, `get_regions`).
|
|
199
|
+
2. Package your new provider class.
|
|
200
|
+
3. In your package's `pyproject.toml`, add an entry point under the `[project.entry-points."opsmith.cloud_providers"]` group.
|
|
201
|
+
|
|
202
|
+
Example `pyproject.toml` entry:
|
|
203
|
+
|
|
204
|
+
```toml
|
|
205
|
+
[project.entry-points."opsmith.cloud_providers"]
|
|
206
|
+
my-provider = "my_opsmith_plugin.providers:MyCloudProvider"
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
Once your package is installed in the same environment as `opsmith-cli`, Opsmith will automatically discover and register your new provider.
|
|
210
|
+
|
|
211
|
+
#### Adding a Deployment Strategy
|
|
212
|
+
|
|
213
|
+
Similarly, you can add a new deployment strategy by:
|
|
214
|
+
|
|
215
|
+
1. Creating a Python class that inherits from `opsmith.deployment_strategies.base.BaseDeploymentStrategy` and implements its abstract methods (`name`, `description`, `deploy`, `release`, `destroy`, `run`).
|
|
216
|
+
2. Packaging your new strategy class.
|
|
217
|
+
3. In your package's `pyproject.toml`, add an entry point under the `[project.entry-points."opsmith.deployment_strategies"]` group.
|
|
218
|
+
|
|
219
|
+
Example `pyproject.toml` entry:
|
|
220
|
+
|
|
221
|
+
```toml
|
|
222
|
+
[project.entry-points."opsmith.deployment_strategies"]
|
|
223
|
+
my-strategy = "my_opsmith_plugin.strategies:MyStrategy"
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
After installation, your custom deployment strategy will be available for selection when creating a new environment.
|
|
227
|
+
|
|
228
|
+
## Contributing
|
|
229
|
+
|
|
230
|
+
We welcome contributions to Opsmith! If you're interested in helping improve the tool, here are a few ways to get started:
|
|
231
|
+
|
|
232
|
+
- **Reporting Bugs**: If you encounter a bug, please open an issue on our GitHub repository. Include as much detail as possible, such as your operating system, the command you ran, and the full error message.
|
|
233
|
+
- **Suggesting Enhancements**: Have an idea for a new feature or an improvement to an existing one? We'd love to hear it. Open an issue to start a discussion.
|
|
234
|
+
- **Submitting Pull Requests**: If you'd like to contribute code, please fork the repository and submit a pull request. For major changes, it's best to discuss your idea in an issue first.
|
|
235
|
+
|
|
236
|
+
When contributing, please follow our [engineering conventions](./CONVENTIONS.md) and ensure your code is formatted with `black`.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import json
|
|
2
|
-
from dataclasses import dataclass
|
|
2
|
+
from dataclasses import dataclass, field
|
|
3
3
|
from pathlib import Path
|
|
4
4
|
from typing import List, Type
|
|
5
5
|
|
|
@@ -13,6 +13,7 @@ from opsmith.utils import generate_secret_string
|
|
|
13
13
|
@dataclass
|
|
14
14
|
class AgentDeps:
|
|
15
15
|
src_dir: Path
|
|
16
|
+
tracked_files: List[Path] = field(default_factory=list)
|
|
16
17
|
|
|
17
18
|
|
|
18
19
|
def is_duplicate_tool_call(ctx: RunContext[AgentDeps], tool_name: str) -> bool:
|
|
@@ -64,6 +65,7 @@ def build_agent(model_config: Type[BaseAiModel], instrument: bool = False) -> Ag
|
|
|
64
65
|
"files in this conversation."
|
|
65
66
|
)
|
|
66
67
|
|
|
68
|
+
allowed_files_abs = {str(p) for p in ctx.deps.tracked_files}
|
|
67
69
|
contents = []
|
|
68
70
|
for filename in filenames:
|
|
69
71
|
if Path(filename).is_absolute():
|
|
@@ -74,6 +76,9 @@ def build_agent(model_config: Type[BaseAiModel], instrument: bool = False) -> Ag
|
|
|
74
76
|
|
|
75
77
|
absolute_file_path = ctx.deps.src_dir.joinpath(filename).resolve()
|
|
76
78
|
|
|
79
|
+
if str(absolute_file_path) not in allowed_files_abs:
|
|
80
|
+
raise ModelRetry(f"File '{filename}' is not in the repo map and cannot be read.")
|
|
81
|
+
|
|
77
82
|
if not str(absolute_file_path).startswith(str(ctx.deps.src_dir)):
|
|
78
83
|
raise ModelRetry(
|
|
79
84
|
f"Access denied. File '{filename}' is outside the repository root."
|
|
@@ -162,7 +162,7 @@ class BaseDeploymentStrategy(abc.ABC):
|
|
|
162
162
|
registry_url: str,
|
|
163
163
|
) -> Dict[str, str]:
|
|
164
164
|
"""Builds and pushes Docker images for each service."""
|
|
165
|
-
print("\n[bold blue]
|
|
165
|
+
print("\n[bold blue]Build and push container images to the registry[/bold blue]")
|
|
166
166
|
|
|
167
167
|
images = {}
|
|
168
168
|
|
|
@@ -237,7 +237,7 @@ class BaseDeploymentStrategy(abc.ABC):
|
|
|
237
237
|
:return: The content of the found SSH public key as a string.
|
|
238
238
|
:rtype: str
|
|
239
239
|
"""
|
|
240
|
-
print("\n[bold blue]
|
|
240
|
+
print("\n[bold blue]Looking up the local SSH public key[/bold blue]")
|
|
241
241
|
system = platform.system().lower()
|
|
242
242
|
|
|
243
243
|
# Common SSH key names
|
|
@@ -342,10 +342,10 @@ class BaseDeploymentStrategy(abc.ABC):
|
|
|
342
342
|
print("[bold red]Could not find 'ansible_user' in Terraform outputs.[/bold red]")
|
|
343
343
|
raise ValueError("Could not find 'ansible_user' in Terraform outputs.")
|
|
344
344
|
|
|
345
|
-
print("
|
|
345
|
+
print("[bold blue]Waiting 15 seconds for instance to become ready...[/bold blue]")
|
|
346
346
|
time.sleep(15)
|
|
347
347
|
|
|
348
|
-
print("\n[bold blue]Setting up Docker on the
|
|
348
|
+
print("\n[bold blue]Setting up Docker on the newly created VM[/bold blue]")
|
|
349
349
|
|
|
350
350
|
setup_docker_path = (
|
|
351
351
|
self.deployments_path / "environments" / environment.name / "docker_setup"
|
|
@@ -153,14 +153,13 @@ class MonolithicDeploymentStrategy(BaseDeploymentStrategy):
|
|
|
153
153
|
"""
|
|
154
154
|
Deploys the docker-compose stack and returns container logs for validation.
|
|
155
155
|
"""
|
|
156
|
-
print("\n[bold blue]Deploying docker-compose stack
|
|
156
|
+
print("\n[bold blue]Deploying docker-compose stack to the VM \n[/bold blue]")
|
|
157
157
|
ansible_user, instance_public_ip = (
|
|
158
158
|
environment_state.virtual_machine.user,
|
|
159
159
|
environment_state.virtual_machine.public_ip,
|
|
160
160
|
)
|
|
161
161
|
deploy_compose_path, docker_compose_path = self._get_deploy_docker_compose_path(environment)
|
|
162
162
|
|
|
163
|
-
print("\n[bold blue]Attempting to deploy and get logs...[/bold blue]")
|
|
164
163
|
ansible_runner = AnsibleProvisioner(working_dir=deploy_compose_path)
|
|
165
164
|
ansible_runner.copy_template(
|
|
166
165
|
"docker_compose_deploy", deployment_config.cloud_provider_instance.name().lower()
|
|
@@ -241,8 +240,6 @@ class MonolithicDeploymentStrategy(BaseDeploymentStrategy):
|
|
|
241
240
|
images: Dict[str, str],
|
|
242
241
|
environment_state: MonolithicDeploymentState,
|
|
243
242
|
):
|
|
244
|
-
print("\n[bold blue]Generating docker-compose file...[/bold blue]")
|
|
245
|
-
|
|
246
243
|
base_compose_template = self.docker_compose_snippets_env.get_template("base.yml")
|
|
247
244
|
base_compose = base_compose_template.render(app_name=deployment_config.app_name_slug)
|
|
248
245
|
|
|
@@ -297,8 +294,8 @@ class MonolithicDeploymentStrategy(BaseDeploymentStrategy):
|
|
|
297
294
|
messages = []
|
|
298
295
|
for attempt in range(settings.max_docker_compose_gen_attempts):
|
|
299
296
|
print(
|
|
300
|
-
"\n[bold]Attempt"
|
|
301
|
-
f" {attempt + 1}/{settings.max_docker_compose_gen_attempts}
|
|
297
|
+
"\n[bold blue]Generating docker-compose file, Attempt"
|
|
298
|
+
f" {attempt + 1}/{settings.max_docker_compose_gen_attempts}[/bold blue]"
|
|
302
299
|
)
|
|
303
300
|
prompt = DOCKER_COMPOSE_GENERATION_PROMPT_TEMPLATE.format(
|
|
304
301
|
base_compose=base_compose,
|
|
@@ -338,7 +335,7 @@ class MonolithicDeploymentStrategy(BaseDeploymentStrategy):
|
|
|
338
335
|
if is_successful:
|
|
339
336
|
print("[bold green]Docker compose deployment was successful.[/bold green]")
|
|
340
337
|
break
|
|
341
|
-
print(f"Docker compose validation 'failed' with reason: \n {reason}.")
|
|
338
|
+
print(f"[red]Docker compose validation 'failed' with reason[/red]: \n {reason}.")
|
|
342
339
|
|
|
343
340
|
messages = docker_compose_response.new_messages() + validation_messages
|
|
344
341
|
else:
|
|
@@ -699,7 +696,7 @@ class MonolithicDeploymentStrategy(BaseDeploymentStrategy):
|
|
|
699
696
|
|
|
700
697
|
print(
|
|
701
698
|
"\n[bold blue]Setting up container registry for region"
|
|
702
|
-
f" '{environment.region}'...[/bold blue]"
|
|
699
|
+
f" '{environment.region}'... \n[/bold blue]"
|
|
703
700
|
)
|
|
704
701
|
registry_url = self._setup_container_registry(deployment_config, environment)
|
|
705
702
|
images = self._build_and_push_images(deployment_config, environment, registry_url)
|
|
@@ -743,16 +740,16 @@ class MonolithicDeploymentStrategy(BaseDeploymentStrategy):
|
|
|
743
740
|
)
|
|
744
741
|
self._confirm_dns_records(dns_records)
|
|
745
742
|
|
|
743
|
+
env_state.registry_url = registry_url
|
|
744
|
+
env_state.virtual_machine = virtual_machine_state
|
|
745
|
+
self._generate_docker_compose(deployment_config, environment, images, env_state)
|
|
746
|
+
|
|
746
747
|
for domain in environment.get_domains_for_services(other_services):
|
|
747
748
|
print(
|
|
748
749
|
"\n[bold green]Your website is available at:"
|
|
749
750
|
f" https://{domain.domain_name}[/bold green]"
|
|
750
751
|
)
|
|
751
752
|
|
|
752
|
-
env_state.registry_url = registry_url
|
|
753
|
-
env_state.virtual_machine = virtual_machine_state
|
|
754
|
-
self._generate_docker_compose(deployment_config, environment, images, env_state)
|
|
755
|
-
|
|
756
753
|
env_state.save(env_state_path)
|
|
757
754
|
print(f"Monolithic deployment state saved to {env_state_path}")
|
|
758
755
|
|