Several schools on one server
One server can run several schools, each its own separate copy: its own address, people,
classes, uploaded files, backups and settings. Nothing is shared between them by itself (a course moves
as a course file; a teacher in two schools has two accounts), and one school's program can't even read
another school's files. The first school on the server (the one install.sh made) stays where it is:
it's the main school.
Once: the addresses. A new school's address can be under your own domain (like
alnoor.schoolstack.me) or the school's (like classroom.alnoor.edu.sa). For addresses under your
domain, add one DNS record where the domain is managed: a record of type A, name *, value
your server's address (the same as the @ record), TTL 300. This "wildcard" record makes every
something.yourdomain reach the server, so each new school's address works at once. A school's own
domain needs its own A record pointing to the server, made by the school.
Add a school: run sudo /opt/schoolstack/bin/schoolstack-add-school and answer: a short name
(small letters, like alnoor; also the name of its running copy), its address (Enter keeps
alnoor.<your domain>), its name in English and in Arabic, the first administrator's name and
email, the time zone and the school's language. In about a minute it prints the address. Then:
- the first administrator gets an email with a link to choose their password (when email is on); otherwise the command shows a temporary password once: give it to them privately, and they choose their own at the first sign-in. They are the school's main administrator: they set the logo in Users: School settings and add the school's people;
- the padlock certificate arrives by itself within a minute once the address points to the server (the command says whether it does yet);
- Sign in with Google starts off. To turn it on, add the school's line
https://<its address>/signin/google/callbackto your Google client (see Sign in with Google), then runsudo /opt/schoolstack/bin/schoolstack-google-setup --school alnoor(it can use the main school's client, so nothing is typed again).
It refuses when the server has too little free memory (a school needs about 300 MB; the rush test used 126 MB at 1,000 students), and a 1 GB server is fine for trying two or three schools; real schools want a bigger server (2 GB or more: Resize in DigitalOcean).
See them all: sudo /opt/schoolstack/bin/schoolstack-schools lists the schools, the main one
first: address, up or down, number of people, space used, last backup. Numbers only, never names,
classes or work.
The same care for every school: schoolstack-update updates them all at once, one after
another, each checked; if one doesn't start, every school goes back to the previous version. Each
school is backed up every night into its own folder (/var/backups/schoolstack-schools/<name>,
14 kept; with Google Drive copies on, into its own folder there too). Each has its own
watch: the same owner gets its emails, and their subject starts with the
school's name; its administrators see its own Users ▸ Server speed.
Move a school to another server: sudo /opt/schoolstack/bin/schoolstack-school-export alnoor
saves one file in /root (its people, classes, work and uploaded files, without this server's
email keys). On the other server, after the usual install, run
sudo /opt/schoolstack/bin/schoolstack-add-school --from <that file> (where <that file> is that file), then point the school's address
to the new server. Remove a school: sudo /opt/schoolstack/bin/schoolstack-remove-school alnoor
asks you to type its short name again, makes a last backup (kept 30 days), then removes its running
copy, site, settings and data.
Where each school's things are: data in /var/lib/schoolstack-schools/<name> (only its own Linux
account, ss-<name>, can open it), settings in /etc/schoolstack/schools/<name>.env (read after
the main schoolstack.env, so the email settings are shared), its web address in
/etc/caddy/schools/<name>.caddy, its running copy schoolstack@<name> (logs:
journalctl -u schoolstack@<name>).
Example: The owner adds the wildcard record at Hostinger once. A new school asks to join:
they run schoolstack-add-school, type alnoor, press Enter for alnoor.schoolstack.me, the
names "Al Noor School" and "مدرسة النور", and the head teacher's email. A minute later the head teacher
gets the email, chooses a password and adds the school's logo and people; schoolstack-schools
shows both schools up.
Related: Installing and updating · Speed and watching · Where the data lives