@stacksolo/cli 0.1.0
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.
- package/LICENSE +21 -0
- package/README.md +137 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +11311 -0
- package/dist/index.js.map +1 -0
- package/package.json +69 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 MonkeyBarrels
|
|
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.
|
package/README.md
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
# @stacksolo/cli
|
|
2
|
+
|
|
3
|
+
Command-line tool for deploying GCP infrastructure. Designed for solo developers who want to ship fast without managing complex cloud configurations.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g @stacksolo/cli
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Prerequisites
|
|
12
|
+
|
|
13
|
+
- Node.js 18+
|
|
14
|
+
- [Terraform CLI](https://developer.hashicorp.com/terraform/install) installed
|
|
15
|
+
- [Google Cloud CLI](https://cloud.google.com/sdk/docs/install) installed and authenticated
|
|
16
|
+
|
|
17
|
+
## Quick Start
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
# Initialize a new project
|
|
21
|
+
stacksolo init
|
|
22
|
+
|
|
23
|
+
# Deploy infrastructure
|
|
24
|
+
stacksolo deploy
|
|
25
|
+
|
|
26
|
+
# Check status
|
|
27
|
+
stacksolo status
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Commands
|
|
31
|
+
|
|
32
|
+
| Command | Description |
|
|
33
|
+
|---------|-------------|
|
|
34
|
+
| `stacksolo init` | Initialize a new StackSolo project with GCP setup |
|
|
35
|
+
| `stacksolo deploy` | Deploy infrastructure using CDKTF/Terraform |
|
|
36
|
+
| `stacksolo destroy` | Tear down deployed infrastructure |
|
|
37
|
+
| `stacksolo status` | Show deployment status |
|
|
38
|
+
| `stacksolo list` | List all registered projects |
|
|
39
|
+
| `stacksolo dev` | Start local K8s development environment |
|
|
40
|
+
| `stacksolo scaffold` | Generate local dev environment from config |
|
|
41
|
+
|
|
42
|
+
## Project Configuration
|
|
43
|
+
|
|
44
|
+
StackSolo uses a JSON configuration file at `.stacksolo/stacksolo.config.json`:
|
|
45
|
+
|
|
46
|
+
```json
|
|
47
|
+
{
|
|
48
|
+
"project": {
|
|
49
|
+
"name": "my-app",
|
|
50
|
+
"gcpProjectId": "my-gcp-project",
|
|
51
|
+
"region": "us-central1"
|
|
52
|
+
},
|
|
53
|
+
"networks": {
|
|
54
|
+
"main": {
|
|
55
|
+
"functions": {
|
|
56
|
+
"api": {
|
|
57
|
+
"runtime": "nodejs20",
|
|
58
|
+
"entryPoint": "api",
|
|
59
|
+
"sourceDir": "functions/api"
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Supported Resources
|
|
68
|
+
|
|
69
|
+
- **Cloud Functions (Gen2)** - Serverless functions with automatic scaling
|
|
70
|
+
- **Cloud Run** - Containerized applications
|
|
71
|
+
- **Cloud Storage** - Object storage buckets
|
|
72
|
+
- **Pub/Sub** - Message queuing
|
|
73
|
+
- **VPC Networks** - Private networking with connectors
|
|
74
|
+
- **Load Balancers** - Global HTTP(S) load balancing
|
|
75
|
+
- **Firestore** - NoSQL database
|
|
76
|
+
|
|
77
|
+
## Local Development
|
|
78
|
+
|
|
79
|
+
StackSolo includes a local Kubernetes development environment:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
# Start local dev with emulators
|
|
83
|
+
stacksolo dev
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
This creates a local K8s cluster with:
|
|
87
|
+
- Firebase emulators (Firestore, Auth, Pub/Sub)
|
|
88
|
+
- Hot-reloading for your functions
|
|
89
|
+
- Service mesh for inter-service calls
|
|
90
|
+
|
|
91
|
+
## Runtime Package
|
|
92
|
+
|
|
93
|
+
For environment detection and service-to-service calls in your functions:
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
npm install @stacksolo/runtime
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
```typescript
|
|
100
|
+
import { env, firestore, services } from '@stacksolo/runtime';
|
|
101
|
+
|
|
102
|
+
// Environment detection
|
|
103
|
+
if (env.isLocal) {
|
|
104
|
+
console.log('Running with emulators');
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// Auto-configured Firestore client
|
|
108
|
+
const db = firestore();
|
|
109
|
+
|
|
110
|
+
// Call other services
|
|
111
|
+
const response = await services.call('api', '/users');
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Global Registry
|
|
115
|
+
|
|
116
|
+
StackSolo maintains a registry of all your projects at `~/.stacksolo/registry.db`:
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
# List all projects
|
|
120
|
+
stacksolo list
|
|
121
|
+
|
|
122
|
+
# Register current project
|
|
123
|
+
stacksolo register
|
|
124
|
+
|
|
125
|
+
# View project details
|
|
126
|
+
stacksolo list my-app
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## Links
|
|
130
|
+
|
|
131
|
+
- [Documentation](https://stacksolo.dev)
|
|
132
|
+
- [GitHub](https://github.com/monkeybarrels/stacksolo)
|
|
133
|
+
- [Issues](https://github.com/monkeybarrels/stacksolo/issues)
|
|
134
|
+
|
|
135
|
+
## License
|
|
136
|
+
|
|
137
|
+
MIT
|
package/dist/index.d.ts
ADDED