# Courier Installation Guide

Full reference for installing Courier. If you just want the fastest path to a
first notice, see [`quick-start.md`](quick-start.md) instead -- this guide
covers the same steps in more depth, plus upgrading, uninstalling and
recovery.

Courier ships as a single Windows installer. There is no separate Python
install, no `git clone` and no manual service registration -- Python and every
dependency are bundled, and the installer registers Courier as a Windows
service for you.

Courier is a public beta for everyday notices, and it has only been tried in a
small lab so far. It is not for emergencies: it makes no promise that a notice
reaches or interrupts anyone in time. Try it on one computer, then a few, before
you use it more widely.

---

## Requirements

- **The server:** a 64-bit Windows computer that stays on, normally a Windows
  Server, with administrator rights to install. Python is bundled.
- **The computers that show notices:** Windows computers running the RSJ Agent.
  Courier's installer carries the RSJ Agent installer and hands it to your
  computers, so you do not download it separately. If you already run
  Groundskeeper or Caretaker, the agent is already on your computers and only
  needs enrolling with Courier.
- **Network:** the computers must reach the server on TCP port 8445 (HTTPS).
  Nothing needs to be reachable from the internet. See
  [`network-requirements.md`](network-requirements.md).
- Courier is for Windows computers. It does not reach Macs, Chromebooks,
  phones or tablets.

