Lesson 4 of 7
Deploy and manage remote access
Status: Draft
Purpose
Deploy the tested caster to an isolated Linux host. Operate it as a managed service through approved SSH access on a trusted network or VPN.
Learning objectives
After this lesson, you can:
- Prepare the Linux host and service account.
- Transfer the application without transferring live configuration.
- Install the runtime on the target host.
- Create and manage the
systemdservice. - Inspect redacted logs and perform a safe rollback.
Prerequisites
Complete Lessons 1 to 3. The local tests must pass. An instructor must approve the host, remote-access method, and sanitised configuration.
Key terms
- SSH: A secure remote shell and file-transfer channel.
- VPN: A protected network path between approved systems.
- Service account: The operating-system user that runs the caster.
- systemd: The Linux service manager used by this project guide.
- Working directory: The directory from which the service runs.
- Rollback: A controlled return to the previous known state.
Concept explanation
Deployment boundary
The supplied Windows deployment helper uses tar, scp, and ssh. It copies application files to ~/ntrip_caster. It excludes YAML files, documentation, virtual environments, caches, and Git data. It does not install dependencies or restart the application.
This behaviour protects site configuration from accidental replacement. It also means the operator must prepare the runtime and configuration on the target.
Remote access boundary
Use SSH only through the approved network or VPN. Do not expose the caster or monitor directly to the public internet. Record hostnames and account names as placeholders in learner evidence.
Serial permission
On Linux, use a stable receiver path under /dev/serial/by-id/ when available. The service account normally needs access through the dialout group. A group change normally requires a new login session or reboot before it takes effect.
Service behaviour
The service runs start_ntrip_caster from the project directory. It starts after the network becomes available. It restarts after a failure. The service log must confirm fixed or survey-in receiver mode before the stream is treated as ready.
Worked demonstration
From an approved Windows workstation, the instructor runs:
.\_scripts\windows\deploy.ps1 -Target <user>@<host>
Expected result: application files are copied to ~/ntrip_caster. YAML files are not replaced. Dependencies are not installed. The service is not restarted.
On the Linux host, the instructor then prepares the environment:
cd ~/ntrip_caster
python3 -m venv .venv
.venv/bin/python -m pip install -r requirements.txt
chmod +x start_ntrip_caster
The instructor reviews the service definition from the project overview before placing it in /etc/systemd/system/ntrip-caster.service.
After approval:
sudo systemctl daemon-reload
sudo systemctl enable --now ntrip-caster.service
systemctl status ntrip-caster.service
journalctl -u ntrip-caster.service -f
Expected result: the service is active and the log confirms the selected receiver mode.
Guided practice
- Confirm the target is the isolated course host.
- Record the current application version and service state.
- Run the deployment helper with placeholder evidence.
- Confirm that the target configuration was not replaced.
- Create or update the target virtual environment.
- Review the service account and serial permission.
- Review the service definition before installation.
- Reload
systemdand start the service. - Check service status and receiver-mode logs.
- Stop and start the service once.
Expected result: the service is controllable and uses the intended project and configuration.
Independent practice
Perform a controlled update and rollback in the assessment host snapshot. Keep the previous application directory or host snapshot until the new service has passed its checks.
Checks for understanding
- Which files does the deployment helper exclude?
- Does the helper install dependencies or restart the service?
- Why should the receiver use a stable serial path?
- Which log result confirms the selected receiver mode?
- What must be retained before a controlled update?
Assessment and evidence
Deploy to the isolated host and demonstrate:
- successful transfer
- correct runtime preparation
- reviewed service definition
- active service status
- redacted receiver-mode log
- controlled stop, start, and rollback plan
Troubleshooting guidance
| Symptom | First check |
|---|---|
| SSH connection fails. | Check the approved network or VPN, hostname, and account. |
| Transfer script stops. | Check tar, scp, and ssh on the workstation. |
| Service cannot find Python. | Check the project path and .venv/bin/python. |
| Service cannot open the receiver. | Check stable device path and service-user permissions. |
| Service restarts repeatedly. | Read the first configuration or receiver error in the journal. |
| New version fails. | Stop the service and restore the retained prior state. |
Summary
Deployment copies application code but protects target configuration. Prepare the target runtime separately. Use a reviewed systemd service, approved remote access, stable serial permissions, and a tested rollback path.
Source references
SRC-PROJECT-OVERVIEW: Linux environment, service, log, and permission proceduresSRC-PROJECT-CODE: deployment helper and start-script behaviour