inferyx-codegate 1.1.0__tar.gz → 2.0.1__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.
- {inferyx_codegate-1.1.0 → inferyx_codegate-2.0.1}/.gitignore +1 -1
- {inferyx_codegate-1.1.0 → inferyx_codegate-2.0.1}/PKG-INFO +38 -38
- {inferyx_codegate-1.1.0 → inferyx_codegate-2.0.1}/README.md +37 -37
- {inferyx_codegate-1.1.0 → inferyx_codegate-2.0.1}/pyproject.toml +4 -4
- inferyx_codegate-2.0.1/src/inferyx_codegate/__init__.py +7 -0
- {inferyx_codegate-1.1.0/src/codegate → inferyx_codegate-2.0.1/src/inferyx_codegate}/api/admin.py +2 -2
- {inferyx_codegate-1.1.0/src/codegate → inferyx_codegate-2.0.1/src/inferyx_codegate}/api/deps.py +3 -3
- {inferyx_codegate-1.1.0/src/codegate → inferyx_codegate-2.0.1/src/inferyx_codegate}/api/devproxy.py +1 -1
- {inferyx_codegate-1.1.0/src/codegate → inferyx_codegate-2.0.1/src/inferyx_codegate}/api/public.py +2 -2
- {inferyx_codegate-1.1.0/src/codegate → inferyx_codegate-2.0.1/src/inferyx_codegate}/app.py +3 -3
- {inferyx_codegate-1.1.0/src/codegate → inferyx_codegate-2.0.1/src/inferyx_codegate}/auth/csrf.py +2 -2
- {inferyx_codegate-1.1.0/src/codegate → inferyx_codegate-2.0.1/src/inferyx_codegate}/auth/saml.py +3 -3
- {inferyx_codegate-1.1.0/src/codegate → inferyx_codegate-2.0.1/src/inferyx_codegate}/cli/auth_cmd.py +2 -2
- {inferyx_codegate-1.1.0/src/codegate → inferyx_codegate-2.0.1/src/inferyx_codegate}/cli/backup_cmd.py +6 -6
- {inferyx_codegate-1.1.0/src/codegate → inferyx_codegate-2.0.1/src/inferyx_codegate}/cli/common.py +6 -6
- {inferyx_codegate-1.1.0/src/codegate → inferyx_codegate-2.0.1/src/inferyx_codegate}/cli/doctor_cmd.py +16 -16
- {inferyx_codegate-1.1.0/src/codegate → inferyx_codegate-2.0.1/src/inferyx_codegate}/cli/main.py +32 -32
- {inferyx_codegate-1.1.0/src/codegate → inferyx_codegate-2.0.1/src/inferyx_codegate}/cli/nginx_setup.py +20 -20
- {inferyx_codegate-1.1.0/src/codegate → inferyx_codegate-2.0.1/src/inferyx_codegate}/cli/setup_cmd.py +71 -42
- {inferyx_codegate-1.1.0/src/codegate → inferyx_codegate-2.0.1/src/inferyx_codegate}/cli/ssh_setup.py +3 -3
- {inferyx_codegate-1.1.0/src/codegate → inferyx_codegate-2.0.1/src/inferyx_codegate}/cli/upgrade_cmd.py +16 -16
- {inferyx_codegate-1.1.0/src/codegate → inferyx_codegate-2.0.1/src/inferyx_codegate}/config.py +19 -19
- {inferyx_codegate-1.1.0/src/codegate → inferyx_codegate-2.0.1/src/inferyx_codegate}/db.py +1 -1
- {inferyx_codegate-1.1.0/src/codegate → inferyx_codegate-2.0.1/src/inferyx_codegate}/errors.py +1 -1
- {inferyx_codegate-1.1.0/src/codegate → inferyx_codegate-2.0.1/src/inferyx_codegate}/jobs.py +1 -1
- {inferyx_codegate-1.1.0/src/codegate → inferyx_codegate-2.0.1/src/inferyx_codegate}/pages.py +5 -5
- {inferyx_codegate-1.1.0/src/codegate → inferyx_codegate-2.0.1/src/inferyx_codegate}/resources/docker/Dockerfile +3 -3
- inferyx_codegate-1.1.0/src/codegate/resources/nginx/codegate.conf.tmpl → inferyx_codegate-2.0.1/src/inferyx_codegate/resources/nginx/inferyx-codegate.conf.tmpl +4 -4
- inferyx_codegate-2.0.1/src/inferyx_codegate/resources/nginx/map.conf +5 -0
- inferyx_codegate-2.0.1/src/inferyx_codegate/resources/nginx/site.conf.tmpl +9 -0
- {inferyx_codegate-1.1.0/src/codegate → inferyx_codegate-2.0.1/src/inferyx_codegate}/resources/nginx/user.conf.tmpl +5 -5
- inferyx_codegate-2.0.1/src/inferyx_codegate/resources/systemd/inferyx-codegate-backup.service.tmpl +7 -0
- inferyx_codegate-1.1.0/src/codegate/resources/systemd/codegate-backup.timer → inferyx_codegate-2.0.1/src/inferyx_codegate/resources/systemd/inferyx-codegate-backup.timer +1 -1
- inferyx_codegate-1.1.0/src/codegate/resources/systemd/codegate.service.tmpl → inferyx_codegate-2.0.1/src/inferyx_codegate/resources/systemd/inferyx-codegate.service.tmpl +4 -4
- inferyx_codegate-1.1.0/src/codegate/static/admin/chunk-Cjwyuum6.js → inferyx_codegate-2.0.1/src/inferyx_codegate/static/admin/chunk-B7t5PLiA.js +1 -1
- inferyx_codegate-1.1.0/src/codegate/static/admin/chunk-BqiJ460N.js → inferyx_codegate-2.0.1/src/inferyx_codegate/static/admin/chunk-BLCQMMDZ.js +2 -2
- inferyx_codegate-1.1.0/src/codegate/static/admin/chunk-yikJ2ObQ.js → inferyx_codegate-2.0.1/src/inferyx_codegate/static/admin/chunk-BcWnus1s.js +1 -1
- inferyx_codegate-1.1.0/src/codegate/static/admin/chunk-CB4E-q63.js → inferyx_codegate-2.0.1/src/inferyx_codegate/static/admin/chunk-Cc10NZIQ.js +1 -1
- inferyx_codegate-1.1.0/src/codegate/static/admin/chunk-DXvCZ3pT.js → inferyx_codegate-2.0.1/src/inferyx_codegate/static/admin/chunk-CmXB5r2Q.js +1 -1
- inferyx_codegate-1.1.0/src/codegate/static/admin/chunk-kPDFCwHP.js → inferyx_codegate-2.0.1/src/inferyx_codegate/static/admin/chunk-Cq6_su0x.js +1 -1
- inferyx_codegate-1.1.0/src/codegate/static/admin/chunk-D9RytJgO.js → inferyx_codegate-2.0.1/src/inferyx_codegate/static/admin/chunk-DBJVeJTU.js +1 -1
- inferyx_codegate-1.1.0/src/codegate/static/admin/chunk-CMN75K3s.js → inferyx_codegate-2.0.1/src/inferyx_codegate/static/admin/chunk-DHiMuNVv.js +1 -1
- inferyx_codegate-1.1.0/src/codegate/static/admin/chunk-DA6TldFU.js → inferyx_codegate-2.0.1/src/inferyx_codegate/static/admin/chunk-DUattgRk.js +1 -1
- inferyx_codegate-1.1.0/src/codegate/static/admin/chunk-DstgVdtz.js → inferyx_codegate-2.0.1/src/inferyx_codegate/static/admin/chunk-DWxCcfUA.js +1 -1
- inferyx_codegate-1.1.0/src/codegate/static/admin/chunk-CW_CPa20.js → inferyx_codegate-2.0.1/src/inferyx_codegate/static/admin/chunk-D_G74AQ0.js +1 -1
- inferyx_codegate-1.1.0/src/codegate/static/admin/chunk-BoGqYCjO.js → inferyx_codegate-2.0.1/src/inferyx_codegate/static/admin/chunk-DgRSUTTA.js +1 -1
- inferyx_codegate-1.1.0/src/codegate/static/admin/chunk-0r_p7pcB.js → inferyx_codegate-2.0.1/src/inferyx_codegate/static/admin/chunk-Dl6u9GML.js +1 -1
- inferyx_codegate-1.1.0/src/codegate/static/admin/chunk-CcgsCK7w.js → inferyx_codegate-2.0.1/src/inferyx_codegate/static/admin/chunk-DuNG7u87.js +1 -1
- inferyx_codegate-1.1.0/src/codegate/static/admin/chunk-DFGdyoNb.js → inferyx_codegate-2.0.1/src/inferyx_codegate/static/admin/chunk-Fs7Koo5R.js +1 -1
- inferyx_codegate-1.1.0/src/codegate/static/admin/chunk-BtoaIoDj.js → inferyx_codegate-2.0.1/src/inferyx_codegate/static/admin/chunk-nYrDDlq9.js +1 -1
- {inferyx_codegate-1.1.0/src/codegate → inferyx_codegate-2.0.1/src/inferyx_codegate}/static/admin/index.html +2 -2
- inferyx_codegate-1.1.0/src/codegate/static/admin/main-LWBML7JF.js → inferyx_codegate-2.0.1/src/inferyx_codegate/static/admin/main-2ZQ5DCKC.js +2 -2
- {inferyx_codegate-1.1.0/src/codegate → inferyx_codegate-2.0.1/src/inferyx_codegate}/system/__init__.py +1 -1
- {inferyx_codegate-1.1.0/src/codegate → inferyx_codegate-2.0.1/src/inferyx_codegate}/system/base.py +1 -1
- {inferyx_codegate-1.1.0/src/codegate → inferyx_codegate-2.0.1/src/inferyx_codegate}/system/devdocker.py +1 -1
- {inferyx_codegate-1.1.0/src/codegate → inferyx_codegate-2.0.1/src/inferyx_codegate}/system/fake.py +3 -3
- {inferyx_codegate-1.1.0/src/codegate → inferyx_codegate-2.0.1/src/inferyx_codegate}/system/real.py +9 -9
- {inferyx_codegate-1.1.0/src/codegate → inferyx_codegate-2.0.1/src/inferyx_codegate}/system/shell.py +1 -1
- {inferyx_codegate-1.1.0/src/codegate → inferyx_codegate-2.0.1/src/inferyx_codegate}/workspace.py +2 -2
- inferyx_codegate-1.1.0/src/codegate/__init__.py +0 -8
- inferyx_codegate-1.1.0/src/codegate/resources/nginx/map.conf +0 -5
- inferyx_codegate-1.1.0/src/codegate/resources/nginx/site.conf.tmpl +0 -9
- inferyx_codegate-1.1.0/src/codegate/resources/systemd/codegate-backup.service.tmpl +0 -7
- {inferyx_codegate-1.1.0 → inferyx_codegate-2.0.1}/frontend/README.md +0 -0
- {inferyx_codegate-1.1.0/src/codegate → inferyx_codegate-2.0.1/src/inferyx_codegate}/__main__.py +0 -0
- {inferyx_codegate-1.1.0/src/codegate → inferyx_codegate-2.0.1/src/inferyx_codegate}/api/__init__.py +0 -0
- {inferyx_codegate-1.1.0/src/codegate → inferyx_codegate-2.0.1/src/inferyx_codegate}/auth/__init__.py +0 -0
- {inferyx_codegate-1.1.0/src/codegate → inferyx_codegate-2.0.1/src/inferyx_codegate}/auth/native.py +0 -0
- {inferyx_codegate-1.1.0/src/codegate → inferyx_codegate-2.0.1/src/inferyx_codegate}/auth/passwords.py +0 -0
- {inferyx_codegate-1.1.0/src/codegate → inferyx_codegate-2.0.1/src/inferyx_codegate}/auth/sessions.py +0 -0
- {inferyx_codegate-1.1.0/src/codegate → inferyx_codegate-2.0.1/src/inferyx_codegate}/cli/__init__.py +0 -0
- {inferyx_codegate-1.1.0/src/codegate → inferyx_codegate-2.0.1/src/inferyx_codegate}/resources/__init__.py +0 -0
- {inferyx_codegate-1.1.0/src/codegate → inferyx_codegate-2.0.1/src/inferyx_codegate}/static/admin/3rdpartylicenses.txt +0 -0
- {inferyx_codegate-1.1.0/src/codegate → inferyx_codegate-2.0.1/src/inferyx_codegate}/static/admin/chunk-D6j6hnz3.js +0 -0
- {inferyx_codegate-1.1.0/src/codegate → inferyx_codegate-2.0.1/src/inferyx_codegate}/static/admin/favicon.ico +0 -0
- {inferyx_codegate-1.1.0/src/codegate → inferyx_codegate-2.0.1/src/inferyx_codegate}/static/admin/media/material-icons-JLIDJUWE.woff +0 -0
- {inferyx_codegate-1.1.0/src/codegate → inferyx_codegate-2.0.1/src/inferyx_codegate}/static/admin/media/material-icons-LEZCGFVT.woff2 +0 -0
- {inferyx_codegate-1.1.0/src/codegate → inferyx_codegate-2.0.1/src/inferyx_codegate}/static/admin/styles-YWRWGLKG.css +0 -0
- {inferyx_codegate-1.1.0/src/codegate → inferyx_codegate-2.0.1/src/inferyx_codegate}/users.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: inferyx-codegate
|
|
3
|
-
Version:
|
|
3
|
+
Version: 2.0.1
|
|
4
4
|
Summary: Multi-user browser VS Code (code-server) on one server: password and AWS IAM Identity Center (SSO) login, per-user Docker workspaces and an admin portal.
|
|
5
5
|
Author: Inferyx
|
|
6
6
|
License: Proprietary
|
|
@@ -24,7 +24,7 @@ Provides-Extra: saml
|
|
|
24
24
|
Requires-Dist: python3-saml>=1.16; extra == 'saml'
|
|
25
25
|
Description-Content-Type: text/markdown
|
|
26
26
|
|
|
27
|
-
# CodeGate
|
|
27
|
+
# Inferyx CodeGate
|
|
28
28
|
|
|
29
29
|
Browser VS Code (code-server) for many users on one Ubuntu server. Each user gets their own
|
|
30
30
|
Docker workspace; admins manage everything from a web portal.
|
|
@@ -50,24 +50,24 @@ https://code.example.com/codeapp/admin/ → admin portal
|
|
|
50
50
|
|
|
51
51
|
```bash
|
|
52
52
|
# 1. install into its own virtual environment
|
|
53
|
-
sudo python3 -m venv /opt/codegate
|
|
54
|
-
sudo /opt/codegate/bin/pip install "inferyx-codegate[saml]"
|
|
55
|
-
sudo ln -sf /opt/codegate/bin/codegate /usr/local/bin/codegate
|
|
53
|
+
sudo python3 -m venv /opt/inferyx-codegate
|
|
54
|
+
sudo /opt/inferyx-codegate/bin/pip install "inferyx-codegate[saml]"
|
|
55
|
+
sudo ln -sf /opt/inferyx-codegate/bin/inferyx-codegate /usr/local/bin/inferyx-codegate
|
|
56
56
|
|
|
57
57
|
# 2. set everything up (asks for the domain and the default admin's email + password)
|
|
58
|
-
sudo codegate setup
|
|
58
|
+
sudo inferyx-codegate setup
|
|
59
59
|
|
|
60
60
|
# 3. check
|
|
61
|
-
sudo codegate doctor
|
|
61
|
+
sudo inferyx-codegate doctor
|
|
62
62
|
```
|
|
63
63
|
|
|
64
64
|
If installing `[saml]` fails to build `xmlsec`, install `inferyx-codegate` without `[saml]`;
|
|
65
|
-
`codegate setup` then installs the system libraries and the SAML library for you.
|
|
65
|
+
`inferyx-codegate setup` then installs the system libraries and the SAML library for you.
|
|
66
66
|
|
|
67
67
|
Unattended install:
|
|
68
68
|
|
|
69
69
|
```bash
|
|
70
|
-
sudo codegate setup -y --domain code.example.com --admin-email admin@example.com \
|
|
70
|
+
sudo inferyx-codegate setup -y --domain code.example.com --admin-email admin@example.com \
|
|
71
71
|
--admin-password-file /root/admin-pw.txt # omit to generate a password (shown once)
|
|
72
72
|
```
|
|
73
73
|
|
|
@@ -80,19 +80,19 @@ Setup is **safe to run again**: it checks each part and skips what's already in
|
|
|
80
80
|
| Packages | Installs only what's missing: nginx, docker.io, quota, certbot, xmlsec libraries |
|
|
81
81
|
| Docker | Reuses an existing Docker install; builds the workspace image (code-server, Python, AWS CLI) |
|
|
82
82
|
| Default admin | Creates the first admin with password login. Must change a generated password at first login |
|
|
83
|
-
| nginx | Writes **only its own files** (`/etc/nginx/codegate/`, `/etc/nginx/conf.d/codegate-map.conf`). Never edits your existing nginx files (see below) |
|
|
84
|
-
| HTTPS | Runs certbot only for a site CodeGate created itself (`--skip-ssl` to skip) |
|
|
85
|
-
| Host SSH | Adds `/etc/ssh/sshd_config.d/10-codegate.conf` so workspace users can't SSH into the server |
|
|
86
|
-
| Service | systemd service `codegate` plus a daily backup timer |
|
|
83
|
+
| nginx | Writes **only its own files** (`/etc/nginx/inferyx-codegate/`, `/etc/nginx/conf.d/inferyx-codegate-map.conf`). Never edits your existing nginx files (see below) |
|
|
84
|
+
| HTTPS | Runs certbot only for a site Inferyx CodeGate created itself (`--skip-ssl` to skip) |
|
|
85
|
+
| Host SSH | Adds `/etc/ssh/sshd_config.d/10-inferyx-codegate.conf` so workspace users can't SSH into the server |
|
|
86
|
+
| Service | systemd service `inferyx-codegate` plus a daily backup timer |
|
|
87
87
|
| Existing code-server | Detected; you choose keep, stop or disable |
|
|
88
88
|
|
|
89
89
|
### nginx: one manual line
|
|
90
90
|
|
|
91
91
|
If your domain already has an nginx `server { }` block, add this line inside it (the 443
|
|
92
|
-
block), then reload nginx. Setup and `codegate doctor` show the exact file:
|
|
92
|
+
block), then reload nginx. Setup and `inferyx-codegate doctor` show the exact file:
|
|
93
93
|
|
|
94
94
|
```nginx
|
|
95
|
-
include /etc/nginx/codegate/codegate.conf;
|
|
95
|
+
include /etc/nginx/inferyx-codegate/inferyx-codegate.conf;
|
|
96
96
|
```
|
|
97
97
|
|
|
98
98
|
```bash
|
|
@@ -114,7 +114,7 @@ If the domain has no server block, setup creates its own site and you don't need
|
|
|
114
114
|
|
|
115
115
|
1. AWS console → IAM Identity Center → **Applications** → **Add application** →
|
|
116
116
|
*I have an application I want to set up* → **SAML 2.0**.
|
|
117
|
-
2. In CodeGate: **Settings → Login**. Copy the **ACS URL** and **SAML audience** shown there into
|
|
117
|
+
2. In Inferyx CodeGate: **Settings → Login**. Copy the **ACS URL** and **SAML audience** shown there into
|
|
118
118
|
the AWS application ("Manually type your metadata values").
|
|
119
119
|
3. AWS **Attribute mappings**:
|
|
120
120
|
|
|
@@ -149,31 +149,31 @@ Password login and SSO can each be switched off in **Settings → Login**; at le
|
|
|
149
149
|
On the server:
|
|
150
150
|
|
|
151
151
|
```bash
|
|
152
|
-
sudo codegate user passwd <admin-username-or-email> # set a new password (--generate for random)
|
|
153
|
-
sudo codegate user unlock <user>
|
|
154
|
-
sudo codegate auth show
|
|
155
|
-
sudo codegate auth enable password
|
|
152
|
+
sudo inferyx-codegate user passwd <admin-username-or-email> # set a new password (--generate for random)
|
|
153
|
+
sudo inferyx-codegate user unlock <user>
|
|
154
|
+
sudo inferyx-codegate auth show
|
|
155
|
+
sudo inferyx-codegate auth enable password
|
|
156
156
|
```
|
|
157
157
|
|
|
158
158
|
## Day-to-day commands
|
|
159
159
|
|
|
160
160
|
```bash
|
|
161
|
-
sudo codegate status | start | stop | restart | logs -f
|
|
162
|
-
sudo codegate doctor # checks everything, prints fix hints
|
|
163
|
-
sudo codegate user add dev@example.com --plan medium --password
|
|
164
|
-
sudo codegate user set <user> --plan large # CPU/RAM apply live
|
|
165
|
-
sudo codegate user delete <user> --remove-home # home is archived first
|
|
166
|
-
sudo codegate admin add second-admin@example.com
|
|
167
|
-
sudo codegate backup | restore <file>
|
|
161
|
+
sudo inferyx-codegate status | start | stop | restart | logs -f
|
|
162
|
+
sudo inferyx-codegate doctor # checks everything, prints fix hints
|
|
163
|
+
sudo inferyx-codegate user add dev@example.com --plan medium --password
|
|
164
|
+
sudo inferyx-codegate user set <user> --plan large # CPU/RAM apply live
|
|
165
|
+
sudo inferyx-codegate user delete <user> --remove-home # home is archived first
|
|
166
|
+
sudo inferyx-codegate admin add second-admin@example.com
|
|
167
|
+
sudo inferyx-codegate backup | restore <file>
|
|
168
168
|
```
|
|
169
169
|
|
|
170
|
-
Full list: `codegate --help`, and `codegate <command> --help`.
|
|
170
|
+
Full list: `inferyx-codegate --help`, and `inferyx-codegate <command> --help`.
|
|
171
171
|
|
|
172
172
|
## Upgrade
|
|
173
173
|
|
|
174
174
|
```bash
|
|
175
|
-
sudo codegate upgrade --dry-run # show the plan
|
|
176
|
-
sudo codegate upgrade # latest version from PyPI
|
|
175
|
+
sudo inferyx-codegate upgrade --dry-run # show the plan
|
|
176
|
+
sudo inferyx-codegate upgrade # latest version from PyPI
|
|
177
177
|
```
|
|
178
178
|
|
|
179
179
|
Before upgrading, it backs up the database, config and nginx files, plus the installed package.
|
|
@@ -191,18 +191,18 @@ sudo apt install -y quota linux-image-extra-virtual
|
|
|
191
191
|
sudo mount -o remount /
|
|
192
192
|
sudo quotacheck -cum /
|
|
193
193
|
sudo quotaon -v /
|
|
194
|
-
sudo codegate doctor # "Disk quotas on /home" should show ✓
|
|
194
|
+
sudo inferyx-codegate doctor # "Disk quotas on /home" should show ✓
|
|
195
195
|
```
|
|
196
196
|
|
|
197
197
|
## Files
|
|
198
198
|
|
|
199
199
|
| Path | Contents |
|
|
200
200
|
|---|---|
|
|
201
|
-
| `/etc/codegate/codegate.env` | configuration (`codegate config show`) |
|
|
202
|
-
| `/var/lib/codegate/codegate.db` | database: users, sessions, audit log, settings |
|
|
203
|
-
| `/var/lib/codegate/backups/` | daily and pre-upgrade backups |
|
|
204
|
-
| `/var/log/codegate/codegate.log` | service log |
|
|
205
|
-
| `/etc/nginx/codegate/` | generated nginx config |
|
|
201
|
+
| `/etc/inferyx-codegate/inferyx-codegate.env` | configuration (`inferyx-codegate config show`) |
|
|
202
|
+
| `/var/lib/inferyx-codegate/inferyx-codegate.db` | database: users, sessions, audit log, settings |
|
|
203
|
+
| `/var/lib/inferyx-codegate/backups/` | daily and pre-upgrade backups |
|
|
204
|
+
| `/var/log/inferyx-codegate/inferyx-codegate.log` | service log |
|
|
205
|
+
| `/etc/nginx/inferyx-codegate/` | generated nginx config |
|
|
206
206
|
| `/home/<user>` | user files (mounted into their container) |
|
|
207
207
|
|
|
208
208
|
## Good to know
|
|
@@ -211,7 +211,7 @@ sudo codegate doctor # "Disk quotas on /home" should show ✓
|
|
|
211
211
|
- Workspace users can't sign in to the server over SSH; they only get VS Code.
|
|
212
212
|
- **sudo inside a workspace** makes the user root in their container. Only give it to people you
|
|
213
213
|
would trust with the server. Mounting `/home` with `nosuid` adds protection
|
|
214
|
-
(`codegate doctor` checks it).
|
|
214
|
+
(`inferyx-codegate doctor` checks it).
|
|
215
215
|
- The service runs as root (it manages Linux users, Docker and nginx) but listens only on
|
|
216
216
|
127.0.0.1; nginx is the only public entry point.
|
|
217
|
-
- Signing out of CodeGate doesn't sign the user out of the AWS access portal.
|
|
217
|
+
- Signing out of Inferyx CodeGate doesn't sign the user out of the AWS access portal.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# CodeGate
|
|
1
|
+
# Inferyx CodeGate
|
|
2
2
|
|
|
3
3
|
Browser VS Code (code-server) for many users on one Ubuntu server. Each user gets their own
|
|
4
4
|
Docker workspace; admins manage everything from a web portal.
|
|
@@ -24,24 +24,24 @@ https://code.example.com/codeapp/admin/ → admin portal
|
|
|
24
24
|
|
|
25
25
|
```bash
|
|
26
26
|
# 1. install into its own virtual environment
|
|
27
|
-
sudo python3 -m venv /opt/codegate
|
|
28
|
-
sudo /opt/codegate/bin/pip install "inferyx-codegate[saml]"
|
|
29
|
-
sudo ln -sf /opt/codegate/bin/codegate /usr/local/bin/codegate
|
|
27
|
+
sudo python3 -m venv /opt/inferyx-codegate
|
|
28
|
+
sudo /opt/inferyx-codegate/bin/pip install "inferyx-codegate[saml]"
|
|
29
|
+
sudo ln -sf /opt/inferyx-codegate/bin/inferyx-codegate /usr/local/bin/inferyx-codegate
|
|
30
30
|
|
|
31
31
|
# 2. set everything up (asks for the domain and the default admin's email + password)
|
|
32
|
-
sudo codegate setup
|
|
32
|
+
sudo inferyx-codegate setup
|
|
33
33
|
|
|
34
34
|
# 3. check
|
|
35
|
-
sudo codegate doctor
|
|
35
|
+
sudo inferyx-codegate doctor
|
|
36
36
|
```
|
|
37
37
|
|
|
38
38
|
If installing `[saml]` fails to build `xmlsec`, install `inferyx-codegate` without `[saml]`;
|
|
39
|
-
`codegate setup` then installs the system libraries and the SAML library for you.
|
|
39
|
+
`inferyx-codegate setup` then installs the system libraries and the SAML library for you.
|
|
40
40
|
|
|
41
41
|
Unattended install:
|
|
42
42
|
|
|
43
43
|
```bash
|
|
44
|
-
sudo codegate setup -y --domain code.example.com --admin-email admin@example.com \
|
|
44
|
+
sudo inferyx-codegate setup -y --domain code.example.com --admin-email admin@example.com \
|
|
45
45
|
--admin-password-file /root/admin-pw.txt # omit to generate a password (shown once)
|
|
46
46
|
```
|
|
47
47
|
|
|
@@ -54,19 +54,19 @@ Setup is **safe to run again**: it checks each part and skips what's already in
|
|
|
54
54
|
| Packages | Installs only what's missing: nginx, docker.io, quota, certbot, xmlsec libraries |
|
|
55
55
|
| Docker | Reuses an existing Docker install; builds the workspace image (code-server, Python, AWS CLI) |
|
|
56
56
|
| Default admin | Creates the first admin with password login. Must change a generated password at first login |
|
|
57
|
-
| nginx | Writes **only its own files** (`/etc/nginx/codegate/`, `/etc/nginx/conf.d/codegate-map.conf`). Never edits your existing nginx files (see below) |
|
|
58
|
-
| HTTPS | Runs certbot only for a site CodeGate created itself (`--skip-ssl` to skip) |
|
|
59
|
-
| Host SSH | Adds `/etc/ssh/sshd_config.d/10-codegate.conf` so workspace users can't SSH into the server |
|
|
60
|
-
| Service | systemd service `codegate` plus a daily backup timer |
|
|
57
|
+
| nginx | Writes **only its own files** (`/etc/nginx/inferyx-codegate/`, `/etc/nginx/conf.d/inferyx-codegate-map.conf`). Never edits your existing nginx files (see below) |
|
|
58
|
+
| HTTPS | Runs certbot only for a site Inferyx CodeGate created itself (`--skip-ssl` to skip) |
|
|
59
|
+
| Host SSH | Adds `/etc/ssh/sshd_config.d/10-inferyx-codegate.conf` so workspace users can't SSH into the server |
|
|
60
|
+
| Service | systemd service `inferyx-codegate` plus a daily backup timer |
|
|
61
61
|
| Existing code-server | Detected; you choose keep, stop or disable |
|
|
62
62
|
|
|
63
63
|
### nginx: one manual line
|
|
64
64
|
|
|
65
65
|
If your domain already has an nginx `server { }` block, add this line inside it (the 443
|
|
66
|
-
block), then reload nginx. Setup and `codegate doctor` show the exact file:
|
|
66
|
+
block), then reload nginx. Setup and `inferyx-codegate doctor` show the exact file:
|
|
67
67
|
|
|
68
68
|
```nginx
|
|
69
|
-
include /etc/nginx/codegate/codegate.conf;
|
|
69
|
+
include /etc/nginx/inferyx-codegate/inferyx-codegate.conf;
|
|
70
70
|
```
|
|
71
71
|
|
|
72
72
|
```bash
|
|
@@ -88,7 +88,7 @@ If the domain has no server block, setup creates its own site and you don't need
|
|
|
88
88
|
|
|
89
89
|
1. AWS console → IAM Identity Center → **Applications** → **Add application** →
|
|
90
90
|
*I have an application I want to set up* → **SAML 2.0**.
|
|
91
|
-
2. In CodeGate: **Settings → Login**. Copy the **ACS URL** and **SAML audience** shown there into
|
|
91
|
+
2. In Inferyx CodeGate: **Settings → Login**. Copy the **ACS URL** and **SAML audience** shown there into
|
|
92
92
|
the AWS application ("Manually type your metadata values").
|
|
93
93
|
3. AWS **Attribute mappings**:
|
|
94
94
|
|
|
@@ -123,31 +123,31 @@ Password login and SSO can each be switched off in **Settings → Login**; at le
|
|
|
123
123
|
On the server:
|
|
124
124
|
|
|
125
125
|
```bash
|
|
126
|
-
sudo codegate user passwd <admin-username-or-email> # set a new password (--generate for random)
|
|
127
|
-
sudo codegate user unlock <user>
|
|
128
|
-
sudo codegate auth show
|
|
129
|
-
sudo codegate auth enable password
|
|
126
|
+
sudo inferyx-codegate user passwd <admin-username-or-email> # set a new password (--generate for random)
|
|
127
|
+
sudo inferyx-codegate user unlock <user>
|
|
128
|
+
sudo inferyx-codegate auth show
|
|
129
|
+
sudo inferyx-codegate auth enable password
|
|
130
130
|
```
|
|
131
131
|
|
|
132
132
|
## Day-to-day commands
|
|
133
133
|
|
|
134
134
|
```bash
|
|
135
|
-
sudo codegate status | start | stop | restart | logs -f
|
|
136
|
-
sudo codegate doctor # checks everything, prints fix hints
|
|
137
|
-
sudo codegate user add dev@example.com --plan medium --password
|
|
138
|
-
sudo codegate user set <user> --plan large # CPU/RAM apply live
|
|
139
|
-
sudo codegate user delete <user> --remove-home # home is archived first
|
|
140
|
-
sudo codegate admin add second-admin@example.com
|
|
141
|
-
sudo codegate backup | restore <file>
|
|
135
|
+
sudo inferyx-codegate status | start | stop | restart | logs -f
|
|
136
|
+
sudo inferyx-codegate doctor # checks everything, prints fix hints
|
|
137
|
+
sudo inferyx-codegate user add dev@example.com --plan medium --password
|
|
138
|
+
sudo inferyx-codegate user set <user> --plan large # CPU/RAM apply live
|
|
139
|
+
sudo inferyx-codegate user delete <user> --remove-home # home is archived first
|
|
140
|
+
sudo inferyx-codegate admin add second-admin@example.com
|
|
141
|
+
sudo inferyx-codegate backup | restore <file>
|
|
142
142
|
```
|
|
143
143
|
|
|
144
|
-
Full list: `codegate --help`, and `codegate <command> --help`.
|
|
144
|
+
Full list: `inferyx-codegate --help`, and `inferyx-codegate <command> --help`.
|
|
145
145
|
|
|
146
146
|
## Upgrade
|
|
147
147
|
|
|
148
148
|
```bash
|
|
149
|
-
sudo codegate upgrade --dry-run # show the plan
|
|
150
|
-
sudo codegate upgrade # latest version from PyPI
|
|
149
|
+
sudo inferyx-codegate upgrade --dry-run # show the plan
|
|
150
|
+
sudo inferyx-codegate upgrade # latest version from PyPI
|
|
151
151
|
```
|
|
152
152
|
|
|
153
153
|
Before upgrading, it backs up the database, config and nginx files, plus the installed package.
|
|
@@ -165,18 +165,18 @@ sudo apt install -y quota linux-image-extra-virtual
|
|
|
165
165
|
sudo mount -o remount /
|
|
166
166
|
sudo quotacheck -cum /
|
|
167
167
|
sudo quotaon -v /
|
|
168
|
-
sudo codegate doctor # "Disk quotas on /home" should show ✓
|
|
168
|
+
sudo inferyx-codegate doctor # "Disk quotas on /home" should show ✓
|
|
169
169
|
```
|
|
170
170
|
|
|
171
171
|
## Files
|
|
172
172
|
|
|
173
173
|
| Path | Contents |
|
|
174
174
|
|---|---|
|
|
175
|
-
| `/etc/codegate/codegate.env` | configuration (`codegate config show`) |
|
|
176
|
-
| `/var/lib/codegate/codegate.db` | database: users, sessions, audit log, settings |
|
|
177
|
-
| `/var/lib/codegate/backups/` | daily and pre-upgrade backups |
|
|
178
|
-
| `/var/log/codegate/codegate.log` | service log |
|
|
179
|
-
| `/etc/nginx/codegate/` | generated nginx config |
|
|
175
|
+
| `/etc/inferyx-codegate/inferyx-codegate.env` | configuration (`inferyx-codegate config show`) |
|
|
176
|
+
| `/var/lib/inferyx-codegate/inferyx-codegate.db` | database: users, sessions, audit log, settings |
|
|
177
|
+
| `/var/lib/inferyx-codegate/backups/` | daily and pre-upgrade backups |
|
|
178
|
+
| `/var/log/inferyx-codegate/inferyx-codegate.log` | service log |
|
|
179
|
+
| `/etc/nginx/inferyx-codegate/` | generated nginx config |
|
|
180
180
|
| `/home/<user>` | user files (mounted into their container) |
|
|
181
181
|
|
|
182
182
|
## Good to know
|
|
@@ -185,7 +185,7 @@ sudo codegate doctor # "Disk quotas on /home" should show ✓
|
|
|
185
185
|
- Workspace users can't sign in to the server over SSH; they only get VS Code.
|
|
186
186
|
- **sudo inside a workspace** makes the user root in their container. Only give it to people you
|
|
187
187
|
would trust with the server. Mounting `/home` with `nosuid` adds protection
|
|
188
|
-
(`codegate doctor` checks it).
|
|
188
|
+
(`inferyx-codegate doctor` checks it).
|
|
189
189
|
- The service runs as root (it manages Linux users, Docker and nginx) but listens only on
|
|
190
190
|
127.0.0.1; nginx is the only public entry point.
|
|
191
|
-
- Signing out of CodeGate doesn't sign the user out of the AWS access portal.
|
|
191
|
+
- Signing out of Inferyx CodeGate doesn't sign the user out of the AWS access portal.
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "inferyx-codegate"
|
|
7
|
-
version = "
|
|
7
|
+
version = "2.0.1"
|
|
8
8
|
description = "Multi-user browser VS Code (code-server) on one server: password and AWS IAM Identity Center (SSO) login, per-user Docker workspaces and an admin portal."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.10"
|
|
@@ -31,10 +31,10 @@ saml = ["python3-saml>=1.16"]
|
|
|
31
31
|
dev = ["pytest>=8", "python3-saml>=1.16"]
|
|
32
32
|
|
|
33
33
|
[project.scripts]
|
|
34
|
-
codegate = "
|
|
34
|
+
inferyx-codegate = "inferyx_codegate.cli.main:app"
|
|
35
35
|
|
|
36
36
|
[tool.hatch.build.targets.wheel]
|
|
37
|
-
packages = ["src/
|
|
37
|
+
packages = ["src/inferyx_codegate"]
|
|
38
38
|
|
|
39
39
|
[tool.hatch.build.targets.sdist]
|
|
40
|
-
include = ["src/
|
|
40
|
+
include = ["src/inferyx_codegate", "README.md", "pyproject.toml"]
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"""Inferyx CodeGate - browser VS Code with password / AWS SSO login and per-user Docker workspaces."""
|
|
2
|
+
|
|
3
|
+
__version__ = "2.0.1"
|
|
4
|
+
|
|
5
|
+
# pip distribution + CLI command: inferyx-codegate ; Python import package: inferyx_codegate
|
|
6
|
+
PACKAGE_NAME = "inferyx-codegate"
|
|
7
|
+
LEGACY_PACKAGE_NAMES: tuple[str, ...] = ()
|
{inferyx_codegate-1.1.0/src/codegate → inferyx_codegate-2.0.1/src/inferyx_codegate}/api/admin.py
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""Admin API (/api/admin/*). Admin role only; mutating calls need X-CodeGate: 1."""
|
|
1
|
+
"""Admin API (/api/admin/*). Admin role only; mutating calls need X-Inferyx-CodeGate: 1."""
|
|
2
2
|
from __future__ import annotations
|
|
3
3
|
|
|
4
4
|
import json
|
|
@@ -340,7 +340,7 @@ def sso_test(body: SsoTestBody, db: Session = Depends(get_db)):
|
|
|
340
340
|
"""Load the IAM Identity Center metadata (without saving) and show what was found."""
|
|
341
341
|
url = (body.metadata_url or saml.sso_config(db)["metadata_url"]).strip()
|
|
342
342
|
if not saml.saml_available():
|
|
343
|
-
raise ValidationFailed("SAML library is not installed on the server (sudo codegate setup)",
|
|
343
|
+
raise ValidationFailed("SAML library is not installed on the server (sudo inferyx-codegate setup)",
|
|
344
344
|
code="saml_not_installed")
|
|
345
345
|
data = saml.load_metadata(url, use_cache=False)
|
|
346
346
|
idp = data.get("idp", {})
|
{inferyx_codegate-1.1.0/src/codegate → inferyx_codegate-2.0.1/src/inferyx_codegate}/api/deps.py
RENAMED
|
@@ -8,7 +8,7 @@ from ..auth.sessions import resolve_session
|
|
|
8
8
|
from ..db import User, get_db
|
|
9
9
|
from ..errors import Forbidden, Unauthorized
|
|
10
10
|
|
|
11
|
-
CSRF_HEADER = "x-codegate"
|
|
11
|
+
CSRF_HEADER = "x-inferyx-codegate"
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
def current_user(request: Request, db: Session = Depends(get_db)) -> User:
|
|
@@ -27,10 +27,10 @@ def admin_user(request: Request, user: User = Depends(current_user)) -> User:
|
|
|
27
27
|
if not user.is_admin:
|
|
28
28
|
raise Forbidden("Admin access required")
|
|
29
29
|
if request.method not in ("GET", "HEAD", "OPTIONS") and request.headers.get(CSRF_HEADER) != "1":
|
|
30
|
-
raise Forbidden("Missing X-CodeGate header", code="csrf_check_failed")
|
|
30
|
+
raise Forbidden("Missing X-Inferyx-CodeGate header", code="csrf_check_failed")
|
|
31
31
|
return user
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
def csrf(request: Request) -> None:
|
|
35
35
|
if request.headers.get(CSRF_HEADER) != "1":
|
|
36
|
-
raise Forbidden("Missing X-CodeGate header", code="csrf_check_failed")
|
|
36
|
+
raise Forbidden("Missing X-Inferyx-CodeGate header", code="csrf_check_failed")
|
{inferyx_codegate-1.1.0/src/codegate → inferyx_codegate-2.0.1/src/inferyx_codegate}/api/devproxy.py
RENAMED
|
@@ -20,7 +20,7 @@ from ..auth.sessions import resolve_session
|
|
|
20
20
|
from ..db import User, session_scope
|
|
21
21
|
from . import public
|
|
22
22
|
|
|
23
|
-
log = logging.getLogger("
|
|
23
|
+
log = logging.getLogger("inferyx_codegate.devproxy")
|
|
24
24
|
router = APIRouter()
|
|
25
25
|
|
|
26
26
|
HOP = {"connection", "keep-alive", "proxy-authenticate", "proxy-authorization", "te", "trailers",
|
{inferyx_codegate-1.1.0/src/codegate → inferyx_codegate-2.0.1/src/inferyx_codegate}/api/public.py
RENAMED
|
@@ -21,7 +21,7 @@ from ..system import get_system
|
|
|
21
21
|
from .deps import csrf as deps_csrf
|
|
22
22
|
from .deps import current_user
|
|
23
23
|
|
|
24
|
-
log = logging.getLogger("
|
|
24
|
+
log = logging.getLogger("inferyx_codegate.api")
|
|
25
25
|
router = APIRouter()
|
|
26
26
|
|
|
27
27
|
|
|
@@ -286,7 +286,7 @@ def auth_check(username: str, request: Request, db: Session = Depends(get_db)):
|
|
|
286
286
|
user = res[1]
|
|
287
287
|
if not users.can_use_editor(user, username):
|
|
288
288
|
return Response(status_code=403)
|
|
289
|
-
return Response(status_code=200, headers={"X-CodeGate-User": user.username})
|
|
289
|
+
return Response(status_code=200, headers={"X-Inferyx-CodeGate-User": user.username})
|
|
290
290
|
|
|
291
291
|
|
|
292
292
|
# --------------------------------------------------------------- editor fallback
|
|
@@ -16,7 +16,7 @@ from .db import migrate
|
|
|
16
16
|
from .errors import install_handlers
|
|
17
17
|
from .jobs import run_background_jobs
|
|
18
18
|
|
|
19
|
-
log = logging.getLogger("
|
|
19
|
+
log = logging.getLogger("inferyx_codegate")
|
|
20
20
|
|
|
21
21
|
STATIC_ADMIN = Path(__file__).parent / "static" / "admin"
|
|
22
22
|
|
|
@@ -70,14 +70,14 @@ def create_app(*, run_jobs: bool = True) -> FastAPI:
|
|
|
70
70
|
log.info("database migrated v%s -> v%s", old, new)
|
|
71
71
|
stop = asyncio.Event()
|
|
72
72
|
task = asyncio.create_task(run_background_jobs(stop)) if run_jobs else None
|
|
73
|
-
log.info("CodeGate %s started (%s) at %s", __version__, "DEV MODE" if s.dev_mode else "prod",
|
|
73
|
+
log.info("Inferyx CodeGate %s started (%s) at %s", __version__, "DEV MODE" if s.dev_mode else "prod",
|
|
74
74
|
s.public_url)
|
|
75
75
|
yield
|
|
76
76
|
stop.set()
|
|
77
77
|
if task:
|
|
78
78
|
await task
|
|
79
79
|
|
|
80
|
-
app = FastAPI(title="CodeGate", version=__version__, lifespan=lifespan,
|
|
80
|
+
app = FastAPI(title="Inferyx CodeGate", version=__version__, lifespan=lifespan,
|
|
81
81
|
docs_url=f"{s.base_path}/api/docs" if s.dev_mode else None,
|
|
82
82
|
openapi_url=f"{s.base_path}/api/openapi.json" if s.dev_mode else None,
|
|
83
83
|
redoc_url=None)
|
{inferyx_codegate-1.1.0/src/codegate → inferyx_codegate-2.0.1/src/inferyx_codegate}/auth/csrf.py
RENAMED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Double-submit token: a random value in an HttpOnly SameSite=Strict cookie and the
|
|
4
4
|
same value in a hidden form field. Also rejects cross-origin POSTs by Origin header.
|
|
5
|
-
The admin API uses the X-CodeGate header instead (see api/deps.py).
|
|
5
|
+
The admin API uses the X-Inferyx-CodeGate header instead (see api/deps.py).
|
|
6
6
|
"""
|
|
7
7
|
from __future__ import annotations
|
|
8
8
|
|
|
@@ -13,7 +13,7 @@ from fastapi import Request, Response
|
|
|
13
13
|
|
|
14
14
|
from ..config import get_settings
|
|
15
15
|
|
|
16
|
-
COOKIE = "
|
|
16
|
+
COOKIE = "inferyx_codegate_csrf"
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
def get_or_create(request: Request) -> str:
|
{inferyx_codegate-1.1.0/src/codegate → inferyx_codegate-2.0.1/src/inferyx_codegate}/auth/saml.py
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"""SAML 2.0 service provider for AWS IAM Identity Center.
|
|
2
2
|
|
|
3
3
|
Uses python3-saml (OneLogin). Install with ``pip install "inferyx-codegate[saml]"``
|
|
4
|
-
(needs ``libxmlsec1-dev pkg-config``; ``codegate setup`` installs them).
|
|
4
|
+
(needs ``libxmlsec1-dev pkg-config``; ``inferyx-codegate setup`` installs them).
|
|
5
5
|
"""
|
|
6
6
|
from __future__ import annotations
|
|
7
7
|
|
|
@@ -17,7 +17,7 @@ from ..config import get_settings
|
|
|
17
17
|
from ..db import SamlReplay, utcnow
|
|
18
18
|
from ..errors import SSOError
|
|
19
19
|
|
|
20
|
-
log = logging.getLogger("
|
|
20
|
+
log = logging.getLogger("inferyx_codegate.saml")
|
|
21
21
|
|
|
22
22
|
_METADATA_CACHE: dict[str, Any] = {"data": None, "ts": 0.0, "key": None}
|
|
23
23
|
METADATA_TTL = 3600
|
|
@@ -34,7 +34,7 @@ def saml_available() -> bool:
|
|
|
34
34
|
def _require_lib():
|
|
35
35
|
if not saml_available():
|
|
36
36
|
raise SSOError(
|
|
37
|
-
"SAML library not installed. Run: sudo codegate setup (or pip install 'inferyx-codegate[saml]')",
|
|
37
|
+
"SAML library not installed. Run: sudo inferyx-codegate setup (or pip install 'inferyx-codegate[saml]')",
|
|
38
38
|
code="saml_not_installed", status_code=500)
|
|
39
39
|
|
|
40
40
|
|
{inferyx_codegate-1.1.0/src/codegate → inferyx_codegate-2.0.1/src/inferyx_codegate}/cli/auth_cmd.py
RENAMED
|
@@ -134,7 +134,7 @@ def _set_method(method: str, on: bool) -> None:
|
|
|
134
134
|
if not on and not get_setting(db, other):
|
|
135
135
|
die("At least one login method must stay enabled")
|
|
136
136
|
if on and method == "sso" and not saml.sso_configured(db):
|
|
137
|
-
die("Set the SSO metadata URL first: sudo codegate auth sso-url <url>")
|
|
137
|
+
die("Set the SSO metadata URL first: sudo inferyx-codegate auth sso-url <url>")
|
|
138
138
|
set_setting(db, key, on)
|
|
139
139
|
n = 0 if on else end_method_sessions(db, "sso" if method == "sso" else "password")
|
|
140
140
|
audit(db, "settings.update", actor="cli", keys=[key], value=on, sessions_ended=n)
|
|
@@ -165,4 +165,4 @@ def auth_sso_url(url: str = typer.Argument(..., help="IAM Identity Center SAML m
|
|
|
165
165
|
set_setting(db, "saml_idp_metadata_url", url)
|
|
166
166
|
audit(db, "settings.update", actor="cli", keys=["saml_idp_metadata_url"])
|
|
167
167
|
saml.clear_metadata_cache()
|
|
168
|
-
console.print("[green]✓ saved.[/] Enable it with: sudo codegate auth enable sso")
|
|
168
|
+
console.print("[green]✓ saved.[/] Enable it with: sudo inferyx-codegate auth enable sso")
|
|
@@ -15,7 +15,7 @@ from .common import console
|
|
|
15
15
|
def create_backup(include_homes: bool = False, label: str = "manual") -> Path:
|
|
16
16
|
s = get_settings()
|
|
17
17
|
s.backup_dir.mkdir(parents=True, exist_ok=True)
|
|
18
|
-
dest = s.backup_dir / f"codegate-{label}-{utcnow():%Y%m%d-%H%M%S}.tar.gz"
|
|
18
|
+
dest = s.backup_dir / f"inferyx-codegate-{label}-{utcnow():%Y%m%d-%H%M%S}.tar.gz"
|
|
19
19
|
with tarfile.open(dest, "w:gz") as tar:
|
|
20
20
|
# consistent DB snapshot via sqlite backup API
|
|
21
21
|
if s.db_path.exists():
|
|
@@ -31,9 +31,9 @@ def create_backup(include_homes: bool = False, label: str = "manual") -> Path:
|
|
|
31
31
|
conn = sqlite3.connect(snap)
|
|
32
32
|
conn.executescript(data.decode())
|
|
33
33
|
conn.close()
|
|
34
|
-
tar.add(snap, arcname="data/codegate.db")
|
|
34
|
+
tar.add(snap, arcname="data/inferyx-codegate.db")
|
|
35
35
|
snap.unlink()
|
|
36
|
-
for path, arc in ((env_file_path(), "etc/codegate.env"), (s.nginx_dir, "nginx"),
|
|
36
|
+
for path, arc in ((env_file_path(), "etc/inferyx-codegate.env"), (s.nginx_dir, "nginx"),
|
|
37
37
|
(s.etc_dir, "data/etc"), (s.data_dir / "installed.json",
|
|
38
38
|
"data/installed.json")):
|
|
39
39
|
if Path(path).exists():
|
|
@@ -59,7 +59,7 @@ def prune(keep_days: int) -> int:
|
|
|
59
59
|
s = get_settings()
|
|
60
60
|
cutoff = time.time() - keep_days * 86400
|
|
61
61
|
n = 0
|
|
62
|
-
for f in s.backup_dir.glob("codegate-*.tar.gz"):
|
|
62
|
+
for f in s.backup_dir.glob("inferyx-codegate-*.tar.gz"):
|
|
63
63
|
if f.stat().st_mtime < cutoff and "-pre-upgrade-" not in f.name:
|
|
64
64
|
f.unlink()
|
|
65
65
|
n += 1
|
|
@@ -76,8 +76,8 @@ def restore_backup(file: Path, include_homes: bool = False) -> None:
|
|
|
76
76
|
if m.name.startswith("/") or ".." in Path(m.name).parts:
|
|
77
77
|
raise RuntimeError(f"unsafe path in backup: {m.name}")
|
|
78
78
|
mapping = {
|
|
79
|
-
"data/codegate.db": s.db_path,
|
|
80
|
-
"etc/codegate.env": env_file_path(),
|
|
79
|
+
"data/inferyx-codegate.db": s.db_path,
|
|
80
|
+
"etc/inferyx-codegate.env": env_file_path(),
|
|
81
81
|
"data/installed.json": s.data_dir / "installed.json",
|
|
82
82
|
}
|
|
83
83
|
for m in members:
|
{inferyx_codegate-1.1.0/src/codegate → inferyx_codegate-2.0.1/src/inferyx_codegate}/cli/common.py
RENAMED
|
@@ -22,16 +22,16 @@ console = Console()
|
|
|
22
22
|
|
|
23
23
|
def require_root() -> None:
|
|
24
24
|
if os.geteuid() != 0 and not get_settings().dev_mode:
|
|
25
|
-
console.print("[red]✗ This command must be run as root:[/] sudo codegate ...")
|
|
25
|
+
console.print("[red]✗ This command must be run as root:[/] sudo inferyx-codegate ...")
|
|
26
26
|
raise typer.Exit(1)
|
|
27
27
|
|
|
28
28
|
|
|
29
|
-
def
|
|
30
|
-
"""Absolute path of the codegate executable (for systemd units)."""
|
|
31
|
-
exe = shutil.which("codegate")
|
|
29
|
+
def inferyx_codegate_exec() -> str:
|
|
30
|
+
"""Absolute path of the inferyx-codegate executable (for systemd units)."""
|
|
31
|
+
exe = shutil.which("inferyx-codegate")
|
|
32
32
|
if exe:
|
|
33
33
|
return str(Path(exe).resolve())
|
|
34
|
-
return f"{sys.executable} -m
|
|
34
|
+
return f"{sys.executable} -m inferyx_codegate"
|
|
35
35
|
|
|
36
36
|
|
|
37
37
|
def marker_file() -> Path:
|
|
@@ -99,5 +99,5 @@ def die(msg: str, code: int = 1) -> None:
|
|
|
99
99
|
raise typer.Exit(code)
|
|
100
100
|
|
|
101
101
|
|
|
102
|
-
__all__ = ["console", "require_root", "
|
|
102
|
+
__all__ = ["console", "require_root", "inferyx_codegate_exec", "read_marker", "write_marker", "Step",
|
|
103
103
|
"run_steps", "die", "dockerfile_sha", "__version__"]
|