228 lines
4.9 KiB
Markdown
228 lines
4.9 KiB
Markdown
# Dewemoji Live Deployment Walkthrough
|
|
|
|
This is the production rollout checklist for the `dewemoji` app.
|
|
|
|
Use this in order:
|
|
1. Prepare env
|
|
2. Deploy code
|
|
3. Run post-deploy commands
|
|
4. Ensure admin access
|
|
5. Verify billing/webhooks/search/auth
|
|
|
|
---
|
|
|
|
## 1) Pre-Deploy (Env + Infra)
|
|
|
|
Set these in live environment first:
|
|
|
|
```env
|
|
APP_ENV=production
|
|
APP_DEBUG=false
|
|
APP_URL=https://your-live-domain.com
|
|
```
|
|
|
|
Core requirements:
|
|
1. Database points to live DB (`DB_*`).
|
|
2. `APP_KEY` is set and stable.
|
|
3. `SESSION_DRIVER`, `CACHE_STORE`, `QUEUE_CONNECTION` configured.
|
|
4. Billing provider secrets are set (PayPal/Pakasir).
|
|
5. Allowed origins include live domain.
|
|
|
|
Recommended billing cooldown config:
|
|
|
|
```env
|
|
DEWEMOJI_BILLING_PENDING_COOLDOWN_SECONDS=120
|
|
```
|
|
|
|
Webhook URLs:
|
|
1. PayPal webhook: `https://your-live-domain.com/v1/paypal/webhook`
|
|
2. Pakasir webhook: `https://your-live-domain.com/webhooks/pakasir`
|
|
|
|
---
|
|
|
|
## 2) Deploy Code
|
|
|
|
From your server app directory (example `/var/www/html`):
|
|
|
|
```bash
|
|
git fetch --all
|
|
git checkout main
|
|
git pull origin main
|
|
```
|
|
|
|
Install dependencies if needed:
|
|
|
|
```bash
|
|
composer install --no-dev --optimize-autoloader
|
|
```
|
|
|
|
---
|
|
|
|
## 3) Post-Deploy Commands (Required)
|
|
|
|
Run in this exact sequence:
|
|
|
|
```bash
|
|
php artisan optimize:clear
|
|
php artisan migrate --force
|
|
php artisan config:cache
|
|
```
|
|
|
|
Optional but recommended:
|
|
|
|
```bash
|
|
php artisan route:cache
|
|
php artisan view:cache
|
|
```
|
|
|
|
If you use queue workers:
|
|
|
|
```bash
|
|
php artisan queue:restart
|
|
```
|
|
|
|
Check migration status:
|
|
|
|
```bash
|
|
php artisan migrate:status
|
|
```
|
|
|
|
---
|
|
|
|
## 4) Ensure Admin User
|
|
|
|
Admin access is role-based (`users.role = admin`).
|
|
|
|
### Option A: Promote existing user (recommended)
|
|
|
|
```bash
|
|
php artisan tinker --execute="\App\Models\User::where('email','dewemoji@gmail.com')->update(['role'=>'admin']);"
|
|
```
|
|
|
|
### Option B: Create admin user if missing
|
|
|
|
```bash
|
|
php artisan tinker --execute="
|
|
\$u=\App\Models\User::firstOrCreate(
|
|
['email'=>'dewemoji@gmail.com'],
|
|
['name'=>'Dewemoji Admin','password'=>\Illuminate\Support\Facades\Hash::make('ChangeMeNow123!'),'tier'=>'free','email_verified_at'=>now()]
|
|
);
|
|
\$u->role='admin';
|
|
\$u->save();
|
|
"
|
|
```
|
|
|
|
Verify:
|
|
|
|
```bash
|
|
php artisan tinker --execute="dump(\App\Models\User::where('email','dewemoji@gmail.com')->first(['id','email','role','tier']));"
|
|
```
|
|
|
|
---
|
|
|
|
## 5) Smoke Test Checklist (Live)
|
|
|
|
### A. Core App
|
|
1. Login/register works over HTTPS with no insecure form warnings.
|
|
2. Dashboard loads.
|
|
3. Discover search returns emojis.
|
|
4. Emoji detail page loads.
|
|
|
|
### B. Skin Tone
|
|
1. Discover: change skin tone selector and verify toneable emoji changes.
|
|
2. Detail: tone chips update hero emoji and copy behavior.
|
|
3. Refresh page: tone preference persists.
|
|
|
|
### C. Account + Keywords
|
|
1. Free account can create up to active limit.
|
|
2. Active/inactive keyword behavior reflected in search.
|
|
3. Private keyword search appears in Discover after creation.
|
|
|
|
### D. Billing
|
|
1. PayPal checkout starts and returns.
|
|
2. Pakasir QRIS starts and modal polls.
|
|
3. Pending payment can be resumed.
|
|
4. Cooldown prevents immediate repeated checkout spam.
|
|
|
|
### E. Webhooks
|
|
1. PayPal event recorded and payment status updates.
|
|
2. Pakasir event recorded and payment status updates.
|
|
|
|
Useful checks:
|
|
|
|
```bash
|
|
tail -n 200 storage/logs/laravel.log
|
|
php artisan tinker --execute="dump(\App\Models\WebhookEvent::latest()->take(10)->get(['id','provider','event_type','status','created_at'])->toArray());"
|
|
php artisan tinker --execute="dump(\App\Models\Payment::latest()->take(10)->get(['id','provider','plan_code','status','created_at'])->toArray());"
|
|
```
|
|
|
|
---
|
|
|
|
## 6) Optional: PayPal Plan Sync (Admin)
|
|
|
|
From admin dashboard:
|
|
1. Open pricing admin page.
|
|
2. Click sync PayPal plans.
|
|
3. Confirm plan IDs are written and no 500.
|
|
|
|
If there is failure, check:
|
|
|
|
```bash
|
|
tail -n 300 storage/logs/laravel.log | grep -Ei "paypal|sync|webhook|error|exception"
|
|
```
|
|
|
|
---
|
|
|
|
## 7) Extension Release Order
|
|
|
|
Release order:
|
|
1. Site/backend live first.
|
|
2. Verify API/auth on live domain.
|
|
3. Update extension default API base to live.
|
|
4. Publish extension update.
|
|
|
|
This avoids extension users hitting endpoints that are not ready.
|
|
|
|
---
|
|
|
|
## 8) APK Release (Direct Download)
|
|
|
|
APK release is independent from site redeploy.
|
|
|
|
Canonical URLs used by the app updater:
|
|
1. `https://dewemoji.com/downloads/version.json`
|
|
2. `https://dewemoji.com/downloads/dewemoji-latest.apk`
|
|
|
|
Set these env vars on app server:
|
|
|
|
```env
|
|
DEWEMOJI_APK_RELEASE_ENABLED=true
|
|
DEWEMOJI_APK_PUBLIC_BASE_URL=https://dewemoji.com/downloads
|
|
DEWEMOJI_R2_PUBLIC_BASE_URL=https://downloads.your-r2-domain.com
|
|
DEWEMOJI_R2_APK_VERSION_KEY=apk/version.json
|
|
DEWEMOJI_R2_APK_LATEST_KEY=apk/dewemoji-latest.apk
|
|
```
|
|
|
|
Validate redirects:
|
|
|
|
```bash
|
|
curl -I https://dewemoji.com/downloads/version.json
|
|
curl -I https://dewemoji.com/downloads/dewemoji-latest.apk
|
|
```
|
|
|
|
---
|
|
|
|
## 9) Rollback Strategy
|
|
|
|
If release is broken:
|
|
1. Re-deploy previous known-good git commit.
|
|
2. Run:
|
|
|
|
```bash
|
|
php artisan optimize:clear
|
|
php artisan config:cache
|
|
php artisan queue:restart
|
|
```
|
|
|
|
3. If issue is emoji dataset, use snapshot activation in admin catalog.
|