This commit is contained in:
+17
-17
@@ -1,7 +1,7 @@
|
|||||||
# Running computer
|
# Running Superbrain
|
||||||
|
|
||||||
This guide takes you from cloning the repository to signing in on your own
|
This guide takes you from cloning the repository to signing in on your own
|
||||||
computer. Docker runs the web app, Go API, and PostgreSQL database together.
|
Superbrain instance. Docker runs the web app, Go API, and PostgreSQL database together.
|
||||||
You do not need to install Go, Node.js, PostgreSQL, Make, or OpenSSL separately.
|
You do not need to install Go, Node.js, PostgreSQL, Make, or OpenSSL separately.
|
||||||
|
|
||||||
## Before you start
|
## Before you start
|
||||||
@@ -26,8 +26,8 @@ Both commands should succeed. On Windows, Docker must be using Linux containers.
|
|||||||
## 1. Download the app
|
## 1. Download the app
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
git clone https://github.com/andrewthecodertx/computer.git
|
git clone https://github.com/andrewthecodertx/superbrain.git
|
||||||
cd computer
|
cd superbrain
|
||||||
```
|
```
|
||||||
|
|
||||||
If you downloaded a ZIP, open a terminal in the extracted folder instead.
|
If you downloaded a ZIP, open a terminal in the extracted folder instead.
|
||||||
@@ -67,11 +67,11 @@ For a new local installation, keep these other settings:
|
|||||||
NEXTAUTH_URL=http://localhost:3000
|
NEXTAUTH_URL=http://localhost:3000
|
||||||
COOKIE_SECURE=0
|
COOKIE_SECURE=0
|
||||||
ADMIN_EMAILS=
|
ADMIN_EMAILS=
|
||||||
POSTGRES_VOLUME=computer_pgdata
|
POSTGRES_VOLUME=superbrain_pgdata
|
||||||
POSTGRES_VOLUME_EXTERNAL=false
|
POSTGRES_VOLUME_EXTERNAL=false
|
||||||
```
|
```
|
||||||
|
|
||||||
The supplied `POSTGRES_PASSWORD=computer` works with the bundled database.
|
The supplied `POSTGRES_PASSWORD=superbrain` works with the bundled database.
|
||||||
If you choose a different password, set it before the first startup; use a
|
If you choose a different password, set it before the first startup; use a
|
||||||
random hexadecimal value to avoid special characters in the connection URL.
|
random hexadecimal value to avoid special characters in the connection URL.
|
||||||
Keep the `OIDC_*` placeholders as supplied: use email/password login for now.
|
Keep the `OIDC_*` placeholders as supplied: use email/password login for now.
|
||||||
@@ -137,7 +137,7 @@ Addresses listed in `ADMIN_EMAILS` are reserved and cannot be claimed through
|
|||||||
public signup. To create an account for one of those addresses, use the
|
public signup. To create an account for one of those addresses, use the
|
||||||
operator-provisioning command in [README.md](README.md#developer-commands).
|
operator-provisioning command in [README.md](README.md#developer-commands).
|
||||||
|
|
||||||
The default setup is accessible only from this computer. Public bookmark
|
The default setup is accessible only from this superbrain. Public bookmark
|
||||||
links are also local until you configure externally accessible hosting.
|
links are also local until you configure externally accessible hosting.
|
||||||
|
|
||||||
### What to test
|
### What to test
|
||||||
@@ -180,7 +180,7 @@ environment variables.
|
|||||||
### Where your data lives
|
### Where your data lives
|
||||||
|
|
||||||
Bookmarks, accounts, pages, and settings live in the Docker PostgreSQL volume
|
Bookmarks, accounts, pages, and settings live in the Docker PostgreSQL volume
|
||||||
named `computer_pgdata` by default. They survive normal stops, container
|
named `superbrain_pgdata` by default. They survive normal stops, container
|
||||||
recreation, and image rebuilds.
|
recreation, and image rebuilds.
|
||||||
|
|
||||||
**Do not use `docker compose down -v` or delete that volume if you want to
|
**Do not use `docker compose down -v` or delete that volume if you want to
|
||||||
@@ -192,7 +192,7 @@ Take dumps with the database running (review OPS-03: a dump is only a backup
|
|||||||
once a restore from it has been proven):
|
once a restore from it has been proven):
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
docker compose exec -T db pg_dump -U computer -d computer | gzip > computer-$(date -u +%Y%m%d).sql.gz
|
docker compose exec -T db pg_dump -U superbrain -d superbrain | gzip > superbrain-$(date -u +%Y%m%d).sql.gz
|
||||||
cp .env env-$(date -u +%Y%m%d).bak # AUTH_SECRET / ENCRYPTION_KEY / POSTGRES_PASSWORD
|
cp .env env-$(date -u +%Y%m%d).bak # AUTH_SECRET / ENCRYPTION_KEY / POSTGRES_PASSWORD
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -201,19 +201,19 @@ stored IMAP passwords are AES-GCM ciphertext, and without the secret they
|
|||||||
were encrypted under, a restored database cannot decrypt them. The
|
were encrypted under, a restored database cannot decrypt them. The
|
||||||
deployment entry point (`scripts/deploy.sh`, which runs
|
deployment entry point (`scripts/deploy.sh`, which runs
|
||||||
`scripts/server-deploy.sh` on the server) does this automatically before every
|
`scripts/server-deploy.sh` on the server) does this automatically before every
|
||||||
deploy into `/var/backups/computer` (0600 dumps, 15 retained); it starts a
|
deploy into `/var/backups/superbrain` (0600 dumps, 15 retained); it starts a
|
||||||
stopped database rather than skipping the backup silently.
|
stopped database rather than skipping the backup silently.
|
||||||
|
|
||||||
Restore into an isolated environment first to verify a dump before trusting
|
Restore into an isolated environment first to verify a dump before trusting
|
||||||
it. Use a separate checkout (or stop the live stack first) and a scratch
|
it. Use a separate checkout (or stop the live stack first) and a scratch
|
||||||
volume so the live `computer_pgdata` volume is never touched:
|
volume so the live `superbrain_pgdata` volume is never touched:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
POSTGRES_VOLUME=computer_restore docker compose up -d db
|
POSTGRES_VOLUME=superbrain_restore docker compose up -d db
|
||||||
gunzip -c computer-YYYYMMDD.sql.gz | docker compose exec -T db psql -U computer -d computer
|
gunzip -c superbrain-YYYYMMDD.sql.gz | docker compose exec -T db psql -U superbrain -d superbrain
|
||||||
# inspect the restored data, then remove the scratch container and volume
|
# inspect the restored data, then remove the scratch container and volume
|
||||||
docker compose rm -sf db
|
docker compose rm -sf db
|
||||||
docker volume rm computer_restore
|
docker volume rm superbrain_restore
|
||||||
```
|
```
|
||||||
|
|
||||||
Then restore the matching `.env` so the secrets can decrypt integration
|
Then restore the matching `.env` so the secrets can decrypt integration
|
||||||
@@ -363,15 +363,15 @@ pointing at it, and `rsync` + `git` on your workstation. Then, from the
|
|||||||
repository root:
|
repository root:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
HOST=app-server DOMAIN=computer.example.tld CERTBOT_EMAIL=ops@example.tld ./scripts/deploy.sh
|
HOST=app-server DOMAIN=superbrain.example.tld CERTBOT_EMAIL=ops@example.tld ./scripts/deploy.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
The script deploys a **known git revision** (dirty working trees are refused
|
The script deploys a **known git revision** (dirty working trees are refused
|
||||||
unless `ALLOW_DIRTY=1`) and on the server provisions Docker/nginx/certbot,
|
unless `ALLOW_DIRTY=1`) and on the server provisions Docker/nginx/certbot,
|
||||||
writes `.env` on first deploy, takes a pre-deploy database dump plus `.env`
|
writes `.env` on first deploy, takes a pre-deploy database dump plus `.env`
|
||||||
snapshot into `/var/backups/computer` (0600, 15 retained), builds
|
snapshot into `/var/backups/superbrain` (0600, 15 retained), builds
|
||||||
revision-tagged images, renders the nginx + Let's Encrypt proxy from
|
revision-tagged images, renders the nginx + Let's Encrypt proxy from
|
||||||
`deploy/nginx/computer.conf.template`, and verifies `https://DOMAIN/login`
|
`deploy/nginx/superbrain.conf.template`, and verifies `https://DOMAIN/login`
|
||||||
end to end.
|
end to end.
|
||||||
|
|
||||||
Rollback: re-deploy an older revision (`git checkout <rev> && ./scripts/deploy.sh`),
|
Rollback: re-deploy an older revision (`git checkout <rev> && ./scripts/deploy.sh`),
|
||||||
|
|||||||
Reference in New Issue
Block a user