feat: update Docker setup and documentation for PostgreSQL integration
This commit is contained in:
1 parent
f56eac28f7
commit
14a7348632
7 files changed
+46
-130
No files matched your search
+17
-26
@@ -9,12 +9,12 @@ A collaborative table management server built with Node.js, Express, TypeScript,
|
||||
- PostgreSQL (pg) database backend
|
||||
- Single-admin-account web dashboard login (session cookie, bcrypt-hashed password) plus a
|
||||
long-lived API token for sync clients/devices, generated from the dashboard
|
||||
- Dockerized deployment with persistent storage
|
||||
- Dockerized deployment (bring your own PostgreSQL instance)
|
||||
- TypeScript for type safety
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Docker and Docker Compose
|
||||
- Docker and a PostgreSQL instance (bring your own - this app does not run Postgres for you)
|
||||
- Or Node.js 20+ and a PostgreSQL instance (for local development)
|
||||
|
||||
## Quick Start with Docker
|
||||
@@ -25,14 +25,18 @@ A collaborative table management server built with Node.js, Express, TypeScript,
|
||||
cd CollabTableServer
|
||||
```
|
||||
|
||||
3. Copy the example environment file:
|
||||
3. Build the image:
|
||||
```bash
|
||||
cp .env.example .env
|
||||
docker build -t collabtable-server .
|
||||
```
|
||||
|
||||
4. Start the services (this also starts a bundled PostgreSQL container):
|
||||
4. Run it, pointing at your own Postgres instance:
|
||||
```bash
|
||||
docker-compose up -d
|
||||
docker run -d --name collabtable-server --restart unless-stopped \
|
||||
-p 3000:3000 \
|
||||
-e DATABASE_URL=postgres://user:password@host:5432/collabtable \
|
||||
-e COOKIE_SECURE=false \
|
||||
collabtable-server
|
||||
```
|
||||
|
||||
The server will be available at `http://localhost:3000`. Open it in a browser to create the
|
||||
@@ -53,12 +57,6 @@ admin account, then generate an API token from the dashboard for your sync clien
|
||||
3. Point it at a PostgreSQL instance in `.env`:
|
||||
```
|
||||
DATABASE_URL=postgres://user:password@localhost:5432/collabtable
|
||||
# OR, as discrete variables:
|
||||
# PGHOST=localhost
|
||||
# PGPORT=5432
|
||||
# PGUSER=postgres
|
||||
# PGPASSWORD=yourpassword
|
||||
# PGDATABASE=collabtable
|
||||
|
||||
# Set to "true" once served over HTTPS
|
||||
COOKIE_SECURE=false
|
||||
@@ -199,24 +197,19 @@ npm start
|
||||
|
||||
## Docker Commands
|
||||
|
||||
Start services:
|
||||
Stop the container:
|
||||
```bash
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
Stop services:
|
||||
```bash
|
||||
docker-compose down
|
||||
docker stop collabtable-server
|
||||
```
|
||||
|
||||
View logs:
|
||||
```bash
|
||||
docker-compose logs -f
|
||||
docker logs -f collabtable-server
|
||||
```
|
||||
|
||||
Rebuild and restart:
|
||||
```bash
|
||||
docker-compose up -d --build
|
||||
docker build -t collabtable-server . && docker restart collabtable-server
|
||||
```
|
||||
|
||||
## Environment Variables
|
||||
@@ -224,8 +217,7 @@ docker-compose up -d --build
|
||||
- `PORT` - Server port (default: 3000)
|
||||
- `NODE_ENV` - Environment (development/production)
|
||||
- `COOKIE_SECURE` - Set to `true` to mark the admin session cookie `Secure` (requires HTTPS); default `false`
|
||||
- `DATABASE_URL` - PostgreSQL connection URL (optional alternative to PG* variables)
|
||||
- `PGHOST`, `PGPORT`, `PGUSER`, `PGPASSWORD`, `PGDATABASE` - PostgreSQL connection parameters
|
||||
- `DATABASE_URL` - PostgreSQL connection URL (required; bring your own Postgres instance)
|
||||
- `DB_INIT_RETRY_INTERVAL_MS` - Delay between DB init retries in ms (default: `5000`)
|
||||
- `DB_INIT_RETRY_MAX_ATTEMPTS` - Max DB init retries; `0` retries forever (default: `0`)
|
||||
- `SYNC_MAX_FUTURE_SKEW_MS` - Allowed future timestamp skew from clients during sync (default: `0`)
|
||||
@@ -245,9 +237,8 @@ when left unset.
|
||||
|
||||
## Data Persistence
|
||||
|
||||
Use your normal PostgreSQL backup/restore procedures (e.g., `pg_dump`, `pg_restore`). If
|
||||
using the bundled Dockerized Postgres service, the data is stored in a named volume (see
|
||||
`docker-compose.yml`).
|
||||
Use your normal PostgreSQL backup/restore procedures (e.g., `pg_dump`, `pg_restore`) against
|
||||
your own Postgres instance - this app does not manage Postgres storage itself.
|
||||
|
||||
## License
|
||||
|
||||
|
||||
Reference in new issue
Block a user