smoonb 0.0.71 → 0.0.73
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/LICENSE.pt-BR.md +24 -0
- package/README.md +441 -363
- package/README.pt-BR.md +730 -0
- package/bin/smoonb.js +187 -128
- package/package.json +6 -3
- package/src/commands/backup/index.js +13 -12
- package/src/commands/backup/utils.js +25 -31
- package/src/commands/check.js +12 -8
- package/src/commands/config.js +142 -134
- package/src/commands/functions.js +14 -10
- package/src/commands/import.js +22 -19
- package/src/commands/restore/index.js +13 -12
- package/src/i18n/index.js +216 -0
- package/src/i18n/locales/en.json +251 -0
- package/src/i18n/locales/pt-BR.json +251 -0
- package/src/index.js +19 -18
- package/src/utils/banner.js +19 -16
- package/src/utils/prompt.js +4 -1
package/README.md
CHANGED
|
@@ -2,21 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
**Complete Supabase backup and migration tool**
|
|
4
4
|
|
|
5
|
-
Backup
|
|
5
|
+
Backup and restore: complete and simple, as it should be
|
|
6
6
|
|
|
7
|
-
> **
|
|
7
|
+
> **Note on commercial access:** Supa Moonbase will require account validation before executing operations (login + subscription verification) in a future phase. In this version, there is no authentication implemented — this README only presents the legal/commercial basis. Operational use will be governed by the [Terms of Service](https://smoonb.com/terms) and [Privacy Policy](https://smoonb.com/privacy).
|
|
8
8
|
|
|
9
|
-
**
|
|
9
|
+
**Read this in other languages:** [Português (Brasil)](README.pt-BR.md)
|
|
10
|
+
|
|
11
|
+
**Developed by:** Goalmoon Tecnologia LTDA
|
|
10
12
|
**Website:** https://smoonb.com
|
|
11
13
|
**GitHub:** https://github.com/almmello/smoonb
|
|
12
14
|
|
|
13
|
-
## 🎯
|
|
15
|
+
## 🎯 Objective
|
|
14
16
|
|
|
15
|
-
|
|
17
|
+
**smoonb** solves the problem of existing tools that only backup the PostgreSQL database, ignoring critical Supabase components.
|
|
16
18
|
|
|
17
|
-
## 📦
|
|
19
|
+
## 📦 Backup Components
|
|
18
20
|
|
|
19
|
-
|
|
21
|
+
smoonb performs a complete backup of all components of your Supabase project:
|
|
20
22
|
|
|
21
23
|
- ✅ **Database PostgreSQL** (backup completo via `pg_dumpall` + SQL separados, idêntico ao Dashboard)
|
|
22
24
|
- ✅ **Database Extensions and Settings** (extensões PostgreSQL e configurações)
|
|
@@ -28,357 +30,433 @@ O smoonb faz backup completo de todos os componentes do seu projeto Supabase:
|
|
|
28
30
|
- ✅ **Supabase .temp** (arquivos temporários do Supabase CLI)
|
|
29
31
|
- ✅ **Migrations** (todas as migrations do projeto via `supabase migration fetch`)
|
|
30
32
|
|
|
31
|
-
## ⚠️
|
|
32
|
-
|
|
33
|
-
Ao usar o smoonb, você reconhece e concorda que o smoonb é fornecido "NO ESTADO EM QUE SE ENCONTRA" ("AS IS") e "CONFORME DISPONIBILIDADE", sem garantias de qualquer natureza—expressas, implícitas ou legais—incluindo, sem limitação, garantias de comercialização, adequação a um fim específico e não violação, na máxima extensão permitida pela lei aplicável.
|
|
34
|
-
|
|
35
|
-
Operações de backup e restauração envolvem riscos, os ambientes variam amplamente e não é possível prever ou validar todas as configurações dos usuários. Você é o único responsável por validar seu ambiente, manter cópias independentes e verificar os resultados antes de utilizá-los em produção.
|
|
33
|
+
## ⚠️ Universal Disclaimer / Aviso Legal Universal
|
|
36
34
|
|
|
37
|
-
|
|
35
|
+
By continuing, you acknowledge and agree that Supa Moonbase (smoonb) is provided "AS IS" and "AS AVAILABLE", with no warranties of any kind—express, implied, or statutory—including but not limited to merchantability, fitness for a particular purpose, and non-infringement, to the maximum extent permitted by applicable law. Backup and restore operations inherently carry risk, environments vary widely, and we cannot foresee or validate all user setups. You are solely responsible for validating your own environment, keeping independent copies, and verifying results before relying on them in production. We build Supa Moonbase (smoonb) on public, auditable, open-source repositories to help people simplify their workflows, but this does not create any warranty, promise of support, or service-level commitment.
|
|
38
36
|
|
|
39
|
-
**
|
|
37
|
+
**Limitation of liability** — To the maximum extent permitted by law, Goalmoon Tecnologia LTDA, its contributors, and licensors will not be liable for any indirect, incidental, special, consequential, exemplary, or punitive damages (including loss of data, interruption of business, or lost profits) arising from or related to the use of, inability to use, backup/restore operations performed by, or results produced by Supa Moonbase (smoonb). In any case, our aggregate liability for all claims relating to Supa Moonbase (smoonb) will not exceed the amount you paid for Supa Moonbase (smoonb) in the 12 months preceding the event. Nothing in this notice excludes or limits liability where such limits are prohibited by law, including (as applicable) for willful misconduct or gross negligence.
|
|
40
38
|
|
|
41
|
-
## 🚀
|
|
39
|
+
## 🚀 Installation
|
|
42
40
|
|
|
43
|
-
**⚠️
|
|
41
|
+
**⚠️ IMPORTANT: Install ONLY locally in the project!**
|
|
44
42
|
|
|
45
43
|
```bash
|
|
46
|
-
# ✅
|
|
44
|
+
# ✅ CORRECT - Install locally in the project
|
|
47
45
|
npm install smoonb
|
|
48
46
|
|
|
49
|
-
# ✅
|
|
47
|
+
# ✅ CORRECT - Use with npx
|
|
50
48
|
npx smoonb --help
|
|
51
49
|
|
|
52
|
-
# ❌
|
|
53
|
-
npm install -g smoonb # ←
|
|
50
|
+
# ❌ WRONG - DO NOT install globally
|
|
51
|
+
npm install -g smoonb # ← This will be blocked!
|
|
54
52
|
```
|
|
55
53
|
|
|
56
|
-
### 🔄
|
|
54
|
+
### 🔄 Update to Latest Version
|
|
57
55
|
|
|
58
|
-
|
|
56
|
+
To update smoonb to the latest available version:
|
|
59
57
|
|
|
60
58
|
```bash
|
|
61
|
-
#
|
|
59
|
+
# Update in current project
|
|
62
60
|
npm install smoonb@latest
|
|
63
61
|
```
|
|
64
62
|
|
|
65
|
-
**⚠️
|
|
63
|
+
**⚠️ IMPORTANT:** smoonb must be installed locally in the project. Using without installing (e.g., `npx smoonb@latest`) is not allowed.
|
|
66
64
|
|
|
67
|
-
**💡
|
|
68
|
-
- **🔒
|
|
69
|
-
- **📦
|
|
70
|
-
- **🔄
|
|
71
|
-
- **🛡️
|
|
65
|
+
**💡 Why local only?**
|
|
66
|
+
- **🔒 Security**: Avoids version conflicts
|
|
67
|
+
- **📦 Isolation**: Each project uses its own version
|
|
68
|
+
- **🔄 Updates**: Granular control per project
|
|
69
|
+
- **🛡️ Stability**: Prevents breaking other projects
|
|
72
70
|
|
|
73
|
-
## 📋
|
|
71
|
+
## 📋 Prerequisites
|
|
74
72
|
|
|
75
|
-
### 1. Docker Desktop (
|
|
73
|
+
### 1. Docker Desktop (REQUIRED)
|
|
76
74
|
```bash
|
|
77
|
-
#
|
|
75
|
+
# Install Docker Desktop
|
|
78
76
|
# Windows/macOS: https://docs.docker.com/desktop/install/
|
|
79
77
|
# Linux: https://docs.docker.com/engine/install/
|
|
80
78
|
|
|
81
|
-
#
|
|
79
|
+
# Verify if it's running
|
|
82
80
|
docker --version
|
|
83
81
|
docker ps
|
|
84
82
|
```
|
|
85
83
|
|
|
86
|
-
**⚠️
|
|
87
|
-
-
|
|
88
|
-
-
|
|
89
|
-
-
|
|
84
|
+
**⚠️ IMPORTANT:** Docker is required for:
|
|
85
|
+
- Database backup via `pg_dumpall` (compatible with Supabase Dashboard)
|
|
86
|
+
- Compression of `.backup.gz` files
|
|
87
|
+
- Restoration of `.backup` and `.backup.gz` backups
|
|
90
88
|
|
|
91
89
|
### 2. Supabase CLI
|
|
92
90
|
```bash
|
|
93
91
|
npm install -g supabase
|
|
94
92
|
```
|
|
95
93
|
|
|
96
|
-
### 3. Personal Access Token
|
|
97
|
-
|
|
94
|
+
### 3. Supabase Personal Access Token
|
|
95
|
+
You need to obtain a Supabase personal access token to use the Management API:
|
|
98
96
|
|
|
99
|
-
1.
|
|
100
|
-
2.
|
|
101
|
-
3.
|
|
102
|
-
4.
|
|
97
|
+
1. Visit: https://supabase.com/dashboard/account/tokens
|
|
98
|
+
2. Click "Generate new token"
|
|
99
|
+
3. Copy the token (format: `sbp_...`)
|
|
100
|
+
4. Add to `.env.local` as `SUPABASE_ACCESS_TOKEN`
|
|
103
101
|
|
|
104
|
-
## ⚙️
|
|
102
|
+
## ⚙️ Configuration
|
|
105
103
|
|
|
106
|
-
###
|
|
104
|
+
### Modern Method: `.env.local` (RECOMMENDED)
|
|
107
105
|
|
|
108
|
-
|
|
106
|
+
**smoonb** now uses `.env.local` for configuration, following industry standards. This makes the process simpler and more integrated with your workflow.
|
|
109
107
|
|
|
110
|
-
#### 1.
|
|
108
|
+
#### 1. Create or edit `.env.local` in the project root
|
|
111
109
|
|
|
112
110
|
```bash
|
|
113
|
-
#
|
|
111
|
+
# Create .env.local file
|
|
114
112
|
touch .env.local
|
|
115
113
|
```
|
|
116
114
|
|
|
117
|
-
#### 2.
|
|
115
|
+
#### 2. Add required environment variables
|
|
118
116
|
|
|
119
117
|
```env
|
|
120
|
-
# URLs
|
|
121
|
-
NEXT_PUBLIC_SUPABASE_URL=[
|
|
122
|
-
NEXT_PUBLIC_SUPABASE_ANON_KEY=[
|
|
123
|
-
SUPABASE_SERVICE_ROLE_KEY=
|
|
118
|
+
# Supabase URLs and Keys
|
|
119
|
+
NEXT_PUBLIC_SUPABASE_URL=[your-supabase-url]
|
|
120
|
+
NEXT_PUBLIC_SUPABASE_ANON_KEY=[your-anon-key]
|
|
121
|
+
SUPABASE_SERVICE_ROLE_KEY=[your-service-role]
|
|
124
122
|
|
|
125
123
|
# Database Connection
|
|
126
|
-
SUPABASE_DB_URL=postgresql://postgres:[
|
|
124
|
+
SUPABASE_DB_URL=postgresql://postgres:[your-database-password]@db.[your-project-id].supabase.co:5432/postgres
|
|
127
125
|
|
|
128
|
-
#
|
|
129
|
-
SUPABASE_PROJECT_ID=[
|
|
126
|
+
# Project Identification
|
|
127
|
+
SUPABASE_PROJECT_ID=[your-project-id]
|
|
130
128
|
|
|
131
|
-
# Personal Access Token (
|
|
132
|
-
SUPABASE_ACCESS_TOKEN=[
|
|
129
|
+
# Personal Access Token (REQUIRED for Management API)
|
|
130
|
+
SUPABASE_ACCESS_TOKEN=[your-access-token]
|
|
133
131
|
|
|
134
|
-
#
|
|
132
|
+
# Backup Directory (optional, default: ./backups)
|
|
135
133
|
SMOONB_OUTPUT_DIR=./backups
|
|
136
134
|
```
|
|
137
135
|
|
|
138
|
-
#### 3.
|
|
136
|
+
#### 3. Interactive Mapping
|
|
137
|
+
|
|
138
|
+
When running `backup` or `restore` for the first time, **smoonb** will:
|
|
139
|
+
|
|
140
|
+
1. **Read** your current `.env.local`
|
|
141
|
+
2. **Identify** the keys you already have
|
|
142
|
+
3. **Ask interactively** which keys correspond to the expected ones (if names are different)
|
|
143
|
+
4. **Add** missing keys if necessary
|
|
144
|
+
5. **Create automatic backup** of `.env.local` before any changes
|
|
145
|
+
6. **Save mapping** for future executions
|
|
146
|
+
|
|
147
|
+
**Mapping example:**
|
|
148
|
+
```
|
|
149
|
+
🔧 Mapping variable: NEXT_PUBLIC_SUPABASE_URL
|
|
150
|
+
Current value: https://abc123.supabase.co
|
|
151
|
+
Is this the correct value for the target project? (Y/n): Y
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## 🌐 Internationalization (i18n)
|
|
155
|
+
|
|
156
|
+
**smoonb** supports multiple languages automatically. Currently supported languages are:
|
|
157
|
+
|
|
158
|
+
- **English (en)** - Default language
|
|
159
|
+
- **Portuguese (Brazil) (pt-BR)** - Full support
|
|
160
|
+
|
|
161
|
+
### Automatic Language Detection
|
|
162
|
+
|
|
163
|
+
Language is detected automatically in the following order of precedence:
|
|
164
|
+
|
|
165
|
+
1. **CLI flag `--lang`** (highest priority)
|
|
166
|
+
```bash
|
|
167
|
+
npx smoonb --lang pt-BR backup
|
|
168
|
+
npx smoonb --lang en restore
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
2. **Environment variable `SMOONB_LANG`**
|
|
172
|
+
```bash
|
|
173
|
+
# Windows PowerShell
|
|
174
|
+
$env:SMOONB_LANG="pt-BR"
|
|
175
|
+
npx smoonb backup
|
|
176
|
+
|
|
177
|
+
# Linux/macOS
|
|
178
|
+
export SMOONB_LANG=pt-BR
|
|
179
|
+
npx smoonb backup
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
3. **System locale** (LANG, LC_ALL, LC_MESSAGES)
|
|
183
|
+
```bash
|
|
184
|
+
# smoonb automatically detects system locale
|
|
185
|
+
# Example: LANG=pt_BR.UTF-8 → pt-BR
|
|
186
|
+
# Example: LANG=en_US.UTF-8 → en
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
4. **Fallback to English (en)** if none of the above are detected
|
|
139
190
|
|
|
140
|
-
|
|
191
|
+
### Supported Languages and Aliases
|
|
141
192
|
|
|
142
|
-
|
|
143
|
-
2. **Identificar** as chaves que você já tem
|
|
144
|
-
3. **Perguntar interativamente** quais chaves correspondem às esperadas (se os nomes forem diferentes)
|
|
145
|
-
4. **Adicionar** chaves faltantes se necessário
|
|
146
|
-
5. **Criar backup** automático do `.env.local` antes de qualquer alteração
|
|
147
|
-
6. **Salvar mapeamento** para futuras execuções
|
|
193
|
+
smoonb accepts the following language codes:
|
|
148
194
|
|
|
149
|
-
|
|
195
|
+
- `en` or `en-US` → English
|
|
196
|
+
- `pt-BR`, `pt_BR` or `pt` → Portuguese (Brazil)
|
|
197
|
+
|
|
198
|
+
### Usage Examples
|
|
199
|
+
|
|
200
|
+
**Force Portuguese:**
|
|
201
|
+
```bash
|
|
202
|
+
npx smoonb --lang pt-BR backup
|
|
150
203
|
```
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
204
|
+
|
|
205
|
+
**Force English:**
|
|
206
|
+
```bash
|
|
207
|
+
npx smoonb --lang en restore
|
|
154
208
|
```
|
|
155
209
|
|
|
156
|
-
|
|
210
|
+
**Use environment variable:**
|
|
211
|
+
```bash
|
|
212
|
+
# Windows PowerShell
|
|
213
|
+
$env:SMOONB_LANG="pt-BR"
|
|
214
|
+
npx smoonb check
|
|
215
|
+
|
|
216
|
+
# Linux/macOS
|
|
217
|
+
export SMOONB_LANG=en
|
|
218
|
+
npx smoonb check
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
**Automatic system detection:**
|
|
222
|
+
```bash
|
|
223
|
+
# If system is configured with LANG=pt_BR.UTF-8
|
|
224
|
+
# smoonb will automatically use Portuguese
|
|
225
|
+
npx smoonb backup
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
### Important Notes
|
|
229
|
+
|
|
230
|
+
- **Machine outputs** (e.g., `--json` if implemented) are **not** translated; fields and keys remain in English
|
|
231
|
+
- If a translation key is missing in a language, the system automatically **falls back to English**
|
|
232
|
+
- Language is detected once at the start of execution and applied to all CLI messages
|
|
233
|
+
|
|
234
|
+
## 🎯 Usage
|
|
157
235
|
|
|
158
|
-
### Backup
|
|
236
|
+
### Full Backup
|
|
159
237
|
|
|
160
238
|
```bash
|
|
161
239
|
npx smoonb backup
|
|
162
240
|
```
|
|
163
241
|
|
|
164
|
-
**
|
|
165
|
-
|
|
166
|
-
1. **
|
|
167
|
-
2. **
|
|
168
|
-
3. **
|
|
169
|
-
4.
|
|
170
|
-
5. **
|
|
171
|
-
- ⚡ Edge Functions (
|
|
172
|
-
- 📦 Storage (
|
|
173
|
-
- 🔐 Auth Settings (
|
|
174
|
-
- 🔄 Realtime Settings (
|
|
175
|
-
- 🗑️
|
|
176
|
-
6. **
|
|
177
|
-
7. **
|
|
178
|
-
8. **
|
|
179
|
-
- 📊 1/10 - Backup
|
|
180
|
-
- 📊 2/10 -
|
|
181
|
-
- 🔧 3/10 -
|
|
182
|
-
- 🔐 4/10 -
|
|
183
|
-
- 🔄 5/10 -
|
|
184
|
-
- 📦 6/10 - Backup
|
|
185
|
-
- 👥 7/10 -
|
|
186
|
-
- ⚡ 8/10 -
|
|
187
|
-
- 📁 9/10 -
|
|
188
|
-
- 📋 10/10 - Backup
|
|
189
|
-
|
|
190
|
-
**
|
|
242
|
+
**Interactive backup flow:**
|
|
243
|
+
|
|
244
|
+
1. **Docker Validation** - Verifies if Docker is running
|
|
245
|
+
2. **Consent** - Asks permission to read/write `.env.local`
|
|
246
|
+
3. **Variable Mapping** - Maps your environment variables (first time)
|
|
247
|
+
4. **.env.local Backup** - Creates automatic backup before changes
|
|
248
|
+
5. **Component Selection** - Asks which components to include:
|
|
249
|
+
- ⚡ Edge Functions (explanation about link reset and download)
|
|
250
|
+
- 📦 Storage (explanation about full backup: file download + ZIP in Dashboard format)
|
|
251
|
+
- 🔐 Auth Settings (explanation about configurations)
|
|
252
|
+
- 🔄 Realtime Settings (explanation about interactive capture of 7 parameters)
|
|
253
|
+
- 🗑️ Cleanup options (functions, .temp, migrations after backup)
|
|
254
|
+
6. **Configuration Summary** - Shows everything that will be done
|
|
255
|
+
7. **Final Confirmation** - Confirms before starting
|
|
256
|
+
8. **Step Execution:**
|
|
257
|
+
- 📊 1/10 - Database Backup via `pg_dumpall` (Docker)
|
|
258
|
+
- 📊 2/10 - Separate Database SQL (schema, data, roles)
|
|
259
|
+
- 🔧 3/10 - Database Extensions and Settings Backup
|
|
260
|
+
- 🔐 4/10 - Auth Settings Backup (if selected)
|
|
261
|
+
- 🔄 5/10 - Realtime Settings Backup (if selected) - 7 parameters captured interactively
|
|
262
|
+
- 📦 6/10 - Storage Backup (if selected) - Full file download + ZIP in Dashboard format
|
|
263
|
+
- 👥 7/10 - Custom Roles Backup
|
|
264
|
+
- ⚡ 8/10 - Edge Functions Backup (if selected)
|
|
265
|
+
- 📁 9/10 - Supabase .temp Backup (if selected)
|
|
266
|
+
- 📋 10/10 - Migrations Backup (if selected)
|
|
267
|
+
|
|
268
|
+
**Result:**
|
|
191
269
|
```
|
|
192
270
|
backups/backup-2025-10-31-09-37-54/
|
|
193
|
-
├── backup-manifest.json #
|
|
194
|
-
├── db_cluster-31-10-2025@09-38-57.backup.gz #
|
|
195
|
-
├── schema.sql #
|
|
196
|
-
├── data.sql #
|
|
197
|
-
├── roles.sql #
|
|
198
|
-
├── database-settings-*.json #
|
|
199
|
-
├── auth-settings.json #
|
|
200
|
-
├── realtime-settings.json #
|
|
201
|
-
├── storage/ #
|
|
202
|
-
│ └── [bucket-name].json #
|
|
203
|
-
├── [project-id].storage.zip #
|
|
204
|
-
├── storage_temp/ #
|
|
205
|
-
│ └── [project-id]/ #
|
|
206
|
-
│ └── [bucket-name]/ #
|
|
207
|
-
├── edge-functions/ # Edge Functions
|
|
208
|
-
│ └── [
|
|
209
|
-
├── supabase-temp/ #
|
|
210
|
-
├── migrations/ #
|
|
271
|
+
├── backup-manifest.json # Manifest with metadata
|
|
272
|
+
├── db_cluster-31-10-2025@09-38-57.backup.gz # Full backup (Dashboard compatible)
|
|
273
|
+
├── schema.sql # Database schema
|
|
274
|
+
├── data.sql # Data
|
|
275
|
+
├── roles.sql # PostgreSQL roles
|
|
276
|
+
├── database-settings-*.json # Extensions and settings
|
|
277
|
+
├── auth-settings.json # Auth configurations
|
|
278
|
+
├── realtime-settings.json # Realtime configurations
|
|
279
|
+
├── storage/ # Storage metadata
|
|
280
|
+
│ └── [bucket-name].json # Metadata for each bucket
|
|
281
|
+
├── [project-id].storage.zip # Full Storage backup (Dashboard format)
|
|
282
|
+
├── storage_temp/ # Temporary structure (optional, can be removed)
|
|
283
|
+
│ └── [project-id]/ # Downloaded files structure
|
|
284
|
+
│ └── [bucket-name]/ # Files for each bucket
|
|
285
|
+
├── edge-functions/ # Downloaded Edge Functions
|
|
286
|
+
│ └── [function-name]/
|
|
287
|
+
├── supabase-temp/ # Supabase CLI .temp files
|
|
288
|
+
├── migrations/ # All migrations
|
|
211
289
|
└── env/
|
|
212
|
-
├── .env.local #
|
|
213
|
-
└── env-map.json #
|
|
290
|
+
├── .env.local # .env.local backup
|
|
291
|
+
└── env-map.json # Variable mapping
|
|
214
292
|
```
|
|
215
293
|
|
|
216
|
-
###
|
|
294
|
+
### Interactive Restoration
|
|
217
295
|
|
|
218
|
-
**
|
|
296
|
+
**Restore existing backup:**
|
|
219
297
|
```bash
|
|
220
298
|
npx smoonb restore
|
|
221
299
|
```
|
|
222
300
|
|
|
223
|
-
**
|
|
301
|
+
**Import and restore directly from Dashboard:**
|
|
224
302
|
```bash
|
|
225
|
-
#
|
|
303
|
+
# Database only
|
|
226
304
|
npx smoonb restore --file "C:\Downloads\db_cluster-04-03-2024@14-16-59.backup.gz"
|
|
227
305
|
|
|
228
|
-
# Database
|
|
229
|
-
npx smoonb restore --file "backup.backup.gz" --storage "
|
|
306
|
+
# Database and storage together
|
|
307
|
+
npx smoonb restore --file "backup.backup.gz" --storage "my-project.storage.zip"
|
|
230
308
|
```
|
|
231
309
|
|
|
232
|
-
**
|
|
233
|
-
|
|
234
|
-
1. **
|
|
235
|
-
2. **
|
|
236
|
-
3. **
|
|
237
|
-
4. **
|
|
238
|
-
5.
|
|
239
|
-
6. **
|
|
240
|
-
-
|
|
241
|
-
-
|
|
242
|
-
7. **
|
|
243
|
-
- 📊 Database (
|
|
244
|
-
- ⚡ Edge Functions (
|
|
245
|
-
- 🔐 Auth Settings (
|
|
246
|
-
- 📦 Storage (
|
|
247
|
-
- 🔧 Database Extensions and Settings (
|
|
248
|
-
- 🔄 Realtime Settings (
|
|
249
|
-
8. **
|
|
250
|
-
9. **
|
|
251
|
-
10. **
|
|
252
|
-
- 📊 Database -
|
|
253
|
-
- ⚡ Edge Functions -
|
|
254
|
-
- 🔐 Auth Settings -
|
|
255
|
-
- 📦 Storage -
|
|
256
|
-
- 🔧 Database Settings -
|
|
257
|
-
- 🔄 Realtime Settings -
|
|
258
|
-
|
|
259
|
-
**
|
|
260
|
-
- ✅ `.backup.gz` (
|
|
261
|
-
- ✅ `.backup` (
|
|
262
|
-
|
|
263
|
-
**
|
|
264
|
-
-
|
|
265
|
-
-
|
|
266
|
-
-
|
|
267
|
-
-
|
|
268
|
-
|
|
269
|
-
###
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
**
|
|
310
|
+
**Interactive restore flow:**
|
|
311
|
+
|
|
312
|
+
1. **Docker Validation** - Verifies if Docker is running
|
|
313
|
+
2. **Terms of Use** - Displays and requests acceptance of terms
|
|
314
|
+
3. **Consent** - Asks permission to read/write `.env.local`
|
|
315
|
+
4. **Variable Mapping** - Maps variables to target project
|
|
316
|
+
5. **.env.local Backup** - Creates automatic backup
|
|
317
|
+
6. **Backup Selection** - Lists and allows choosing which backup to restore (skips if `--file` provided)
|
|
318
|
+
- If `--file` is provided: automatically imports and auto-selects the backup
|
|
319
|
+
- If `--storage` is provided along with `--file`: also imports the storage file
|
|
320
|
+
7. **Component Selection** - Asks which components to restore:
|
|
321
|
+
- 📊 Database (always available)
|
|
322
|
+
- ⚡ Edge Functions (if available in backup)
|
|
323
|
+
- 🔐 Auth Settings (if available in backup)
|
|
324
|
+
- 📦 Storage (if available in backup)
|
|
325
|
+
- 🔧 Database Extensions and Settings (if available in backup)
|
|
326
|
+
- 🔄 Realtime Settings (if available in backup)
|
|
327
|
+
8. **Detailed Summary** - Shows selected backup, target project and components
|
|
328
|
+
9. **Final Confirmation** - Confirms before starting
|
|
329
|
+
10. **Restore Execution:**
|
|
330
|
+
- 📊 Database - Restores via `psql` (supports `.backup.gz` and `.backup`)
|
|
331
|
+
- ⚡ Edge Functions - Copies and deploys to target project
|
|
332
|
+
- 🔐 Auth Settings - Displays configurations for manual application
|
|
333
|
+
- 📦 Storage - Restores buckets and files from ZIP (if available) or displays information for manual migration
|
|
334
|
+
- 🔧 Database Settings - Restores extensions and settings via SQL
|
|
335
|
+
- 🔄 Realtime Settings - Displays configurations for manual application
|
|
336
|
+
|
|
337
|
+
**Supported file formats:**
|
|
338
|
+
- ✅ `.backup.gz` (compressed) - Automatically decompresses before restoring
|
|
339
|
+
- ✅ `.backup` (uncompressed) - Restores directly
|
|
340
|
+
|
|
341
|
+
**When to use `--file`:**
|
|
342
|
+
- Automatically imports backup file before restoring
|
|
343
|
+
- Eliminates backup selection step
|
|
344
|
+
- If `--storage` provided, also imports storage file
|
|
345
|
+
- Useful for restoring backups downloaded directly from Supabase Dashboard
|
|
346
|
+
|
|
347
|
+
### Import Backup from Supabase Dashboard
|
|
348
|
+
|
|
349
|
+
If you downloaded a backup directly from the Supabase Dashboard (`.backup.gz` format), you can import it to the format expected by smoonb. The command also supports optionally importing storage files (`.storage.zip`).
|
|
350
|
+
|
|
351
|
+
**Import database only:**
|
|
274
352
|
```bash
|
|
275
|
-
npx smoonb import --file "
|
|
353
|
+
npx smoonb import --file "full/path/to/db_cluster-04-03-2024@14-16-59.backup.gz"
|
|
276
354
|
```
|
|
277
355
|
|
|
278
|
-
**
|
|
356
|
+
**Import database and storage together:**
|
|
279
357
|
```bash
|
|
280
|
-
npx smoonb import --file "backup.backup.gz" --storage "
|
|
358
|
+
npx smoonb import --file "backup.backup.gz" --storage "my-project.storage.zip"
|
|
281
359
|
```
|
|
282
360
|
|
|
283
|
-
**
|
|
284
|
-
1.
|
|
285
|
-
2.
|
|
286
|
-
3.
|
|
287
|
-
4.
|
|
288
|
-
5.
|
|
289
|
-
6.
|
|
290
|
-
7.
|
|
361
|
+
**What the command does:**
|
|
362
|
+
1. Reads the `.backup.gz` file from Dashboard (required)
|
|
363
|
+
2. If provided, reads the `.storage.zip` file from Dashboard (optional)
|
|
364
|
+
3. Extracts information from backup file name (date and time)
|
|
365
|
+
4. Creates a backup folder in expected format (`backup-YYYY-MM-DD-HH-MM-SS`)
|
|
366
|
+
5. Copies backup file to created folder
|
|
367
|
+
6. If provided, copies storage file to same folder
|
|
368
|
+
7. Makes backup ready to be found by `restore` command
|
|
291
369
|
|
|
292
|
-
**
|
|
370
|
+
**Complete example - Database only (using import + restore):**
|
|
293
371
|
```bash
|
|
294
|
-
# 1.
|
|
295
|
-
#
|
|
372
|
+
# 1. Download backup from Supabase Dashboard
|
|
373
|
+
# File: db_cluster-04-03-2024@14-16-59.backup.gz
|
|
296
374
|
|
|
297
|
-
# 2.
|
|
375
|
+
# 2. Import the file
|
|
298
376
|
npx smoonb import --file "C:\Downloads\db_cluster-04-03-2024@14-16-59.backup.gz"
|
|
299
377
|
|
|
300
|
-
# 3.
|
|
378
|
+
# 3. Restore the imported backup
|
|
301
379
|
npx smoonb restore
|
|
302
|
-
#
|
|
380
|
+
# The imported backup will appear in the list of available backups
|
|
303
381
|
```
|
|
304
382
|
|
|
305
|
-
**
|
|
383
|
+
**Complete example - Database only (using restore directly):**
|
|
306
384
|
```bash
|
|
307
|
-
# 1.
|
|
308
|
-
#
|
|
385
|
+
# 1. Download backup from Supabase Dashboard
|
|
386
|
+
# File: db_cluster-04-03-2024@14-16-59.backup.gz
|
|
309
387
|
|
|
310
|
-
# 2.
|
|
388
|
+
# 2. Import and restore directly (skips backup selection)
|
|
311
389
|
npx smoonb restore --file "C:\Downloads\db_cluster-04-03-2024@14-16-59.backup.gz"
|
|
312
390
|
```
|
|
313
391
|
|
|
314
|
-
**
|
|
392
|
+
**Complete example - Database and Storage (using import + restore):**
|
|
315
393
|
```bash
|
|
316
|
-
# 1.
|
|
317
|
-
#
|
|
394
|
+
# 1. Download backup and storage from Supabase Dashboard
|
|
395
|
+
# Files:
|
|
318
396
|
# - db_cluster-04-03-2024@14-16-59.backup.gz
|
|
319
|
-
# -
|
|
397
|
+
# - my-project.storage.zip
|
|
320
398
|
|
|
321
|
-
# 2.
|
|
322
|
-
npx smoonb import --file "C:\Downloads\db_cluster-04-03-2024@14-16-59.backup.gz" --storage "C:\Downloads\
|
|
399
|
+
# 2. Import both files
|
|
400
|
+
npx smoonb import --file "C:\Downloads\db_cluster-04-03-2024@14-16-59.backup.gz" --storage "C:\Downloads\my-project.storage.zip"
|
|
323
401
|
|
|
324
|
-
# 3.
|
|
402
|
+
# 3. Restore the imported backup
|
|
325
403
|
npx smoonb restore
|
|
326
|
-
#
|
|
404
|
+
# The imported backup will appear in the list of available backups
|
|
327
405
|
```
|
|
328
406
|
|
|
329
|
-
**
|
|
407
|
+
**Complete example - Database and Storage (using restore directly):**
|
|
330
408
|
```bash
|
|
331
|
-
# 1.
|
|
332
|
-
#
|
|
409
|
+
# 1. Download backup and storage from Supabase Dashboard
|
|
410
|
+
# Files:
|
|
333
411
|
# - db_cluster-04-03-2024@14-16-59.backup.gz
|
|
334
|
-
# -
|
|
412
|
+
# - my-project.storage.zip
|
|
335
413
|
|
|
336
|
-
# 2.
|
|
337
|
-
npx smoonb restore --file "C:\Downloads\db_cluster-04-03-2024@14-16-59.backup.gz" --storage "C:\Downloads\
|
|
414
|
+
# 2. Import and restore directly (skips backup selection)
|
|
415
|
+
npx smoonb restore --file "C:\Downloads\db_cluster-04-03-2024@14-16-59.backup.gz" --storage "C:\Downloads\my-project.storage.zip"
|
|
338
416
|
```
|
|
339
417
|
|
|
340
|
-
**
|
|
341
|
-
-
|
|
342
|
-
-
|
|
343
|
-
-
|
|
344
|
-
-
|
|
345
|
-
-
|
|
346
|
-
-
|
|
418
|
+
**Important:**
|
|
419
|
+
- Backup file is **required** and must be in Dashboard format: `db_cluster-DD-MM-YYYY@HH-MM-SS.backup.gz`
|
|
420
|
+
- Storage file is **optional** and must be in format: `*.storage.zip`
|
|
421
|
+
- Storage depends on a backup, but backup does not depend on storage
|
|
422
|
+
- Both files will be copied to the same backup folder
|
|
423
|
+
- Path can be absolute or relative
|
|
424
|
+
- Command will automatically create necessary folder structure
|
|
347
425
|
|
|
348
|
-
**
|
|
349
|
-
- `import`:
|
|
350
|
-
- `restore --file`:
|
|
426
|
+
**Difference between `import` and `restore --file`:**
|
|
427
|
+
- `import`: Only imports the file and creates backup structure. You need to run `restore` afterwards.
|
|
428
|
+
- `restore --file`: Automatically imports the file and starts the restoration process, skipping the backup selection step.
|
|
351
429
|
|
|
352
|
-
###
|
|
430
|
+
### Post-Restore Verification
|
|
353
431
|
|
|
354
432
|
```bash
|
|
355
433
|
npx smoonb check
|
|
356
434
|
```
|
|
357
435
|
|
|
358
|
-
**
|
|
359
|
-
- ✅
|
|
360
|
-
- ✅
|
|
361
|
-
- ✅
|
|
362
|
-
- ✅
|
|
363
|
-
- ✅
|
|
364
|
-
- ✅
|
|
436
|
+
**Verifies:**
|
|
437
|
+
- ✅ Database connection
|
|
438
|
+
- ✅ Installed extensions
|
|
439
|
+
- ✅ Created tables
|
|
440
|
+
- ✅ RLS policies
|
|
441
|
+
- ✅ Realtime publications
|
|
442
|
+
- ✅ Storage buckets
|
|
365
443
|
|
|
366
444
|
|
|
367
|
-
## 🔧
|
|
445
|
+
## 🔧 Available Commands
|
|
368
446
|
|
|
369
|
-
|
|
|
370
|
-
|
|
371
|
-
| `npx smoonb backup` |
|
|
372
|
-
| `npx smoonb restore` |
|
|
373
|
-
| `npx smoonb restore --file <path> [--storage <path>]` |
|
|
374
|
-
| `npx smoonb import --file <path> [--storage <path>]` |
|
|
375
|
-
| `npx smoonb check` |
|
|
447
|
+
| Command | Description |
|
|
448
|
+
|---------|-------------|
|
|
449
|
+
| `npx smoonb backup` | Full interactive backup using Docker |
|
|
450
|
+
| `npx smoonb restore` | Interactive restoration using psql (Docker) |
|
|
451
|
+
| `npx smoonb restore --file <path> [--storage <path>]` | Import and restore directly .backup.gz file and optionally .storage.zip from Dashboard |
|
|
452
|
+
| `npx smoonb import --file <path> [--storage <path>]` | Import .backup.gz file and optionally .storage.zip from Supabase Dashboard |
|
|
453
|
+
| `npx smoonb check` | Post-restore integrity verification |
|
|
376
454
|
|
|
377
|
-
## 🏗️
|
|
455
|
+
## 🏗️ Technical Architecture
|
|
378
456
|
|
|
379
|
-
###
|
|
457
|
+
### Modular Structure
|
|
380
458
|
|
|
381
|
-
|
|
459
|
+
The code has been refactored to a **modular architecture** with independent steps:
|
|
382
460
|
|
|
383
461
|
#### Backup (`src/commands/backup/`)
|
|
384
462
|
```
|
|
@@ -419,38 +497,38 @@ restore/
|
|
|
419
497
|
### Backup Strategy
|
|
420
498
|
|
|
421
499
|
#### Database
|
|
422
|
-
- **Backup
|
|
423
|
-
-
|
|
424
|
-
-
|
|
425
|
-
- **Backup
|
|
426
|
-
- `schema.sql` -
|
|
427
|
-
- `data.sql` -
|
|
428
|
-
- `roles.sql` - Roles
|
|
500
|
+
- **Main Backup**: `pg_dumpall` via Docker (identical to Dashboard)
|
|
501
|
+
- File: `db_cluster-XX-XX-XXXX@XX-XX-XX.backup.gz`
|
|
502
|
+
- Compatible with restoration via Supabase Dashboard
|
|
503
|
+
- **Separate Backup**: SQL in separate files via Supabase CLI
|
|
504
|
+
- `schema.sql` - Table structure
|
|
505
|
+
- `data.sql` - Data (COPY statements)
|
|
506
|
+
- `roles.sql` - Roles and permissions
|
|
429
507
|
|
|
430
508
|
#### Edge Functions
|
|
431
|
-
- **Download
|
|
432
|
-
- **Reset
|
|
433
|
-
- **Backup
|
|
509
|
+
- **Automatic Download**: Via Supabase CLI `supabase functions download`
|
|
510
|
+
- **Link Reset**: Ensures clean link with project before download
|
|
511
|
+
- **Complete Backup**: Full code of each function
|
|
434
512
|
|
|
435
513
|
#### Migrations
|
|
436
|
-
- **Download
|
|
437
|
-
- **Reset
|
|
438
|
-
- **Backup
|
|
514
|
+
- **Automatic Download**: Via `supabase migration fetch`
|
|
515
|
+
- **Link Reset**: Ensures clean link with project
|
|
516
|
+
- **Complete Backup**: All server migrations
|
|
439
517
|
|
|
440
518
|
#### Storage
|
|
441
|
-
- **Backup
|
|
442
|
-
- **
|
|
443
|
-
- **ZIP
|
|
444
|
-
- **
|
|
445
|
-
- **
|
|
446
|
-
- **Fallback**:
|
|
447
|
-
- **Management API**:
|
|
448
|
-
- **Supabase Client**:
|
|
519
|
+
- **Complete Backup**: Download of all files from all buckets
|
|
520
|
+
- **Temporary Structure**: Creates `storage_temp/project-id/bucket-name/files...` inside backupDir
|
|
521
|
+
- **ZIP in Dashboard Format**: Creates `{project-id}.storage.zip` with structure `project-id/bucket-name/files...`
|
|
522
|
+
- **Restore Compatible**: Created ZIP is compatible with restore process (same format as Dashboard)
|
|
523
|
+
- **Interactive Question**: After creating ZIP, asks if you want to clean temporary structure
|
|
524
|
+
- **Fallback**: If Supabase credentials are not available, backs up metadata only
|
|
525
|
+
- **Management API**: Uses Personal Access Token to list buckets and objects
|
|
526
|
+
- **Supabase Client**: Uses Service Role Key for file downloads
|
|
449
527
|
|
|
450
528
|
#### Auth, Realtime
|
|
451
|
-
- **Management API**:
|
|
452
|
-
- **JSON Export**:
|
|
453
|
-
- **Realtime Settings**:
|
|
529
|
+
- **Management API**: Uses Personal Access Token
|
|
530
|
+
- **JSON Export**: Configurations exported as JSON
|
|
531
|
+
- **Realtime Settings**: Interactive capture of 7 parameters:
|
|
454
532
|
1. Enable Realtime service
|
|
455
533
|
2. Allow public access
|
|
456
534
|
3. Database connection pool size
|
|
@@ -458,195 +536,195 @@ restore/
|
|
|
458
536
|
5. Max events per second
|
|
459
537
|
6. Max presence events per second
|
|
460
538
|
7. Max payload size in KB
|
|
461
|
-
- **Manual
|
|
539
|
+
- **Manual for some**: Some settings need to be applied manually for security
|
|
462
540
|
|
|
463
541
|
### Restore Strategy
|
|
464
542
|
|
|
465
543
|
#### Database
|
|
466
|
-
- **
|
|
467
|
-
- `.backup.gz` -
|
|
468
|
-
- `.backup` -
|
|
469
|
-
- **Clean Restore**:
|
|
544
|
+
- **Format Support**:
|
|
545
|
+
- `.backup.gz` - Automatically decompresses via Docker
|
|
546
|
+
- `.backup` - Restores directly via `psql` (Docker)
|
|
547
|
+
- **Clean Restore**: Can overwrite existing data (with confirmation)
|
|
470
548
|
|
|
471
549
|
#### Edge Functions
|
|
472
|
-
- **Clean Deploy**:
|
|
473
|
-
- **Reset
|
|
474
|
-
- **Deploy
|
|
550
|
+
- **Clean Deploy**: Cleans `supabase/functions` before deploy
|
|
551
|
+
- **Link Reset**: Ensures correct link with target project
|
|
552
|
+
- **Automatic Deploy**: Uses `supabase functions deploy`
|
|
475
553
|
|
|
476
|
-
####
|
|
477
|
-
- **Database Settings**:
|
|
478
|
-
- **Storage**:
|
|
479
|
-
- **Auth/Realtime**:
|
|
554
|
+
#### Other Components
|
|
555
|
+
- **Database Settings**: Restores via SQL
|
|
556
|
+
- **Storage**: Restores buckets and files from ZIP (if available) or displays information for manual configuration
|
|
557
|
+
- **Auth/Realtime**: Displays information for manual configuration in Dashboard
|
|
480
558
|
|
|
481
|
-
###
|
|
559
|
+
### Cross-Platform
|
|
482
560
|
|
|
483
|
-
- **Windows/macOS/Linux**:
|
|
484
|
-
- **Cross-platform**:
|
|
485
|
-
- **Docker
|
|
561
|
+
- **Windows/macOS/Linux**: Automatic binary detection
|
|
562
|
+
- **Cross-platform**: Uses `fs.promises.cp`, `path.join`, Docker
|
|
563
|
+
- **Docker for Everything**: Backup, restore and compression via Docker (ensures consistency)
|
|
486
564
|
|
|
487
|
-
## 📊
|
|
565
|
+
## 📊 Recommended Flow
|
|
488
566
|
|
|
489
567
|
```bash
|
|
490
|
-
# 1.
|
|
491
|
-
#
|
|
568
|
+
# 1. Configure .env.local (first time)
|
|
569
|
+
# Edit .env.local with your source project credentials
|
|
492
570
|
|
|
493
|
-
# 2. Backup
|
|
571
|
+
# 2. Backup source project
|
|
494
572
|
npx smoonb backup
|
|
495
|
-
# -
|
|
496
|
-
# -
|
|
497
|
-
# -
|
|
573
|
+
# - Maps variables interactively (first time)
|
|
574
|
+
# - Selects components for backup
|
|
575
|
+
# - Executes full backup
|
|
498
576
|
|
|
499
|
-
# 3.
|
|
500
|
-
# (via Dashboard
|
|
577
|
+
# 3. Create new Supabase project
|
|
578
|
+
# (via Dashboard or Supabase CLI)
|
|
501
579
|
|
|
502
|
-
# 4.
|
|
503
|
-
#
|
|
580
|
+
# 4. Edit .env.local with new project credentials
|
|
581
|
+
# Update variables to point to target project
|
|
504
582
|
|
|
505
|
-
# 5.
|
|
583
|
+
# 5. Restore backup (interactive mode)
|
|
506
584
|
npx smoonb restore
|
|
507
|
-
# -
|
|
508
|
-
# -
|
|
509
|
-
# -
|
|
585
|
+
# - Selects desired backup
|
|
586
|
+
# - Selects components to restore
|
|
587
|
+
# - Executes restoration
|
|
510
588
|
|
|
511
|
-
# 6.
|
|
589
|
+
# 6. Verify integrity
|
|
512
590
|
npx smoonb check
|
|
513
591
|
|
|
514
|
-
# 7.
|
|
592
|
+
# 7. Apply manual configurations (if necessary)
|
|
515
593
|
# - Auth Settings: Dashboard → Authentication → Settings
|
|
516
594
|
# - Realtime: Dashboard → Database → Replication
|
|
517
|
-
#
|
|
595
|
+
# Note: Storage is automatically restored from ZIP if available
|
|
518
596
|
```
|
|
519
597
|
|
|
520
|
-
## 🎨
|
|
598
|
+
## 🎨 User Experience
|
|
521
599
|
|
|
522
|
-
### Interface
|
|
600
|
+
### Multi-Language Interface
|
|
523
601
|
|
|
524
|
-
|
|
525
|
-
-
|
|
526
|
-
-
|
|
527
|
-
-
|
|
528
|
-
-
|
|
602
|
+
All interactions are **automatically translated** based on system locale or `--lang` flag:
|
|
603
|
+
- Clear and direct questions
|
|
604
|
+
- Explanations before each process
|
|
605
|
+
- Detailed summaries before confirming
|
|
606
|
+
- Confirmations with `(Y/n)` or `(y/N)` in English, `(S/n)` or `(s/N)` in Portuguese
|
|
529
607
|
|
|
530
|
-
###
|
|
608
|
+
### Intelligent Variable Mapping
|
|
531
609
|
|
|
532
|
-
- **
|
|
533
|
-
- **
|
|
534
|
-
- **
|
|
535
|
-
- **Backup
|
|
610
|
+
- **Automatic Detection**: If key already exists with expected name, skips selection
|
|
611
|
+
- **Add Option**: Allows adding new keys if they don't exist
|
|
612
|
+
- **Value Validation**: Confirms values before saving
|
|
613
|
+
- **Automatic Backup**: Always creates backup of `.env.local` before changes
|
|
536
614
|
|
|
537
|
-
###
|
|
615
|
+
### Guided Process
|
|
538
616
|
|
|
539
|
-
- **
|
|
540
|
-
- **
|
|
541
|
-
- **
|
|
542
|
-
- **Feedback
|
|
617
|
+
- **Prior Validation**: Verifies Docker before starting
|
|
618
|
+
- **Contextual Explanations**: Explains each process before asking
|
|
619
|
+
- **Final Summary**: Shows everything that will be done before executing
|
|
620
|
+
- **Visual Feedback**: Colors and icons for better experience
|
|
543
621
|
|
|
544
622
|
## 🐛 Troubleshooting
|
|
545
623
|
|
|
546
|
-
### Docker
|
|
624
|
+
### Docker not found or not running
|
|
547
625
|
```bash
|
|
548
|
-
#
|
|
626
|
+
# Verify if Docker is installed
|
|
549
627
|
docker --version
|
|
550
628
|
|
|
551
|
-
#
|
|
629
|
+
# Verify if Docker Desktop is running
|
|
552
630
|
docker ps
|
|
553
631
|
|
|
554
|
-
#
|
|
555
|
-
# Windows/macOS:
|
|
632
|
+
# If not, start Docker Desktop
|
|
633
|
+
# Windows/macOS: Open Docker Desktop application
|
|
556
634
|
# Linux: sudo systemctl start docker
|
|
557
635
|
```
|
|
558
636
|
|
|
559
|
-
### Supabase CLI
|
|
637
|
+
### Supabase CLI not found
|
|
560
638
|
```bash
|
|
561
639
|
npm install -g supabase
|
|
562
640
|
```
|
|
563
641
|
|
|
564
|
-
### Personal Access Token
|
|
642
|
+
### Invalid or missing Personal Access Token
|
|
565
643
|
|
|
566
|
-
1.
|
|
567
|
-
2.
|
|
568
|
-
3.
|
|
644
|
+
1. Verify if `SUPABASE_ACCESS_TOKEN` is in `.env.local`
|
|
645
|
+
2. Generate new token: https://supabase.com/dashboard/account/tokens
|
|
646
|
+
3. Update `.env.local` with new token
|
|
569
647
|
|
|
570
|
-
### Database URL
|
|
571
|
-
-
|
|
572
|
-
-
|
|
573
|
-
-
|
|
648
|
+
### Incorrect Database URL
|
|
649
|
+
- Verify password in connection URL
|
|
650
|
+
- Use Connection string from Supabase Dashboard (Settings → Database)
|
|
651
|
+
- Test connection: `psql "your-database-url" -c "SELECT 1"`
|
|
574
652
|
|
|
575
|
-
###
|
|
653
|
+
### .backup.gz file cannot be restored
|
|
576
654
|
|
|
577
|
-
|
|
578
|
-
- ✅ `.backup.gz` -
|
|
579
|
-
- ✅ `.backup` -
|
|
655
|
+
smoonb automatically supports:
|
|
656
|
+
- ✅ `.backup.gz` - Decompresses via Docker before restoring
|
|
657
|
+
- ✅ `.backup` - Restores directly
|
|
580
658
|
|
|
581
|
-
|
|
582
|
-
1.
|
|
583
|
-
2.
|
|
584
|
-
3.
|
|
659
|
+
If there are problems:
|
|
660
|
+
1. Verify if Docker is running
|
|
661
|
+
2. Verify file permissions
|
|
662
|
+
3. Verify disk space
|
|
585
663
|
|
|
586
|
-
###
|
|
664
|
+
### Error downloading Edge Functions
|
|
587
665
|
|
|
588
|
-
1.
|
|
589
|
-
2.
|
|
590
|
-
3.
|
|
666
|
+
1. Verify if `SUPABASE_ACCESS_TOKEN` is configured
|
|
667
|
+
2. Verify if project is linked: `supabase link`
|
|
668
|
+
3. Verify if functions exist on server
|
|
591
669
|
|
|
592
|
-
###
|
|
670
|
+
### Error downloading Migrations
|
|
593
671
|
|
|
594
|
-
1.
|
|
595
|
-
2.
|
|
596
|
-
3.
|
|
672
|
+
1. Verify if `SUPABASE_ACCESS_TOKEN` is configured
|
|
673
|
+
2. Verify if project is linked: `supabase link`
|
|
674
|
+
3. Verify if there are migrations on server
|
|
597
675
|
|
|
598
|
-
## 🔒
|
|
676
|
+
## 🔒 Security
|
|
599
677
|
|
|
600
|
-
- **Backup
|
|
601
|
-
- **
|
|
602
|
-
- **
|
|
603
|
-
- **Docker
|
|
678
|
+
- **Automatic Backup**: Always creates backup of `.env.local` before changes
|
|
679
|
+
- **Local Mapping**: Variable mapping saved only locally
|
|
680
|
+
- **No Sensitive Data**: No sensitive data is sent outside your environment
|
|
681
|
+
- **Isolated Docker**: Database operations via Docker (isolation)
|
|
604
682
|
|
|
605
|
-
## 💼
|
|
683
|
+
## 💼 Access Model and Subscription
|
|
606
684
|
|
|
607
|
-
|
|
685
|
+
Supa Moonbase code is provided under MIT license (see `LICENSE`). In a future phase, CLI execution will be linked to a per-account subscription, allowing use associated with a valid account. Account validation will occur before any sensitive operations (e.g., backup and restore).
|
|
608
686
|
|
|
609
|
-
|
|
687
|
+
Until validation is active, the tool can be used without login.
|
|
610
688
|
|
|
611
|
-
|
|
689
|
+
Learn more at [Pricing](https://smoonb.com/pricing) and [Commercial FAQ](https://smoonb.com/faq).
|
|
612
690
|
|
|
613
|
-
## 🎁 Grandfathering (
|
|
691
|
+
## 🎁 Grandfathering (concept)
|
|
614
692
|
|
|
615
|
-
|
|
693
|
+
Accounts created during the initial commercial availability period may maintain differentiated access conditions while they remain active. The goal is to recognize early users. Specific details will be in the [Terms of Service](https://smoonb.com/terms) and [Pricing](https://smoonb.com/pricing).
|
|
616
694
|
|
|
617
|
-
## 🔒
|
|
695
|
+
## 🔒 Privacy and LGPD (summary)
|
|
618
696
|
|
|
619
|
-
|
|
697
|
+
Supa Moonbase adopts the data minimization principle. When account validation is active, we will only process information strictly necessary for access control and billing (e.g., account identifier and contact). Purposes, legal bases and data subject rights will be described in the [Privacy Policy](https://smoonb.com/privacy).
|
|
620
698
|
|
|
621
|
-
## 📋
|
|
699
|
+
## 📋 Terms of Service and Brand Usage
|
|
622
700
|
|
|
623
|
-
|
|
701
|
+
The code license (MIT) does not replace the Terms of Service that will govern per-account operational access and subscription validation.
|
|
624
702
|
|
|
625
|
-
"Supa Moonbase"
|
|
703
|
+
"Supa Moonbase" and visual identity elements are trademarks of Goalmoon Tecnologia Ltda.; brand and branding assets usage is restricted, as per [Terms of Service](https://smoonb.com/terms).
|
|
626
704
|
|
|
627
|
-
## ❓ FAQ
|
|
705
|
+
## ❓ Commercial FAQ
|
|
628
706
|
|
|
629
|
-
**
|
|
707
|
+
**Why subscription if the code is MIT?**
|
|
630
708
|
|
|
631
|
-
>
|
|
709
|
+
> The code remains open for audit and contributions. Operational access will be conditioned to account validation, as per Terms of Service.
|
|
632
710
|
|
|
633
|
-
**
|
|
711
|
+
**What does grandfathering mean?**
|
|
634
712
|
|
|
635
|
-
>
|
|
713
|
+
> Accounts from the initial period may maintain differentiated conditions while active; details will be in the Terms.
|
|
636
714
|
|
|
637
715
|
|
|
638
716
|
|
|
639
|
-
## 📝
|
|
717
|
+
## 📝 License
|
|
640
718
|
|
|
641
|
-
|
|
719
|
+
Supa Moonbase code is provided under MIT license. See [LICENSE](LICENSE) for the full license text. A Portuguese translation is available in [LICENSE.pt-BR.md](LICENSE.pt-BR.md) for convenience only.
|
|
642
720
|
|
|
643
|
-
## 🤝
|
|
721
|
+
## 🤝 Contributing
|
|
644
722
|
|
|
645
|
-
|
|
723
|
+
Contributions are welcome! This is an experimental project and we need community feedback.
|
|
646
724
|
|
|
647
725
|
|
|
648
726
|
---
|
|
649
727
|
|
|
650
|
-
**
|
|
728
|
+
**Developed by:** Goalmoon Tecnologia LTDA
|
|
651
729
|
**Website:** https://smoonb.com
|
|
652
730
|
**GitHub:** https://github.com/almmello/smoonb
|