jvdeploy 0.1.0__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.
- jvdeploy-0.1.0/LICENSE +21 -0
- jvdeploy-0.1.0/MANIFEST.in +6 -0
- jvdeploy-0.1.0/PKG-INFO +368 -0
- jvdeploy-0.1.0/README.md +325 -0
- jvdeploy-0.1.0/jvdeploy/Dockerfile.base +6 -0
- jvdeploy-0.1.0/jvdeploy/__init__.py +6 -0
- jvdeploy-0.1.0/jvdeploy/aws/__init__.py +9 -0
- jvdeploy-0.1.0/jvdeploy/aws/lambda_deployer.py +1143 -0
- jvdeploy-0.1.0/jvdeploy/bundler.py +74 -0
- jvdeploy-0.1.0/jvdeploy/cli.py +1071 -0
- jvdeploy-0.1.0/jvdeploy/config.py +342 -0
- jvdeploy-0.1.0/jvdeploy/docker_builder.py +407 -0
- jvdeploy-0.1.0/jvdeploy/dockerfile_generator.py +202 -0
- jvdeploy-0.1.0/jvdeploy/templates/deploy.yaml.template +229 -0
- jvdeploy-0.1.0/jvdeploy.egg-info/PKG-INFO +368 -0
- jvdeploy-0.1.0/jvdeploy.egg-info/SOURCES.txt +25 -0
- jvdeploy-0.1.0/jvdeploy.egg-info/dependency_links.txt +1 -0
- jvdeploy-0.1.0/jvdeploy.egg-info/entry_points.txt +2 -0
- jvdeploy-0.1.0/jvdeploy.egg-info/requires.txt +16 -0
- jvdeploy-0.1.0/jvdeploy.egg-info/top_level.txt +1 -0
- jvdeploy-0.1.0/pyproject.toml +82 -0
- jvdeploy-0.1.0/setup.cfg +4 -0
- jvdeploy-0.1.0/setup.py +51 -0
- jvdeploy-0.1.0/tests/test_bundler.py +246 -0
- jvdeploy-0.1.0/tests/test_cli.py +248 -0
- jvdeploy-0.1.0/tests/test_config.py +318 -0
- jvdeploy-0.1.0/tests/test_dockerfile_generator.py +339 -0
jvdeploy-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 TrueSelph Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
jvdeploy-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: jvdeploy
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Dockerfile generator for jvagent applications
|
|
5
|
+
Home-page: https://github.com/your-org/jvdeploy
|
|
6
|
+
Author: TrueSelph Inc.
|
|
7
|
+
Author-email: "TrueSelph Inc." <adminh@trueselph.com>
|
|
8
|
+
License: MIT
|
|
9
|
+
Project-URL: Homepage, https://github.com/your-org/jvdeploy
|
|
10
|
+
Project-URL: Repository, https://github.com/your-org/jvdeploy
|
|
11
|
+
Project-URL: Issues, https://github.com/your-org/jvdeploy/issues
|
|
12
|
+
Keywords: docker,dockerfile,bundler,jvagent,deployment
|
|
13
|
+
Classifier: Development Status :: 3 - Alpha
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
22
|
+
Classifier: Topic :: Software Development :: Build Tools
|
|
23
|
+
Requires-Python: >=3.8
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
License-File: LICENSE
|
|
26
|
+
Requires-Dist: pyyaml>=6.0.0
|
|
27
|
+
Provides-Extra: deploy
|
|
28
|
+
Requires-Dist: boto3>=1.28.0; extra == "deploy"
|
|
29
|
+
Requires-Dist: jinja2>=3.1.0; extra == "deploy"
|
|
30
|
+
Provides-Extra: dev
|
|
31
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
32
|
+
Requires-Dist: black>=23.9.0; extra == "dev"
|
|
33
|
+
Requires-Dist: ruff>=0.1.0; extra == "dev"
|
|
34
|
+
Requires-Dist: mypy>=1.6.0; extra == "dev"
|
|
35
|
+
Requires-Dist: boto3>=1.28.0; extra == "dev"
|
|
36
|
+
Requires-Dist: jinja2>=3.1.0; extra == "dev"
|
|
37
|
+
Provides-Extra: test
|
|
38
|
+
Requires-Dist: pytest>=7.0; extra == "test"
|
|
39
|
+
Dynamic: author
|
|
40
|
+
Dynamic: home-page
|
|
41
|
+
Dynamic: license-file
|
|
42
|
+
Dynamic: requires-python
|
|
43
|
+
|
|
44
|
+
# jvdeploy
|
|
45
|
+
|
|
46
|
+
A standalone Dockerfile generator and deployment tool for jvagent applications. This tool discovers action dependencies from `info.yaml` files, generates production-ready Dockerfiles with optimized layer caching, and deploys applications to AWS Lambda and Kubernetes.
|
|
47
|
+
|
|
48
|
+
## Overview
|
|
49
|
+
|
|
50
|
+
`jvdeploy` is a Python CLI tool that automates Dockerfile generation and deployment for jvagent applications. It:
|
|
51
|
+
- Validates jvagent application structure (requires `app.yaml`)
|
|
52
|
+
- Discovers pip dependencies from all action `info.yaml` files
|
|
53
|
+
- Generates Dockerfiles with separate RUN commands per action for optimal layer caching
|
|
54
|
+
- Extends a customizable base Dockerfile template
|
|
55
|
+
- Deploys applications to AWS Lambda with ECR, IAM, and API Gateway integration
|
|
56
|
+
- Supports Kubernetes deployment (coming soon)
|
|
57
|
+
|
|
58
|
+
## Installation
|
|
59
|
+
|
|
60
|
+
### From Source
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
cd jvdeploy
|
|
64
|
+
pip install -e .
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### With Deployment Features
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
cd jvdeploy
|
|
71
|
+
pip install -e ".[deploy]"
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### For Development
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
cd jvdeploy
|
|
78
|
+
pip install -e ".[dev]"
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Usage
|
|
82
|
+
|
|
83
|
+
### Dockerfile Generation
|
|
84
|
+
|
|
85
|
+
Generate Dockerfiles using the `generate` command or the legacy direct invocation:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
# Generate Dockerfile in current directory
|
|
89
|
+
cd my-jvagent-app
|
|
90
|
+
jvdeploy generate
|
|
91
|
+
|
|
92
|
+
# Or using legacy syntax
|
|
93
|
+
jvdeploy
|
|
94
|
+
|
|
95
|
+
# Generate Dockerfile for specific app
|
|
96
|
+
jvdeploy generate /path/to/my-app
|
|
97
|
+
|
|
98
|
+
# With absolute path
|
|
99
|
+
jvdeploy generate ~/projects/my-jvagent-app
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Deployment
|
|
103
|
+
|
|
104
|
+
Deploy jvagent applications to AWS Lambda or Kubernetes:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
# Initialize deployment configuration
|
|
108
|
+
jvdeploy init --lambda
|
|
109
|
+
|
|
110
|
+
# Deploy to AWS Lambda
|
|
111
|
+
export JVAGENT_ADMIN_PASSWORD="your-secure-password"
|
|
112
|
+
jvdeploy deploy lambda --all
|
|
113
|
+
|
|
114
|
+
# Check deployment status
|
|
115
|
+
jvdeploy status lambda
|
|
116
|
+
|
|
117
|
+
# View logs
|
|
118
|
+
jvdeploy logs lambda --follow
|
|
119
|
+
|
|
120
|
+
# Destroy deployment
|
|
121
|
+
jvdeploy destroy lambda --yes
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
For complete deployment documentation, see [DEPLOY_README.md](DEPLOY_README.md).
|
|
125
|
+
|
|
126
|
+
### Quick Deployment Example
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
# 1. Initialize configuration
|
|
130
|
+
cd my-jvagent-app
|
|
131
|
+
jvdeploy init --lambda
|
|
132
|
+
|
|
133
|
+
# 2. Edit deploy.yaml with your settings
|
|
134
|
+
vim deploy.yaml
|
|
135
|
+
|
|
136
|
+
# 3. Set required environment variables
|
|
137
|
+
export JVAGENT_ADMIN_PASSWORD="your-password"
|
|
138
|
+
|
|
139
|
+
# 4. Deploy (dry-run first to test)
|
|
140
|
+
jvdeploy deploy lambda --all --dry-run
|
|
141
|
+
|
|
142
|
+
# 5. Actual deployment
|
|
143
|
+
jvdeploy deploy lambda --all
|
|
144
|
+
|
|
145
|
+
# 6. Check the deployment
|
|
146
|
+
jvdeploy status lambda
|
|
147
|
+
|
|
148
|
+
# 7. View your API URL in the output!
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## How It Works
|
|
152
|
+
|
|
153
|
+
### 1. App Validation
|
|
154
|
+
- Validates that `app.yaml` exists in the app root directory
|
|
155
|
+
- Ensures the directory is a valid jvagent application
|
|
156
|
+
|
|
157
|
+
### 2. Dependency Discovery
|
|
158
|
+
- Scans `agents/{namespace}/{agent_name}/actions/` directory structure
|
|
159
|
+
- For each action, reads `info.yaml` file
|
|
160
|
+
- Extracts `package.dependencies.pip` list from each action
|
|
161
|
+
- Deduplicates dependencies per action
|
|
162
|
+
|
|
163
|
+
### 3. Dockerfile Generation
|
|
164
|
+
- Loads base Dockerfile template (`Dockerfile.base`)
|
|
165
|
+
- Generates separate RUN commands per action for pip dependencies
|
|
166
|
+
- Replaces `{{ACTION_DEPENDENCIES}}` placeholder in base template
|
|
167
|
+
- Writes `Dockerfile` to the app directory
|
|
168
|
+
|
|
169
|
+
## Generated Dockerfile Structure
|
|
170
|
+
|
|
171
|
+
The generated Dockerfile includes:
|
|
172
|
+
- Base image and environment setup (from `Dockerfile.base`)
|
|
173
|
+
- Action-specific pip dependencies (one RUN command per action)
|
|
174
|
+
- Optimized layer caching for faster rebuilds
|
|
175
|
+
|
|
176
|
+
Example output:
|
|
177
|
+
|
|
178
|
+
```dockerfile
|
|
179
|
+
FROM registry.v75inc.dev/jvagent/jvagent-base:latest
|
|
180
|
+
|
|
181
|
+
WORKDIR /var/task
|
|
182
|
+
COPY . /var/task/
|
|
183
|
+
|
|
184
|
+
# Action-specific pip dependencies
|
|
185
|
+
# Dependencies for myorg/my_action
|
|
186
|
+
RUN /opt/venv/bin/pip install --no-cache-dir openai>=1.0.0 httpx>=0.24.0
|
|
187
|
+
|
|
188
|
+
# Dependencies for myorg/another_action
|
|
189
|
+
RUN /opt/venv/bin/pip install --no-cache-dir requests>=2.31.0 pydantic>=2.0.0
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
## Action Dependency Discovery
|
|
193
|
+
|
|
194
|
+
The bundler discovers dependencies by:
|
|
195
|
+
1. Scanning `agents/` directory for all agents
|
|
196
|
+
2. For each agent, scanning `actions/{namespace}/{action_name}/` directories
|
|
197
|
+
3. Reading `info.yaml` from each action directory
|
|
198
|
+
4. Extracting `package.dependencies.pip` list
|
|
199
|
+
|
|
200
|
+
**Example info.yaml structure:**
|
|
201
|
+
|
|
202
|
+
```yaml
|
|
203
|
+
package:
|
|
204
|
+
name: jvagent/my_action
|
|
205
|
+
dependencies:
|
|
206
|
+
pip:
|
|
207
|
+
- openai>=1.0.0
|
|
208
|
+
- httpx>=0.24.0
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
## Base Template
|
|
212
|
+
|
|
213
|
+
The base Dockerfile template (`Dockerfile.base`) is included in the package and can be customized. The template must include the `{{ACTION_DEPENDENCIES}}` placeholder where action dependencies will be inserted.
|
|
214
|
+
|
|
215
|
+
**Default Dockerfile.base:**
|
|
216
|
+
|
|
217
|
+
```dockerfile
|
|
218
|
+
FROM registry.v75inc.dev/jvagent/jvagent-base:latest
|
|
219
|
+
|
|
220
|
+
WORKDIR /var/task
|
|
221
|
+
COPY . /var/task/
|
|
222
|
+
|
|
223
|
+
# {{ACTION_DEPENDENCIES}}
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
## Customization
|
|
227
|
+
|
|
228
|
+
You can customize the base template by:
|
|
229
|
+
1. Copying `Dockerfile.base` from the package to your project
|
|
230
|
+
2. Modifying it to suit your needs
|
|
231
|
+
3. Keeping the `{{ACTION_DEPENDENCIES}}` placeholder where you want dependencies inserted
|
|
232
|
+
|
|
233
|
+
## Project Structure
|
|
234
|
+
|
|
235
|
+
```
|
|
236
|
+
jvdeploy/
|
|
237
|
+
├── jvdeploy/
|
|
238
|
+
│ ├── __init__.py # Package initialization
|
|
239
|
+
│ ├── cli.py # CLI entry point
|
|
240
|
+
│ ├── bundler.py # Main Bundler class
|
|
241
|
+
│ ├── dockerfile_generator.py # Dockerfile generation logic
|
|
242
|
+
│ └── Dockerfile.base # Base Dockerfile template
|
|
243
|
+
├── tests/
|
|
244
|
+
│ ├── __init__.py
|
|
245
|
+
│ ├── conftest.py # pytest fixtures
|
|
246
|
+
│ ├── test_bundler.py # Bundler tests
|
|
247
|
+
│ └── test_dockerfile_generator.py # Generator tests
|
|
248
|
+
├── README.md
|
|
249
|
+
├── setup.py
|
|
250
|
+
└── pyproject.toml
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
## Development
|
|
254
|
+
|
|
255
|
+
### Running Tests
|
|
256
|
+
|
|
257
|
+
```bash
|
|
258
|
+
pytest
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
### Running Tests with Coverage
|
|
262
|
+
|
|
263
|
+
```bash
|
|
264
|
+
pytest --cov=jvdeploy --cov-report=html
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
### Code Formatting
|
|
268
|
+
|
|
269
|
+
```bash
|
|
270
|
+
black jvdeploy tests
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
### Linting
|
|
274
|
+
|
|
275
|
+
```bash
|
|
276
|
+
ruff check jvdeploy tests
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
### Type Checking
|
|
280
|
+
|
|
281
|
+
```bash
|
|
282
|
+
mypy jvdeploy
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
## API Usage
|
|
286
|
+
|
|
287
|
+
You can also use `jvdeploy` as a Python library:
|
|
288
|
+
|
|
289
|
+
```python
|
|
290
|
+
from jvdeploy import Bundler
|
|
291
|
+
|
|
292
|
+
# Create bundler instance
|
|
293
|
+
bundler = Bundler(app_root="/path/to/jvagent_app")
|
|
294
|
+
|
|
295
|
+
# Generate Dockerfile
|
|
296
|
+
success = bundler.generate_dockerfile()
|
|
297
|
+
|
|
298
|
+
if success:
|
|
299
|
+
print("Dockerfile generated successfully!")
|
|
300
|
+
else:
|
|
301
|
+
print("Dockerfile generation failed")
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
## Requirements
|
|
305
|
+
|
|
306
|
+
### Core Requirements
|
|
307
|
+
- Python >= 3.8
|
|
308
|
+
- PyYAML >= 6.0.0
|
|
309
|
+
|
|
310
|
+
### Deployment Requirements (optional)
|
|
311
|
+
- boto3 >= 1.28.0 (for AWS Lambda deployment)
|
|
312
|
+
- jinja2 >= 3.1.0 (for Kubernetes templates)
|
|
313
|
+
|
|
314
|
+
Install deployment dependencies with:
|
|
315
|
+
```bash
|
|
316
|
+
pip install jvdeploy[deploy]
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
## Features
|
|
320
|
+
|
|
321
|
+
### Dockerfile Generation
|
|
322
|
+
- ✅ Automatic dependency discovery from action info.yaml files
|
|
323
|
+
- ✅ Optimized Docker layer caching
|
|
324
|
+
- ✅ Customizable base template
|
|
325
|
+
- ✅ Action-specific dependency isolation
|
|
326
|
+
|
|
327
|
+
### AWS Lambda Deployment
|
|
328
|
+
- ✅ ECR repository management
|
|
329
|
+
- ✅ IAM role creation and management
|
|
330
|
+
- ✅ Lambda function deployment from containers
|
|
331
|
+
- ✅ API Gateway (HTTP API) integration
|
|
332
|
+
- ✅ Environment variable configuration
|
|
333
|
+
- ✅ VPC and EFS support
|
|
334
|
+
- ✅ CloudWatch Logs integration
|
|
335
|
+
- ✅ Dry-run mode for testing
|
|
336
|
+
- ✅ Deployment status checking
|
|
337
|
+
- ✅ Log streaming and viewing
|
|
338
|
+
|
|
339
|
+
### Kubernetes Deployment (Coming Soon)
|
|
340
|
+
- 🚧 Jinja2 manifest templates
|
|
341
|
+
- 🚧 kubectl integration
|
|
342
|
+
- 🚧 Service, Deployment, ConfigMap support
|
|
343
|
+
- 🚧 Ingress configuration
|
|
344
|
+
- 🚧 Persistent storage support
|
|
345
|
+
|
|
346
|
+
## Documentation
|
|
347
|
+
|
|
348
|
+
- [Deployment Guide](DEPLOY_README.md) - Complete guide for deploying applications
|
|
349
|
+
- [Implementation Summary](DEPLOY_IMPLEMENTATION.md) - Technical implementation details
|
|
350
|
+
- [Deployment Specification](DEPLOYMENT_SPEC.md) - Complete technical specification
|
|
351
|
+
- [Quick Reference](DEPLOYMENT_QUICKREF.md) - Command cheat sheet
|
|
352
|
+
|
|
353
|
+
## License
|
|
354
|
+
|
|
355
|
+
MIT License
|
|
356
|
+
|
|
357
|
+
## Contributing
|
|
358
|
+
|
|
359
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
360
|
+
|
|
361
|
+
## Related Projects
|
|
362
|
+
|
|
363
|
+
- [jvagent](https://github.com/your-org/jvagent) - The main jvagent framework
|
|
364
|
+
- [jvspatial](https://github.com/your-org/jvspatial) - Spatial database for jvagent
|
|
365
|
+
|
|
366
|
+
## Support
|
|
367
|
+
|
|
368
|
+
For issues and questions, please open an issue on the [GitHub repository](https://github.com/your-org/jvdeploy/issues).
|
jvdeploy-0.1.0/README.md
ADDED
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
# jvdeploy
|
|
2
|
+
|
|
3
|
+
A standalone Dockerfile generator and deployment tool for jvagent applications. This tool discovers action dependencies from `info.yaml` files, generates production-ready Dockerfiles with optimized layer caching, and deploys applications to AWS Lambda and Kubernetes.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
`jvdeploy` is a Python CLI tool that automates Dockerfile generation and deployment for jvagent applications. It:
|
|
8
|
+
- Validates jvagent application structure (requires `app.yaml`)
|
|
9
|
+
- Discovers pip dependencies from all action `info.yaml` files
|
|
10
|
+
- Generates Dockerfiles with separate RUN commands per action for optimal layer caching
|
|
11
|
+
- Extends a customizable base Dockerfile template
|
|
12
|
+
- Deploys applications to AWS Lambda with ECR, IAM, and API Gateway integration
|
|
13
|
+
- Supports Kubernetes deployment (coming soon)
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
### From Source
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
cd jvdeploy
|
|
21
|
+
pip install -e .
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### With Deployment Features
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
cd jvdeploy
|
|
28
|
+
pip install -e ".[deploy]"
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### For Development
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
cd jvdeploy
|
|
35
|
+
pip install -e ".[dev]"
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Usage
|
|
39
|
+
|
|
40
|
+
### Dockerfile Generation
|
|
41
|
+
|
|
42
|
+
Generate Dockerfiles using the `generate` command or the legacy direct invocation:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
# Generate Dockerfile in current directory
|
|
46
|
+
cd my-jvagent-app
|
|
47
|
+
jvdeploy generate
|
|
48
|
+
|
|
49
|
+
# Or using legacy syntax
|
|
50
|
+
jvdeploy
|
|
51
|
+
|
|
52
|
+
# Generate Dockerfile for specific app
|
|
53
|
+
jvdeploy generate /path/to/my-app
|
|
54
|
+
|
|
55
|
+
# With absolute path
|
|
56
|
+
jvdeploy generate ~/projects/my-jvagent-app
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Deployment
|
|
60
|
+
|
|
61
|
+
Deploy jvagent applications to AWS Lambda or Kubernetes:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
# Initialize deployment configuration
|
|
65
|
+
jvdeploy init --lambda
|
|
66
|
+
|
|
67
|
+
# Deploy to AWS Lambda
|
|
68
|
+
export JVAGENT_ADMIN_PASSWORD="your-secure-password"
|
|
69
|
+
jvdeploy deploy lambda --all
|
|
70
|
+
|
|
71
|
+
# Check deployment status
|
|
72
|
+
jvdeploy status lambda
|
|
73
|
+
|
|
74
|
+
# View logs
|
|
75
|
+
jvdeploy logs lambda --follow
|
|
76
|
+
|
|
77
|
+
# Destroy deployment
|
|
78
|
+
jvdeploy destroy lambda --yes
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
For complete deployment documentation, see [DEPLOY_README.md](DEPLOY_README.md).
|
|
82
|
+
|
|
83
|
+
### Quick Deployment Example
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
# 1. Initialize configuration
|
|
87
|
+
cd my-jvagent-app
|
|
88
|
+
jvdeploy init --lambda
|
|
89
|
+
|
|
90
|
+
# 2. Edit deploy.yaml with your settings
|
|
91
|
+
vim deploy.yaml
|
|
92
|
+
|
|
93
|
+
# 3. Set required environment variables
|
|
94
|
+
export JVAGENT_ADMIN_PASSWORD="your-password"
|
|
95
|
+
|
|
96
|
+
# 4. Deploy (dry-run first to test)
|
|
97
|
+
jvdeploy deploy lambda --all --dry-run
|
|
98
|
+
|
|
99
|
+
# 5. Actual deployment
|
|
100
|
+
jvdeploy deploy lambda --all
|
|
101
|
+
|
|
102
|
+
# 6. Check the deployment
|
|
103
|
+
jvdeploy status lambda
|
|
104
|
+
|
|
105
|
+
# 7. View your API URL in the output!
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## How It Works
|
|
109
|
+
|
|
110
|
+
### 1. App Validation
|
|
111
|
+
- Validates that `app.yaml` exists in the app root directory
|
|
112
|
+
- Ensures the directory is a valid jvagent application
|
|
113
|
+
|
|
114
|
+
### 2. Dependency Discovery
|
|
115
|
+
- Scans `agents/{namespace}/{agent_name}/actions/` directory structure
|
|
116
|
+
- For each action, reads `info.yaml` file
|
|
117
|
+
- Extracts `package.dependencies.pip` list from each action
|
|
118
|
+
- Deduplicates dependencies per action
|
|
119
|
+
|
|
120
|
+
### 3. Dockerfile Generation
|
|
121
|
+
- Loads base Dockerfile template (`Dockerfile.base`)
|
|
122
|
+
- Generates separate RUN commands per action for pip dependencies
|
|
123
|
+
- Replaces `{{ACTION_DEPENDENCIES}}` placeholder in base template
|
|
124
|
+
- Writes `Dockerfile` to the app directory
|
|
125
|
+
|
|
126
|
+
## Generated Dockerfile Structure
|
|
127
|
+
|
|
128
|
+
The generated Dockerfile includes:
|
|
129
|
+
- Base image and environment setup (from `Dockerfile.base`)
|
|
130
|
+
- Action-specific pip dependencies (one RUN command per action)
|
|
131
|
+
- Optimized layer caching for faster rebuilds
|
|
132
|
+
|
|
133
|
+
Example output:
|
|
134
|
+
|
|
135
|
+
```dockerfile
|
|
136
|
+
FROM registry.v75inc.dev/jvagent/jvagent-base:latest
|
|
137
|
+
|
|
138
|
+
WORKDIR /var/task
|
|
139
|
+
COPY . /var/task/
|
|
140
|
+
|
|
141
|
+
# Action-specific pip dependencies
|
|
142
|
+
# Dependencies for myorg/my_action
|
|
143
|
+
RUN /opt/venv/bin/pip install --no-cache-dir openai>=1.0.0 httpx>=0.24.0
|
|
144
|
+
|
|
145
|
+
# Dependencies for myorg/another_action
|
|
146
|
+
RUN /opt/venv/bin/pip install --no-cache-dir requests>=2.31.0 pydantic>=2.0.0
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## Action Dependency Discovery
|
|
150
|
+
|
|
151
|
+
The bundler discovers dependencies by:
|
|
152
|
+
1. Scanning `agents/` directory for all agents
|
|
153
|
+
2. For each agent, scanning `actions/{namespace}/{action_name}/` directories
|
|
154
|
+
3. Reading `info.yaml` from each action directory
|
|
155
|
+
4. Extracting `package.dependencies.pip` list
|
|
156
|
+
|
|
157
|
+
**Example info.yaml structure:**
|
|
158
|
+
|
|
159
|
+
```yaml
|
|
160
|
+
package:
|
|
161
|
+
name: jvagent/my_action
|
|
162
|
+
dependencies:
|
|
163
|
+
pip:
|
|
164
|
+
- openai>=1.0.0
|
|
165
|
+
- httpx>=0.24.0
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## Base Template
|
|
169
|
+
|
|
170
|
+
The base Dockerfile template (`Dockerfile.base`) is included in the package and can be customized. The template must include the `{{ACTION_DEPENDENCIES}}` placeholder where action dependencies will be inserted.
|
|
171
|
+
|
|
172
|
+
**Default Dockerfile.base:**
|
|
173
|
+
|
|
174
|
+
```dockerfile
|
|
175
|
+
FROM registry.v75inc.dev/jvagent/jvagent-base:latest
|
|
176
|
+
|
|
177
|
+
WORKDIR /var/task
|
|
178
|
+
COPY . /var/task/
|
|
179
|
+
|
|
180
|
+
# {{ACTION_DEPENDENCIES}}
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
## Customization
|
|
184
|
+
|
|
185
|
+
You can customize the base template by:
|
|
186
|
+
1. Copying `Dockerfile.base` from the package to your project
|
|
187
|
+
2. Modifying it to suit your needs
|
|
188
|
+
3. Keeping the `{{ACTION_DEPENDENCIES}}` placeholder where you want dependencies inserted
|
|
189
|
+
|
|
190
|
+
## Project Structure
|
|
191
|
+
|
|
192
|
+
```
|
|
193
|
+
jvdeploy/
|
|
194
|
+
├── jvdeploy/
|
|
195
|
+
│ ├── __init__.py # Package initialization
|
|
196
|
+
│ ├── cli.py # CLI entry point
|
|
197
|
+
│ ├── bundler.py # Main Bundler class
|
|
198
|
+
│ ├── dockerfile_generator.py # Dockerfile generation logic
|
|
199
|
+
│ └── Dockerfile.base # Base Dockerfile template
|
|
200
|
+
├── tests/
|
|
201
|
+
│ ├── __init__.py
|
|
202
|
+
│ ├── conftest.py # pytest fixtures
|
|
203
|
+
│ ├── test_bundler.py # Bundler tests
|
|
204
|
+
│ └── test_dockerfile_generator.py # Generator tests
|
|
205
|
+
├── README.md
|
|
206
|
+
├── setup.py
|
|
207
|
+
└── pyproject.toml
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
## Development
|
|
211
|
+
|
|
212
|
+
### Running Tests
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
pytest
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### Running Tests with Coverage
|
|
219
|
+
|
|
220
|
+
```bash
|
|
221
|
+
pytest --cov=jvdeploy --cov-report=html
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
### Code Formatting
|
|
225
|
+
|
|
226
|
+
```bash
|
|
227
|
+
black jvdeploy tests
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
### Linting
|
|
231
|
+
|
|
232
|
+
```bash
|
|
233
|
+
ruff check jvdeploy tests
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
### Type Checking
|
|
237
|
+
|
|
238
|
+
```bash
|
|
239
|
+
mypy jvdeploy
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
## API Usage
|
|
243
|
+
|
|
244
|
+
You can also use `jvdeploy` as a Python library:
|
|
245
|
+
|
|
246
|
+
```python
|
|
247
|
+
from jvdeploy import Bundler
|
|
248
|
+
|
|
249
|
+
# Create bundler instance
|
|
250
|
+
bundler = Bundler(app_root="/path/to/jvagent_app")
|
|
251
|
+
|
|
252
|
+
# Generate Dockerfile
|
|
253
|
+
success = bundler.generate_dockerfile()
|
|
254
|
+
|
|
255
|
+
if success:
|
|
256
|
+
print("Dockerfile generated successfully!")
|
|
257
|
+
else:
|
|
258
|
+
print("Dockerfile generation failed")
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
## Requirements
|
|
262
|
+
|
|
263
|
+
### Core Requirements
|
|
264
|
+
- Python >= 3.8
|
|
265
|
+
- PyYAML >= 6.0.0
|
|
266
|
+
|
|
267
|
+
### Deployment Requirements (optional)
|
|
268
|
+
- boto3 >= 1.28.0 (for AWS Lambda deployment)
|
|
269
|
+
- jinja2 >= 3.1.0 (for Kubernetes templates)
|
|
270
|
+
|
|
271
|
+
Install deployment dependencies with:
|
|
272
|
+
```bash
|
|
273
|
+
pip install jvdeploy[deploy]
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
## Features
|
|
277
|
+
|
|
278
|
+
### Dockerfile Generation
|
|
279
|
+
- ✅ Automatic dependency discovery from action info.yaml files
|
|
280
|
+
- ✅ Optimized Docker layer caching
|
|
281
|
+
- ✅ Customizable base template
|
|
282
|
+
- ✅ Action-specific dependency isolation
|
|
283
|
+
|
|
284
|
+
### AWS Lambda Deployment
|
|
285
|
+
- ✅ ECR repository management
|
|
286
|
+
- ✅ IAM role creation and management
|
|
287
|
+
- ✅ Lambda function deployment from containers
|
|
288
|
+
- ✅ API Gateway (HTTP API) integration
|
|
289
|
+
- ✅ Environment variable configuration
|
|
290
|
+
- ✅ VPC and EFS support
|
|
291
|
+
- ✅ CloudWatch Logs integration
|
|
292
|
+
- ✅ Dry-run mode for testing
|
|
293
|
+
- ✅ Deployment status checking
|
|
294
|
+
- ✅ Log streaming and viewing
|
|
295
|
+
|
|
296
|
+
### Kubernetes Deployment (Coming Soon)
|
|
297
|
+
- 🚧 Jinja2 manifest templates
|
|
298
|
+
- 🚧 kubectl integration
|
|
299
|
+
- 🚧 Service, Deployment, ConfigMap support
|
|
300
|
+
- 🚧 Ingress configuration
|
|
301
|
+
- 🚧 Persistent storage support
|
|
302
|
+
|
|
303
|
+
## Documentation
|
|
304
|
+
|
|
305
|
+
- [Deployment Guide](DEPLOY_README.md) - Complete guide for deploying applications
|
|
306
|
+
- [Implementation Summary](DEPLOY_IMPLEMENTATION.md) - Technical implementation details
|
|
307
|
+
- [Deployment Specification](DEPLOYMENT_SPEC.md) - Complete technical specification
|
|
308
|
+
- [Quick Reference](DEPLOYMENT_QUICKREF.md) - Command cheat sheet
|
|
309
|
+
|
|
310
|
+
## License
|
|
311
|
+
|
|
312
|
+
MIT License
|
|
313
|
+
|
|
314
|
+
## Contributing
|
|
315
|
+
|
|
316
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
317
|
+
|
|
318
|
+
## Related Projects
|
|
319
|
+
|
|
320
|
+
- [jvagent](https://github.com/your-org/jvagent) - The main jvagent framework
|
|
321
|
+
- [jvspatial](https://github.com/your-org/jvspatial) - Spatial database for jvagent
|
|
322
|
+
|
|
323
|
+
## Support
|
|
324
|
+
|
|
325
|
+
For issues and questions, please open an issue on the [GitHub repository](https://github.com/your-org/jvdeploy/issues).
|