@specific.dev/cli 0.1.49 → 0.1.51
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/admin/404/index.html +1 -1
- package/dist/admin/404.html +1 -1
- package/dist/admin/__next.__PAGE__.txt +1 -1
- package/dist/admin/__next._full.txt +1 -1
- package/dist/admin/__next._head.txt +1 -1
- package/dist/admin/__next._index.txt +1 -1
- package/dist/admin/__next._tree.txt +1 -1
- package/dist/admin/_not-found/__next._full.txt +1 -1
- package/dist/admin/_not-found/__next._head.txt +1 -1
- package/dist/admin/_not-found/__next._index.txt +1 -1
- package/dist/admin/_not-found/__next._not-found.__PAGE__.txt +1 -1
- package/dist/admin/_not-found/__next._not-found.txt +1 -1
- package/dist/admin/_not-found/__next._tree.txt +1 -1
- package/dist/admin/_not-found/index.html +1 -1
- package/dist/admin/_not-found/index.txt +1 -1
- package/dist/admin/databases/__next._full.txt +1 -1
- package/dist/admin/databases/__next._head.txt +1 -1
- package/dist/admin/databases/__next._index.txt +1 -1
- package/dist/admin/databases/__next._tree.txt +1 -1
- package/dist/admin/databases/__next.databases.__PAGE__.txt +1 -1
- package/dist/admin/databases/__next.databases.txt +1 -1
- package/dist/admin/databases/index.html +1 -1
- package/dist/admin/databases/index.txt +1 -1
- package/dist/admin/index.html +1 -1
- package/dist/admin/index.txt +1 -1
- package/dist/cli.js +1585 -707
- package/dist/docs/builds.md +42 -0
- package/dist/docs/index.md +3 -0
- package/dist/docs/postgres/reshape/actions.md +90 -0
- package/dist/docs/postgres/reshape/index.md +149 -0
- package/dist/docs/postgres.md +20 -1
- package/dist/docs/services.md +34 -0
- package/dist/postinstall.js +1 -1
- package/package.json +2 -2
- /package/dist/admin/_next/static/{FMaKxl-Dpw5U-PgHqIMag → h5UEt0QGdPmIwztzVl3eF}/_buildManifest.js +0 -0
- /package/dist/admin/_next/static/{FMaKxl-Dpw5U-PgHqIMag → h5UEt0QGdPmIwztzVl3eF}/_clientMiddlewareManifest.json +0 -0
- /package/dist/admin/_next/static/{FMaKxl-Dpw5U-PgHqIMag → h5UEt0QGdPmIwztzVl3eF}/_ssgManifest.js +0 -0
package/dist/docs/builds.md
CHANGED
|
@@ -16,6 +16,8 @@ build "api" {
|
|
|
16
16
|
## Optional fields
|
|
17
17
|
|
|
18
18
|
- `command` - Build command to run after dependencies are installed (e.g., `npm run build`, `go build -o api`).
|
|
19
|
+
- `root` - Working directory for build commands, relative to `specific.hcl`. Defaults to `"."`. Sets the `WORKDIR` in the generated Dockerfile. Services that reference this build inherit its root. Dependency detection (e.g., `package.json`) also looks in this directory.
|
|
20
|
+
- `context` - Docker build context scope, relative to `specific.hcl`. Defaults to `"."`. Controls what files are available to `COPY` in the Dockerfile and what's included in the deployment tarball. Use this when you need to include files outside of `root` (e.g., shared libraries in a monorepo).
|
|
19
21
|
- `env` - Environment variables available during the build. Supports string literals and `service.<name>.public_url` references. These are passed as Docker build args.
|
|
20
22
|
|
|
21
23
|
## Automatic dependency installation
|
|
@@ -73,6 +75,46 @@ Supported reference types:
|
|
|
73
75
|
- String literals (e.g., `"production"`)
|
|
74
76
|
- `service.<name>.public_url` - The public domain of another service
|
|
75
77
|
|
|
78
|
+
## Monorepo support
|
|
79
|
+
|
|
80
|
+
Use `root` to specify where build commands run in a monorepo. This sets the working directory for both the build command and dependency installation.
|
|
81
|
+
|
|
82
|
+
```hcl
|
|
83
|
+
build "backend" {
|
|
84
|
+
base = "node"
|
|
85
|
+
root = "packages/backend"
|
|
86
|
+
command = "npm run build"
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
build "frontend" {
|
|
90
|
+
base = "node"
|
|
91
|
+
root = "packages/frontend"
|
|
92
|
+
command = "npm run build"
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Without `root`, you would need to prefix commands with `cd packages/backend &&`, and dependency detection would look for `package.json` in the wrong directory.
|
|
97
|
+
|
|
98
|
+
Services that reference a build inherit its `root` automatically, so service commands also run from the correct directory.
|
|
99
|
+
|
|
100
|
+
### `root` vs `context`
|
|
101
|
+
|
|
102
|
+
`root` and `context` are orthogonal:
|
|
103
|
+
|
|
104
|
+
- `root` = where commands run (working directory)
|
|
105
|
+
- `context` = what files are available (Docker build context / tarball scope)
|
|
106
|
+
|
|
107
|
+
By default, `context` is `"."` (the `specific.hcl` directory), which includes all files in the project. You only need to set `context` when you want to widen the scope beyond the default, for example to include a parent directory:
|
|
108
|
+
|
|
109
|
+
```hcl
|
|
110
|
+
# specific.hcl is in apps/myapp/, but shared libs are in libs/
|
|
111
|
+
build "api" {
|
|
112
|
+
base = "node"
|
|
113
|
+
root = "packages/api"
|
|
114
|
+
context = "../" # Include parent dir so shared libs are available
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
76
118
|
## Dev configuration
|
|
77
119
|
|
|
78
120
|
Override the build command for local development. If no `dev` block is defined, the build is skipped in development.
|
package/dist/docs/index.md
CHANGED
|
@@ -17,6 +17,9 @@ A full development environment can be started with `specific dev`. To deploy any
|
|
|
17
17
|
- [Services](/services): define how to build, deploy and run the code in this project as services, both in development and production.
|
|
18
18
|
- [Secrets and configuration](/secrets-config): define secrets and configuration variables that the user may or should provide. These can be injected into services through environment variables.
|
|
19
19
|
- [Postgres](/postgres): define managed PostgreSQL databases that services depend on.
|
|
20
|
+
<!-- beta:reshape -->
|
|
21
|
+
- [Reshape](/postgres/reshape): zero-downtime database schema migrations.
|
|
22
|
+
<!-- /beta:reshape -->
|
|
20
23
|
- [Sync](/sync): define real-time, partial synchronisation out of PostgreSQL into frontends or other services. Should be used to implement real-time and collaborative apps.
|
|
21
24
|
- [Storage](/storage): define S3-compatible object/blob storage for services to store files in.
|
|
22
25
|
- [Redis](/redis): define non-durable Redis-compatible databases for caching and more.
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
<!-- beta:reshape -->
|
|
2
|
+
# Reshape Actions
|
|
3
|
+
|
|
4
|
+
Reshape migrations are composed of **actions** that define schema changes. Each migration file contains one or more actions that are applied together.
|
|
5
|
+
|
|
6
|
+
## Available Actions
|
|
7
|
+
|
|
8
|
+
Reshape supports many different actions for modifying your database schema:
|
|
9
|
+
|
|
10
|
+
- `create_table` - Create a new table
|
|
11
|
+
- `add_column` - Add a column to an existing table
|
|
12
|
+
- `alter_column` - Modify an existing column (type, default, nullable)
|
|
13
|
+
- `remove_column` - Remove a column from a table
|
|
14
|
+
- `create_index` - Create an index
|
|
15
|
+
- `remove_index` - Remove an index
|
|
16
|
+
- `add_foreign_key` - Add a foreign key constraint
|
|
17
|
+
- `remove_foreign_key` - Remove a foreign key constraint
|
|
18
|
+
- `create_enum` - Create an enum type
|
|
19
|
+
- `alter_enum` - Add or remove variants from an enum
|
|
20
|
+
- `remove_enum` - Remove an enum type
|
|
21
|
+
- `rename_table` - Rename a table
|
|
22
|
+
- `remove_table` - Remove a table
|
|
23
|
+
- `custom` - Run custom SQL
|
|
24
|
+
|
|
25
|
+
## Action Documentation
|
|
26
|
+
|
|
27
|
+
For detailed documentation on each action including all available options and examples, use the Reshape CLI directly:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
# List all available actions
|
|
31
|
+
reshape docs /actions
|
|
32
|
+
|
|
33
|
+
# Get documentation for a specific action
|
|
34
|
+
reshape docs /actions/create-table
|
|
35
|
+
reshape docs /actions/add-column
|
|
36
|
+
reshape docs /actions/alter-column
|
|
37
|
+
reshape docs /actions/remove-column
|
|
38
|
+
reshape docs /actions/create-enum
|
|
39
|
+
reshape docs /actions/alter-enum
|
|
40
|
+
reshape docs /actions/remove-enum
|
|
41
|
+
reshape docs /actions/add-index
|
|
42
|
+
reshape docs /actions/remove-index
|
|
43
|
+
reshape docs /actions/add-foreign-key
|
|
44
|
+
reshape docs /actions/remove-foreign-key
|
|
45
|
+
reshape docs /actions/rename-table
|
|
46
|
+
reshape docs /actions/remove-table
|
|
47
|
+
reshape docs /actions/custom
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Example Migration
|
|
51
|
+
|
|
52
|
+
Here's an example migration that creates a table and adds an index:
|
|
53
|
+
|
|
54
|
+
```toml
|
|
55
|
+
# migrations/001_create_users.toml
|
|
56
|
+
|
|
57
|
+
[[actions]]
|
|
58
|
+
type = "create_table"
|
|
59
|
+
name = "users"
|
|
60
|
+
primary_key = ["id"]
|
|
61
|
+
|
|
62
|
+
[[actions.columns]]
|
|
63
|
+
name = "id"
|
|
64
|
+
type = "INTEGER"
|
|
65
|
+
generated = "ALWAYS AS IDENTITY"
|
|
66
|
+
|
|
67
|
+
[[actions.columns]]
|
|
68
|
+
name = "email"
|
|
69
|
+
type = "TEXT"
|
|
70
|
+
nullable = false
|
|
71
|
+
|
|
72
|
+
[[actions.columns]]
|
|
73
|
+
name = "created_at"
|
|
74
|
+
type = "TIMESTAMPTZ"
|
|
75
|
+
default = "NOW()"
|
|
76
|
+
|
|
77
|
+
[[actions]]
|
|
78
|
+
type = "add_index"
|
|
79
|
+
table = "users"
|
|
80
|
+
name = "users_email_idx"
|
|
81
|
+
columns = ["email"]
|
|
82
|
+
unique = true
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
Related topics:
|
|
88
|
+
- Run `specific docs /postgres/reshape` for general Reshape documentation
|
|
89
|
+
- Run `reshape docs /actions/{ACTION}` for detailed action documentation
|
|
90
|
+
<!-- /beta:reshape -->
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
<!-- beta:reshape -->
|
|
2
|
+
# Reshape Migrations
|
|
3
|
+
|
|
4
|
+
Zero-downtime database schema migrations using [Reshape](https://github.com/fabianlindfors/reshape).
|
|
5
|
+
|
|
6
|
+
Reshape is a schema migration tool that uses a 3-phase approach to achieve zero-downtime migrations:
|
|
7
|
+
|
|
8
|
+
1. **Start**: Creates new schema version with views and triggers. Both old and new schemas are available simultaneously.
|
|
9
|
+
2. **Rollout**: Deploy new application code. Services use the new schema via `search_path`.
|
|
10
|
+
3. **Complete**: Removes old schema and cleanup artifacts.
|
|
11
|
+
|
|
12
|
+
## Enabling Reshape
|
|
13
|
+
|
|
14
|
+
Add a `reshape` block to your postgres definition in `specific.hcl`:
|
|
15
|
+
|
|
16
|
+
```hcl
|
|
17
|
+
postgres "main" {
|
|
18
|
+
reshape {
|
|
19
|
+
enabled = true
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
With a custom migrations directory:
|
|
25
|
+
|
|
26
|
+
```hcl
|
|
27
|
+
postgres "main" {
|
|
28
|
+
reshape {
|
|
29
|
+
enabled = true
|
|
30
|
+
migrations_dir = "db/migrations"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
The default migrations directory is `migrations/` relative to `specific.hcl`.
|
|
36
|
+
|
|
37
|
+
## Automatic Migration Management
|
|
38
|
+
|
|
39
|
+
When `specific dev` starts with Reshape enabled, migrations are automatically managed:
|
|
40
|
+
|
|
41
|
+
1. **All migrations except the last one are completed** - These become permanent schema changes
|
|
42
|
+
2. **The last migration is started but not completed** - This allows iteration during development
|
|
43
|
+
3. **Completed migration files are made read-only** - Prevents accidental modification
|
|
44
|
+
|
|
45
|
+
This means you can focus on writing migrations without manually running commands.
|
|
46
|
+
|
|
47
|
+
### File Change Handling
|
|
48
|
+
|
|
49
|
+
While `specific dev` is running:
|
|
50
|
+
|
|
51
|
+
- **Modifying the last migration file**: The migration is automatically aborted and restarted. Your services continue running (no restart needed since the schema name doesn't change).
|
|
52
|
+
|
|
53
|
+
- **Adding a new migration file**: The previous migration is completed (made permanent), and the new migration is started. Services are automatically restarted to use the new schema.
|
|
54
|
+
|
|
55
|
+
## Connection Strings
|
|
56
|
+
|
|
57
|
+
When Reshape is enabled, `postgres.<name>.url` automatically includes the correct `search_path` option. You don't need to change your service configuration:
|
|
58
|
+
|
|
59
|
+
```hcl
|
|
60
|
+
service "api" {
|
|
61
|
+
build = build.api
|
|
62
|
+
command = "node server.js"
|
|
63
|
+
|
|
64
|
+
env = {
|
|
65
|
+
DATABASE_URL = postgres.main.url # Automatically includes search_path
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Writing Migrations
|
|
71
|
+
|
|
72
|
+
Place migration files in your migrations directory. Files are processed in **lexical order** (e.g., `001_first.toml` before `002_second.toml`).
|
|
73
|
+
|
|
74
|
+
**IMPORTANT:** You MUST run `specific reshape check` every time you create or edit a migration file. This validates the migration syntax and catches errors before the watcher applies them. Without this step, invalid migrations will silently fail to apply.
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
# Validate all migration files
|
|
78
|
+
specific reshape check
|
|
79
|
+
|
|
80
|
+
# Validate migrations for a specific database
|
|
81
|
+
specific reshape check main
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Example migration (`migrations/001_create_users.toml`):
|
|
85
|
+
|
|
86
|
+
```toml
|
|
87
|
+
[[actions]]
|
|
88
|
+
type = "create_table"
|
|
89
|
+
name = "users"
|
|
90
|
+
primary_key = ["id"]
|
|
91
|
+
|
|
92
|
+
[[actions.columns]]
|
|
93
|
+
name = "id"
|
|
94
|
+
type = "INTEGER"
|
|
95
|
+
generated = "ALWAYS AS IDENTITY"
|
|
96
|
+
|
|
97
|
+
[[actions.columns]]
|
|
98
|
+
name = "email"
|
|
99
|
+
type = "TEXT"
|
|
100
|
+
nullable = false
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
For full documentation on available actions and migration syntax, see [Actions](/postgres/reshape/actions).
|
|
104
|
+
|
|
105
|
+
## Manual Migration Commands
|
|
106
|
+
|
|
107
|
+
You can also manually control migrations using the `specific reshape` command:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
# Validate migration files (does NOT require specific dev to be running)
|
|
111
|
+
specific reshape check
|
|
112
|
+
|
|
113
|
+
# Start a migration (applies new schema while keeping old one available)
|
|
114
|
+
specific reshape start
|
|
115
|
+
|
|
116
|
+
# Start migration on a specific database
|
|
117
|
+
specific reshape start main
|
|
118
|
+
|
|
119
|
+
# Check migration status
|
|
120
|
+
specific reshape status main
|
|
121
|
+
|
|
122
|
+
# Complete a migration (removes old schema)
|
|
123
|
+
specific reshape complete main
|
|
124
|
+
|
|
125
|
+
# Abort a migration (rolls back to old schema)
|
|
126
|
+
specific reshape abort main
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
**Note:** Most commands require `specific dev` to be running as they need access to the database. The `check` command is an exception - it only validates migration file syntax and can be run anytime.
|
|
130
|
+
|
|
131
|
+
## Development Workflow
|
|
132
|
+
|
|
133
|
+
1. Write your migration file in the migrations directory
|
|
134
|
+
2. Run `specific reshape check` to validate the migration syntax
|
|
135
|
+
3. `specific dev` automatically applies it
|
|
136
|
+
4. Iterate on the migration - run `specific reshape check` after **every** change
|
|
137
|
+
5. When ready, add a new migration file to "lock in" the previous one
|
|
138
|
+
|
|
139
|
+
**Remember:** Always run `specific reshape check` after any change to a migration file. This is required to catch syntax errors before they are applied.
|
|
140
|
+
|
|
141
|
+
Completed migrations are made read-only to prevent accidental changes. If you need to modify a completed migration, you'll need to manually change the file permissions first.
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
Related topics:
|
|
146
|
+
- Run `specific docs /postgres/reshape/actions` for available migration actions
|
|
147
|
+
- Run `specific docs /postgres` for general PostgreSQL documentation
|
|
148
|
+
- Run `specific docs /sync` for real-time data synchronization
|
|
149
|
+
<!-- /beta:reshape -->
|
package/dist/docs/postgres.md
CHANGED
|
@@ -49,8 +49,27 @@ specific psql main -- -c "SELECT * FROM users LIMIT 5"
|
|
|
49
49
|
specific psql main -- -c "\dt"
|
|
50
50
|
```
|
|
51
51
|
|
|
52
|
+
<!-- beta:reshape -->
|
|
53
|
+
## Schema Migrations
|
|
54
|
+
|
|
55
|
+
For zero-downtime schema migrations, use Reshape:
|
|
56
|
+
|
|
57
|
+
```hcl
|
|
58
|
+
postgres "main" {
|
|
59
|
+
reshape {
|
|
60
|
+
enabled = true
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Run `specific docs /postgres/reshape` for full documentation on managing migrations.
|
|
66
|
+
|
|
67
|
+
<!-- /beta:reshape -->
|
|
52
68
|
---
|
|
53
69
|
|
|
54
70
|
Related topics:
|
|
71
|
+
<!-- beta:reshape -->
|
|
72
|
+
- Run `specific docs /postgres/reshape` for zero-downtime schema migrations
|
|
73
|
+
<!-- /beta:reshape -->
|
|
55
74
|
- Run `specific docs sync` for real-time data synchronization
|
|
56
|
-
- Run `specific docs exec` for running
|
|
75
|
+
- Run `specific docs exec` for running one-off commands
|
package/dist/docs/services.md
CHANGED
|
@@ -46,6 +46,7 @@ service "api" {
|
|
|
46
46
|
```
|
|
47
47
|
|
|
48
48
|
- `command` - Command to start the server
|
|
49
|
+
- `root` - Working directory for service commands, relative to `specific.hcl`. Defaults to the referenced build's `root`, or `"."` if no build. In development, this sets the working directory for the spawned process. In production, the working directory is set by the build's `root` in the Dockerfile.
|
|
49
50
|
- `endpoint` - Defines a network endpoint (see Endpoints below)
|
|
50
51
|
- `port` - Reference to the auto-assigned port (pass this to your server)
|
|
51
52
|
|
|
@@ -190,6 +191,39 @@ service "api" {
|
|
|
190
191
|
}
|
|
191
192
|
```
|
|
192
193
|
|
|
194
|
+
## Monorepo support
|
|
195
|
+
|
|
196
|
+
For monorepos, use `root` on builds to set the working directory. Services inherit the build's root, so commands like `npm start` run from the correct directory:
|
|
197
|
+
|
|
198
|
+
```hcl
|
|
199
|
+
build "backend" {
|
|
200
|
+
base = "node"
|
|
201
|
+
root = "packages/backend"
|
|
202
|
+
command = "npm run build"
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
service "backend" {
|
|
206
|
+
build = build.backend
|
|
207
|
+
command = "node dist/index.js"
|
|
208
|
+
|
|
209
|
+
dev {
|
|
210
|
+
command = "npm run dev"
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
Dev-only services can set their own root:
|
|
216
|
+
|
|
217
|
+
```hcl
|
|
218
|
+
service "docs" {
|
|
219
|
+
root = "packages/docs"
|
|
220
|
+
|
|
221
|
+
dev {
|
|
222
|
+
command = "npm run dev"
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
```
|
|
226
|
+
|
|
193
227
|
## Workers
|
|
194
228
|
|
|
195
229
|
Background processes that don't expose HTTP endpoints.
|
package/dist/postinstall.js
CHANGED
package/package.json
CHANGED
/package/dist/admin/_next/static/{FMaKxl-Dpw5U-PgHqIMag → h5UEt0QGdPmIwztzVl3eF}/_buildManifest.js
RENAMED
|
File without changes
|
|
File without changes
|
/package/dist/admin/_next/static/{FMaKxl-Dpw5U-PgHqIMag → h5UEt0QGdPmIwztzVl3eF}/_ssgManifest.js
RENAMED
|
File without changes
|