portacode 0.2.6.dev0__tar.gz → 0.3.dev20__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.
Files changed (55) hide show
  1. portacode-0.3.dev20/.claude/agents/communication-manager.md +5 -0
  2. portacode-0.3.dev20/.claude/settings.local.json +15 -0
  3. portacode-0.3.dev20/.gitignore +9 -0
  4. portacode-0.3.dev20/LICENSE +21 -0
  5. portacode-0.3.dev20/PKG-INFO +241 -0
  6. portacode-0.3.dev20/README.md +211 -0
  7. portacode-0.3.dev20/backup.sh +42 -0
  8. portacode-0.3.dev20/docker-compose.yaml +37 -0
  9. {portacode-0.2.6.dev0 → portacode-0.3.dev20}/portacode/_version.py +16 -3
  10. {portacode-0.2.6.dev0 → portacode-0.3.dev20}/portacode/cli.py +71 -9
  11. {portacode-0.2.6.dev0 → portacode-0.3.dev20}/portacode/connection/client.py +3 -2
  12. portacode-0.3.dev20/portacode/connection/handlers/WEBSOCKET_PROTOCOL.md +797 -0
  13. {portacode-0.2.6.dev0 → portacode-0.3.dev20}/portacode/connection/handlers/__init__.py +15 -0
  14. portacode-0.3.dev20/portacode/connection/handlers/base.py +157 -0
  15. portacode-0.3.dev20/portacode/connection/handlers/project_state_handlers.py +2587 -0
  16. {portacode-0.2.6.dev0 → portacode-0.3.dev20}/portacode/connection/handlers/registry.py +39 -7
  17. portacode-0.3.dev20/portacode/connection/handlers/session.py +516 -0
  18. portacode-0.3.dev20/portacode/connection/handlers/system_handlers.py +134 -0
  19. portacode-0.3.dev20/portacode/connection/handlers/tab_factory.py +382 -0
  20. portacode-0.3.dev20/portacode/connection/handlers/terminal_handlers.py +265 -0
  21. portacode-0.3.dev20/portacode/connection/terminal.py +796 -0
  22. {portacode-0.2.6.dev0 → portacode-0.3.dev20}/portacode/service.py +6 -0
  23. portacode-0.3.dev20/portacode.egg-info/PKG-INFO +241 -0
  24. {portacode-0.2.6.dev0 → portacode-0.3.dev20}/portacode.egg-info/SOURCES.txt +8 -0
  25. {portacode-0.2.6.dev0 → portacode-0.3.dev20}/portacode.egg-info/requires.txt +4 -0
  26. portacode-0.3.dev20/restore.sh +56 -0
  27. {portacode-0.2.6.dev0 → portacode-0.3.dev20}/setup.py +5 -0
  28. portacode-0.2.6.dev0/.gitignore +0 -7
  29. portacode-0.2.6.dev0/PKG-INFO +0 -55
  30. portacode-0.2.6.dev0/README.md +0 -31
  31. portacode-0.2.6.dev0/docker-compose.yaml +0 -53
  32. portacode-0.2.6.dev0/portacode/connection/handlers/base.py +0 -115
  33. portacode-0.2.6.dev0/portacode/connection/handlers/session.py +0 -305
  34. portacode-0.2.6.dev0/portacode/connection/handlers/system_handlers.py +0 -32
  35. portacode-0.2.6.dev0/portacode/connection/handlers/terminal_handlers.py +0 -139
  36. portacode-0.2.6.dev0/portacode/connection/terminal.py +0 -205
  37. portacode-0.2.6.dev0/portacode.egg-info/PKG-INFO +0 -55
  38. {portacode-0.2.6.dev0 → portacode-0.3.dev20}/.gitmodules +0 -0
  39. {portacode-0.2.6.dev0 → portacode-0.3.dev20}/MANIFEST.in +0 -0
  40. {portacode-0.2.6.dev0 → portacode-0.3.dev20}/Makefile +0 -0
  41. {portacode-0.2.6.dev0 → portacode-0.3.dev20}/portacode/README.md +0 -0
  42. {portacode-0.2.6.dev0 → portacode-0.3.dev20}/portacode/__init__.py +0 -0
  43. {portacode-0.2.6.dev0 → portacode-0.3.dev20}/portacode/__main__.py +0 -0
  44. {portacode-0.2.6.dev0 → portacode-0.3.dev20}/portacode/connection/README.md +0 -0
  45. {portacode-0.2.6.dev0 → portacode-0.3.dev20}/portacode/connection/__init__.py +0 -0
  46. {portacode-0.2.6.dev0 → portacode-0.3.dev20}/portacode/connection/handlers/README.md +0 -0
  47. {portacode-0.2.6.dev0 → portacode-0.3.dev20}/portacode/connection/handlers/file_handlers.py +0 -0
  48. {portacode-0.2.6.dev0 → portacode-0.3.dev20}/portacode/connection/multiplex.py +0 -0
  49. {portacode-0.2.6.dev0 → portacode-0.3.dev20}/portacode/data.py +0 -0
  50. {portacode-0.2.6.dev0 → portacode-0.3.dev20}/portacode/keypair.py +0 -0
  51. {portacode-0.2.6.dev0 → portacode-0.3.dev20}/portacode.egg-info/dependency_links.txt +0 -0
  52. {portacode-0.2.6.dev0 → portacode-0.3.dev20}/portacode.egg-info/entry_points.txt +0 -0
  53. {portacode-0.2.6.dev0 → portacode-0.3.dev20}/portacode.egg-info/top_level.txt +0 -0
  54. {portacode-0.2.6.dev0 → portacode-0.3.dev20}/pyproject.toml +0 -0
  55. {portacode-0.2.6.dev0 → portacode-0.3.dev20}/setup.cfg +0 -0
