gitarsenal-cli 1.1.2 → 1.1.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gitarsenal-cli",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "description": "CLI tool for creating Modal sandboxes with GitHub repositories",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -0,0 +1,126 @@
1
+ # Modal Proxy Service for GitArsenal CLI
2
+
3
+ This document explains how to set up and use the Modal proxy service with GitArsenal CLI.
4
+
5
+ ## What is the Modal Proxy Service?
6
+
7
+ The Modal proxy service allows users to access Modal services (like GPU-accelerated containers) without exposing the owner's Modal token. The service runs on a server and provides API endpoints for creating sandboxes and SSH containers, using API key authentication.
8
+
9
+ ## Server-Side Setup
10
+
11
+ 1. **Install Requirements**:
12
+ ```bash
13
+ pip install flask flask-cors modal python-dotenv
14
+ ```
15
+
16
+ 2. **Set Environment Variables**:
17
+ Create a `.env` file in the same directory as `modal_proxy_service.py`:
18
+ ```
19
+ MODAL_TOKEN=your_modal_token_here
20
+ ADMIN_KEY=your_admin_key_here
21
+ API_KEYS=optional_comma_separated_list_of_api_keys
22
+ ```
23
+
24
+ 3. **Start the Service**:
25
+ ```bash
26
+ python modal_proxy_service.py
27
+ ```
28
+
29
+ The service will start on port 5001 by default.
30
+
31
+ 4. **Create an API Key** (if not pre-configured in `.env`):
32
+ ```bash
33
+ curl -X POST http://localhost:5001/api/create-api-key \
34
+ -H "X-Admin-Key: your_admin_key_here"
35
+ ```
36
+
37
+ This will return a JSON response with a new API key:
38
+ ```json
39
+ {"api_key": "generated_api_key_here"}
40
+ ```
41
+
42
+ 5. **Optional: Use ngrok to expose the service publicly**:
43
+ ```bash
44
+ ngrok http 5001
45
+ ```
46
+
47
+ This will provide you with a public URL that you can share with users.
48
+
49
+ Current ngrok URL: `https://e74889c63199.ngrok-free.app`
50
+
51
+ ## Client-Side Setup
52
+
53
+ 1. **Configure the proxy client**:
54
+ ```bash
55
+ ./gitarsenal.py proxy configure
56
+ ```
57
+
58
+ You'll be prompted to enter:
59
+ - The proxy URL (the default is now set to `https://e74889c63199.ngrok-free.app`)
60
+ - Your API key
61
+
62
+ 2. **Check proxy service status**:
63
+ ```bash
64
+ ./gitarsenal.py proxy status
65
+ ```
66
+
67
+ ## Using the Proxy Service
68
+
69
+ ### Create an SSH Container
70
+
71
+ ```bash
72
+ # Using the proxy command
73
+ ./gitarsenal.py proxy ssh --gpu A10G --repo-url https://github.com/username/repo.git --wait
74
+
75
+ # Or using the standard ssh command with --use-proxy flag
76
+ ./gitarsenal.py ssh --use-proxy --gpu A10G --repo-url https://github.com/username/repo.git
77
+ ```
78
+
79
+ ### Create a Sandbox
80
+
81
+ ```bash
82
+ # Using the proxy command
83
+ ./gitarsenal.py proxy sandbox --gpu A10G --repo-url https://github.com/username/repo.git --wait
84
+
85
+ # Or using the standard sandbox command with --use-proxy flag
86
+ ./gitarsenal.py sandbox --use-proxy --gpu A10G --repo-url https://github.com/username/repo.git
87
+ ```
88
+
89
+ ## Troubleshooting
90
+
91
+ ### "Token missing" Error
92
+
93
+ If you see a "Token missing" error when creating containers through the proxy service:
94
+
95
+ 1. **Check that the MODAL_TOKEN is set on the server**:
96
+ - Verify the `.env` file has a valid MODAL_TOKEN
97
+ - Restart the proxy service after updating the token
98
+
99
+ 2. **Check that the proxy service is running**:
100
+ - Use `./gitarsenal.py proxy status` to check connectivity
101
+ - Verify the ngrok tunnel is active and the URL is correct
102
+
103
+ 3. **Check API key authentication**:
104
+ - Make sure your client is configured with a valid API key
105
+ - If needed, reconfigure with `./gitarsenal.py proxy configure`
106
+
107
+ 4. **Check server logs**:
108
+ - Look at `modal_proxy.log` on the server for detailed error messages
109
+
110
+ ### "Unauthorized" Error
111
+
112
+ If you see an "Unauthorized" error:
113
+
114
+ 1. **When creating an API key**:
115
+ - Make sure you're including the correct admin key in the request header
116
+ - Example: `-H "X-Admin-Key: your_admin_key_here"`
117
+
118
+ 2. **When using the API**:
119
+ - Make sure your client is configured with a valid API key
120
+ - Reconfigure with `./gitarsenal.py proxy configure`
121
+
122
+ ## Security Considerations
123
+
124
+ - Keep your admin key and API keys secure
125
+ - Use HTTPS if exposing the service publicly (ngrok provides this automatically)
126
+ - Consider implementing additional authentication mechanisms for production use
package/python/README.md CHANGED
@@ -68,6 +68,101 @@ This will guide you through setting up:
68
68
  - `--setup-commands`: Setup commands to run
