Install Code as Usual
This is the first page for a new installation. It takes an installation administrator from a verified release archive to the first HTTPS login.
Who can do this: a Linux administrator with
sudoaccess to the target host and administrative access to DNS, TLS and PostgreSQL.
Result
When the procedure is complete:
- Code as Usual runs as the unprivileged
code-as-usualLinux account; - the application listens only on host loopback;
- the public application and private previews are reached through HTTPS;
- the first workspace administrator can sign in and enroll MFA; and
- this exact documentation release is available at
/docs/without internet access.
What the release includes
The release contains the private Java runtime, application artifacts, OCI images, database migrations, Windows connector and this documentation site. Do not install Java, Maven or Node on the host for Code as Usual.
The installer deliberately does not upgrade the operating system, format or mount a disk, alter DNS or firewall rules, request certificates, or enable a reverse-proxy site without the administrator reviewing that boundary.
The guided configuration records an installation default and ceiling for each
environment’s memory. The reviewed defaults are 1024 MiB and 4096 MiB. They
become the outer boundary for workspace policy; they do not reserve that amount
of host memory in advance. Advanced installations may set
CODE_AS_USUAL_ENVIRONMENT_MEMORY_DEFAULT_BYTES and
CODE_AS_USUAL_ENVIRONMENT_MEMORY_MAX_BYTES in web.env. Both are byte values,
must be at least 16 MiB, and the default must not exceed the maximum. Choose a
ceiling that accounts for the host’s memory and the number of environments
allowed to run concurrently.
The guided configuration also records a default and ceiling for Linux tasks
(processes and threads) per environment. The reviewed values are 1024 and
4096. Advanced installations may set
CODE_AS_USUAL_ENVIRONMENT_PROCESS_DEFAULT and
CODE_AS_USUAL_ENVIRONMENT_PROCESS_MAX; both must be whole numbers of at least
8 and the default must not exceed the maximum. These are Podman PIDs limits,
and JVM threads count toward them. Choose the ceiling with the host’s process
capacity and the maximum number of concurrent environments in mind.
1. Prepare the host
The supported first-installation shape is:
- supported Ubuntu x86-64 with systemd and cgroups v2;
- rootless Podman under a dedicated
code-as-usualaccount; - PostgreSQL reachable from the host;
- an existing persistent-data directory, preferably a dedicated filesystem;
- Apache or another reverse proxy terminating HTTPS;
- one application hostname and a wildcard private-preview domain.
Install only missing host components. Simulate the Ubuntu change first:
sudo apt-get update
sudo apt-get -s install podman postgresql-client apache2 \
curl openssl tar coreutils util-linux iproute2
Review the proposal, then remove -s to install the accepted packages. A
local PostgreSQL server additionally needs the postgresql package. The
application does not require Apache when an existing reverse proxy provides
the same HTTP and WebSocket contract.
Create the dedicated account if it does not already exist:
sudo useradd --create-home --shell /bin/bash code-as-usual
sudo loginctl enable-linger code-as-usual
sudo -iu code-as-usual podman info --format '{{.Host.Security.Rootless}}'
The last command must print true.
2. Prepare persistent storage
The recommended data root is a separately mounted filesystem at:
/srv/code-as-usual
Verify the actual filesystem before changing ownership:
findmnt -T /srv/code-as-usual
sudo chown code-as-usual:code-as-usual /srv/code-as-usual
sudo chmod 0700 /srv/code-as-usual
For a limited internal evaluation, the directory may share the operating system filesystem after the installer warning is explicitly accepted. Do not describe that layout as production storage. See Production storage.
3. Verify the release
Download both files from the same release:
code-as-usual-VERSION.tar.gz
code-as-usual-VERSION.tar.gz.sha256
Then verify and extract them in a directory readable by the application account:
cd /var/tmp
sha256sum --check code-as-usual-VERSION.tar.gz.sha256
tar -xzf code-as-usual-VERSION.tar.gz
cd code-as-usual-VERSION
./code-as-usual doctor
The checksum must report OK. Stop if it does not. The doctor is read-only;
resolve every INCOMPATIBLE result before continuing.
4. Prepare PostgreSQL
For a default local Ubuntu PostgreSQL installation, prepare the database through its local administrator socket:
sudo -u postgres /var/tmp/code-as-usual-VERSION/code-as-usual database setup \
--host /var/run/postgresql --admin-user postgres
Choose and retain two different passwords:
code_as_usual_owneris used only for schema installation and migration.code_as_usual_appis the restricted account used by the running service.
Store the owner password in the installation owner’s password manager. The application does not retain it. For external PostgreSQL, the guided installer can perform the same preparation when the database administrator uses normal password authentication.
5. Run the guided installer
Switch to the dedicated account and run the release you just verified:
sudo -iu code-as-usual
cd /var/tmp/code-as-usual-VERSION
./code-as-usual install
The guide checks the host again, asks one question at a time and shows one complete plan before writing. Important answers are:
- the real public HTTPS application URL, for example
https://dev.example.com; - the preview base URL, for example
https://preview.dev.example.com; /srv/code-as-usualas persistent data root;- the prepared PostgreSQL database and its two role passwords; and
- whether private tool logins in an environment survive runtime replacement.
The application URL and preview base are different. Entering
https://preview.dev.example.com as the application URL would make the guide
propose the incorrect preview.preview.dev.example.com preview domain.
The installer creates the first workspace administrator at the end. If it is interrupted after private configuration exists, do not delete anything; use:
./code-as-usual install --resume
6. Configure DNS and TLS
Create DNS records pointing to the server for:
dev.example.com
preview.dev.example.com
*.preview.dev.example.com
Obtain a certificate for the application hostname and a certificate covering
both the preview base and wildcard. DNS providers normally ask for the wildcard
record as *.preview.dev; the exact editor syntax is provider-specific.
7. Generate and enable the reverse proxy
As code-as-usual, generate reviewable Apache configuration from the installed
environment file:
~/.local/lib/code-as-usual/current/tools/render-apache-app-vhost.sh \
--environment "$HOME/.config/code-as-usual/web.env" \
--certificate /etc/letsencrypt/live/CERTIFICATE/fullchain.pem \
--private-key /etc/letsencrypt/live/CERTIFICATE/privkey.pem
~/.local/lib/code-as-usual/current/tools/render-apache-preview-vhost.sh \
--environment "$HOME/.config/code-as-usual/web.env" \
--certificate /etc/letsencrypt/live/CERTIFICATE/fullchain.pem \
--private-key /etc/letsencrypt/live/CERTIFICATE/privkey.pem
Exit the application account, copy the generated files to Apache, enable the required modules and sites, then validate before reload:
sudo a2enmod ssl proxy proxy_http headers
sudo cp /home/code-as-usual/.config/code-as-usual/generated/code-as-usual-app-apache.conf \
/etc/apache2/sites-available/code-as-usual-app.conf
sudo cp /home/code-as-usual/.config/code-as-usual/generated/code-as-usual-preview-apache.conf \
/etc/apache2/sites-available/code-as-usual-preview.conf
sudo a2ensite code-as-usual-app.conf code-as-usual-preview.conf
sudo apache2ctl configtest
sudo systemctl reload apache2
Run the reload only after Syntax OK. The filenames do not determine the
hostname; Apache selects the virtual host through ServerName inside the
generated file. Ports 8070–8072 remain on loopback and must not be exposed
publicly.
8. Verify and sign in
Check the service and local endpoint as the application account:
systemctl --user --no-pager status code-as-usual-web.service
curl --fail --show-error http://127.0.0.1:8070/login
Then open the public HTTPS URL, sign in with the first administrator and enroll the authenticator app by scanning the QR code.
Continue with First sign-in and workspace setup.
What the installer will not do
It never runs a general system upgrade, replaces shared Java, PostgreSQL or Apache installations, mounts a disk, changes the firewall or DNS, requests a certificate, or enables and reloads Apache on its own. Those remain visible server-owner decisions.