@@ -0,0 +1,5 @@
1
+ ---
2
+ name: communication-manager
3
+ description: Expert code protocol engineer. Accurately defines and improves simple yet straightforward and concise scallable communication protocols for websocket communication between devices and user sessions
4
+ tools: Read, Grep, Glob
5
+ ---
@@ -0,0 +1,15 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/claude-code-settings.json",
3
+ "permissions": {
4
+ "allow": [
5
+ "WebFetch(domain:stackoverflow.com)",
6
+ "Bash(docker-compose logs:*)",
7
+ "Bash(python:*)",
8
+ "Bash(find:*)",
9
+ "Bash(touch:*)",
10
+ "Bash(npm run lint)",
11
+ "Bash(node:*)"
12
+ ],
13
+ "deny": []
14
+ }
15
+ }
@@ -0,0 +1,9 @@
1
+ __pycache__/
2
+ *.pyc
3
+ *.egg-info
4
+ *.env
5
+ dist
6
+ .pypirc
7
+ _version.py
8
+ client_sessions.json
9
+ project_state_debug.json
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Portacode
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.
@@ -0,0 +1,241 @@
1
+ Metadata-Version: 2.1
2
+ Name: portacode
3
+ Version: 0.3.dev20
4
+ Summary: Portacode CLI client and SDK
5
+ Home-page: https://github.com/portacode/portacode
6
+ Author: Meena Erian
7
+ Author-email: hi@menas.pro
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.8
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Requires-Dist: click>=8.0
15
+ Requires-Dist: platformdirs>=3.0
16
+ Requires-Dist: cryptography>=41.0
17
+ Requires-Dist: websockets>=12.0
18
+ Requires-Dist: pyperclip>=1.8
19
+ Requires-Dist: psutil>=5.9
20
+ Requires-Dist: pyte>=0.8
21
+ Requires-Dist: pywinpty>=2.0; platform_system == "Windows"
22
+ Requires-Dist: GitPython>=3.1.45
23
+ Requires-Dist: watchdog>=3.0
24
+ Requires-Dist: diff-match-patch>=20230430
25
+ Requires-Dist: Pygments>=2.14.0
26
+ Provides-Extra: dev
27
+ Requires-Dist: black; extra == "dev"
28
+ Requires-Dist: flake8; extra == "dev"
29
+ Requires-Dist: pytest; extra == "dev"
30
+
31
+ # Portacode
32
+
33
+ **An AI-first, mobile-first IDE and admin tool, made with love and passion by software engineers, for software engineers.**
34
+
35
+ Portacode transforms any computer into a remotely accessible development environment. Access your home lab from your phone, code on your desktop from anywhere, or help a colleague debug their server - all through a beautiful web interface designed for the modern developer.
36
+
37
+ ## ✨ Why Portacode?
38
+
39
+ - **🤖 AI-First**: Built from the ground up with AI integration in mind
40
+ - **📱 Mobile-First**: Code and administrate from your phone or tablet
41
+ - **🌍 Global Access**: Connect to your devices from anywhere with internet
42
+ - **🔐 Secure**: HTTPS encrypted with RSA key authentication
43
+ - **⚡ Fast Setup**: Get connected in under 60 seconds
44
+ - **🔄 Always Connected**: Automatic reconnection and persistent service options
45
+ - **🆓 Free Account**: Create your account and start connecting immediately
46
+ - **🖥️ Cross-Platform**: Works on Windows, macOS, and Linux
47
+
48
+ ## 🚀 Quick Start
49
+
50
+ ### 1. Install Portacode
51
+
52
+ ```bash
53
+ pip install portacode
54
+ ```
55
+
56
+ ### 2. Connect Your Device
57
+
58
+ ```bash
59
+ portacode connect
60
+ ```
61
+
62
+ Follow the on-screen instructions to:
63
+ - Visit [https://remote.portacode.com](https://remote.portacode.com)
64
+ - Create your free account
65
+ - Add your device using the generated key
66
+ - Start coding and administrating!
67
+
68
+ ### 3. Access Your Development Environment
69
+
70
+ Once connected, you can:
71
+ - Open terminal sessions from the web dashboard
72
+ - Execute commands remotely
73
+ - Monitor system status
74
+ - Access your development environment from any device
75
+
76
+ ## 💡 Use Cases
77
+
78
+ ### Remote Development
79
+ ```bash
80
+ # Connect your development machine
81
+ portacode connect
82
+
83
+ # Now code, build, and debug from anywhere - even your phone
84
+ ```
85
+
86
+ ### Server Administration
87
+ ```bash
88
+ # For a persistent connection, install system-wide first
89
+ sudo pip install portacode --system
90
+
91
+ # Then install as a service
92
+ sudo portacode service install
93
+
94
+ # Your server is now accessible 24/7 from the web dashboard
95
+ ```
96
+
97
+ ### Mobile Development
98
+ ```bash
99
+ # Connect your desktop/laptop
100
+ portacode connect
101
+
102
+ # Code on-the-go from your mobile device with a full IDE experience
103
+ ```
104
+
105
+ ### Team Collaboration
106
+ ```bash
107
+ # Connect shared development environments
108
+ portacode connect
109
+
110
+ # Enable team members to access shared resources securely
111
+ ```
112
+
113
+ ## 🔧 Essential Commands
114
+
115
+ ### Basic Usage
116
+ ```bash
117
+ # Start a connection (runs until closed)
118
+ portacode connect
119
+
120
+ # Run connection in background
121
+ portacode connect --detach
122
+
123
+ # Check version
124
+ portacode --version
125
+
126
+ # Get help
127
+ portacode --help
128
+ ```
129
+
130
+ ### Service Management
131
+ ```bash
132
+ # For system services, install package system-wide first
133
+ sudo pip install portacode --system
134
+
135
+ # Install persistent service (auto-start on boot)
136
+ sudo portacode service install
137
+
138
+ # Check service status
139
+ sudo portacode service status
140
+
141
+ # Stop the service
142
+ sudo portacode service stop
143
+
144
+ # Remove the service
145
+ sudo portacode service uninstall
146
+ ```
147
+
148
+ ## 🌐 Web Dashboard
149
+
150
+ Access your connected devices at [https://remote.portacode.com](https://remote.portacode.com)
151
+
152
+ **Current Features:**
153
+ - Real-time terminal access
154
+ - System monitoring
155
+ - Device management
156
+ - Multi-device switching
157
+ - Secure authentication
158
+
159
+ **Coming Soon:**
160
+ - AI-powered code assistance
161
+ - Mobile-optimized IDE interface
162
+ - File management and editing
163
+ - Collaborative development tools
164
+
165
+ ## 🔐 Security
166
+
167
+ - **RSA Key Authentication**: Each device gets a unique RSA key pair
168
+ - **HTTPS Encrypted**: All communication is encrypted in transit
169
+ - **No Passwords**: Key-based authentication eliminates password risks
170
+ - **Revocable Access**: Remove devices instantly from the web dashboard
171
+ - **Local Key Storage**: Private keys never leave your device
172
+
173
+ ## 🆘 Troubleshooting
174
+
175
+ ### Connection Issues
176
+ ```bash
177
+ # Check if another connection is running
178
+ portacode connect
179
+
180
+ # View service logs
181
+ sudo portacode service status --verbose
182
+ ```
183
+
184
+ ### Service Installation Issues
185
+ ```bash
186
+ # If service commands fail, ensure system-wide installation
187
+ sudo pip install portacode --system
188
+
189
+ # Then try service installation again
190
+ sudo portacode service install
191
+ ```
192
+
193
+ ### Clipboard Issues (Linux)
194
+ ```bash
195
+ # Install clipboard support
196
+ sudo apt-get install xclip
197
+ ```
198
+
199
+ ### Key Management
200
+ Key files are stored in:
201
+ - **Linux**: `~/.local/share/portacode/keys/`
202
+ - **macOS**: `~/Library/Application Support/portacode/keys/`
203
+ - **Windows**: `%APPDATA%\portacode\keys\`
204
+
205
+ ## 🌱 Early Stage Project
206
+
207
+ **Portacode is a young project with big dreams.** We're building the future of remote development and mobile-first coding experiences. As a new project, we're actively seeking:
208
+
209
+ - **👥 Community Feedback**: Does this solve a real problem for you?
210
+ - **🤝 Contributors**: Help us build the IDE of the future
211
+ - **📢 Early Adopters**: Try it out and let us know what you think
212
+ - **💡 Feature Ideas**: What would make your remote development workflow better?
213
+
214
+ **Your support matters!** Whether you contribute code, report bugs, share ideas, or simply let us know that you find value in what we're building - every bit of feedback helps us decide whether to continue investing in this vision or focus on other projects.
215
+
216
+ ## 📞 Get In Touch
217
+
218
+ - **Email**: hi@menas.pro
219
+ - **Support**: support@portacode.com
220
+ - **GitHub**: [https://github.com/portacode/portacode](https://github.com/portacode/portacode)
221
+
222
+ ## 🤝 Contributing
223
+
224
+ We welcome all forms of contribution:
225
+ - 🐛 **Bug Reports**: Found something broken? Let us know!
226
+ - ✨ **Feature Requests**: What would make Portacode better for you?
227
+ - 📖 **Documentation**: Help others get started
228
+ - 💻 **Code Contributions**: Help us build the future of remote development
229
+ - 💬 **Feedback**: Tell us if you find this useful!
230
+
231
+ Check out our [GitHub repository](https://github.com/portacode/portacode) to get started.
232
+
233
+ ## 📄 License
234
+
235
+ MIT License - see [LICENSE](LICENSE) file for details.
236
+
237
+ ---
238
+
239
+ **Get started today**: `pip install portacode && portacode connect`
240
+
241
+ *Built with ❤️ and ☕ by passionate software engineers*
@@ -0,0 +1,211 @@
1
+ # Portacode
2
+
3
+ **An AI-first, mobile-first IDE and admin tool, made with love and passion by software engineers, for software engineers.**
4
+
5
+ Portacode transforms any computer into a remotely accessible development environment. Access your home lab from your phone, code on your desktop from anywhere, or help a colleague debug their server - all through a beautiful web interface designed for the modern developer.
6
+
7
+ ## ✨ Why Portacode?
8
+
9
+ - **🤖 AI-First**: Built from the ground up with AI integration in mind
10
+ - **📱 Mobile-First**: Code and administrate from your phone or tablet
11
+ - **🌍 Global Access**: Connect to your devices from anywhere with internet
12
+ - **🔐 Secure**: HTTPS encrypted with RSA key authentication
13
+ - **⚡ Fast Setup**: Get connected in under 60 seconds
14
+ - **🔄 Always Connected**: Automatic reconnection and persistent service options
15
+ - **🆓 Free Account**: Create your account and start connecting immediately
16
+ - **🖥️ Cross-Platform**: Works on Windows, macOS, and Linux
17
+
18
+ ## 🚀 Quick Start
19
+
20
+ ### 1. Install Portacode
21
+
22
+ ```bash
23
+ pip install portacode
24
+ ```
25
+
26
+ ### 2. Connect Your Device
27
+
28
+ ```bash
29
+ portacode connect
30
+ ```
31
+
32
+ Follow the on-screen instructions to:
33
+ - Visit [https://remote.portacode.com](https://remote.portacode.com)
34
+ - Create your free account
35
+ - Add your device using the generated key
36
+ - Start coding and administrating!
37
+
38
+ ### 3. Access Your Development Environment
39
+
40
+ Once connected, you can:
41
+ - Open terminal sessions from the web dashboard
42
+ - Execute commands remotely
43
+ - Monitor system status
44
+ - Access your development environment from any device
45
+
46
+ ## 💡 Use Cases
47
+
48
+ ### Remote Development
49
+ ```bash
50
+ # Connect your development machine
51
+ portacode connect
52
+
53
+ # Now code, build, and debug from anywhere - even your phone
54
+ ```
55
+
56
+ ### Server Administration
57
+ ```bash
58
+ # For a persistent connection, install system-wide first
59
+ sudo pip install portacode --system
60
+
61
+ # Then install as a service
62
+ sudo portacode service install
63
+
64
+ # Your server is now accessible 24/7 from the web dashboard
65
+ ```
66
+
67
+ ### Mobile Development
68
+ ```bash
69
+ # Connect your desktop/laptop
70
+ portacode connect
71
+
72
+ # Code on-the-go from your mobile device with a full IDE experience
73
+ ```
74
+
75
+ ### Team Collaboration
76
+ ```bash
77
+ # Connect shared development environments
78
+ portacode connect
79
+
80
+ # Enable team members to access shared resources securely
81
+ ```
82
+
83
+ ## 🔧 Essential Commands
84
+
85
+ ### Basic Usage
86
+ ```bash
87
+ # Start a connection (runs until closed)
88
+ portacode connect
89
+
90
+ # Run connection in background
91
+ portacode connect --detach
92
+
93
+ # Check version
94
+ portacode --version
95
+
96
+ # Get help
97
+ portacode --help
98
+ ```
99
+
100
+ ### Service Management
101
+ ```bash
102
+ # For system services, install package system-wide first
103
+ sudo pip install portacode --system
104
+
105
+ # Install persistent service (auto-start on boot)
106
+ sudo portacode service install
107
+
108
+ # Check service status
109
+ sudo portacode service status
110
+
111
+ # Stop the service
112
+ sudo portacode service stop
113
+
114
+ # Remove the service
115
+ sudo portacode service uninstall
116
+ ```
117
+
118
+ ## 🌐 Web Dashboard
119
+
120
+ Access your connected devices at [https://remote.portacode.com](https://remote.portacode.com)
121
+
122
+ **Current Features:**
123
+ - Real-time terminal access
124
+ - System monitoring
125
+ - Device management
126
+ - Multi-device switching
127
+ - Secure authentication
128
+
129
+ **Coming Soon:**
130
+ - AI-powered code assistance
131
+ - Mobile-optimized IDE interface
132
+ - File management and editing
133
+ - Collaborative development tools
134
+
135
+ ## 🔐 Security
136
+
137
+ - **RSA Key Authentication**: Each device gets a unique RSA key pair
138
+ - **HTTPS Encrypted**: All communication is encrypted in transit
139
+ - **No Passwords**: Key-based authentication eliminates password risks
140
+ - **Revocable Access**: Remove devices instantly from the web dashboard
141
+ - **Local Key Storage**: Private keys never leave your device
142
+
143
+ ## 🆘 Troubleshooting
144
+
145
+ ### Connection Issues
146
+ ```bash
147
+ # Check if another connection is running
148
+ portacode connect
149
+
150
+ # View service logs
151
+ sudo portacode service status --verbose
152
+ ```
153
+
154
+ ### Service Installation Issues
155
+ ```bash
156
+ # If service commands fail, ensure system-wide installation
157
+ sudo pip install portacode --system
158
+
159
+ # Then try service installation again
160
+ sudo portacode service install
161
+ ```
162
+
163
+ ### Clipboard Issues (Linux)
164
+ ```bash
165
+ # Install clipboard support
166
+ sudo apt-get install xclip
167
+ ```
168
+
169
+ ### Key Management
170
+ Key files are stored in:
171
+ - **Linux**: `~/.local/share/portacode/keys/`
172
+ - **macOS**: `~/Library/Application Support/portacode/keys/`
173
+ - **Windows**: `%APPDATA%\portacode\keys\`
174
+
175
+ ## 🌱 Early Stage Project
176
+
177
+ **Portacode is a young project with big dreams.** We're building the future of remote development and mobile-first coding experiences. As a new project, we're actively seeking:
178
+
179
+ - **👥 Community Feedback**: Does this solve a real problem for you?
180
+ - **🤝 Contributors**: Help us build the IDE of the future
181
+ - **📢 Early Adopters**: Try it out and let us know what you think
182
+ - **💡 Feature Ideas**: What would make your remote development workflow better?
183
+
184
+ **Your support matters!** Whether you contribute code, report bugs, share ideas, or simply let us know that you find value in what we're building - every bit of feedback helps us decide whether to continue investing in this vision or focus on other projects.
185
+
186
+ ## 📞 Get In Touch
187
+
188
+ - **Email**: hi@menas.pro
189
+ - **Support**: support@portacode.com
190
+ - **GitHub**: [https://github.com/portacode/portacode](https://github.com/portacode/portacode)
191
+
192
+ ## 🤝 Contributing
193
+
194
+ We welcome all forms of contribution:
195
+ - 🐛 **Bug Reports**: Found something broken? Let us know!
196
+ - ✨ **Feature Requests**: What would make Portacode better for you?
197
+ - 📖 **Documentation**: Help others get started
198
+ - 💻 **Code Contributions**: Help us build the future of remote development
199
+ - 💬 **Feedback**: Tell us if you find this useful!
200
+
201
+ Check out our [GitHub repository](https://github.com/portacode/portacode) to get started.
202
+
203
+ ## 📄 License
204
+
205
+ MIT License - see [LICENSE](LICENSE) file for details.
206
+
207
+ ---
208
+
209
+ **Get started today**: `pip install portacode && portacode connect`
210
+
211
+ *Built with ❤️ and ☕ by passionate software engineers*
@@ -0,0 +1,42 @@
1
+ # backup.sh
2
+ #!/usr/bin/env bash
3
+ set -euo pipefail
4
+
5
+ # ensure we’re in project root
6
+ cd "$(dirname "$0")"
7
+
8
+ # config
9
+ BACKUP_DIR="${1:-$PWD/../backups}"
10
+ VOLUME_NAME="portacode_pgdata"
11
+ SERVICE_NAME="db"
12
+
13
+ mkdir -p "$BACKUP_DIR"
14
+
15
+ # check & stop DB for a consistent dump
16
+ if [ "$(docker inspect -f '{{.State.Running}}' portacode-db 2>/dev/null || echo false)" = "true" ]; then
17
+ echo "🛑 Stopping $SERVICE_NAME..."
18
+ docker-compose stop "$SERVICE_NAME"
19
+ RESTART_DB=true
20
+ else
21
+ RESTART_DB=false
22
+ fi
23
+
24
+ # create backup
25
+ TS=$(date +%F_%H-%M-%S)
26
+ FILE="pgdata-$TS.tar.gz"
27
+ echo "📦 Backing up volume to $BACKUP_DIR/$FILE..."
28
+ docker run --rm \
29
+ -v "${VOLUME_NAME}":/data:ro \
30
+ -v "${BACKUP_DIR}":/backup \
31
+ alpine \
32
+ sh -c "cd /data && tar czf /backup/${FILE} ."
33
+
34
+ echo "✅ Backup complete."
35
+
36
+ # restart DB if we stopped it
37
+ if [ "$RESTART_DB" = true ]; then
38
+ echo "🔄 Starting $SERVICE_NAME..."
39
+ docker-compose start "$SERVICE_NAME"
40
+ fi
41
+
42
+ echo "🎉 Done."
@@ -0,0 +1,37 @@
1
+ services:
2
+ db:
3
+ image: postgres:15
4
+ container_name: portacode-db
5
+ restart: unless-stopped
6
+ env_file:
7
+ - main.env
8
+ volumes:
9
+ - pgdata:/var/lib/postgresql/data
10
+ ports:
11
+ - "5432:5432"
12
+ healthcheck:
13
+ test: ["CMD-SHELL", "pg_isready -U portacode -d portacode"]
14
+ interval: 5s
15
+ timeout: 5s
16
+ retries: 5
17
+
18
+ django:
19
+ build:
20
+ context: ./server/portacode_django
21
+ dockerfile: Dockerfile
22
+ container_name: portacode-django
23
+ restart: unless-stopped
24
+ command: ["bash", "-c", "python manage.py migrate && python manage.py collectstatic --noinput && daphne portacode_django.asgi:application -b 0.0.0.0 -p 8001"]
25
+ env_file:
26
+ - main.env
27
+ depends_on:
28
+ db:
29
+ condition: service_healthy
30
+ ports:
31
+ - "8001:8001"
32
+ volumes:
33
+ - ./server/portacode_django:/app
34
+
35
+
36
+ volumes:
37
+ pgdata:
@@ -1,7 +1,14 @@
1
1
  # file generated by setuptools-scm
2
2
  # don't change, don't track in version control
3
3
 
4
- __all__ = ["__version__", "__version_tuple__", "version", "version_tuple"]
4
+ __all__ = [
5
+ "__version__",
6
+ "__version_tuple__",
7
+ "version",
8
+ "version_tuple",
9
+ "__commit_id__",
10
+ "commit_id",
11
+ ]
5
12
 
6
13
  TYPE_CHECKING = False
7
14
  if TYPE_CHECKING:
@@ -9,13 +16,19 @@ if TYPE_CHECKING:
9
16
  from typing import Union
10
17
 
11
18
  VERSION_TUPLE = Tuple[Union[int, str], ...]
19
+ COMMIT_ID = Union[str, None]
12
20
  else:
13
21
  VERSION_TUPLE = object
22
+ COMMIT_ID = object
14
23
 
15
24
  version: str
16
25
  __version__: str
17
26
  __version_tuple__: VERSION_TUPLE
18
27
  version_tuple: VERSION_TUPLE
28
+ commit_id: COMMIT_ID
29
+ __commit_id__: COMMIT_ID
19
30
 
20
- __version__ = version = '0.2.6.dev'
21
- __version_tuple__ = version_tuple = (0, 2, 6, 'dev0')
31
+ __version__ = version = '0.3.dev20'
32
+ __version_tuple__ = version_tuple = (0, 3, 'dev20')
33
+
34
+ __commit_id__ = commit_id = None