diff --git a/docs/DOKKU_SETUP.md b/docs/DOKKU_SETUP.md index b8b7169..1d30e9b 100644 --- a/docs/DOKKU_SETUP.md +++ b/docs/DOKKU_SETUP.md @@ -10,12 +10,12 @@ This guide provides step-by-step instructions for deploying the Casera Go API to 4. [Create the App](#create-the-app) 5. [Configure PostgreSQL](#configure-postgresql) 6. [Configure Redis](#configure-redis) -7. [Set Environment Variables](#set-environment-variables) -8. [Configure Storage](#configure-storage) -9. [Deploy the Application](#deploy-the-application) -10. [Configure SSL](#configure-ssl) -11. [Set Up Worker Process](#set-up-worker-process) -12. [Push Notifications (Optional)](#push-notifications-optional) +7. [Configure Gorush (Push Notifications)](#configure-gorush-push-notifications) +8. [Set Environment Variables](#set-environment-variables) +9. [Configure Storage](#configure-storage) +10. [Deploy the Application](#deploy-the-application) +11. [Configure SSL](#configure-ssl) +12. [Set Up Worker Process](#set-up-worker-process) 13. [Maintenance Commands](#maintenance-commands) 14. [Troubleshooting](#troubleshooting) @@ -198,6 +198,85 @@ dokku redis:info casera-redis --- +## Configure Gorush (Push Notifications) + +Gorush handles push notifications for iOS (APNs) and Android (FCM). + +### 1. Create Gorush App + +```bash +dokku apps:create gorush +``` + +### 2. Create Certificate Storage Directory + +```bash +# Create directory on server +mkdir -p /var/lib/dokku/data/storage/gorush/certs + +# Set permissions (Dokku container user) +chown -R 32767:32767 /var/lib/dokku/data/storage/gorush +``` + +### 3. Copy APNs Key to Server + +From your **local machine**: + +```bash +scp /path/to/AuthKey_XXXXXX.p8 root@your-server:/var/lib/dokku/data/storage/gorush/certs/apns_key.p8 +``` + +### 4. Mount Certificate Directory + +```bash +dokku storage:mount gorush /var/lib/dokku/data/storage/gorush/certs:/certs:ro +``` + +### 5. Deploy Gorush + +```bash +dokku git:from-image gorush appleboy/gorush:latest +``` + +### 6. Configure Gorush Environment + +```bash +dokku config:set gorush \ + GORUSH_CORE_PORT=8080 \ + GORUSH_IOS_ENABLED=true \ + GORUSH_IOS_KEY_PATH=/certs/apns_key.p8 \ + GORUSH_IOS_KEY_ID=XXXXXXXXXX \ + GORUSH_IOS_TEAM_ID=XXXXXXXXXX \ + GORUSH_IOS_TOPIC=com.yourcompany.casera \ + GORUSH_IOS_PRODUCTION=true \ + GORUSH_ANDROID_ENABLED=true \ + GORUSH_ANDROID_APIKEY=your-firebase-server-key +``` + +### 7. Set Proxy Port + +```bash +dokku proxy:ports-set gorush http:80:8080 +``` + +### 8. Restart Gorush + +```bash +dokku ps:restart gorush +``` + +### 9. Verify Gorush is Running + +```bash +# Check status +dokku ps:report gorush + +# Check logs +dokku logs gorush +``` + +--- + ## Set Environment Variables ### 1. Required Variables @@ -231,26 +310,14 @@ dokku config:set casera-api \ APPLE_TEAM_ID=V3PF3M6B6U ``` -### 4. Push Notifications (Optional) - -```bash -dokku config:set casera-api \ - GORUSH_URL=http://localhost:8088 \ - APNS_AUTH_KEY_ID=R9N3SM2WD5 \ - APNS_TEAM_ID=XXXXXXXXXX \ - APNS_TOPIC=com.tt.casera.CaseraDev \ - APNS_USE_SANDBOX=false \ - FCM_SERVER_KEY=your-firebase-server-key -``` - -### 5. Admin Panel URL +### 4. Admin Panel URL ```bash dokku config:set casera-api \ NEXT_PUBLIC_API_URL=https://api.casera.treytartt.com ``` -### 6. View All Configuration +### 5. View All Configuration ```bash dokku config:show casera-api @@ -378,98 +445,6 @@ dokku ps:report casera-api --- -## Push Notifications (Optional) - -### Option A: Run Gorush as Separate Dokku App - -#### 1. Create Gorush App - -```bash -dokku apps:create gorush -``` - -#### 2. Create Certificate Storage Directory - -```bash -# Create directory on server -mkdir -p /var/lib/dokku/data/storage/gorush/certs - -# Set permissions (Dokku container user) -chown -R 32767:32767 /var/lib/dokku/data/storage/gorush -``` - -#### 3. Copy APNs Key to Server - -From your **local machine**: - -```bash -scp /path/to/AuthKey_XXXXXX.p8 root@your-server:/var/lib/dokku/data/storage/gorush/certs/apns_key.p8 -``` - -#### 4. Mount Certificate Directory - -```bash -dokku storage:mount gorush /var/lib/dokku/data/storage/gorush/certs:/certs:ro -``` - -#### 5. Deploy Gorush - -```bash -dokku git:from-image gorush appleboy/gorush:latest -``` - -#### 6. Configure Gorush Environment - -```bash -dokku config:set gorush \ - GORUSH_CORE_PORT=8080 \ - GORUSH_IOS_ENABLED=true \ - GORUSH_IOS_KEY_PATH=/certs/apns_key.p8 \ - GORUSH_IOS_KEY_ID=XXXXXXXXXX \ - GORUSH_IOS_TEAM_ID=XXXXXXXXXX \ - GORUSH_IOS_TOPIC=com.yourcompany.casera \ - GORUSH_IOS_PRODUCTION=true \ - GORUSH_ANDROID_ENABLED=true \ - GORUSH_ANDROID_APIKEY=your-firebase-server-key -``` - -#### 7. Set Proxy Port - -```bash -dokku proxy:ports-set gorush http:80:8080 -``` - -#### 8. Restart Gorush - -```bash -dokku ps:restart gorush -``` - -#### 9. Configure Casera API to Use Gorush - -```bash -dokku config:set casera-api GORUSH_URL=http://gorush.web:8080 -``` - -#### 10. Verify Gorush is Running - -```bash -# Check status -dokku ps:report gorush - -# Check logs -dokku logs gorush - -# Test health endpoint (if you have a domain set) -curl http://gorush.yourdomain.com/api/stat/go -``` - -### Option B: Use External Push Service - -Configure the app to use an external push notification service instead. - ---- - ## Maintenance Commands ### View Logs