# default server details

Everything needed to deploy **AMS-Shiva** (the tenant application) to a server.

Three guides, for three different jobs:

- **[DEPLOYMENT.md](DEPLOYMENT.md)** — the **first** install on a new server.
- **[UPDATE.md](UPDATE.md)** — every time **after** that, when new code has been
  uploaded and the running site has to pick it up.
- **[../ENVIRONMENTS.md](../ENVIRONMENTS.md)** — how local and live are wired,
  side by side. Read it when the question is "which stack am I on".

| File | What it is |
|---|---|
| `DEPLOYMENT.md` | First install. Read this first. |
| `UPDATE.md` | Updating an already-deployed server. |
| `.env.server.example` | Every setting, documented. Copied to the project root as `.env`. |
| `docker-compose.server.yml` | The stack: api, worker, web, db, cache (+ optional government db, minio). |
| `apache/app-ssl.conf` | Apache vhost template. `deploy.sh` renders it for your domain. |
| `scripts/deploy.sh` | **First install.** Configures, builds, migrates, seeds, starts. |
| `scripts/update.sh` | **Every update after that.** Rebuilds, migrates, restarts, runs the UAT. |
| `scripts/uat.sh` | End-to-end test, including a real login. Read-only. |
| `scripts/seed.sh` | Seed roles/users for one tenant without redeploying. |
| `scripts/printers.sh` | Seed the label printers, then list name / roll / width / code type. |
| `scripts/backup.sh` | Dump both databases + documents + `.env`. |
| `scripts/logs.sh` | Tail a service. |

## The short version

```bash
cd /var/www/encureit.astitvaams.com

# first time
bash "default server details/scripts/deploy.sh"

# after uploading new code (leave .env out of the upload)
sudo bash "default server details/scripts/update.sh"
```

## Two things that are easy to get wrong

**This does not deploy the master.** `master.astitvaams.com` is already running
as its own deployment. This stack only talks to it, over `MASTER_API_URL`.
Running a compose command with `-p ams-master` from this directory starts a
second copy of *this* stack under that name and collides on ports.

**There is no web server in the compose file.** Apache on the host owns
:80/:443 and proxies to loopback ports, exactly as it does for master. A
container binding those ports would fail to start.
