73 lines
1.2 KiB
Markdown
73 lines
1.2 KiB
Markdown
# Shop Setup Guide (Production)
|
|
|
|
This guide is for a fresh machine at the shop.
|
|
|
|
## 1. Prerequisites
|
|
|
|
- Docker Desktop installed and running
|
|
- Node.js 20+ and npm
|
|
- Git
|
|
|
|
## 2. Pull and prepare
|
|
|
|
```bash
|
|
git clone https://github.com/Krikorios/OMT-SM.git
|
|
cd OMT-SM
|
|
|
|
npm install
|
|
npm --prefix server install
|
|
```
|
|
|
|
## 3. Configure environment
|
|
|
|
Create root env for Docker DB + seeded owner:
|
|
|
|
```bash
|
|
cp .env.example .env
|
|
```
|
|
|
|
Edit `.env` and set strong values for `POSTGRES_PASSWORD` and `ADMIN_PASSWORD`.
|
|
|
|
Create API env:
|
|
|
|
```bash
|
|
cp server/.env.example server/.env
|
|
```
|
|
|
|
Edit `server/.env`:
|
|
- Set `DATABASE_URL` password to match root `.env` `POSTGRES_PASSWORD`
|
|
- Set a strong `JWT_SECRET` (32+ chars)
|
|
- Keep `NODE_ENV=production`
|
|
|
|
## 4. Start in production mode
|
|
|
|
```bash
|
|
./scripts/start_prod.sh
|
|
```
|
|
|
|
The app is then reachable on:
|
|
- http://localhost:4000
|
|
- http://127.0.0.1:4000
|
|
|
|
## 5. Optional operations
|
|
|
|
Reset DB and rerun all migrations + seed:
|
|
|
|
```bash
|
|
npm run db:reset
|
|
```
|
|
|
|
Run nightly backups (cron example is inside the script header):
|
|
|
|
```bash
|
|
./scripts/backup.sh
|
|
```
|
|
|
|
## 6. First login
|
|
|
|
Use the admin email/password from root `.env`:
|
|
- `ADMIN_EMAIL`
|
|
- `ADMIN_PASSWORD`
|
|
|
|
Then create cashier/manager users from the UI.
|