69
69
  - `--volume-name`: Name of the Modal volume for persistent storage
70
70
  - `--timeout`: Container timeout in minutes (SSH mode only, default: 60)
71
+ - `--use-proxy`: Use Modal proxy service instead of direct Modal access
72
+
73
+ ## Using the Modal Proxy Service
74
+
75
+ GitArsenal CLI now supports using a Modal proxy service, which allows you to use Modal services without having your own Modal token. This is useful for teams or organizations where a single Modal account is shared.
76
+
77
+ ### Setting Up the Proxy Service
78
+
79
+ #### 1. Create an Environment File
80
+
81
+ Copy the example environment file and edit it:
82
+
83
+ ```bash
84
+ cp .env.example .env
85
+ ```
86
+
87
+ Edit the `.env` file to add your Modal token:
88
+
89
+ ```
90
+ MODAL_TOKEN=your_modal_token_here
91
+ ```
92
+
93
+ #### 2. Run the Proxy Service
94
+
95
+ ```bash
96
+ # Start the proxy service
97
+ python modal_proxy_service.py
98
+ ```
99
+
100
+ The service will start on port 5001 by default (to avoid conflicts with macOS AirPlay on port 5000).
101
+
102
+ #### 3. Create an API Key for Clients
103
+
104
+ When the service starts for the first time, it will generate an admin key. Use this key to create API keys for clients:
105
+
106
+ ```bash
107
+ # Create a new API key
108
+ curl -X POST -H "X-Admin-Key: your_admin_key" http://localhost:5001/api/create-api-key
109
+ ```
110
+
111
+ #### 4. Using ngrok for Public Access (Optional)
112
+
113
+ If you want to make your proxy service accessible from outside your network:
114
+
115
+ ```bash
116
+ # Install ngrok if you haven't already
117
+ brew install ngrok # On macOS
118
+
119
+ # Start ngrok to expose your proxy service
120
+ ngrok http 5001
121
+ ```
122
+
123
+ Use the ngrok URL when configuring clients.
124
+
125
+ ### Configuring the Client
126
+
127
+ ```bash
128
+ # Configure the proxy service
129
+ ./gitarsenal.py proxy configure
130
+ ```
131
+
132
+ This will prompt you for the proxy service URL and API key.
133
+
134
+ ### Checking Proxy Service Status
135
+
136
+ ```bash
137
+ # Check if the proxy service is running
138
+ ./gitarsenal.py proxy status
139
+ ```
140
+
141
+ ### Creating a Sandbox through the Proxy
142
+
143
+ ```bash
144
+ # Create a sandbox through the proxy service
145
+ ./gitarsenal.py proxy sandbox --gpu A10G --repo-url "https://github.com/username/repo.git" --wait
146
+ ```
147
+
148
+ ### Creating an SSH Container through the Proxy
149
+
150
+ ```bash
151
+ # Create an SSH container through the proxy service
152
+ ./gitarsenal.py proxy ssh --gpu A10G --repo-url "https://github.com/username/repo.git" --wait
153
+ ```
154
+
155
+ ### Using the Proxy with Standard Commands
156
+
157
+ You can also use the proxy service with the standard `sandbox` and `ssh` commands by adding the `--use-proxy` flag:
158
+
159
+ ```bash
160
+ # Create a sandbox using the proxy service
161
+ ./gitarsenal.py sandbox --gpu A10G --repo-url "https://github.com/username/repo.git" --use-proxy
162
+
163
+ # Create an SSH container using the proxy service
164
+ ./gitarsenal.py ssh --gpu A10G --repo-url "https://github.com/username/repo.git" --use-proxy
165
+ ```
71
166
 
72
167
  ## Managing Credentials
73
168
 
@@ -97,6 +192,8 @@ You can manage your credentials using the following commands:
97
192
 
98
193
  Your credentials are stored securely in `~/.gitarsenal/credentials.json` with restrictive file permissions. The file is only readable by your user account.
99
194
 
195
+ Proxy configuration is stored in `~/.gitarsenal/proxy_config.json` with similar security measures.
196
+
100
197
  ## Troubleshooting
101
198
 
102
199
  ### Modal Authentication Issues
@@ -118,6 +215,29 @@ If you see errors like "Token missing" or "Could not authenticate client":
118
215
  ./gitarsenal.py credentials set modal_token
119
216
  ```
120
217
 
218
+ ### Proxy Service Issues
219
+
220
+ If you're having issues with the proxy service:
221
+
222
+ 1. Check if the proxy service is running:
223
+ ```bash
224
+ ./gitarsenal.py proxy status
225
+ ```
226
+
227
+ 2. Reconfigure the proxy service:
228
+ ```bash
229
+ ./gitarsenal.py proxy configure
230
+ ```
231
+
232
+ 3. Make sure you have a valid API key for the proxy service.
233
+
234
+ 4. Check the proxy service logs:
235
+ ```bash
236
+ cat modal_proxy.log
237
+ ```
238
+
239
+ 5. If using ngrok, make sure the tunnel is active and use the correct URL.
240
+
121
241
  ### API Timeout Issues
122
242
 
123
243
  If the GitArsenal API times out when analyzing repositories, the tool will automatically use fallback setup commands based on the detected programming language and technologies.