Skip to main content

CodeGate

Browser VS Code (code-server) for many users on one Ubuntu server. Each user gets their own Docker workspace; admins manage everything from a web portal.

  • Login: username/password, and optionally AWS IAM Identity Center (SSO).
  • One container per user, with CPU/RAM/disk limits and its own home folder.
  • Admin portal for users, approvals, resources, sessions, audit log and settings.
https://code.example.com/codeapp/                    → sign in
https://code.example.com/codeapp/editor/<username>/  → that user's VS Code
https://code.example.com/codeapp/admin/              → admin portal

Requirements

  • Ubuntu 24.04 server with root (sudo) access
  • Python 3.10+ (sudo apt install -y python3-pip python3-venv)
  • A DNS name pointing to the server, ports 80 and 443 open
  • Optional: AWS IAM Identity Center, if you want SSO login

Install

# 1. install into its own virtual environment
sudo python3 -m venv /opt/codegate
sudo /opt/codegate/bin/pip install "inferyx-codegate[saml]"
sudo ln -sf /opt/codegate/bin/codegate /usr/local/bin/codegate

# 2. set everything up (asks for the domain and the default admin's email + password)
sudo codegate setup

# 3. check
sudo codegate doctor

If installing [saml] fails to build xmlsec, install inferyx-codegate without [saml]; codegate setup then installs the system libraries and the SAML library for you.

Unattended install:

sudo codegate setup -y --domain code.example.com --admin-email admin@example.com \
  --admin-password-file /root/admin-pw.txt   # omit to generate a password (shown once)

What setup does

Setup is safe to run again: it checks each part and skips what's already in place.

Part What happens
Packages Installs only what's missing: nginx, docker.io, quota, certbot, xmlsec libraries
Docker Reuses an existing Docker install; builds the workspace image (code-server, Python, AWS CLI)
Default admin Creates the first admin with password login. Must change a generated password at first login
nginx Writes only its own files (/etc/nginx/codegate/, /etc/nginx/conf.d/codegate-map.conf). Never edits your existing nginx files (see below)
HTTPS Runs certbot only for a site CodeGate created itself (--skip-ssl to skip)
Host SSH Adds /etc/ssh/sshd_config.d/10-codegate.conf so workspace users can't SSH into the server
Service systemd service codegate plus a daily backup timer
Existing code-server Detected; you choose keep, stop or disable

nginx: one manual line

If your domain already has an nginx server { } block, add this line inside it (the 443 block), then reload nginx. Setup and codegate doctor show the exact file:

include /etc/nginx/codegate/codegate.conf;
sudo nginx -t && sudo systemctl reload nginx

If the domain has no server block, setup creates its own site and you don't need this step.

First sign-in

  1. Open https://<your-domain>/codeapp/ and sign in as the default admin.
  2. Change the password when asked.
  3. Users → Add user: enter the email, set a temporary password (or Generate), choose a plan. The user's Linux account, home folder, container and route are created automatically.
  4. Give the user their temporary password over a secure channel. They must change it at first sign-in, then VS Code opens.

AWS SSO login (optional)

  1. AWS console → IAM Identity Center → Applications → Add application → I have an application I want to set up → SAML 2.0.

  2. In CodeGate: Settings → Login. Copy the ACS URL and SAML audience shown there into the AWS application ("Manually type your metadata values").

  3. AWS Attribute mappings:

    User attribute in the application Maps to Format
    Subject ${user:email} emailAddress
    email ${user:email} unspecified
    name (optional) ${user:name} unspecified
  4. Copy the IAM Identity Center SAML metadata file URL from AWS into SAML metadata URL, click Test metadata, switch on AWS SSO login, and Save.

  5. In AWS, assign users or groups to the application. New SSO users wait as pending until an admin approves them, unless their email domain is on the auto-approve list.

Password login and SSO can each be switched off in Settings → Login; at least one stays on.

