feat: add Docker support for push notifications
- Update docker-compose.yml to include VAPID environment variables - Create DOCKER_PUSH_NOTIFICATIONS_SETUP.md with Docker-specific instructions - Create PUSH_NOTIFICATIONS_DOCKER_CHECKLIST.md for easy setup tracking - Update .env.example with Docker command for generating VAPID keys Setup for Docker: 1. Generate VAPID keys (npx web-push generate-vapid-keys) 2. Add keys to .env file 3. Run: docker-compose exec app npx prisma db push 4. Rebuild: docker-compose up --build The web-push package is automatically installed during docker build. All notification functionality works the same in Docker as locally.
This commit is contained in:
81
PUSH_NOTIFICATIONS_DOCKER_CHECKLIST.md
Normal file
81
PUSH_NOTIFICATIONS_DOCKER_CHECKLIST.md
Normal file
@@ -0,0 +1,81 @@
|
||||
# Push Notifications Docker Setup Checklist
|
||||
|
||||
## ✅ What's Already Done
|
||||
|
||||
- [x] Code implementation complete
|
||||
- [x] Docker configuration updated
|
||||
- [x] Environment variables added to docker-compose.yml
|
||||
- [x] Dependencies added to package.json (will install on build)
|
||||
|
||||
## 🔧 What You Need to Do
|
||||
|
||||
### [ ] 1. Generate VAPID Keys
|
||||
|
||||
Run this command:
|
||||
```bash
|
||||
npx web-push generate-vapid-keys
|
||||
```
|
||||
|
||||
Or if you don't have Node locally:
|
||||
```bash
|
||||
docker run --rm -it node:20-slim sh -c "npm install -g web-push && web-push generate-vapid-keys"
|
||||
```
|
||||
|
||||
### [ ] 2. Add Keys to .env
|
||||
|
||||
Copy the output and add to your `.env` file:
|
||||
```env
|
||||
VAPID_PUBLIC_KEY=BNxxx...
|
||||
VAPID_PRIVATE_KEY=xxx...
|
||||
VAPID_SUBJECT=mailto:your-email@example.com
|
||||
```
|
||||
|
||||
### [ ] 3. Update Database
|
||||
|
||||
Start containers and run migration:
|
||||
```bash
|
||||
docker-compose up -d
|
||||
docker-compose exec app npx prisma db push
|
||||
```
|
||||
|
||||
### [ ] 4. Rebuild Containers
|
||||
|
||||
```bash
|
||||
docker-compose down
|
||||
docker-compose up --build
|
||||
```
|
||||
|
||||
## ✅ Verify It Works
|
||||
|
||||
1. Open http://localhost:3500
|
||||
2. Log in
|
||||
3. Wait 3 seconds
|
||||
4. See notification prompt appear
|
||||
5. Click "Enable Notifications"
|
||||
6. Test by adding items from another browser
|
||||
|
||||
## 🎉 Done!
|
||||
|
||||
Once you complete these 4 steps, push notifications will work automatically!
|
||||
|
||||
## Quick Reference
|
||||
|
||||
**Check if VAPID keys are loaded:**
|
||||
```bash
|
||||
docker-compose exec app env | grep VAPID
|
||||
```
|
||||
|
||||
**Check database tables:**
|
||||
```bash
|
||||
docker-compose exec app npx prisma studio
|
||||
```
|
||||
|
||||
**View logs:**
|
||||
```bash
|
||||
docker-compose logs -f app
|
||||
```
|
||||
|
||||
**Restart after .env changes:**
|
||||
```bash
|
||||
docker-compose restart
|
||||
```
|
||||
Reference in New Issue
Block a user