@rebasepro/cli 0.6.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/init.d.ts +13 -0
- package/dist/index.es.js +64 -48
- package/dist/index.es.js.map +1 -1
- package/package.json +7 -8
- package/skills/rebase-admin/SKILL.md +710 -0
- package/skills/rebase-collections/SKILL.md +1 -1
- package/skills/rebase-deployment/SKILL.md +315 -13
- package/skills/rebase-design-language/SKILL.md +96 -68
- package/skills/rebase-ui-components/SKILL.md +77 -0
- package/dist/index.cjs +0 -1948
- package/dist/index.cjs.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: rebase-deployment
|
|
3
|
-
description: Guide for deploying Rebase applications. Use this skill when the user needs to deploy to Rebase Cloud, set up Docker,
|
|
3
|
+
description: Guide for deploying Rebase applications. Use this skill when the user needs to deploy to Rebase Cloud, set up Docker, self-host on AWS/GCP/Hetzner, or use a PaaS like Railway or Render.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Rebase Deployment
|
|
@@ -12,9 +12,13 @@ Rebase supports multiple deployment strategies — from fully managed Rebase Clo
|
|
|
12
12
|
| Option | Best For | Complexity |
|
|
13
13
|
|--------|----------|------------|
|
|
14
14
|
| **Rebase Cloud** | Fastest setup, managed infrastructure | ⭐ Easy |
|
|
15
|
-
| **Docker** | Full control
|
|
16
|
-
| **
|
|
17
|
-
| **
|
|
15
|
+
| **Docker (Self-Hosted)** | Full control on any VPS or bare metal | ⭐⭐ Medium |
|
|
16
|
+
| **AWS** | ECS/Fargate or EC2 with RDS PostgreSQL | ⭐⭐⭐ Advanced |
|
|
17
|
+
| **GCP** | Cloud Run with Cloud SQL PostgreSQL | ⭐⭐⭐ Advanced |
|
|
18
|
+
| **Azure** | Container Apps with Azure Database for PostgreSQL | ⭐⭐⭐ Advanced |
|
|
19
|
+
| **Scaleway** | Serverless Containers with Managed PostgreSQL (EU-only) | ⭐⭐⭐ Advanced |
|
|
20
|
+
| **Hetzner** | Cost-effective VPS with Docker Compose | ⭐⭐ Medium |
|
|
21
|
+
| **PaaS** | Railway, Render, Fly.io — Docker-based platforms | ⭐⭐ Medium |
|
|
18
22
|
|
|
19
23
|
## Rebase Cloud
|
|
20
24
|
|
|
@@ -483,19 +487,319 @@ if (isProduction) {
|
|
|
483
487
|
|
|
484
488
|
---
|
|
485
489
|
|
|
486
|
-
##
|
|
490
|
+
## AWS (ECS/Fargate + RDS)
|
|
487
491
|
|
|
488
|
-
Deploy the
|
|
492
|
+
Deploy the Rebase Docker image to AWS using ECS (Fargate) with a managed PostgreSQL database via RDS.
|
|
493
|
+
|
|
494
|
+
### Architecture
|
|
495
|
+
|
|
496
|
+
```
|
|
497
|
+
Internet → ALB (HTTPS) → ECS Fargate (Rebase container) → RDS PostgreSQL
|
|
498
|
+
→ S3 (file storage)
|
|
499
|
+
```
|
|
500
|
+
|
|
501
|
+
### Key Steps
|
|
502
|
+
|
|
503
|
+
1. **PostgreSQL** — Create an RDS PostgreSQL 16+ instance (or Aurora Serverless v2). Enable automated backups. Place in a private subnet.
|
|
504
|
+
2. **Docker Image** — Push the Rebase Docker image to ECR:
|
|
505
|
+
```bash
|
|
506
|
+
# Build and tag
|
|
507
|
+
docker build -t rebase-backend -f app/backend/Dockerfile .
|
|
508
|
+
docker tag rebase-backend:latest <account-id>.dkr.ecr.<region>.amazonaws.com/rebase-backend:latest
|
|
509
|
+
|
|
510
|
+
# Push
|
|
511
|
+
aws ecr get-login-password --region <region> | docker login --username AWS --password-stdin <account-id>.dkr.ecr.<region>.amazonaws.com
|
|
512
|
+
docker push <account-id>.dkr.ecr.<region>.amazonaws.com/rebase-backend:latest
|
|
513
|
+
```
|
|
514
|
+
3. **ECS Task Definition** — Define a Fargate task with the container image, port `3001`, and environment variables (see env var reference above). Use AWS Secrets Manager for `JWT_SECRET`, `REBASE_SERVICE_KEY`, and `DATABASE_URL`.
|
|
515
|
+
4. **ALB** — Create an Application Load Balancer with HTTPS listener (ACM certificate). Target group pointing to the ECS service on port `3001`. Configure the health check path to `/health`.
|
|
516
|
+
5. **File Storage** — Set `STORAGE_TYPE=s3` with an S3 bucket. Grant the ECS task role `s3:GetObject`, `s3:PutObject`, `s3:DeleteObject` permissions.
|
|
517
|
+
|
|
518
|
+
### Key Environment Variables
|
|
519
|
+
|
|
520
|
+
```bash
|
|
521
|
+
DATABASE_URL=postgresql://rebase:<password>@<rds-endpoint>:5432/rebase
|
|
522
|
+
JWT_SECRET=<your-secret-min-32-chars>
|
|
523
|
+
REBASE_SERVICE_KEY=<your-service-key-min-32-chars>
|
|
524
|
+
CORS_ORIGINS=https://yourdomain.com
|
|
525
|
+
FRONTEND_URL=https://yourdomain.com
|
|
526
|
+
NODE_ENV=production
|
|
527
|
+
STORAGE_TYPE=s3
|
|
528
|
+
S3_BUCKET=your-rebase-uploads
|
|
529
|
+
S3_REGION=us-east-1
|
|
530
|
+
S3_ACCESS_KEY_ID=<iam-key-or-use-task-role>
|
|
531
|
+
S3_SECRET_ACCESS_KEY=<iam-secret>
|
|
532
|
+
```
|
|
533
|
+
|
|
534
|
+
> **TIP:** Use IAM task roles instead of static access keys for S3. Attach the policy to the ECS task execution role and omit `S3_ACCESS_KEY_ID` / `S3_SECRET_ACCESS_KEY` — the AWS SDK will use the role credentials automatically.
|
|
535
|
+
|
|
536
|
+
---
|
|
537
|
+
|
|
538
|
+
## GCP (Cloud Run + Cloud SQL)
|
|
539
|
+
|
|
540
|
+
Deploy the Rebase Docker image to Cloud Run with Cloud SQL for PostgreSQL.
|
|
541
|
+
|
|
542
|
+
### Architecture
|
|
543
|
+
|
|
544
|
+
```
|
|
545
|
+
Internet → Cloud Run (HTTPS, auto-scaling) → Cloud SQL PostgreSQL
|
|
546
|
+
→ GCS or S3-compatible (file storage)
|
|
547
|
+
```
|
|
548
|
+
|
|
549
|
+
### Key Steps
|
|
550
|
+
|
|
551
|
+
1. **PostgreSQL** — Create a Cloud SQL for PostgreSQL 16+ instance. Enable private IP or use the Cloud SQL Auth Proxy.
|
|
552
|
+
2. **Docker Image** — Push to Artifact Registry:
|
|
553
|
+
```bash
|
|
554
|
+
# Build and tag
|
|
555
|
+
docker build -t rebase-backend -f app/backend/Dockerfile .
|
|
556
|
+
docker tag rebase-backend:latest <region>-docker.pkg.dev/<project-id>/rebase/backend:latest
|
|
557
|
+
|
|
558
|
+
# Push
|
|
559
|
+
gcloud auth configure-docker <region>-docker.pkg.dev
|
|
560
|
+
docker push <region>-docker.pkg.dev/<project-id>/rebase/backend:latest
|
|
561
|
+
```
|
|
562
|
+
3. **Cloud Run Service** — Deploy with the Cloud SQL connection:
|
|
563
|
+
```bash
|
|
564
|
+
gcloud run deploy rebase-backend \
|
|
565
|
+
--image <region>-docker.pkg.dev/<project-id>/rebase/backend:latest \
|
|
566
|
+
--region <region> \
|
|
567
|
+
--port 3001 \
|
|
568
|
+
--add-cloudsql-instances <project-id>:<region>:<instance-name> \
|
|
569
|
+
--set-env-vars "NODE_ENV=production,CORS_ORIGINS=https://yourdomain.com,FRONTEND_URL=https://yourdomain.com" \
|
|
570
|
+
--set-secrets "DATABASE_URL=rebase-db-url:latest,JWT_SECRET=rebase-jwt-secret:latest,REBASE_SERVICE_KEY=rebase-service-key:latest" \
|
|
571
|
+
--min-instances 1 \
|
|
572
|
+
--memory 512Mi \
|
|
573
|
+
--allow-unauthenticated
|
|
574
|
+
```
|
|
575
|
+
4. **Custom Domain** — Map a custom domain in Cloud Run settings. Cloud Run provides HTTPS automatically.
|
|
576
|
+
5. **File Storage** — Use `STORAGE_TYPE=s3` with a GCS bucket via the S3-compatible interop endpoint, or use a dedicated S3 provider like Cloudflare R2.
|
|
577
|
+
|
|
578
|
+
### Cloud SQL Auth Proxy (Connection String)
|
|
579
|
+
|
|
580
|
+
When using the Cloud SQL connector in Cloud Run, the database is exposed via a Unix socket:
|
|
581
|
+
|
|
582
|
+
```bash
|
|
583
|
+
DATABASE_URL=postgresql://rebase:<password>@localhost/rebase?host=/cloudsql/<project-id>:<region>:<instance-name>
|
|
584
|
+
```
|
|
585
|
+
|
|
586
|
+
> **WARNING:** Cloud Run has a **request timeout** (default 300s, max 3600s) and can scale to zero. WebSocket connections will be terminated when instances scale down. If you rely on Rebase realtime features, set `--min-instances 1` and increase the request timeout. For heavy realtime usage, consider GCE (Compute Engine) with Docker Compose instead.
|
|
587
|
+
|
|
588
|
+
---
|
|
589
|
+
|
|
590
|
+
## Azure (Container Apps + PostgreSQL Flexible Server)
|
|
591
|
+
|
|
592
|
+
Deploy the Rebase Docker image to Azure Container Apps with Azure Database for PostgreSQL.
|
|
593
|
+
|
|
594
|
+
### Architecture
|
|
595
|
+
|
|
596
|
+
```
|
|
597
|
+
Internet → Azure Container Apps (HTTPS, auto-scaling) → Azure Database for PostgreSQL
|
|
598
|
+
→ Azure Blob Storage (file storage)
|
|
599
|
+
```
|
|
600
|
+
|
|
601
|
+
### Key Steps
|
|
602
|
+
|
|
603
|
+
1. **PostgreSQL** — Create an Azure Database for PostgreSQL Flexible Server. Choose a Burstable or General Purpose tier. Place in an EU region (West Europe, North Europe, or France Central).
|
|
604
|
+
2. **Docker Image** — Push to Azure Container Registry (ACR):
|
|
605
|
+
```bash
|
|
606
|
+
# Login to ACR
|
|
607
|
+
az acr login --name YourRegistryName
|
|
608
|
+
|
|
609
|
+
# Build and push
|
|
610
|
+
docker build -t yourregistryname.azurecr.io/rebase-backend:latest -f app/backend/Dockerfile .
|
|
611
|
+
docker push yourregistryname.azurecr.io/rebase-backend:latest
|
|
612
|
+
```
|
|
613
|
+
3. **Container App** — Create a Container Apps Environment and deploy:
|
|
614
|
+
- Point to your ACR image
|
|
615
|
+
- Set the target port to `3001`
|
|
616
|
+
- Enable Ingress for external traffic
|
|
617
|
+
- Configure environment variables (see below)
|
|
618
|
+
4. **Networking** — If the PostgreSQL server uses private networking, configure VNet integration in the Container Apps Environment.
|
|
619
|
+
5. **File Storage** — Use `STORAGE_TYPE=s3` with Azure Blob Storage via the S3-compatible API, or use Cloudflare R2.
|
|
620
|
+
|
|
621
|
+
### Key Environment Variables
|
|
622
|
+
|
|
623
|
+
```bash
|
|
624
|
+
DATABASE_URL=postgresql://rebase_admin:<password>@<server-name>.postgres.database.azure.com:5432/rebase
|
|
625
|
+
JWT_SECRET=<your-secret-min-32-chars>
|
|
626
|
+
REBASE_SERVICE_KEY=<your-service-key-min-32-chars>
|
|
627
|
+
CORS_ORIGINS=https://yourdomain.com
|
|
628
|
+
FRONTEND_URL=https://yourdomain.com
|
|
629
|
+
NODE_ENV=production
|
|
630
|
+
ALLOW_REGISTRATION=false
|
|
631
|
+
```
|
|
632
|
+
|
|
633
|
+
> **TIP:** Azure Container Apps provides built-in HTTPS with automatic TLS certificates. Use Managed Identity instead of static credentials for accessing Azure services.
|
|
634
|
+
|
|
635
|
+
---
|
|
636
|
+
|
|
637
|
+
## Scaleway (Serverless Containers + Managed PostgreSQL)
|
|
638
|
+
|
|
639
|
+
Deploy the Rebase Docker image to Scaleway Serverless Containers. Scaleway is a premier European cloud provider with datacenters in Paris, Amsterdam, and Warsaw — ideal for EU data sovereignty.
|
|
640
|
+
|
|
641
|
+
### Architecture
|
|
642
|
+
|
|
643
|
+
```
|
|
644
|
+
Internet → Scaleway Serverless Container (HTTPS) → Managed PostgreSQL
|
|
645
|
+
→ Object Storage (S3-compatible)
|
|
646
|
+
```
|
|
647
|
+
|
|
648
|
+
### Key Steps
|
|
649
|
+
|
|
650
|
+
1. **PostgreSQL** — Create a Managed Database for PostgreSQL in your preferred EU region (e.g., Paris `fr-par`).
|
|
651
|
+
2. **Docker Image** — Push to Scaleway Container Registry:
|
|
652
|
+
```bash
|
|
653
|
+
# Build and push
|
|
654
|
+
docker build -t rg.fr-par.scw.cloud/rebase-apps/rebase-backend:latest -f app/backend/Dockerfile .
|
|
655
|
+
docker push rg.fr-par.scw.cloud/rebase-apps/rebase-backend:latest
|
|
656
|
+
```
|
|
657
|
+
3. **Serverless Container** — Deploy from the Scaleway Console or CLI:
|
|
658
|
+
- Select your image from the Container Registry
|
|
659
|
+
- Set the port to `3001`
|
|
660
|
+
- Configure environment variables (see below)
|
|
661
|
+
4. **File Storage** — Use `STORAGE_TYPE=s3` with Scaleway Object Storage (natively S3-compatible):
|
|
662
|
+
```bash
|
|
663
|
+
S3_ENDPOINT=https://s3.fr-par.scw.cloud
|
|
664
|
+
S3_BUCKET=your-rebase-uploads
|
|
665
|
+
S3_REGION=fr-par
|
|
666
|
+
S3_FORCE_PATH_STYLE=true
|
|
667
|
+
```
|
|
668
|
+
|
|
669
|
+
### Key Environment Variables
|
|
670
|
+
|
|
671
|
+
```bash
|
|
672
|
+
DATABASE_URL=postgresql://user:<password>@<instance-ip>:5432/rebase
|
|
673
|
+
JWT_SECRET=<your-secret-min-32-chars>
|
|
674
|
+
REBASE_SERVICE_KEY=<your-service-key-min-32-chars>
|
|
675
|
+
CORS_ORIGINS=https://yourdomain.com
|
|
676
|
+
FRONTEND_URL=https://yourdomain.com
|
|
677
|
+
NODE_ENV=production
|
|
678
|
+
ALLOW_REGISTRATION=false
|
|
679
|
+
STORAGE_TYPE=s3
|
|
680
|
+
S3_ENDPOINT=https://s3.fr-par.scw.cloud
|
|
681
|
+
S3_BUCKET=your-rebase-uploads
|
|
682
|
+
S3_REGION=fr-par
|
|
683
|
+
S3_FORCE_PATH_STYLE=true
|
|
684
|
+
```
|
|
685
|
+
|
|
686
|
+
> **TIP:** Scaleway Object Storage is natively S3-compatible — no interop layer needed. Set `S3_FORCE_PATH_STYLE=true` for compatibility.
|
|
687
|
+
|
|
688
|
+
---
|
|
689
|
+
|
|
690
|
+
## Hetzner (VPS + Docker Compose)
|
|
691
|
+
|
|
692
|
+
The most cost-effective production deployment. A single Hetzner VPS running Docker Compose.
|
|
693
|
+
|
|
694
|
+
### Architecture
|
|
695
|
+
|
|
696
|
+
```
|
|
697
|
+
Internet → Caddy (HTTPS, auto-TLS) → Rebase container (port 3001)
|
|
698
|
+
→ PostgreSQL container
|
|
699
|
+
→ Hetzner Volume (persistent storage)
|
|
700
|
+
```
|
|
701
|
+
|
|
702
|
+
### Setup
|
|
703
|
+
|
|
704
|
+
1. **Provision a VPS** — A Hetzner CPX21 (3 vCPU, 4 GB RAM, ~€8/mo) handles most workloads. Choose Ubuntu 24.04.
|
|
705
|
+
2. **Install Docker** — SSH in and install Docker + Docker Compose:
|
|
706
|
+
```bash
|
|
707
|
+
curl -fsSL https://get.docker.com | sh
|
|
708
|
+
```
|
|
709
|
+
3. **Clone your project** and copy your `.env` file to the server.
|
|
710
|
+
4. **Use the existing `docker-compose.yml`** — the template generated by `rebase init` works out of the box. Just update `.env` with production values:
|
|
711
|
+
```bash
|
|
712
|
+
DATABASE_PASSWORD=<strong-random-password>
|
|
713
|
+
JWT_SECRET=<your-secret-min-32-chars>
|
|
714
|
+
REBASE_SERVICE_KEY=<your-service-key-min-32-chars>
|
|
715
|
+
CORS_ORIGINS=https://yourdomain.com
|
|
716
|
+
FRONTEND_URL=https://yourdomain.com
|
|
717
|
+
NODE_ENV=production
|
|
718
|
+
ALLOW_REGISTRATION=false
|
|
719
|
+
```
|
|
720
|
+
5. **Reverse Proxy (Caddy)** — Add a Caddy service for automatic HTTPS:
|
|
721
|
+
```yaml
|
|
722
|
+
# Add to docker-compose.yml
|
|
723
|
+
caddy:
|
|
724
|
+
image: caddy:2-alpine
|
|
725
|
+
restart: unless-stopped
|
|
726
|
+
ports:
|
|
727
|
+
- "80:80"
|
|
728
|
+
- "443:443"
|
|
729
|
+
- "443:443/udp" # HTTP/3
|
|
730
|
+
volumes:
|
|
731
|
+
- ./Caddyfile:/etc/caddy/Caddyfile
|
|
732
|
+
- caddy_data:/data
|
|
733
|
+
- caddy_config:/config
|
|
734
|
+
depends_on:
|
|
735
|
+
- backend
|
|
736
|
+
|
|
737
|
+
# Add to volumes:
|
|
738
|
+
caddy_data:
|
|
739
|
+
driver: local
|
|
740
|
+
caddy_config:
|
|
741
|
+
driver: local
|
|
742
|
+
```
|
|
743
|
+
|
|
744
|
+
Create a `Caddyfile`:
|
|
745
|
+
```
|
|
746
|
+
yourdomain.com {
|
|
747
|
+
reverse_proxy backend:3001
|
|
748
|
+
}
|
|
749
|
+
```
|
|
750
|
+
6. **Start everything:**
|
|
751
|
+
```bash
|
|
752
|
+
docker compose up -d
|
|
753
|
+
```
|
|
754
|
+
7. **Persistent Storage** — Attach a Hetzner Volume for the `postgres_data` and `uploads` Docker volumes if you need data to survive server rebuilds.
|
|
755
|
+
|
|
756
|
+
### Backups
|
|
757
|
+
|
|
758
|
+
Schedule automated PostgreSQL backups via cron on the host:
|
|
489
759
|
|
|
490
760
|
```bash
|
|
491
|
-
#
|
|
492
|
-
|
|
493
|
-
|
|
761
|
+
# /etc/cron.d/rebase-backup
|
|
762
|
+
0 3 * * * root docker compose -f /path/to/docker-compose.yml exec -T db pg_dump -U rebase rebase | gzip > /backups/rebase-$(date +\%Y\%m\%d).sql.gz
|
|
763
|
+
```
|
|
764
|
+
|
|
765
|
+
> **TIP:** Hetzner also offers managed snapshots (server-level) and the option to attach a Hetzner Volume for data that survives server rebuilds. For production, strongly consider both.
|
|
766
|
+
|
|
767
|
+
---
|
|
494
768
|
|
|
495
|
-
|
|
496
|
-
|
|
769
|
+
## PaaS (Railway, Render, Fly.io)
|
|
770
|
+
|
|
771
|
+
Docker-based PaaS platforms that deploy directly from your repo or Docker image.
|
|
772
|
+
|
|
773
|
+
### General Pattern
|
|
774
|
+
|
|
775
|
+
All PaaS platforms follow the same workflow:
|
|
776
|
+
1. Connect your Git repository or point to a Dockerfile
|
|
777
|
+
2. Provision a managed PostgreSQL add-on
|
|
778
|
+
3. Set environment variables (see env var reference above)
|
|
779
|
+
4. Deploy — the platform builds and runs the Docker image
|
|
780
|
+
|
|
781
|
+
### Platform-Specific Notes
|
|
782
|
+
|
|
783
|
+
| Platform | PostgreSQL | Notes |
|
|
784
|
+
|----------|-----------|-------|
|
|
785
|
+
| **Railway** | Built-in add-on | Connects via `DATABASE_URL` injected automatically. Supports persistent volumes for file uploads. |
|
|
786
|
+
| **Render** | Managed PostgreSQL | Use a "Web Service" with Docker runtime. Free tier has cold starts — use paid for production. |
|
|
787
|
+
| **Fly.io** | Fly Postgres (community) | Closest to self-hosted — Fly Postgres is a managed wrapper around standard Postgres. Supports persistent volumes via `fly volumes`. |
|
|
788
|
+
|
|
789
|
+
### Minimum Environment Variables
|
|
790
|
+
|
|
791
|
+
```bash
|
|
792
|
+
DATABASE_URL=<provided-by-platform>
|
|
793
|
+
JWT_SECRET=<your-secret-min-32-chars>
|
|
794
|
+
REBASE_SERVICE_KEY=<your-service-key-min-32-chars>
|
|
795
|
+
CORS_ORIGINS=https://your-app.up.railway.app # or your custom domain
|
|
796
|
+
FRONTEND_URL=https://your-app.up.railway.app
|
|
797
|
+
NODE_ENV=production
|
|
798
|
+
ALLOW_REGISTRATION=false
|
|
497
799
|
```
|
|
498
800
|
|
|
801
|
+
> **WARNING:** Most PaaS free tiers have ephemeral filesystems — uploaded files will be lost on redeploy. Use `STORAGE_TYPE=s3` with an external object storage provider (Cloudflare R2, AWS S3, MinIO) for production file storage.
|
|
802
|
+
|
|
499
803
|
---
|
|
500
804
|
|
|
501
805
|
## Health Check Endpoint
|
|
@@ -550,8 +854,6 @@ process.on("SIGINT", () => gracefulShutdown("SIGINT"));
|
|
|
550
854
|
|
|
551
855
|
**Agents should NEVER deploy or run deployment commands unless explicitly asked by the user in the current conversation.** This includes:
|
|
552
856
|
- `rebase deploy` (any variant)
|
|
553
|
-
- `firebase deploy` (any variant)
|
|
554
|
-
- `gcloud functions deploy`
|
|
555
857
|
- `gcloud run deploy`
|
|
556
858
|
- `terraform apply` (any variant that deploys resources)
|
|
557
859
|
- `docker compose up` in production
|