Login security

  • Passwords are stored only as salted scrypt hashes. Rules: at least 12 characters, 3 of lowercase / uppercase / digit / symbol, not containing the username or email.
  • After 5 failed attempts an account is locked for 15 minutes (adjustable); admins can unlock it from the user page. Attempts are also rate-limited per IP address.
  • Sessions use a random token in an HttpOnly, Secure cookie; only its hash is stored. A new token is issued at every sign-in and password change. Session length and idle timeout are in Settings.
  • Changing or resetting a password ends the user's other sessions. Turning a login method off ends the sessions that used it.
  • Sign-in, sign-out and password forms are protected against cross-site requests.

Locked out of the web portal?

On the server:

sudo codegate user passwd <admin-username-or-email>   # set a new password (--generate for random)
sudo codegate user unlock <user>
sudo codegate auth show
sudo codegate auth enable password

Day-to-day commands

sudo codegate status | start | stop | restart | logs -f
sudo codegate doctor                                 # checks everything, prints fix hints
sudo codegate user add dev@example.com --plan medium --password
sudo codegate user set <user> --plan large           # CPU/RAM apply live
sudo codegate user delete <user> --remove-home       # home is archived first
sudo codegate admin add second-admin@example.com
sudo codegate backup | restore <file>

Full list: codegate --help, and codegate <command> --help.

Upgrade

sudo codegate upgrade --dry-run    # show the plan
sudo codegate upgrade              # latest version from PyPI

Before upgrading, it backs up the database, config and nginx files, plus the installed package. After installing, it runs migrations, refreshes nginx routes and restarts the service. If any step fails, the previous version is restored automatically.

Disk limits

Without Linux disk quotas, limits are monitored every 5 minutes and a workspace over its limit is stopped. For hard limits, enable quotas on the /home filesystem (maintenance window):

sudo apt install -y quota linux-image-extra-virtual
# add usrquota to the /home (or /) line in /etc/fstab, then:
sudo mount -o remount /
sudo quotacheck -cum /
sudo quotaon -v /
sudo codegate doctor               # "Disk quotas on /home" should show ✓

Files

Path Contents
/etc/codegate/codegate.env configuration (codegate config show)
/var/lib/codegate/codegate.db database: users, sessions, audit log, settings
/var/lib/codegate/backups/ daily and pre-upgrade backups
/var/log/codegate/codegate.log service log
/etc/nginx/codegate/ generated nginx config
/home/<user> user files (mounted into their container)

Good to know

  • Admins can't open other users' VS Code.
  • Workspace users can't sign in to the server over SSH; they only get VS Code.
  • sudo inside a workspace makes the user root in their container. Only give it to people you would trust with the server. Mounting /home with nosuid adds protection (codegate doctor checks it).
  • The service runs as root (it manages Linux users, Docker and nginx) but listens only on 127.0.0.1; nginx is the only public entry point.
  • Signing out of CodeGate doesn't sign the user out of the AWS access portal.

Metadata

Release files for inferyx-codegate 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for inferyx-codegate 1.1.0
File Size Uploaded Provenance Actions
inferyx_codegate-1.1.0.tar.gz 662.9 kB Without provenance Details for inferyx_codegate-1.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for inferyx-codegate 1.1.0
File Interpreter ABI Platform Actions
inferyx_codegate-1.1.0-py3-none-any.whl Python 3 none any Details for inferyx_codegate-1.1.0-py3-none-any.whl

Total release size: 1.4 MB

Release files / inferyx_codegate-1.1.0.tar.gz

Download URL inferyx_codegate-1.1.0.tar.gz
Size 662.9 kB
Tags Source
SHA-256 checksum
How to use checksums
415518a2623f4dbb86e184a7433744d48d35a95ec709a47e36022c60aaa8efb3
BLAKE2b-256 checksum
How to use checksums
cb73a5f2ff5f6ea9116b46937240ce5e8ecb18b96c21dece839903c70b74d7c8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.15.2

Release files / inferyx_codegate-1.1.0-py3-none-any.whl

Download URL inferyx_codegate-1.1.0-py3-none-any.whl
Size 692.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4af96240c5e4e1e6574e433e724449e2788abc154d5f97de43850550a8415779
BLAKE2b-256 checksum
How to use checksums
28d1b5202623fbe5dd43bcc2342cece1df1c85bd93e95aa4ced643367cd1794c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.15.2

Security for inferyx-codegate 1.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page