There is no licence key. For what Courier costs, see the Pricing section of the
[Courier website](https://courier.rsjsoftware.com/#pricing).

---

## What the installer does

`CourierSetup.exe` (built with Inno Setup) will:

- Install Courier to `C:\Program Files\RSJ Software\Courier`
- Register and start the **Courier** Windows service, running as Local Service
  and set to start automatically
- Optionally add a Windows Firewall rule, **Courier (TCP 8445)**, allowing
  inbound TCP 8445. It is ticked by default; untick it if you manage the
  firewall by Group Policy and open the port yourself, scoped to your school's
  computers
- Optionally add a desktop shortcut (off by default)
- Add Start menu entries: **Open Console**, **Open Settings**, **Courier Diagnostics** (a read-only check of why the console will not load), **Stop Service** and **Uninstall Courier**
- Make sure the **RSJ Server Monitor** is installed: a small tray icon on the server that is shared by RSJ products, so a server running more than one has one icon, not one each. It is kept at the newest version and is removed when the last RSJ product that uses it is uninstalled
- Keep everything Courier writes -- accounts, history, settings, logs, the
  certificate -- in `C:\ProgramData\RSJ Software\Courier\Data`, apart from the
  program files

Courier makes its own certificate for HTTPS the first time it starts. There is
no plain-http mode.

---

## Step 1 -- Download

Download the latest `CourierSetup.exe` from the
[Releases page](https://github.com/rsjsoftwareltd/courier-beta/releases). Each
release lists a SHA-256 checksum for the installer. To check your download, run
`Get-FileHash .\CourierSetup.exe` in PowerShell and compare.

That one installer is all you need on the server: the Courier module that the
RSJ Agent runs on each computer is inside it, and your Courier server hands it
to each computer. The two *Source code* links GitHub shows on every release
hold only the repository's README and security policy, not the product.

---

## Step 2 -- Run the installer

Run `CourierSetup.exe` on the server and approve the administrator prompt.

> **Two prompts are normal.** The installer should name **RSJ Software Ltd** as
> its publisher. While that publisher is new, Windows SmartScreen may still show
> "Windows protected your PC" -- click **More info**, check the publisher, then
> **Run anyway**. If the publisher shows as unknown, do not run it.

---

## Step 3 -- Create the first administrator

On the server, choose **Courier -> Open Console** from the Start menu. It opens
`https://localhost:8445`. Your browser will warn that the connection is not
trusted; that is expected, because Courier made the certificate itself. Choose
to continue.

The page offers **Create admin account**. Enter a username, a display name and
a password of at least ten characters, twice. This can only be done on the
server itself, and only while Courier has no accounts. There is no default
password. You are signed in straight away.

After that, people can open the console from other computers on your network at
`https://<server name or address>:8445` and sign in. To limit it to certain
computers, list their addresses under **General Settings -> Access**. Do not
make the console reachable from the internet. The server name or address used
must be one the server knows itself by; a DNS alias is refused.

**If every account is ever lost**, run `Courier.exe --setup-admin` from an
elevated prompt in the program folder
(`C:\Program Files\RSJ Software\Courier`). It is for recovery only, and it
refuses to replace an account that exists.

---

## Step 4 -- Put the RSJ Agent on your computers

In the console, **Agent Settings** (under Configuration), the **Deploy** tab:

1. **Deploy the RSJ Agent.** Enter the server's name as your computers reach it
   and choose **Download deploy script**. The script contains your server's
   connection secret, so keep it private and delete it when you are done.
2. Run it from an elevated Windows PowerShell window on a computer:
   `powershell.exe -ExecutionPolicy Bypass -File .\Deploy-RSJAgent-Courier.ps1`.
   It downloads the RSJ Agent from your Courier server, checks it is exactly
   the build the server holds, installs it and enrols it. If a newer RSJ Agent
   is already there it is kept and only enrolled. Run again on a computer
   already enrolled with this server, it installs nothing.
3. For many computers, add the same script as a Group Policy computer startup
   script (the Deploy tab shows the steps) or run it with your deployment tool.

The deploy script records the certificate your server shows, so the agents know
they are talking to your Courier server.

Already have the RSJ Agent from Groundskeeper or Caretaker? `Enrol-Courier.ps1`
in the Courier program folder adds Courier to it without reinstalling.

The Deploy tab also has **Find computers in Active Directory** (a read-only
search for computers that have no agent yet) and **Deploy selected**, which
pushes the agent over WinRM with a Windows administrator account typed for that
one push; Courier never saves or logs it. WinRM is off by default on Windows 10
and 11 computers, so use the script for those.

---

## Step 5 -- Switch Courier on for a computer

A computer shows notices only once it has the Courier module. On
**Agent Settings**, the **Courier module** tab, tick the computers and choose
**Enable on selected** (or **Enable on all enrolled computers**). The computer
collects the module at its next check-in, about a minute later. **Remove
Courier** on the same tab takes it off again. The agent's other modules are not
touched.

---

## Step 6 -- Send a first notice

See Step 5 of [`quick-start.md`](quick-start.md), or the
[Sending a notice](https://courier.rsjsoftware.com/docs/Sending-a-Notice) page.

---

## Accounts

Under **General Settings -> Users**, administrators add accounts. An
**administrator** sends notices, sees everyone's history and manages users,
templates, the school name and logo, retention, the directory and updates. A
**sender** sees their own history only and can send only to the audiences an
administrator gives them, within limits. Courier will not let you remove the
last administrator. Two-factor sign-in is optional, account by account.

---

## Upgrading

Download the newer `CourierSetup.exe` and run it over the existing install.
It stops the Courier service, replaces the program files and starts it again;
your data folder is not touched. Take a copy of the data folder first, with the
Courier service stopped, as you would before any upgrade.

General Settings -> Updates can also check for a newer version and install it,
and has an automatic option that is off unless you turn it on. Today, with
public releases, running the installer by hand is the way that is documented.
Courier will not install an installer whose checksum does not match the one
published with the release, and will not install an older version than the one
running. See [Updates](https://courier.rsjsoftware.com/docs/Updates).

---

## Backups

Everything is in the one data folder. Courier also backs its database up for
itself every night and can make a password-protected settings file; see
[Backup and Restore](https://courier.rsjsoftware.com/docs/Backup-and-Restore).
To copy the folder by hand: stop the Courier service, copy the whole `Data`
folder somewhere safe (ideally off the server), start the service again.

---

## Uninstalling

Use **Courier -> Uninstall Courier** in the Start menu. It removes the service
and the firewall rule it made, and leaves the data folder in place; delete that
yourself if you want the history gone. The RSJ Agent on your computers is not
removed by uninstalling Courier.

---

## Troubleshooting

- **Console will not open** -- use `https://localhost:8445` on the server. Check
  the **Courier** service is started (`services.msc`). If another program uses
  port 8445, Courier logs "Cannot listen on port" and stops.
- **A computer does not appear under Registered** -- run the deploy script from
  an elevated PowerShell window and check the computer can reach TCP 8445.
- **Logs** are in `C:\ProgramData\RSJ Software\Courier\Data\logs`. General
  Settings -> Logs can also collect a support bundle.

Full list: [Troubleshooting](https://courier.rsjsoftware.com/docs/Troubleshooting)
and [Support bundle](https://courier.rsjsoftware.com/docs/Support-bundle).
